19.2.3.1 Loading and Refreshing the Watchdog Timer

The WDOGLOAD register is used to store the value that is loaded into the counter each time the watchdog timer is refreshed. The six least significant bits of the WDOGLOAD register are always set to 0x3F, irrespective of what value is written to it. This effectively means that there is a lower limit on the value that can be written to the counter. After refreshing, at least 64 RCOSCCLK clock ticks (0.00128ms for Vdd=1.2 V) are required before the counter times out. The purpose of this feature is to prevent a watchdog timer reset/interrupt from occurring immediately after, or during refresh in the case where a very low value has been written to the WDOGLOAD register.

The watchdog timer counter is refreshed by writing the value 0xAC15DE42 to the WDOGREFRESH register. This causes the counter to be loaded with the value in the WDOGLOAD register as defined in the system register block shown in Table 19-12.

An appropriate value must be written to the WDOGLOAD System register before writing to the WDOGREFRESH register. Forbidden and permitted windows in time regulate when refreshing can occur. The size of these windows is controlled by the value in the WDOGMVRP System register.

When the counter value is greater than the value in the WDOGMVRP, refreshing the watchdog timer is forbidden. If a refresh is executed in these circumstances, the refresh is successful, but a reset or interrupt (depending on Operation mode selected) is also generated. This is shown in the following figure.

When the counter value falls below the level programmed in the WDOGMVRP, refreshing of the watchdog timer is permitted. It is possible to avoid having forbidden and permitted windows by ensuring that the value in the WDOGMVRP is greater than the value in the WDOGLOAD.

The following figure shows how the value of the watchdog timer counter might vary with time.

Figure 19-3. Watchdog Timer Counter

When the TIMEOUT occurs, the watchdog timer counter is reloaded with the WDOGLOAD value. Hence the WDOGLOAD from the system registers block should be programmed such that it should not be lesser than the default value of 0x1800000. This is because if the WDOGLOAD is programmed to a smaller value, each time the WDOGTIMEOUT occurs, the watchdog timer counter is assigned to a lesser value that results in the counter reaching the timeout value within a short period of time and generating the TIMEOUT repeatedly. To avoid such instances, the firmware programs the WDOGLOAD value in the system register to be higher or equal to the default value, which is 0x1800000.