Lorawan stack with low powermode not fully working with STM32 mcu


I use the CMWX1ZZABZ-091 murata module in some LoraWan applications with the following tools : VScode + PlatformIO + STM32cube HAL + I-CUBE-LRWAN lora stack. It works and I get some interresting results : Lora class A configuration, data is sent every 5 min, power consumption <5µA most of the time. I get the following measurements : … > Sleep (5µA) > Tx > Sleep (5µA) > Rx1 > Sleep (5µA) > Rx2 > Sleep (5µA) > …

As I discovered RIOT-OS few month ago and this OS seems to be very nice I try to learn and use it for my next projects.

I spend some time learning how to use RIOT, thanks to the high quality slides and examples provided by a.abadie and I get nice results with the provided examples.

I tried some RIOT examples / test programs and I did not manage to get similar results that I get with STM32Cube HAL + provided Lora stack.

  1. When I compile the examples/lorawan program there is no low power mode activated by default. The power consumption is about 5.6mA when idle.

  2. Low power mode 0 and 1 with RTC seems to work as I get some nice results with tests/periph_pm program:

  • mode 1 with rtc : 44µA and its resume from RTC with sucess

  • mode 0 with rtc : 1.2µA and its resume from RTC with sucess but reboots the MCU.

I observe that I previously get about 5µA without reboot. Is there some way to do that with RIOT ?

  1. I tried the riot-course-exercises/riot-lorawan/pm program provided by aabadi on his github and I get the following results :
  • mode 1 : 1.2mA in sleep mode without reboot

  • mode 0 : 1.2µA in sleep mode with reboot

I observe that the i2c pull up resistor are not desactivated in mode 1 during sleep. It can explained the 1.mA observed as it will power some external component on my board. Is there a way to disable the internal pull resistors of i2c bus ?

To be noted, I had to add CFLAGS += -DMODULE_SEMTECH_LORAMAC_RX in my makefile to be able to build without error, otherwise the semtech_loramac_recv() function introduce some build errors.

To conclude, the results are encouraging with RIOT OS but there is still some minor issue that prevent me to use it for my next design :

Power consumption in sleep mode should be lower than 10µA and it would be more pratical not to use the low power mode 0 to avoid board reboot and context loss.

In mode 1, I get the following behavior : … > Sleep (1.2mA) > Tx > Idle (7.6mA) > Rx1 > Idle (7.6mA) > Rx2 > Sleep (1.2mA) > … when compared to the behavior I get with the STM32cube HAL we did not sleep prior Rx1 and Rx2 events, resulting in some additionnal losses. Is there a way to improve this behavior ?

My measurements are done using OTII hardware solution on my custom designed board, with UART and probe linked unplugged.

I can perform additionnal measurements on B-L072Z-LRWAN1 board or SAMR34Xplained board if needed.

I would appreciate any suggestion to help my reduce my overall power consumption using the RIOT lorawan stack ^^