32-Bit Arm
®
Cortex
®
-M0+ MCU
HT32F52220/HT32F52230
Functional Description
The Watchdog timer is formed from a 12-bit count-down counter and a fixed 3-bit prescaler. The
largest time-out period is 16 seconds, using the LSI clock and a 1/128 maximum prescaler value.
The Watchdog timer configuration setup includes a programmable counter reload value, reset
enable, window value and prescaler value. These configurations are setup using the WDTMR0
and WDTMR1 registers which must be properly programmed before the Watchdog timer starts
counting. In order to prevent unexpected write operations to those configurations, a register write
protection function can be enabled by writing any value, other than 0x35CA to PROTECT[15:0],
in the WDTPR register. A value of 0x35CA can be written to PROTECT[15:0] to disable the
register write protection function before accessing any configuration register. A read operation on
PROTECT[0] can obtain the enable/disable status of the register write protection function.
During normal operation, the Watchdog timer counter should be reloaded before it underflows to
prevent the generation of a Watchdog reset. The 12-bit count-down counter can be reloaded with
the required Watchdog Timer Counter Value (WDTV) by first setting the WDTRS bit to1 with the
correct key, which is 0x5FA0 in the WDTCR register.
If a software deadlock occurs during a Watchdog timer reload routine, the reload operation will
still go ahead and therefore the software deadlock cannot be detected. To prevent this situation
from occurring, the reload operation must be executed in such a way that the value of the Watchdog
timer counter is limited to within a delta value (WDTD). If the Watchdog timer counter value
is greater than the delta value and a reload operation is executed, a Watchdog Timer error will
occur. The Watchdog timer error will generate a Watchdog reset if the related functional control is
enabled. Additionally, the above features can be disabled by programming a WDTD value greater
than or equal to the WDTV value.
The WDTUF and WDTERR f lags in the WDTSR register will be set respectively when the
Watchdog timer underflows or when a Watchdog timer error occurs. A system reset or written one
operation on the WDTSR register clears the WDTERR and WDTUF flags.
The watchdog timer uses two clocks: PCLK and CK_WDT. The PCLK clock is used for APB
access to the watchdog registers. The CK_WDT clock is used for the Watchdog timer functionality
and counting. There is some synchronization logic between these two clock domains.
When the system enters the Sleep or Deep sleep mode 1, the Watchdog timer counter will either
continue to count or stop depending on the WDTSHLT bits in the WDTMR0 register. The
Watchdog stops counting when the WDTSHLT bits are set in the Sleep mode. The count value
is retained so that it continues counting after the system is woken up from the Sleep mode. A
Watchdog reset will occur any time when the Watchdog timer is running and when it has an
operating clock source. When the system enters the debug mode, the Watchdog timer counter will
either continue to count or stop depending on the DB_WDT bit (in the MCUDBGCR register) in
the Clock Control Unit.
Rev. 1.10
270 of 366
November 09, 2018
Need help?
Do you have a question about the HT32F52220 and is the answer not in the manual?