 Hello and welcome to this presentation of the STM32 System Window Watchdog. It will cover the main features of this peripheral used to detect software faults. The Window Watchdog is used to detect the occurrence of software faults. The Window Watchdog can be programmed to detect abnormally late or early application behavior. It is best suited for applications required to react within an accurate timing window. Once enabled, it can only be disabled by a device reset. An early wake-up interrupt can be generated before a reset happens to perform a system recovery or manage certain actions before a system restart. The Window Watchdog offers several features. The user can program the timeout value and the window width according to application needs. It can generate a reset under two conditions. When the down counter value becomes less or equal to 0x3f or when the Watchdog is refreshed outside the time window. It can generate an early wake-up interrupt when the down counter reaches 0x40. The early wake-up interrupt can be used to reload the down counter in order to avoid a reset generation or to manage system recovery and context backup operations. As shown in the figure, the Window Watchdog uses the APB clock or PCLK as reference clock for its time base. The PCLK is provided by the RCC block. This clock is divided by 4096 and by a value programmed by the application. The application can also program the reload value of the down counter bits T6 to 0. The window width is controlled by bits W, 6 to 0. The STM32WB's embedded WWDG is dedicated for use by the CPU1 only. The WWDG is connected to the APB1 bus and clocked by the APB1 clock. The WWDG early wake-up interrupt output is connected to the NVIC of the CPU1. It is possible to select the hardware or software start via an option byte. In hardware mode, the WWDG can be automatically enabled after reset. The Window Watchdog is frozen when the system is in stop, standby or shutdown mode but can remain active when the CPU1 is in C-sleep mode. The WWDG performs a system reset handled by the RCC block when a timeout occurs or when the WWDG is refreshed outside the allowed window. This diagram illustrates how the Window Watchdog operates. When the 7-bit down counter rolls over from 0x40 to 0x3F, the Watchdog asserts the reset. This happens if the application software does not refresh the Window Watchdog on time. The early wake-up interrupt or EWI if enabled can be generated when the down counter reaches 0x40. If the software refreshes the Watchdog while the down counter is greater than the value stored in bits, W6 to 0, a reset is generated. This happens when the application refreshes the Watchdog too early. No interrupt is generated in this case. To prevent a Window Watchdog reset, the Watchdog refresh must happen while the down counter value is lower than the time window value and greater than 0x3F. This is illustrated by the green area. The refresh operation consists of reloading the down counter with bits T6 to 0. The WWDG can work either in hardware or software mode. In software mode, the application needs to enable the APB1 Watchdog clocks via the RCC and set the bit WDGA to 1 in the WWDG in order to enable the Watchdog. Note that once the APB1 clock for the Watchdog is enabled, the application cannot disable it. Only a system reset can disable the Watchdog clock. The low-power enable bit can be set as well if the application wishes to keep the window Watchdog activated, even if the CPU1 is in sleep mode. In hardware mode, there is no need to enable the Watchdog. The WWDG is counting down when the CPU1 is in run or sleep. The bits WWDGEN and WWDGSMEN are forced to 1 by the hardware. The down counter uses the APB1 clock divided by 4096 and again divided by a division ratio selected by the application. This division can be 1, 2, 4, or 8, as defined in the WWDG CFR register. The formula shown in this slide lets you determine the Watchdog timeout value. When a system reset occurs, it is possible to identify the cause of the reset thanks to status flags provided by the RCC block. The window Watchdog can be one of the sources. The early wake-up interrupt or EWI can be used in order to perform emergency tasks before the reset occurs, such as data logging, data protection, Watchdog refresh in order to prevent the reset or other emergency tasks. The EWI interrupt occurs whenever the down counter value reaches 0x40. It is enabled by setting EWI bit in the WWDG CFR register. The EWI interrupt is cleared by writing 0 to the EWIF bit in the WWDGSR register. The window Watchdog is active in run and sleep modes. It is not available in stop, standby, or shutdown mode. In sleep mode, when the Watchdog is used in software start mode, it can be enabled by clearing the low-power enabled bit located in the RCC block.