Disabling Tickless mode

I have two tasks running, and there is a third task that only comes into action after I press a switch. I am using the Tickless mode of FreeRTOS in STM32. I would like to disable the Tickless mode when the third task is entered. Is it possible? If yes, how?

Tickless idle is currently a compile time configuration. Can you tell us why do you want to disable tickless idle? What problem are you trying to solve by doing that?

The third task involves high speed transmission of data so we don’t really need to sleep .
Also an issue I am facing now is that, the tickless mode was working perfectly when only the two tasks were running. Now when I added the third task, there is some issue. Like I added an osDelay in the for loop of third task, and now it is not waking from it( osDelay is working perfectly for the other 2 tasks ).

I think there is slippage in time. What can be done to correct this?

If you want to conditionally suppress tickless idle, you can use the macro configPRE_SUPPRESS_TICKS_AND_SLEEP_PROCESSING(x) to set x to 0 when you don’t want to be able to enter tickless idle.

Note also, the standard definition for tickless idle does suffer from some time slippage, as is inevitable when you asynchronously change the time base clock rate as it does. It tries to correct the time, but it can’t do it precisely.

Kernel v10.5.1 fixed some edge-case issues that occasionally caused excessive slippage. Starting with that version, slippage is usually trivial. So you could try upgrading the kernel.

If your STM32 has an available LPTIM, you can completely eliminate slippage by using lptimTick.c. It never stops the clock, so it doesn’t have any slippage.