A watchdog timer is a dedicated hardware circuit that counts down continuously and must be periodically reset by the main program. If the software freezes or enters an infinite loop, it fails to reset the counter. Once the counter reaches zero, the watchdog triggers a hard reset to bring the system back to a known good state.
The main loop got stuck waiting for the ADC, so the watchdog kicked in and rebooted the board.
Rookies often place the watchdog reset command inside a timer interrupt, which defeats the purpose since interrupts can continue running even if the main program loop has crashed.
Also heard as
- watchdog timer
- WDT
Related terms
Reset button
A physical switch that forces a circuit or microcontroller to halt and restart its operation from a known initial state.
Hard-reset
To force a device to restart by physically interrupting its power supply or triggering a dedicated hardware reset line.
Microcontroller
A compact integrated circuit designed to govern a specific operation in an embedded system.