cancel
Showing results for 
Search instead for 
Did you mean: 

Success STML4, FREERTOS, TICKLESS using LSI and LPTIMx, w SLEEP wfi, Need help with STOP1 wfi

Kent Swan
Senior

On a STM32L4 I've successfully developed a FreeRTOS tickless method using LSI driving LPTIMx at 32Khz with wfi Sleep mode in spite of the restrictions on the LP timers. Tick timing while not perfect is reasonably accurate and more than sufficient for my purposes. For those that are curious, I'm using the PWM mode with dynamic updating of the CMP register to maintain tick timing. This allows me to set longer tick delays within the tickless sleep mode without disrupting the underlying clock which is running continuously even while sleeping.

I've instrumented my platform with signaling outputs on gpio pins into a logic analyzer which allows me to verify timing as well FreeRTOS task switching performance and everything works perfectly until I try to use STOP1 sleep mode.

When I STOP1 mode it works... sort of... The documentation on STOP modes indicate that the clock tree needs to be restored from a default state. Calling SystemClock_Config() just after coming out of STOP1 either isn't restablishing my clock tree or if it is, seems to disrupt the LPTIMx. What I want is to recover the clock tree back to where I was before calling STOP1 but without disrupting the LPTIMx I'm using to keep track of things while sleeping.

Can anyone give me some hints here?

11 REPLIES 11
Kent Swan
Senior

It's really that simple!!!??? This is the first time I've seen that explained clearly and I've been looking a lot. Thanks. I'll give it a try tomorrow.

Well an old proverb says Never throw together sample code at the last minute. But let's see what happens!