sx126x device driver: adding power management to the #driver #lora


Diogo Correia
 

Hello,

I’m building a battery powered IoT device based on an nRF52832, with a small sensor (i2c) and a LoRa transceiver (sx126x). The device measures and sends the measured value every 12 hours and stays in sleep during the rest of time. The device is currently withdrawing ~360uA (during sleep) which is a lot when compared with the my initial estimation of ~15uA. I think the problem is in the sx126x driver and the its lack of SoC’s power management. I have tried to add this functionality to the driver, but had no success. I used device_set_power_state with all GPIOs and the SPI peripheral. When deactivating the first, nothing special appears to happen on the consumption. When I deactivate SPI, the consumption increases in the order of mA (guess is something related with the context loss that is described in zephyr documentation). Does anybody have any suggestions in how to address this issue?


Kind regards,
Diogo Correia


PS: snippets of the code are attached to the thread