Jump to main content

##

# 3.38.15 Reinforced Safety Watchdog Timer (RSWDT)

The RSWDT works in parallel with the Watchdog Timer (WDT) to reinforce safe watchdog operations.

The RSWDT is a 12-bit down counter that allows a watchdog period of up to 16 seconds with a 32kHz slow clock. It should be fed periodically before it counts down to zero. If the timer counts down to zero, it will reset the device.

The RSWDT uses the Main RC oscillator divided clock (frequency is equivalent to Slow RC) if the Main RC oscillator is enabled by the application, or if the WDT is driven by the 32kHz Slow clock.

If the WDT clock source (for example, the 32 kHz crystal oscillator) fails, the system lock-up is no longer monitored by the WDT and the RSWDT performs the monitoring with the Main RC oscillator and resets the device.

## Using The Library

The RSWDT module runs independent of the rest of the system, causing system resets whenever it times out. However, the application software should ensure that the timeout never occurs by resetting the RSWDT periodically as long as the software is in a known healthy state. If the system hangs or program execution is corrupted, the RSWDT will not receive its periodic reset, and will eventually time out and cause a system reset.

In many systems, there is an obvious upper boundary to the amount of time each iteration of the main application loop can be expected to run, before a malfunction can be assumed (either due to a deadlock waiting on hardware or software, or due to other means). When the RSWDT is configured with a timeout period equal to this upper boundary, a malfunction in the system will force a full system reset to allow for a graceful recovery. The upper boundary is specified by a 12-bit watch dog period value.

Window Mode

In many system, there is also lower boundary to the amount of time each iteration of the main application loop can be expected to run. To guard against a system failure resetting the Watchdog in a tight loop (or a failure in the system application causing the main loop to run faster than expected) a watch dog delta value can be specified to disallow resetting of the Watchdog counter before a certain period of time. Any attempt to reset the watchdog when the watchdog counter has not counted down to the delta value results in device reset.

## Library Interface

Reinforced Safety Watchdog Timer peripheral library provides the following interfaces:

Functions

Name | Description
--- | ---
RSWDT_Initialize | Initializes given instance of the RSWDT peripheral
RSWDT_Clear | Restart the RSWDT counter
RSWDT_CallbackRegister | Sets the pointer to the function (and it's context) to be called when the Timeout events occur

Data types and constants

Name | Type | Description
--- | --- | ---
RSWDT_CALLBACK | Typedef | Defines the data type and function signature for the RSWDT peripheral callback function