Have you ever wondered what happens when a microcontroller gets stuck while running an embedded application?
In many embedded systems, the software must operate continuously without human intervention. If the firmware hangs due to an unexpected condition, the system may stop responding. A manual reset may not be practical, especially in remote or safety-critical applications.
This is where the Watchdog Timer (WDT) becomes useful.
What Is a Watchdog Timer?
A Watchdog Timer is a hardware timer used to detect situations where software fails to respond as expected. The firmware must refresh the watchdog within a configured time. If the refresh does not happen before the timeout, the watchdog can trigger a microcontroller reset or another configured fault response.
How Does a Watchdog Timer Work?
The basic operation involves three steps:
- Start the watchdog: Configure and enable the watchdog timer.
- Refresh the watchdog: The firmware periodically reloads the watchdog counter while the application is operating correctly.
- Detect a failure: If the firmware gets stuck and fails to refresh the watchdog, the timer expires and can reset the microcontroller.
Normal Operation
Application running → Watchdog refreshed → Counter reloaded → Application continues.
Fault Condition
Application hangs → Watchdog not refreshed → Timeout occurs → Microcontroller reset.

What Does Feeding or Kicking the Watchdog Mean?
In embedded programming, terms such as feed, kick, refresh, and service the watchdog refer to updating or reloading the watchdog timer before it expires.
This tells the watchdog that the firmware has reached a point where it is still operating as expected.
However, watchdog servicing should be designed carefully. Refreshing it unconditionally from an interrupt may hide a failure in the main application.
Types of Watchdog Timers
Watchdogs can be classified in different ways:
- Hardware watchdog: Implemented in hardware and capable of monitoring firmware independently of normal application execution, subject to its clock and hardware operation.
- Software watchdog: Implemented using firmware mechanisms such as tasks or software timers; it depends on the software and scheduling mechanisms that support it.
- Independent Watchdog (IWDG/IWDT): Typically uses a clock source independent of the main system clock.
- Window Watchdog (WWDG/WWDT): Requires the watchdog to be refreshed within a permitted time window. Refreshing too early or too late can trigger a fault.
These terms describe different characteristics, so they are not all mutually exclusive categories.
Watchdog Timers in STM32F407
The STM32F407 microcontroller provides two hardware watchdog peripherals:
1. Independent Watchdog (IWDG)
The IWDG typically uses the low-speed internal oscillator (LSI). It is useful for detecting missing watchdog refreshes and recovering from firmware stalls.
2. Window Watchdog (WWDG)
The WWDG uses a clock derived from the APB peripheral clock. It adds a refresh-window requirement, helping detect refreshes that occur too early or too late.
The exact configuration and behavior should be checked against the STM32F407 reference manual.
Why Is a Watchdog Timer Important?
Watchdog timers are useful in embedded applications where continuous operation and automatic recovery matter, including:
- Automotive electronic systems
- Industrial automation
- Medical and monitoring equipment
- IoT devices
- Remote monitoring systems
- Consumer electronics
A watchdog is not a complete solution to every failure, but it is an important part of a robust firmware design.
Learn Embedded Systems with VinTech Embedded Academy
VinTech Embedded Academy provides practical training in Embedded C, ARM Cortex-M architecture, STM32 microcontrollers, bare-metal driver development, and embedded firmware programming.
For course information and one-on-one training:
- Website: https://vintechembeddedacademy.com/
- Email: vintechembeddedacademy@gmail.com
- WhatsApp: +91 7569883386

