In embedded systems and control systems, watchdog timers are often used to activate fail-safe circuitry. When activated, the fail-safe circuitry forces all control outputs to safe states (e.g., turns off motors, heaters, and high-voltages) to prevent injuries and equipment damage while the fault persists. In a two-stage watchdog, the first timer is often used to activate fail-safe outputs and start the second timer stage; the second stage will reset the computer if the fault cannot be corrected before the timer elapses.
Watchdog timers are sometimes used to trigger the recording of system state information—which may be useful during fault recovery[3]—or debug information (which may be useful for determining the cause of the fault) onto a persistentmedium. In such cases, a second timer—which is started when the first timer elapses—is typically used to reset the computer later, after allowing sufficient time for data recording to complete. This allows time for the information to be saved, but ensures that the computer will be reset even if the recording process fails.
http://arduino.cc/forum/index.php?topic=128717.0
External Hardware WatchDog:
http://www.practicalarduino.com/news/id/471
#include <avr/wdt.h>
void setup ()
{
Serial.begin (115200);
Serial.println ("Restarted.");
wdt_enable (WDTO_1S); // reset after one second, if no "pat the dog" received
} // end of setup
void loop ()
{
Serial.println ("Entered loop ...");
wdt_reset (); // give me another second to do stuff (pat the dog)
while (true) ; // oops, went into a loop
} // end of loop
The more severe issue is, that the bootloader does not de-activate the watchdog upon reset, so that one can end up with endless resets.
the official ATmega328 bootloader (optiboot) deactivates the watchdog on reset.The official MEGA bootloader does not.
I'm not sure about Leonardo or Due.
AVR Watch Dog Macro
stackexchange Arduino Watch Dog Example
http://electronics.stackexchange.com/questions/18/watch-dog-timer-arduino
Watch dog AVR Library
Bootloader Selectionhttp://arduino.cc/forum/index.php?PHPSESSID=c322bf19e2be8fb4daedb3e931a0c8f0&topic=128717.0
A arguable solution?
http://www.jasoncavett.com/2011/03/accessing-watchdog-timer-on-arduino-uno.htmlBlocking service serial.print in WDT_ISR?
No comments:
Post a Comment