Suspend-Resume with Tickless Idle cause to Assert

Hi, I’m using FreeRTOS v7.5.2 on STM32F2xx with

define configUSETICKLESSIDLE 1

Once I have strated to use vTaskSuspend and vTaskResume I keep getting ASSERT here (tasks.c) : ~~~~~~ void vTaskStepTick( portTickType xTicksToJump ) { /* Correct the tick count value after a period during which the tick was suppressed. Note this does not call the tick hook function for each stepped tick. */ configASSERT( ( xTickCount + xTicksToJump ) <= xNextTaskUnblockTime ); xTickCount += xTicksToJump; traceINCREASE_TICK_COUNT( xTicksToJump ); } ~~~~~~ It happens once per a few hours. I have a transmit and receive tasks that implement some interface with external device. During transmit I suspend receive task and resume it after transmit finished. Do you have any comments about this assert? Probably this issue was fixed in higher versions? Thanks.

Suspend-Resume with Tickless Idle cause to Assert

While I’m not aware of any issues the tickless idle functionality has been refined a few times since the version you are using – so using a newer version might help. Other than that: Are you using the default tickless idle implementation that still uses the SysTick timer, or have you created your own using a different timer? Have you created any PRE/POST sleep macros? If so, please post them. What are the values of xTickCount, xTicksToJump and xNextTaskUnblockTime when the assert is hit? Regards.

Suspend-Resume with Tickless Idle cause to Assert

While I’m not aware of any issues the tickless idle functionality has been refined a few times since the version you are using – so using a newer version might help.
What version do you think worth to try before v8.x.x as I do not want to change API so far.
Other than that: Are you using the default tickless idle implementation that still uses the SysTick timer, or have you created your own using a different timer?
Default
Have you created any PRE/POST sleep macros? If so, please post them.
No PRE/POST. Actually I don’t even know what is it?
What are the values of xTickCount, xTicksToJump and xNextTaskUnblockTime when the assert is hit?
I’ll try to catch and print it.

Suspend-Resume with Tickless Idle cause to Assert

What version do you think worth to try before v8.x.x as I do not want to change API so far.
I would always recommend using the latest – I’m not sure what you mean by “I don’t want to change API” though. The API is the same and by default fully backward compatible, as is documented. Regards.

Suspend-Resume with Tickless Idle cause to Assert

Here are the values that ASSERT the code
xTickCount: 31605614, xTicksToJump: 35656, xNextTaskUnblockTime: 31605618 ASSERT ../../STM32/FreeRTOS-7.5.2/Source/tasks.c:1563
xTicksToJump looks suspicious.

Suspend-Resume with Tickless Idle cause to Assert

So the MCU has been asleep for 35656 ticks, whereas it should have been asleep for a maximum of 4 ticks – something has gone very wrong there. I suspect the timer didn’t unblock the task at all, as it should have been re-programmed to generate an interrupt in 4 ticks time, but instead the MCU just stayed asleep until there was an external interrupt that brought it out of sleep mode. What is your tick frequency? It may be conceivable that if the frequency was very very high, or the tick clock driving SysTick was not operating at the frequency you thought it was, that the timer could not be programmed to generate a tick before the time had already past – but to be honest on the assumption you have not changed anything in the code I would doubt that very much as the timer is momentarily stopped while it is re-programmed. In any case, I don’t want to spend time delving into old code, so suggest you update the code to the latest as a fist step. Regards.