Ticktimer overflow issue

olibats wrote on Friday, September 28, 2007:


I am running freeRTOS in preemptive mode. Assuming my system will run a very long time without a restart I have come to the conclusion that xTickCount could overflow. I tried to provoke this by using 16 bit tick counter and see what happens to my RTOS and tasks.

For what I have seen everything looks good. No fault times where no task is executed or else.

Nevertheless I am asking you, if somebody knows if there is any other issue concerning long time runs.

Also I am asking about the configTOTAL_HEAP_SIZE, which seems to have absolutely no influence on the system. (Which might be because I am using the heap_3.c??).


rtel wrote on Friday, September 28, 2007:

First - you are right - configTOTAL_HEAP_SIZE has no influence when using heap_3.

Regarding the tick count overflow - everything internal to FreeRTOS.org is designed to cope with the tick count overflowing so you have no worries there.  This was checked out very thoroughly during the SafeRTOS testing process, and actually resulted in a minor change to the FreeRTOS.org code to fix a glitch that could have occurred once in a billion billion years (i.e. extremely unlikely).

Naturally if your application code itself (as opposed to the kernel code) makes use of the tick count value then it has to be aware of overflows just as if it used any other timer.  There is actually an undocumented feature that can assist with this - take a look at how the queue code uses the vTaskSetTimeOutState() and xTaskCheckForTimeOut() functions.


olibats wrote on Monday, October 01, 2007:


Tanks for your comment. I put my mind at rest on this issue.

Thanks for the Hint with those methods. Since I have to work with the TickCount I am almost sure I will need them.

Thanks again,