delphes wrote on Monday, March 05, 2018:

Dear All,

I am working on project on STM32L4 where I have mulitple FreeRTOS task all of them are waiting event, semaphore etc on infinite time, so the system is most of the time idle. However I have to do a very simple led blink every 6 secs, so my first idea was to use tickless feature of FreeRTOS, having a task like :


so the VportSuppressTicksAndSleep will be called during the wait, however based on LSE clock at 32768 khz and tick for FreeRTOS at 1000 hz the xMaximumPossibleSuppressedTicks will be 1999 ticks so after 2 secs, MCU will wakeup again, is there any way to have this limit higher than 2 secs ? or maybe do a different design to blink this led.


richard_damon wrote on Monday, March 05, 2018:

If the longest delay that the processor can use in hardware is 2 seconds then it will need to wake up every 2 seconds just so it maintains approximate time.

The good news is that after waking up, it should detect that it has nothing to do and go back to sleep again.

The only alternative I can see is to find some other resource that allows a longer delay and rework the code to use that. Maybe there is a way to create a 32 bit timer, or prescale the clock going into it.

delphes wrote on Monday, March 05, 2018:

Daer Richard,

First thanks for answer, second I will check if there is a way to use anotherLPTIM which is 32 bits timer (not quite sure) and make some rework.

I discovered in some example that Interrupt are disable by __asm volatile ( “cpsid i” ); before entering in sleep mode by WFI, so I do not understand why since Timer is supposed to wakeup MCU ?

Thanks again

rtel wrote on Monday, March 05, 2018:

If the MCU has interrupts disabled when an interrupt occurs the interrupt will wake the MCU, but not execute until interrupts are re-enable.

delphes wrote on Monday, March 05, 2018:

Ok this is clear;