• Skip to primary navigation
  • Skip to main content
  • Skip to primary sidebar
  • Skip to footer

Electrical Engineering News and Products

Electronics Engineering Resources, Articles, Forums, Tear Down Videos and Technical Electronics How-To's

  • Products / Components
    • Analog ICs
    • Connectors
    • Microcontrollers
    • Power Electronics
    • Sensors
    • Test and Measurement
    • Wire / Cable
  • Applications
    • Automotive/Transportation
    • Industrial
    • IoT
    • Medical
    • Telecommunications
    • Wearables
    • Wireless
  • Resources
    • DesignFast
    • Digital Issues
    • Engineering Week
    • Oscilloscope Product Finder
    • Podcasts
    • Webinars / Digital Events
    • White Papers
    • Women in Engineering
  • Videos
    • Teschler’s Teardown Videos
    • EE Videos and Interviews
  • Learning Center
    • EE Classrooms
    • Design Guides
      • WiFi & the IOT Design Guide
      • Microcontrollers Design Guide
      • State of the Art Inductors Design Guide
    • FAQs
    • Ebooks / Tech Tips
  • EE Forums
    • EDABoard.com
    • Electro-Tech-Online.com
  • 5G

What’s a Watch Dog Timer (WDT)?

April 4, 2017 By Scott Thornton

In the world of microcontrollers, sometimes things go wrong. If a program goes haywire or into an infinite loop, it needs a way to check and see if things are still running. In “the old days,” the Windows operating system would occasionally crash (experience a fatal error) and put up what was called the Blue Screen of Death (BSoD) where after it would reboot to prevent damage to the computer such as writing over vital boot code or similarly dangerous events. (The BSoD happens much less often these days.) Embedded systems are different from desktop computers, however, in that there is rarely going to be a human around who will know how to reboot the failing device.

Watchdog timers (WDTs), or watchdogs, are circuits external to the processor that can detect and trigger a processor reset (and/or another event) if necessary. The MCU checks in with the watchdog timer at a set interval to show that it’s still on the job. Like a bomb, the watchdog timer is set to count down and if it times out, it resets the MCU, dumping programs and rebooting the MCU and probably other areas in the system that work in tandem with the MCU. But as long as the MCU is running, it will continue to ping the watchdog to reset the timer. It’s best to keep a watchdog external and unreachable by MCU code. A watchdog can be an external component in a separate package from the integrated circuit (IC) that houses the MCU (best), or a watchdog can be found inside the IC but on a different circuit from the MCU, however a WDT that’s dependent on the same resources as the MCU might not be a good idea for obvious reasons.

Figure 1: This computer WDT has 3 stages of successive WDTs. A bit unusual for embedded WDTs, this nested WDT gives the system up to 3 chances to reset the WDT before resetting the computer. The first WDT, if not reset, may trigger consequences akin to a soft-boot rather than a hard boot. (Source: CC BY-SA 3.0, )

Smartphones can be rebooted with a power-cycle off and on (usually when you need to make an urgent call), but how do you power down the MCU that runs the cruise control in your car? Turning off the car would definitely reboot the cruise control loop, but this option is obviously not safe at a high rate of speed. What if the cruise control program gets stuck in the acceleration mode? The MCU running the cruise control program may need a watchdog timer, which is a kind of external check. You can’t expect something at risk of possibly losing its mind to mind its own safety. MCUs don’t necessarily lose their mind that often, at least they aren’t supposed to, but in critical systems, you cannot trust that something won’t happen. It’s possible that a single cosmic ray can obliterate a single register in flash memory that causes a stack overflow and infinite loops. Once the MCU has gone off the rails, software checks are likely to be ignored, bypassed, overwritten, or just plain forgotten as a rogue event can wreak exquisite havoc.

“Watchdog” may seem a curious choice of words, but there’s a metaphor in there. (Maybe “time bomb” would have been a more accurate description, but it wouldn’t sound quite right to talk about bombs in your system, either.) The act of resetting the WDT has been referred to as “kicking the dog.” According to Niall Murphy (by way of Jack Ganssle), “If the man stops kicking the dog, the dog will take advantage of the hesitation and bite the man.” If you take too long to kick the dog, the dog bites you by resetting the MCU. Regardless, the watchdog timer has been around for decades and is still a reliable method to maintain an electronic fail-safe. WDTs are not necessarily the last line of defense, however. If a watchdog were to fail along with the MCU (perhaps the entire PCB burns out), mechanical hardware fail safes might be the next step for ensuring safety.

The post What’s a Watch Dog Timer (WDT)? appeared first on Microcontroller Tips.

DesignFast Banner version: b9bfab28

Filed Under: FAQ, Microcontroller Tips Tagged With: basics, FAQ

Primary Sidebar

EE Training Center Classrooms

EE Classrooms

Featured Resources

  • EE World Online Learning Center
  • CUI Devices – CUI Insights Blog
  • EE Classroom: Power Delivery
  • EE Classroom: Building Automation
  • EE Classroom: Aerospace & Defense
  • EE Classroom: Grid Infrastructure
Search Millions of Parts from Thousands of Suppliers.

Search Now!
design fast globle

R&D World Podcasts

R&D 100 Episode 7
See More >

Current Digital Issue

April 2022 Special Edition: Internet of Things Handbook

How to turn off a smart meter the hard way Potential cyber attacks have a lot of people worried thanks to the recent conflict in Ukraine. So it might be appropriate to review what happened when cybersecurity fi rm FireEye’s Mandiant team demonstrated how to infiltrate the network of a North American utility. During this…

Digital Edition Back Issues

Sponsored Content

Positioning in 5G NR – A look at the technology and related test aspects

Radar, NFC, UV Sensors, and Weather Kits are Some of the New RAKwireless Products for IoT

5G Connectors: Enabling the global 5G vision

Control EMI with I-PEX ZenShield™ Connectors

Speed-up time-to-tapeout with the Aprisa digital place-and-route system and Solido Characterization Suite

Siemens Analogue IC Design Simulation Flow

More Sponsored Content >>

RSS Current EDABoard.com discussions

  • Hotplugging UART
  • Can I use 5000uF 50V instead of 4700uF 50V in Inverter 700VA output rating board ?
  • Control panel 3 phase sequence indicators
  • Diagnosing a fault on a 18volt lithium Ion charger
  • Buck Regulator (5V, how to select, automotive application)

RSS Current Electro-Tech-Online.com Discussions

  • ASM - Enhanced 16F and long calls - how?
  • Passthrough charging-simple but impossible to achieve?
  • I need a music/LED fasher IC (only die)
  • I need a PROM CPU
  • software PWM

Oscilloscopes Product Finder

Footer

EE World Online

EE WORLD ONLINE NETWORK

  • 5G Technology World
  • Analog IC Tips
  • Battery Power Tips
  • Connector Tips
  • DesignFast
  • EDABoard Forums
  • Electro-Tech-Online Forums
  • Engineer's Garage
  • Microcontroller Tips
  • Power Electronic Tips
  • Sensor Tips
  • Test and Measurement Tips
  • Wire & Cable Tips

EE WORLD ONLINE

  • Subscribe to our newsletter
  • Lee's teardown videos
  • Advertise with us
  • Contact us
  • About Us
Follow us on TwitterAdd us on FacebookConnect with us on LinkedIn Follow us on YouTube Add us on Instagram

Copyright © 2022 · WTWH Media LLC and its licensors. All rights reserved.
The material on this site may not be reproduced, distributed, transmitted, cached or otherwise used, except with the prior written permission of WTWH Media.

Privacy Policy