AnsweredAssumed Answered

STM32L476 had too much coffee

Question asked by reed.matthew.003 on May 6, 2016
Latest reply on May 10, 2016 by reed.matthew.003
I have been trying to implement the Tickless Idle feature in FreeRTOS (which comes pre-implemented for STM32 processors).

In my main code I have turned off all IP except the pushbutton (EXTI0), which I want to use to wake the device. I call HAL_DBGMCU_DisableDBGSleepMode so the debugger will not interrupt sleeping. Then I suspend all tasks, this forces FreeRTOS's tickless idle to kick in.

I have modified PreSleepProcessing (which is called immediately before the WFI call) with code to record how long I am sleeping, and PostSleepProcessing to do nothing but hit any programmed breakpoint.

I hit the debug breakpoint in PreSleepProcessing (meaning it is prepared to go to sleep), and hit RUN, but the current does not drop.  If I put a breakpoint in PostSleepProcessing it seems to hit immediately, but from the PreSleepProcessing breakpoint I know it is only sleeping for 209 ms.

I have breakpoints in all interrupts (including the RTOS ones) so I know none of those are causing it to wake. While awake (between PostSleepProcessing and PreSleepProcessing) the SysTick does run.

How do I know it's actually sleeping? I've been looking for a register that will indicate why it woke, the only one I can find is PWR_SR1, but that's for events and FreeRTOS is using WFI.

Should I be posting in the FreeRTOS forum?

Any help appreciated!