IV PERIPHERAL MODULES 2 (TIMERS): WATCHDOG TIMER (WDT)
S1C33E07 TECHNICAL MANUAL
EPSON
IV-2-5
IV
WDT
Write protection of watchdog timer registers
The Watchdog Timer Enable Register (0x300662) and Watchdog Timer Comparison Data Registers (0x300664,
0x300666) are write-protected to prevent NMI or reset signals from being inadvertently generated by unnec-
essary write operations. To rewrite these registers, write protection must be removed by writing 0x96 to the
Watchdog Timer Write-Protect Register (0x300660). Once the registers are rewritten, be sure to write other than
0x96 to the Watchdog Timer Write-Protect Register (0x300660) to reapply write protection.
IV.2.4.2 Starting/Stopping the Watchdog Timer
Writing 1 to RUNSTP (D4/0x300662) starts counting by the watchdog timer; writing 0 stops the watchdog timer.
RUNSTP: Watchdog Timer Run/Stop Control Bit in the Watchdog Timer Enable Register (D4/0x300662)
Since RUNSTP (D4/0x300662) exists in the write-protected Watchdog Timer Enable Register (0x300662), write
protection must be removed by writing 0x96 to the Watchdog Timer Write-Protect Register (0x300660) before the
content of RUNSTP can be altered.
IV.2.4.3 Resetting the Watchdog Timer
Before the NMI/reset generation function of the watchdog timer can be used, a routine to reset the watchdog timer
before NMI or reset generation must be prepared in a location for periodic processing. Make sure that this routine
is processed within the NMI/reset generation cycle described earlier.
Writing 1 to WDRESEN (D0/0x30066C) resets the watchdog timer. The up-counter is reset to 0 at this time, then
starts counting NMI/reset generation cycles all over again.
WDRESEN: Watchdog Timer Reset Bit in the Watchdog Timer Control Register (D0/0x30066C)
If the watchdog timer is not reset within the set cycle for some reason, the CPU is placed into trap handling by an
NMI or reset signal to execute the processing routine.
The reset and NMI trap vector addresses are set by default to 0xC00000 and 0xC0001C, respectively. The trap table
base address can be altered by using TTBR.
The count value of the up-counter can be read out from the Watchdog Timer Count Registers (0x300668,
0x30066A) at any time.
CTRDT[15:0]: 16 Low-order Counter Data Bits in the Watchdog Timer Count Register 0 (D[15:0]/0x300668)
CTRDT[29:16]: 14 High-order Counter Data Bits in the Watchdog Timer Count Register 1 (D[13:0]/0x30066A)
IV.2.4.4 Operation in Standby Mode
In HALT mode
In HALT mode, the watchdog timer remains active as it is supplied with a clock. Therefore, if HALT mode re-
mains active beyond the NMI/reset generation cycle, an NMI or reset signal deactivates HALT mode.
To disable the watchdog timer in HALT mode, set NMIEN (D1/0x300662) or RESEN (D0/0x300662) to 0.
Otherwise, write 0 to RUNSTP (D4/0x300662) to stop the watchdog timer before executing the halt instruction.
When NMIEN (D1/0x300662) or RESEN (D0/0x300662) disables NMI or reset generation, the watchdog
timer continues counting even in HALT mode. To reenable NMI or reset generation after exiting HALT mode,
be sure to reset the watchdog timer beforehand.
When HALT mode is entered after stopping the watchdog timer, be sure to reset the watchdog timer before re-
starting it.
In SLEEP mode
The supply of MCLK from the CMU stops in SLEEP mode. Therefore, the watchdog timer also stops operat-
ing. To prevent an unnecessary NMI or reset signal from being generated after exiting SLEEP mode, be sure to
reset the watchdog timer before executing the slp instruction. Moreover, disable NMI/reset generation by set-
ting NMIEN (D1/0x300662) or RESEN (D0/0x300662) as required.