176
CHAPTER 6 WATCHDOG TIMER
6.1
Overview of Watchdog Timer
The watchdog timer is a 1-bit counter that uses, as its count clock source, either the
timebase timer derived from the main clock, or the watch prescaler derived from the
subclock. The watchdog timer resets the CPU if not cleared within a fixed time after
activation.
s Watchdog Timer Function
The watchdog timer is a counter provided to guard against program runaway. Once activated,
the counter must be repeatedly cleared within a fixed time interval. If the program becomes
trapped in an endless loop or similar and does not clear the counter within the fixed time, the
watchdog timer generates a four-instruction cycle watchdog reset to the CPU.
Either the timebase timer output or the watch prescaler output can be selected as the watchdog
timer count clock.
Table 6.1-1 "Watchdog Timer Interval Time" lists the watchdog timer interval times. If not
cleared, the watchdog timer generates a watchdog reset at a time between the minimum and
maximum times listed. Clear the counter within the minimum time given in the .
Reference:
See Section 6.4 "Watchdog Timer Operation" for the details on the minimum and maximum
time of the watchdog timer interval times.
Check:
When the timebase timer output is selected as the watchdog timer counter count clock, the
watchdog timer will be cleared at the same time (and each time) the timebase timer counter
is cleared (TBTC: TBR = 0). When the timeclock prescaler is selected as the count clock, the
watchdog timer will be cleared at the same time as the timeclock prescaler is cleared
(WPCR: WCLR = 0). Therefore, if the counter selected as the count clock (either the
timebase timer or the timeclock prescaler) is repeatedly cleared before the end of the
watchdog timer interval, the watchdog timer will fail to perform its intended function.
Note:
The watchdog timer counter is cleared whenever the device changes to sleep or stop watch
mode. Operation halts until the device returns to normal operation (RUN state).
Table 6.1-1 Watchdog Timer Interval Time
Count clock
Watch timer output (main clock
oscillator frequency at 4.2 MHz)
Watch prescaler output (subclock
oscillator frequency at 32.768 kHz)
Minimum time
Approx. 998.6 ms*1
500 ms*2
Maximum time
Approx. 1997.3 ms
1000 ms
*1:
Divide-by-two the main clock source oscillation (FCH)× timebase timer count value (2
21).
*2:
The time of a clock cycle at the subclock oscillator frequency (FCL)× timeclock prescaler
count (214).