![Analog Devices ADuCM355 Hardware Reference Manual Download Page 282](http://html1.mh-extra.com/html/analog-devices/aducm355/aducm355_hardware-reference-manual_2939808282.webp)
UG-1262
Rev. B | Page 282 of 312
AFE WATCHDOG TIMER
WATCHDOG TIMER FEATURES AND BLOCK DIAGRAM
To satisfy the IEC 61508 standard requirement for separating the watchdog timer from all processor clock sources, the analog die watchdog
timer is used to recover from an invalid software state. After the watchdog timer is enabled by user code, it requires periodic servicing to prevent
it from forcing a reset of the processor. The required maximum watchdog timer reset period is 16 sec in gas sensor applications.
The watchdog timer is a windowed timer with an upper and lower refresh period. The watchdog timer triggers a reset if the following are true:
The timer is not refreshed before the largest interval. The largest interval is set by the user via the WDTLD register.
The timer is refreshed before the shortest interval. The shortest interval is set by the user via the WDTMINLD register.
The timer is refreshed by writing 0xCCCC to the WDTCLRI register.
A watchdog timer reset is forced by writing a value other than 0xCCCC to the WDTCLRI register.
The watchdog timer is clocked by the low frequency oscillator (see the Clock Divider Configuration Register section). It is clocked at all
times, except during reset, while in debug mode, and when it is selectively disabled while in hibernate mode.
The watchdog timer is a 16-bit countdown timer with a programmable prescaler. The prescaler source is selectable and can be scaled by a
factor of 1, 16, 256, or 4096. The analog die watchdog timer control registers ensure a maximum timeout period of 16383.5 sec when
WDTCON, Bit 8 = 1. WDTCON, Bit 8 = 1 results in the 32.768 kHz clock being divided by 2. When WDTCON, Bit 8 = 0, the maximum
timeout is 8191.75 sec. The default timeout period is 32 sec.
WATCHDOG TIMER OPERATION
After any reset, the watchdog timer is initialized with an initial configuration. This initial configuration can be modified by user code.
However, setting the watchdog timer enable register write protects the watchdog timer configuration or enable register so that the
watchdog timer keeps running. Only a reset clears the write protection and allows reconfiguration of the timer. When the watchdog
timer is not enabled, the watchdog timer can be reconfigured at any time.
When the watchdog timer decrements to 0, a reset is generated. This reset can be prevented by writing 0xCCCC to the WDTCLRI
register. Writing 0xCCCC to WDTCLRI causes the watchdog timer to reload with the watchdog timer configuration in free running
mode. In this case, the watchdog timer immediately begins a new timeout period and starts to count again.
The reset output of the watchdog timer works solely from the 32 kHz clock and does not require the system clock to be active. Therefore,
the reset output can work with all the power-down modes, including hibernate mode.
In MCU software debugging mode, disable the WDT first before software debugging. These specific values written to specific registers
eliminate the possibility of rogue code refreshing the watchdog timer.
WINDOWED WATCHDOG FEATURE
The windowed watchdog feature provides extra robustness to the watchdog timer for safety critical applications. With the window
feature enabled, the watchdog timer reset fires if user code refreshes the watchdog timer either too quickly or too slowly. When the
window feature is enabled (WDTCON, Bit 9 = 1), the watchdog timer must be refreshed before the counter value reaches 0. The WDT
must also be refreshed after the counter has passed the value written to the WDTMINLD register.
The following are example instructions to set up the windowed watchdog feature:
pADI_AFEWDT->WDTLD = 0x800; //16 second timeout period
pADI_AFEWDT->WDTMINLD = 0x600; // Min window is 4s after start
pADI_AFEWDT->WDTCON = 0x248; // Enable Windowed feature
INTERRUPT MODE
If a watchdog reset occurs while debugging via the SWD port, communications between the debugger and the
can be lost.
As such, while debugging, the user can optionally configure the watchdog timer to generate an interrupt instead of a reset. Enable this feature
only during code development and debug. Enable the watchdog timer to generate a reset in full user applications. Setting WDTCON,
Bit 0 to 1 or 0 has no effect in interrupt mode. The following are example instructions to set up the watchdog timer in interrupt mode:
pADI_AFEWDT->WDTLD = 0x200; //4second timeout period
pADI_AFEWDT->WDTCON = 0x44A; // WDT IRQ, Window On, periodic, Clock div256,
NVIC_EnableIRQ(AFE_Watchdog_IRQn); // Enable the NVIC interrupt for the AFE Watchdog timer