Difference between revisions of "Watchdog"

From SEGGER Wiki
Jump to: navigation, search
m
m (Feeding the watchdog)
Line 20: Line 20:
 
However, in a single threaded program, there may be one task taking over the functionality of the main loop , being responsible for feeding the watchdog.
 
However, in a single threaded program, there may be one task taking over the functionality of the main loop , being responsible for feeding the watchdog.
   
Another option is to feed it in a peridocally called Interrupt-service-routine, again based on certain conditions.
+
Another option is to feed it in a peridocally called Interrupt-service-routine, again based on certain conditions.
   
  +
  +
New line to section Feeeding
   
 
== Examples ==
 
== Examples ==

Revision as of 17:40, 8 May 2019

A Watchdog is a hardware unit that automatically resets the CPU, or the entire Embedded System, in the case of system failure, such as a program crash or hardware fault. Also known as Watchdog Timers, they are common in systems that are critical, especially if human access is difficult or would take too much time. The time until an watchdog resets the system is usually programmable, and depends very much on the application. It is typically between 1ms and a few seconds.


Operation

The Watchdog starts with a time value higher that the acceptable worst-case-scenario time requirement to complete the loop. The timer counts down until it is reset or the allotted time runs out, at which point a timeout signal is generated and the CPU is reset.

NEW LINE 2

Feeding the watchdog

The application program is responsible for resetting the watchdog time before it expires and resets the system. It usually does this by writing a particular value at a particular location, a "special function register" of the Watchdog. This process is typically called “feeding” or “kicking" the watchdog. In a single threaded program (one that continously runs through a main loop), this process is usually easy; the watchdog is typically fed once with every execution of this loop. The act of feeding can be conditional, in which case the watchdog is only fed if all critical components of the system are up and running. One example of that functionality check could be a communication interface, such as Ethernet, to verify that the packet queued for sending actually gets sent out in the expected time frame. In multi-tasking environments (typically using an RTOS), things can be more tricky. Usually, a special watchdog task exists, which checks a number of indicators for a functioning system and feeds the watchdog only if everything is "up and running".

However, there may also be one task taking over the functionality of the main loop in a single threaded program, being responsible for feeding the watchdog. However, in a single threaded program, there may be one task taking over the functionality of the main loop , being responsible for feeding the watchdog.

Another option is to feed it in a peridocally called Interrupt-service-routine, again based on certain conditions.


New line to section Feeeding

Examples

Examples include pretty much any Embedded System from critical ones such as space probes, where access is impossible, and pace makers, where time is of the essence, to simple consumer applications such as a cordless phone. Even for a cordless phone, the end user wants it to reset automatcially and continue to function in case the program crashes, rather than having to disconnect the batteries.