freertos dog

enlogiccui wrote on Wednesday, December 26, 2012:

Hi:

is there a way to monitor task dead ?
my aim is to reset system once finding one task is dead (never calll vtaskdelay function).

davedoors wrote on Wednesday, December 26, 2012:

There are lots of different ways of doing that. For example, all the standard demos have a check task that monitors the other tasks to see if they are still running. You can have the check task kick a hardware watchdog.

enlogiccui wrote on Friday, December 28, 2012:

if the check task is dead, what happen

rtel wrote on Friday, December 28, 2012:

In any embedded system you have to consider what to do when something goes wrong.  The only difference in a multitasking system is how to detect when something has gone wrong.

In a single threaded system, if something goes wrong in that thread, you do “something” to correct it.  The easiest “something” to do is reset the system, and a hardware watchdog is the most common method of doing that (when resetting is acceptable to the application).  When the system is in an error state stop kicking the watchdog.

In a multitasking system the principals are the same, except you have to look at multiple tasks to know if something has gone wrong instead of a single task.  There are several ways you can do that, as already mentioned, but the “something” you do to correct it can still be resetting the system in exactly the same way as for a single threaded system.  You also have other alternatives, for example deleting then restarting just the task showing an error.

The check task is a simple way of monitoring other tasks, and if the check task is the task kicking the watchdog, and something goes wrong with the check task, then the watchdog will not get kicked and the system will reset automatically.  You can use other techniques to - for example have a software timer per critical task and have the task keep resetting the software timer so it never expires.  If a software timer expires then you can assume something is wrong in the task and have that reset the task or the whole system as appropriate.

Regards.