Tickless mode and software timers


I have a working project that is required to have a low power mode.

To the initial tests, I just activated the configUSE_TICKLESS_IDLE option, changed all the calls to osDelay() to HAL_Delay() to make sure the STM32 would never enter the PreSleepProcessing() function, to go to sleep mode.

What I noticed immediately was that the software timers don’t work at all. Please note, as I mentioned above, the MCU does not enter the PreSleepProcessing. This is intended as in this 1st step I want to have the same behavior without tickless idle active.

I’m running V10.3.1 on a STM32G473, and the code was generated by STM32CubeMX.

Anyone confirms that I cannot use software timers with tickless idle mode?


If I remember right, HAL_Delay is just a busy wait on the timer incrementing the required amount, verse osDelay() which will call vTaskDelay() which will block the task and let another task run.

If you have a task with priority above the TimerTask that doesn’t block, the timers can’t run.

If you do not want the core to enter sleep mode, why don’t you just remove the line that puts the core in the sleep mode?

@aggarg I divided the job in 2 parts:

  1. enable tickless idle mode, and make sure everything works as expected
  2. enter sleep mode, when some conditions are met

Right now I’m failing on #1

Enable tickless idle does not mean use need to use HAL_Delay. HAL_Delay is busy wait and as @richard-damon explained, it will most likely cause problems.