17 WATCHDOG TIMER (WDT)
17-2
Seiko Epson Corporation
S1C33L26 TECHNICAL MANUAL
WDT Operating Clock
17.3
The watchdog timer module is clocked by the PCLK2 clock (= system clock) supplied from the CMU. At initial
reset, this clock is also selected as the count clock for the watchdog timer.
For more information on clock generation and control, see the “Clock Management Unit (CMU)” chapter.
Note: Even when using an external clock as the count clock for the watchdog timer, PCLK2 is required
for watchdog timer operation and access to its control register.
Control of the Watchdog Timer
17.4
Setting Up the Watchdog Timer
17.4.1
Selecting the count clock
The internal clock (PCLK2) or an external clock (T16A_EXCL_0) can be selected as the count clock for the
30-bit up-counter by using CLKSEL/WD_EN register.
Setting CLKSEL to 0 (default) selects the internal clock (PCLK2); setting it to 1 selects an external clock (T16A_
EXCL_0).
Setting the NMI/reset generation cycle
The watchdog timer has a 30-bit comparison data register (CMPDT[29:0]/WD_CMP_L/H registers) that can be
used to set a cycle in which to generate an NMI or reset signal.
The data set to CMPDT[29:0] is compared with the up-counter value. When both match, a specified NMI or
reset signal is output. The up-counter is reset to 0 at this time.
The NMI/reset generation cycle can be calculated from the equation below.
CMPDT + 1
NMI generating cycle = ———— [s]
f
WDTIN
where
CMPDT = value set to CMPDT[29:0]
f
WDTIN
= Input clock (PCLK2 or T16A_EXCL_0) frequency [Hz]
Note: Do not set a value equal to or less than 0x1f in the comparison data register.
Selecting the NMI/reset generation function
To output an NMI signal when the watchdog timer is not reset within a specified cycle, set NMIEN/WD_EN
register to 1. To output a reset signal instead, set RESEN/WD_EN register to 1.
Setting both bits to 0 (default) generates neither an NMI signal nor a reset signal, although the up-counter re-
mains active and can output a clock.
Setting both bits to 1 outputs both an NMI signal and a reset signal. In this case, however, reset handling is ex-
ecuted since it has priority over the NMI handling.
The NMI and reset signals are both output as pulses of 32 system clocks in width.
Note: Depending on the counter and comparison register values, an NMI or reset signal may be gener-
ated after the NMI or reset function is enabled here (or even when the watchdog timer has not yet
been started). Always be sure to set comparison data and reset the watchdog timer before writing
1 to NMIEN or RESEN.
Write protection of watchdog timer registers
The WD_EN, WD_CMP_L, and WD_CMP_H registers are write-protected to prevent NMI or reset signals
from being inadvertently generated by unnecessary write operations. To rewrite these registers, write protection
must be removed by writing 0x96 to WDPTC[15:0]/WD_PROTECT register in 16-bit access only. Once the
registers are rewritten, be sure to write other than 0x96 to WDPTC[15:0] to reapply write protection.