I am porting a legacy code to freertos. I have ser the timer task to higher priority than the other tasks. The system runs normally for sometime. After about 55 minutes, the timer task runs continuously and blocks the other tasks. What could be causing timer task to run continuously?
Hi, stm32. Its a legacy code with 10 plus tasks and multiple modules which use timers. Hence it is not possible.to share a sample code.
The timer thread runs as expected for long time and then this behavior starts. What can ppssinly cause such a behavior?
I was able to find out the issue. In one of the timer callbacks, the timer period was reconfigured and this was causing an infinite loop inside the timer task in the function prvReloadTimer. As the parameter timeNow is received as a parameter for this function and not re-read, the while loop never exits. I am planning to use a notify from the callback and then update the timer period in the main thread. Please let me know your comments.
The callback you see inside prvReloadTimer() occurs only if the auto-reload timer has fallen behind. (The normal callback is in prvProcessExpiredTimer().) In the debugger, can you see how your timer fell so far behind?
Did your call to xTimerChangePeriod() include a nonzero xTicksToWait parameter?
My earlier reply was a bit too early as the issue was not actually fixed. I think the issue was that a static timer was created with same parameters in duplicate from two places. This timer was set to expire after an hour and the duplicate entries in pxcurrenttimerlist created an infinite loop inside the for loop inside vListInsert as pxIterator and pxIterator next were the same. I didnt find this earlier as the timer was created from a thirdparty library .