[riot-notifications] [RIOT-OS/RIOT] drivers/sx127x: optimize power consumption on nss pin (#11384)

Francisco notifications at github.com
Fri May 3 12:22:49 CEST 2019

fjmolinas commented on this pull request.

@aabadie I looked into this again... I came to the conclusion the reason we were seeing the excessive power consumption was because of the X-NUCLEO-LPM01A. I connected a multi-meter directly between the NSS_PIN and the board and I get 0uA of current draw (same for all I/O pins going to sx1276).

Doing some further measurements I can Identify sources of excessive current draw threw MISO, MOSI and SCK. NSS isn't a problem since it's inactive state is by default HIGH. 

To minimize the current draw on MOSI and SCK they must be pulled low before going to sleep. From measurements after releasing the SPI device there state isn't 0 but close to 0. Two options for handling this:

- initiate them with pull-downs
    gpio_init(spi_config[bus].mosi_pin, GPIO_OUT_PD);
    gpio_init(spi_config[bus].sclk_pin, GPIO_OUT_PD);
- clear the gpio's before entering sleep

    gpio_init(spi_config[bus].mosi_pin, GPIO_OUT); 
    gpio_init(spi_config[bus].sclk_pin, GPIO_OUT);

I think option 2 is better since it can be handled by the driver. This has to be done since according to reference manual (at least for stm32) "If software configures a GPIO pin as Alternate Function Output, but peripheral is not activated, its output is not specified".

In the case of MISO the SPI device should be initialized with the corresponding pull-up (in this case since it would be the inactive state).

gpio_init(spi_config[bus].miso_pin, GPIO_IN_PU);

I tested this using a nucleo-l1073rz and an mbed sx1272 sheild runing examples/lorawan. When in sleep the shield consumes 8uA and the node around 2uA. 

DIOs are tied to VDD upon initialization and RESET is already in proper inactive state by default.

You are receiving this because you are subscribed to this thread.
Reply to this email directly or view it on GitHub:
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.riot-os.org/pipermail/notifications/attachments/20190503/604867c8/attachment.html>

More information about the notifications mailing list