??? 07/21/04 08:14 Read: times |
#74537 - RE: WD in lengthy functions Responding to: ???'s previous message |
In my projects, I often implement what are effectively tasks using a home-grown operating system. I need to ensure that none of these tasks nor the main thread of exectution get stuck.
I solve this problem by implementing a hardware watchdog that is reset by an ISR that runs periodically. In turn, the ISR implements a number of "softdogs". Each softdog is a countdown timer decremented each time the ISR runs. There is one softdog for each thread of execution to be monitored. If a thread fails to reset its softdog, the ISR will decrement it down to zero, at which point it will stop the processor and allow the hardware watchdog to time out - causing a processor reset. Each softdog is independent and can have its own timeout period - which can, if necessary, be quite long. |