Issues with timer task

Analyzing the logs of the device, I noticed that the program timers stopped working. I saw that the timer task had stopped running (the runtime time was not increasing).

#define configMAX_PRIORITIES    ( 6 )

#define configUSE_TIME_SLICING                  1 

#define configTIMER_TASK_PRIORITY               (configMAX_PRIORITIES-1)

At the same time, tasks with a lower priority are performed as before.I also noticed that in another task, the current priority increases to 5 (equal to the priority of the timer task).

Can you tell me how i can investigate more deeply the reason for blocking the timer task? Just for information, this situation occurs when trying to reconnect a device over tcp (I use the TCP stack from FreeRTOS)

Your observation about the priority raising strongly hints at a deadlock involving a mutex (priority inheritance).

As I am sure you are aware, you should never making blocking calls in a timer callback unless you can guarantee that the block always returns very fast because otherwise all your other timers become deferred (convoy effect). I would revise the designmin your place.

Your problem may be related to another callback owing a mutex that your callback wants to claim.

1 Like

Thank you very much for your answer. I used a third-party library (ported from Linux) and did not pay attention to the use of a mutex in the timer callback. You are absolutely right, the problem is indeed in the mutex. I will think about how to rework the code