Values of configEXPECTED_IDLE_TIME_BEFORE_SLEEP below 2?

brunopaillard wrote on Wednesday, November 09, 2016:


I am working on an STM32L432, and trying to implement low-power features.
Specifically, I am using the Tickless-Idle mode of FreeRTOS. I would like to be able to (when there is nothing else to do) wake-up through a periodic interrupt, perform minimal processing (about 100us worth), and immediately go back to sleep.
I notice that by default, the value of configEXPECTED_IDLE_TIME_BEFORE_SLEEP is 2. With that value, the MCU stays awake for at least a whole tick period (1ms) before being able to sleep again (too long for me).
I tried to force configEXPECTED_IDLE_TIME_BEFORE_SLEEP to 1, and that produced the correct behaviour: MCU falls back to sleep immediately if there are no tasks above Idle ready to run. But that triggers a compile error that says: “#error configEXPECTED_IDLE_TIME_BEFORE_SLEEP must not be less than 2”.
I can disable that error, but I would like to better understand the dangers of doing so.

Q) What are the risk of side-effects of setting configEXPECTED_IDLE_TIME_BEFORE_SLEEP to a value < 2?

Note that in that project keeping a tight accounting of tick periods is not required. The tick counter could easily skip one tick or freeze for one tick, once in a while, without any problem.



Bruno Paillard
Ph D
Senior Designer
Convergence Instruments
tel: (xxx) xxx xxxx