
iVPeRiPheRaLMoDuLes2(tiMeRs):WatChDogtiMeR(WDt)
iV-2-4
ePson
s1C33L17teChniCaLManuaL
iV.2.4ControloftheWatchdogtimer
iV.2.4.1settinguptheWatchdogtimer
selectingthecountclock
The internal clock (MCLK) or external clock (EXCL0) can be selected as the count clock for the 30-bit up-
counter by using CLKSEL (D6/0x300662).
CLKseL:WatchdogTimerInputClockSelectBitinWatchdogTimerEnableRegister(D6/0x300662)
Setting CLKSEL (D6/0x300662) to 0 (default) selects the internal clock (MCLK); setting it to 1 selects the
external clock (EXCL0). Therefore, before an external clock can be used, the function of the pin set as an I/O
port by default must be switched to EXCL0 (external clock input for 16-bit timer 0) by using the Port Function
Select Register. For details about pin functions and how to switch over, see Section I.3.3, “Switching Over the
Multiplexed Pin Functions.”
For details about MCLK generation and control, see Section III.1, “Clock Management Unit (CMU).”
settingthenMi/resetgenerationcycle
The watchdog timer has a 30-bit comparison data register that can be used to set a cycle in which to generate an
NMI or reset signal.
CMPDt[15:0]: 16Low-orderComparisonDataBitsintheWatchdogTimerComparisonDataSetup
Register0(D[15:0]/0x300664)
CMPDt[29:16]:14High-orderComparisonDataBitsintheWatchdogTimerComparisonDataSetup
Register1(D[13:0]/0x300666)
The data set in these register bits 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
NMIgeneratingcycle=————[sec]
fWDTIN
where
CMPDT = value set in CMPDT[29:0] (D[13:0]/0x300666, D[15:0]/0x300664)
fWDTIN = MCLK or EXCL0 input clock frequency [Hz]
For example, the specifiable maximum NMI/reset generation cycle is about 21.47 seconds at 50-MHz MCLK
input.
note: Donotsetavalueequaltoorlessthan0x0000001Finthecomparisondataregister.
selectingthenMi/resetgenerationfunction
To output an NMI signal when the watchdog timer is not reset within a specified cycle, set NMIEN (D1/
0x300662) to 1. To output a reset signal instead, set RESEN (D0/0x300662) to 1.
nMien:WatchdogTimerNMIEnableBitintheWatchdogTimerEnableRegister(D1/0x300662)
Resen:WatchdogTimerRESETEnableBitintheWatchdogTimerEnableRegister(D0/0x300662)
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 exception han-
dling is executed since it has priority over the NMI exception handling.
The NMI and reset signals are both output as pulses of 32 MCLK clocks in width.
note: Dependingonthecounterandcomparisonregistervalues,anNMIorresetsignalmaybegener-
atedaftertheNMIorresetfunctionisenabledhere(orevenwhenthewatchdogtimerhasnotyet
beenstarted).Alwaysbesuretosetcomparisondataandresetthewatchdogtimerbeforewriting
1toNMIEN(D1/0x300662)orRESEN(D0/0x300662).