GD32VF103 User Manual
209
Figure 13.2. Window watchdog timer block diagram
Reset
Write WWDGT_CTL
CNT>WIN
CNT[6]=0
Reset
PCLK1/4096
Prescaler
/1/2/4/8
7-Bit Down Counter
CNT
Window WIN
WDGTEN
The watchdog is always disabled after power on reset. The software starts the watchdog by
setting the WDGTEN bit in the WWDGT_CTL register. Whenever window watchdog timer is
enabled, the counter counts down all the time, the configured value of the counter should be
greater than 0x3F, it implies that the CNT[6] bit should be set. The CNT[5:0] determine the
maximum time interval of two reloading. The countdown speed depends on the APB1 clock
and the prescaler (PSC[1:0] bits in the WWDGT_CFG register).
The WIN[6:0] bits in the configuration register (WWDGT_CFG) specifies the window value.
The software can prevent the reset event by reloading the downcounter when counter value
is less than the window value and greater than 0x3F, otherwise the watchdog causes a reset.
The early wakeup interrupt (EWI) is enabled by setting the EWIE bit in the WWDGT_CFG
register, and the interrupt is generated when the counter reaches 0x40 or the counter is
refreshed before it reaches the window value. The software can do something such as
communication or data logging in the interrupt service routine (ISR) in order to analyse the
reason of software malfunctions or save the important data before resetting the device.
Moreover the software can reload the counter in ISR to manage a software system check and
so on. In this case, the WWDGT will never generate a WWDGT reset but can be used for
other things.
The EWI interrupt is cleared by writing '0' to the EWIF bit in the WWDGT_STAT register.