-
Notifications
You must be signed in to change notification settings - Fork 0
Watchdog Timer
MarekBykowski edited this page May 26, 2026
·
1 revision
A hardware counter that resets the CPU if not "petted" (reset) within a timeout. Prevents firmware from hanging silently.
// Initialise watchdog with 1s timeout
watchdog_init(1000); // 1000ms
// Main loop — must pet before timeout
while (1) {
watchdog_kick(); // reset the counter ("I'm alive")
do_work();
}
// If do_work() hangs → watchdog fires → CPU reset → system recovers