B. appendix b: watchdog timer, B.1 introduction, B.2 detail register descriptions – Lanner LEC-2010 User Manual
Page 58: B.2.1 to use the watch-dog timer
LEC-2010 Fanless Embedded System User’s Manual
58
B. Appendix B: Watchdog Timer
B.1 Introduction
systems need to be self-reliant. If an error should occur it is typically not possible to wait for
the system to be rebooted manually. In some cases, such as space probes, the system is
simply not accessible to human operators. If such systems should ever hang, they would be
permanently disabled. In other cases, the speed at which a human operator would reset the
system would be too slow to meet the uptime requirements of the product.
A watchdog timer is a piece of hardware that can be used to automatically detect system
anomalies and reset the processor in the case any problems are found. Generally speaking,
a watchdog timer is based on a counter that counts down from an initial value to zero. The
software selects the counter's initial value and periodically restarts it. Should the counter
reach zero before the software restarts it, the software is presumed to be malfunctioning,
and the processor's reset signal is asserted. Thus, the processor will be restarted as if a
human operator had cycled the power.
B.2 Detail Register Descriptions
A watchdog action consists of a series of watchdog instructions. A watchdog instruction is
the operation on a register region. This section describes the detail register in LPD I/O
(W83697UHG)
B.2.1 To use the watch-dog timer
For DOS system:
Execute the WD.EXE file under DOS (WD.EXE and CWSDPMI.EXE should be placed on same
directory), then key-in 0~255. The system will reboot automatically according to the
time-out you set.
Watch Dog sample code:
#include
#include
#include
#include
#include
#define INDEX_PORT 0x2e
#define DATA_PORT 0x2f
void help()
{
printf("Watchdog timer control for EM-9345\n\n");
printf("wd.exe -wr xxx (1-255 sec)(Watchdog Control - SYSTEM RESET)\n");
printf("\n");
}
int main(int argc, char *argv[])
{
int temp, time;
if( argc < 2 )
{