Professional Documents
Culture Documents
9 WATCH-DOG TIMER
OVERVIEW
The HAMCOP watchdog timer is used to resume the controller operation when it had been disturbed by malfunctions
such as noise and system errors. It can be used as a normal 16-bit interval timer to request interrupt service. The
watchdog timer generates the reset signal for 128 GCLK cycles.
FEATURES
9-1
WATCH-DOG TIMER HAMCOP MICROPROCESSOR COMPANION CHIP
The functional block diagram of the watchdog timer is shown in Figure 9-1. The watchdog timer uses GCLK as its
only source clock. To generate the corresponding watchdog timer clock, the GCLK frequency is prescaled first, and
the resulting frequency is divided again.
WTDAT
MUX
1/16 Interrupt
1/32
WTCNT
PCLK 8-bit Prescaler Reset Signal Generator RESET
1/64 (Down Counter)
1/128
The prescaler value and the frequency division factor are specified in the watchdog timer control register, WTCON.
The valid prescaler values range from 0 to 28-1. The frequency division factor can be selected as 16, 32, 64, or 128.
Use the following equation to calculate the watchdog timer clock frequency and the duration of each timer clock
cycle:
When the watchdog timer is enabled first, the value of WTDAT (watchdog timer data register) cannot be
automatically reloaded into the WTCNT (timer counter). For this reason, an initial value must be written to the
watchdog timer count register, WTCNT, before the watchdog timer starts.
When HAMCOP is in debug mode using Embedded ICE, the watch-dog timer must not operate.
The watch-dog timer can determine whether or not the current mode is the debug mode from the CPU core signal
(DBGACK signal). Once the DBGACK signal is asserted, the reset output of the watch-dog timer is not activated
when the watchdog timer is expired.
9-2
HAMCOP MICROPROCESSOR COMPANION CHIP WATCH-DOG TIMER
Using the Watch-Dog Timer Control register, WTCON, you can enable/disable the watch-dog timer, select the clock
signal from 4 different sources, enable/disable interrupts, and enable/disable the watch-dog timer output.
The Watch-dog timer is used to resume the HAMCOP restart on mal-function after power-on; if controller restart is
not desired, the Watch-dog timer should be disabled.
If the user wants to use the normal timer provided by the Watch-dog timer, please enable the interrupt and disable
the Watch-dog timer.
9-3
WATCH-DOG TIMER HAMCOP MICROPROCESSOR COMPANION CHIP
The watchdog timer data register, WTDAT is used to specify the time-out duration. The content of WTDAT can not
be automatically loaded into the timer counter at initial watchdog timer operation. However, the first time-out occurs
by using 0x8000(initial value), after then the value of WTDAT will be automatically reloaded into WTCNT.
The watchdog timer count register, WTCNT, contains the current count values for the watchdog timer during normal
operation. Note that the content of the watchdog timer data register cannot be automatically loaded into the timer
count register when the watchdog timer is enabled initially, so the watchdog timer count register must be set to an
initial value before enabling it.
9-4