Introduction

The watchdog timer is a hardware-level safety monitoring module used to detect and recover from software faults (such as infinite loops, code runaway, bus hangs). When system software fails to perform the watchdog feeding operation (refreshing the counter) within the specified time, the WDG will time out and trigger a reset signal, forcing the corresponding CPU or the entire system to reboot, ensuring reliability and recoverability under abnormal conditions.

In the Ameba series SoC, the watchdog is divided into two categories: independent watchdog (IWDG) and system watchdog (SWDG):

  • Independent watchdog: Operates with an independent clock source, does not rely on the system main clock, and is not affected by low-power modes or main clock configurations. It can serve as a global fault monitor shared by dual cores, and can trigger a system-level reset upon timeout.

  • System watchdog: Bound to the CPU. In a multi-core system, each CPU is configured with a dedicated system watchdog. For CPUs that support TrustZone, independent secure watchdog (Secure WDG) and non-secure watchdog (Non-secure WDG) are also provided, used for fault monitoring of secure domain and non-secure domain firmware respectively, enabling hierarchical fault isolation and handling.

All watchdogs support dual paths of timeout interrupt and reset. An interrupt can first notify the software for fault diagnosis and remediation. If the fault is not handled, a reset signal will be output upon timeout, implementing a multi-level recovery strategy ranging from single-core reset to system-wide global reset.

RTL8721Dx:
  • IWDG: System independent watchdog timer

  • WDG0: Watchdog timer for KM0

  • WDG1: Secure watchdog timer for KM4

  • WDG2: Non-secure watchdog timer for KM4

The watchdog architecture is shown in the following figure.

../../../_images/wdg_arch_dplus.svg

Independent Watchdog Timer

Introduction

RTL8721Dx:

    The independent watchdog (IWDG) is a system-level safety monitoring module driven by an always-on power domain and a 100 kHz uncalibrated internal clock. The power domain and clock cannot be disabled after system startup, so once the IWDG is enabled (whether by hardware or software), software cannot disable it.

    The IWDG’s 100 kHz clock is an uncalibrated internal oscillator with a frequency tolerance of ±50%. When configuring the timeout period and feeding strategy, software must reserve sufficient margin to avoid unexpected resets. To prevent mistriggers caused by feeding timing deviations, enabling the IWDG window function is not recommended.

    The IWDG behavior in sleep mode can be configured via the LPEN bit in the control register: when set, the IWDG continues counting in sleep mode, and a timeout will trigger a system-level reset; the configured early interrupt can wake up the system. When LPEN is cleared, the IWDG stops counting in sleep mode and holds its current state, resuming counting after wakeup. The IWDG is reset upon entering deep sleep.

    OTP can be configured to auto-load an AON register, enabling the IWDG automatically by hardware. This register only supports writing from 0 to 1 (a one-time operation). Once configured, the IWDG will automatically run after initial boot or deep sleep wakeup, and software cannot intervene or disable it.

Features

RTL8721Dx:
  • Once enabled, it cannot be disabled

  • Optional early interrupt that can generate an interrupt at a programmable time before watchdog timeout

  • Independent wakeup source

  • Powered and clocked by the AON (always-on) power domain

  • Automatically pauses counting when the CPU is in debug mode

  • Configurable operation in sleep mode

System Watchdog Timer

Introduction

The system watchdog (SWDG) is a dedicated safety monitoring module for the CPU core, sharing the power domain with the corresponding CPU core. It is driven by an internal 32 kHz OSC clock, providing fault detection and recovery capabilities for the CPU operating state.

The system watchdog supports a windowed watchdog function, which can be configured to allow watchdog feeding only within a specified window range of the counter. If the feeding timing is too early or too late, a system reset identical to that triggered by a timeout event will occur, thereby enabling strict monitoring of software execution timing.

In sleep mode, the system watchdog stops counting and maintains its current state. Counting resumes after the system wakes up. When entering deep sleep mode, the system watchdog is reset. Therefore, after waking up from deep sleep, the module must be reconfigured and enabled by software.

Features

  • Once enabled, cannot be disabled

  • Optional early interrupt that can generate an interrupt at a programmable time before watchdog timeout

  • Independent wakeup source

  • Powered by SYSON domain and SDM32K clock source

  • Automatically pauses counting when the CPU is in debug mode