Hardware & devices

Watchdog timer

A hardware counter that resets the device unless firmware periodically restarts it, recovering automatically from hangs and crashes in unattended systems.

A watchdog timer is a safety net for devices nobody can walk over to and power-cycle. The counter runs continuously; firmware must “kick” it before it expires, and if it does not, because the code is stuck in a loop, deadlocked on a radio call or corrupted, the hardware forces a reset. Nearly every microcontroller has one.

Using one well takes some thought. Kicking the watchdog from a timer interrupt defeats the purpose, since the interrupt keeps running while the main logic is dead; the kick should prove that the application’s real work is progressing. The timeout must be longer than any legitimate long operation, such as a firmware download, or be paused deliberately around it. A watchdog reset is also worth logging, because frequent silent reboots hide a bug rather than fixing it.

Part of the IoT Glossary. Spotted an error or a missing term? Tell us.