Main Content

STM32 Window watchdog (WWDG)

Configuring Window watchdog (WWDG) on STM32 Nucleo-F401RE and test it.

STM32F401xD/E has two Watchdog timers- Independent watchdog (IWDG) and Window watchdog (WWDG). In this project we will see how to activate and periodically pet the dog, I mean refresh the watchdog. Also we will see what will happen if you don’t pet your watchdog within the window i.e. petting (refreshing) too late or too early.

Some knowledge of STM32CubeMX, Keil MDK, GPIOs, Counters are assumed from the reader to follow along.

Theory
As the name watchdog suggests, it is watching the application running on the MCU. It is a monitoring function. In case of any abnormality from the normal sequence of program execution- software fault, the watchdog detects it. It then initiates a MCU reset, which will help to start the software all over again.

From the functionality stand point, there are two major differences between IWGD and WWDG.

IWDG does not offer a window for refresh. [This means, IWDG doesn’t care as long as it is refreshed before the down counter (WWDG_CR[6:0], rolls over]
IWDG offers no Interrupt Service Routine (ISR) where as WWDG does. [This means, just before initiating a reset, an interrupt is generated, where you could write your routine to have a safe exit.]
Unlike IWDG, WWDG is clocked by the APB1 peripheral clock. The following image shows a snapshot form STM32CubeMX.”

Link to article