cancel
Showing results for 
Search instead for 
Did you mean: 

STOP2 mode and FreeRTOS

deckhard
Associate III

Hi

I want to use FreeRTOS with low power STOP2 mode without using the ticklessidle mode.

One of the tasks once every cycle goes sets the mcu into stop2 mode.

I’m using both RTC and LPUART for waking up the mcu.

when using with just two FreeRTOS tasks all is well.

the task which enters to stop2 mode has the highest priority.

In that case I’m not stopping the systick nor I disable interrupt.

The problems arise when I have more tasks and the task which goes into stop2 mode doesn’t have the highest priority.

Though I try to synchronize everything before going into stop2 mode on my side, I can’t make sure I won’t receive a frame while going in to stop2 mode.

If the cycle time which goes into stop2 mode is the same as the cycle in which the wake frame is being sent, say 100ms. The mcu stops functioning entirely after about an hour.

If I increase the cycle time of the wake frame to be twice as much, that improves things.

My question is:

Even if not using ticklessidle mode, do I still have to suspend the systick and also disable interrupts except for the wake interrupts, before entering stop2 mode?

Do I still have to compensate FreeRTOS for the “lost�? ticks like the ticklessidle mode does?

Wouldn’t be a problem disabling interrupts for from a lower priority thread?

Another issue I’m wondering about is that I don’t know if I’ll wake up from RTC or LPUART, do I need to clear any mcu register of RTC If actually woke from LPUART and vice versa?

mcu is STM32L4

msi clock at 4Mhz

rtc clock is lsi

lpuart clock is lse with 9600 buad

Thanks so much!

1 REPLY 1
EHsie.2
Associate II

Hi @deckhard​ 

Do you have any progress about this issue? Thanks.

I'm using STM32L433 and have 2 tasks(first one just toggle LEDs, second one receive commands from UART1) to run under FreeRTOS. We don't use tickless mode and we expect one button to control whole system enter STOP2 or not.

The problem we face is very similar with yours. Anything goes well before enter STOP2. The UART1 cannot work anymore after wakeup from STOP2. But toggle LEDs task still works.

If you have any progress about anything, could you please give us some suggestions to fix this issue. Thanks a lot.