How can I use the watchdog timer?

Tim Rohaly

The DS80C390 CPU used on the TINI has a built-in hardware watchdog timer that can be controlled using static methods in the com.dalsemi.system.TINIOS class.

To use the watchdog timer, first set the watchdog timeout length by invoking TINIOS.setWatchdogTimeout(int milliseconds) (an argument of zero will disable the watchdog timer). You must then invoke TINIOS.feedWatchdog() periodically - if you neglect to invoke feedWatchdog() before the timer expires, the TINI will be rebooted.

slush provides the wd command which does the equivalent of the above. Thus, you can use wd to start and feed the watchdog timer from the slush command-line.

The watchdog timer gives you a way to add reliablity to your application - if the software fails for some reason and the watchdog does not get fed, the CPU gets reset to a well-known state. See the TINI API documentation for more details.