{"docs":[{"id":139,"title":"Designing Reliable Embedded Systems: Watchdogs, Brown-Outs and Safe States","heading":"Designing Reliable Embedded Systems: Watchdogs, Brown-Outs and Safe States","subheading":null,"category":"Embedded Systems","body":{"root":{"type":"root","children":[{"type":"heading","tag":"h3","version":1,"children":[{"type":"text","text":"Defining the safe state","version":1}]},{"type":"paragraph","version":1,"children":[{"type":"text","text":"Microcontroller pins are typically high-impedance inputs during and immediately after reset, so the hardware, not the firmware, sets what each output does at that moment. Use pull-up or pull-down resistors so that heaters, motors and valves default to off while the processor is resetting or unprogrammed.","version":1}]},{"type":"paragraph","version":1,"children":[{"type":"text","text":"In firmware, set outputs to their safe values before anything else, then read the reset cause. A device that has reset repeatedly from the watchdog can enter a limited mode and report the fault rather than cycling indefinitely.","version":1}]}],"direction":"ltr","format":"","indent":0,"version":1}},"tags":"Embedded Systems, Firmware, Reliability","cardCta":{"label":null,"link":null},"pageCta":{"label":"Talk to AAVICO engineering","link":"/contact"},"excerpt":"Every embedded device will eventually meet a supply dip, a hung peripheral or a firmware fault. Reliability comes from deciding in advance what the hardware does next.","featuredImage":null,"type":"Blog","readTime":"3 min read","publishedAt":"2026-11-15T20:54:00.000Z","heroImage":null,"introText":"A supply sags during a motor start, an I2C sensor holds the bus low, a rare code path loops forever. What separates a robust product from a fragile one is not the absence of faults but how the system detects them and where it ends up afterwards. This article covers the three mechanisms that matter most: the watchdog, brown-out detection and a defined safe state.","metrics":[{"id":"designing-reliable-embedded-systems-watchdogs-br-metric-1","value":"Watchdog","label":"A hardware timer that resets the processor unless firmware refreshes it in time.","icon":null},{"id":"designing-reliable-embedded-systems-watchdogs-br-metric-2","value":"Windowed","label":"A window watchdog also resets on a refresh that arrives too early, catching runaway loops.","icon":null},{"id":"designing-reliable-embedded-systems-watchdogs-br-metric-3","value":"BOR","label":"Brown-out reset holds the processor in reset while the supply is below a safe threshold.","icon":null},{"id":"designing-reliable-embedded-systems-watchdogs-br-metric-4","value":"Reset cause","label":"Most microcontrollers record why they last reset; logging it makes silent resets visible.","icon":null}],"gallery":[],"challenge":{"root":{"type":"root","children":[{"type":"paragraph","version":1,"children":[{"type":"text","text":"A processor running below its rated supply voltage can execute instructions incorrectly, corrupt RAM or write garbage to flash. Without brown-out detection, a slow supply ramp or a brief dip can leave the device running in an undefined condition that firmware cannot detect.","version":1}]},{"type":"paragraph","version":1,"children":[{"type":"text","text":"Watchdogs are often fitted and then defeated. A refresh placed in a timer interrupt keeps the watchdog satisfied while the main loop is stuck, so the device sits hung and never resets.","version":1}]}],"direction":"ltr","format":"","indent":0,"version":1}},"blockquote":{"quote":"Assume the firmware will fail at some point, and decide in advance what the outputs do when it does.","author":"","role":"AAVICO Engineering"},"supportImage1":null,"deliverables":{"root":{"type":"root","children":[{"type":"paragraph","version":1,"children":[{"type":"text","text":"Enable the brown-out reset and choose a threshold above the minimum supply voltage the processor and its flash need at the chosen clock speed.","version":1}]},{"type":"paragraph","version":1,"children":[{"type":"text","text":"Refresh the watchdog from one supervisory point only, and only when every task has reported progress since the last refresh.","version":1}]},{"type":"paragraph","version":1,"children":[{"type":"text","text":"Define the safe state of every output in hardware, then log the reset cause and count consecutive watchdog resets in firmware.","version":1}]}],"direction":"ltr","format":"","indent":0,"version":1}},"results":[{"id":"designing-reliable-embedded-systems-watchdogs-br-result-1","title":"Recovery","description":"Hangs end in a controlled reset, not a device that needs a power cycle."},{"id":"designing-reliable-embedded-systems-watchdogs-br-result-2","title":"Data Integrity","description":"Flash is never written while the supply is too low to do it correctly."},{"id":"designing-reliable-embedded-systems-watchdogs-br-result-3","title":"Safety","description":"Outputs fall to a known, harmless condition whenever the firmware is not in control."},{"id":"designing-reliable-embedded-systems-watchdogs-br-result-4","title":"Diagnosability","description":"Logged reset causes show which faults occur in the field and how often."}],"lookingAhead":{"root":{"type":"root","children":[{"type":"paragraph","version":1,"children":[{"type":"text","text":"Protect stored settings against a reset mid-write: keep two copies with a sequence number and a CRC, and use the newest valid one at start-up.","version":1}]},{"type":"paragraph","version":1,"children":[{"type":"text","text":"Test the mechanisms deliberately: hang a task, ramp the supply down slowly, and confirm the device behaves as designed.","version":1}]}],"direction":"ltr","format":"","indent":0,"version":1}},"supportImage2":null,"testimonial":{"quote":null,"author":null,"role":null,"photo":null},"challengesSolved":[{"id":"designing-reliable-embedded-systems-watchdogs-br-challenge-1","title":"A watchdog refreshed from a timer interrupt","description":null,"icon":null},{"id":"designing-reliable-embedded-systems-watchdogs-br-challenge-2","title":"Flash corrupted by writes during a supply dip","description":null,"icon":null},{"id":"designing-reliable-embedded-systems-watchdogs-br-challenge-3","title":"Outputs that switch on while the processor resets","description":null,"icon":null},{"id":"designing-reliable-embedded-systems-watchdogs-br-challenge-4","title":"Field resets that leave no record of their cause","description":null,"icon":null}],"relatedPosts":[],"contactUs":{"show":true},"updatedAt":"2026-11-15T17:32:32.682Z","createdAt":"2026-11-15T17:32:32.682Z"}],"hasNextPage":false,"hasPrevPage":false,"limit":10,"nextPage":null,"page":1,"pagingCounter":1,"prevPage":null,"totalDocs":1,"totalPages":1}