Bookmark and Share Printer-friendly version Email to a Friend

Hardware Watchdog Timer Accepts Range of Frequencies

( 01 Nov 2010 )
By Robert Most, Ferris State University, Big Rapids, Michigan

Microcontrollers usually require a watchdog timer to bring high currents or high voltages into a safe condition. Many microcontrollers have built-in watchdog timers for this purpose. You may, however, prefer that an external circuit be the judge. An external watchdog circuit checks the integrity of the microcontroller’s code, bringing the outputs to a safe state when it judges that the microcontroller’s firmware has gone awry. Conditions such as errant code or failed hardware can cause these issues.

You have many options for designing an interface between your external timer and the microcontroller. For example, you can use a port pin, which yields a flexible and adaptable way to couple with almost any microcontroller.

In applications that require energizing an output or series of outputs, you need an enable signal. You can use this enable signal to energize a relay providing power to an output device. Turning the enable signal into a watchdog signal is therefore a wash in terms of port-pin usage. The implementation of this watchdog circuit requires the output port pin to toggle, rather than stay at a constant state.

Most microcontroller code has a main loop that is always either performing a task or calling larger functions and interacting with interrupt-service routines. If an errant task, unforeseen bug, or unintentional vector executes, the main loop either gracefully reinitializes or becomes stuck indefinitely. Either situation breaks the execution of the main loop. When that situation occurs, the timer needs to remove power from your circuits.

You can implement the watchdog timer by toggling a port output whenever the main loop runs, provided that the main loop executes 10 to 100,000 times/sec. Figure 1 demonstrates this concept. You can implement this watchdog philosophy in several ways.


FIGURE 1


You must allow for variability in the rate of the toggle signal because extraneous interrupts and other nondeterministic events may cause variability in the main loop’s execution loop time. If the watchdog circuit is not sufficiently forgiving, it may lead to false triggers, defeating its purpose. The recovery time of the watchdog timer is the maximum time between toggling events in duration. This scenario can happen when the system is in a recovery, or “limphome,” mode. This circuit can accommodate the recovery duration, but, if it deems necessary, the recovery operation can disable the watchdog timer’s output. Listing 1 is a document containing sample code.

The circuit in Figure 2 uses two bipolar transistors. The second transistor is simply a relay driver. The circuit works by removing the dc component from the incoming toggling square wave, rectifying and creating an average dc value. This wave feeds transistor Q1, biased such that a prolonged absence of pulses turns it off, thus turning off Q2 and the relay. Changing the value of C2 also changes how quickly the watchdog timer reacts to an absence of pulses. The circuit accepts toggling frequencies of 10Hz to 100kHz.


FIGURE 2


Changing the value of capacitor C2 changes the range of compliance frequencies that the main loop generates. The circuit also functions with a 3.3V processor, but either the relay must have its own 5V supply or you must use a lower- voltage relay.

 
Printer-friendly version Email to a Friend
 
Article Rating 
Average Rate:
 
Poor Quite Good Good Very Good Excellent
 
 
ADVERTISEMENT
 
Related Content 
 
 
ON-DEMAND WEBCASTS


 
 
Highest Rated  
Feedback Loop  

ADS BY GOOGLE 
 
 
 
ADVERTISEMENT
Press Release 
 
TECHNOLOGY NEWS
 
 
 
PRODUCT NEWS
 
FEATURED SPONSORS
 
 
 
DESIGN CENTERS
 
ADVERTISEMENT
     
Reference Designs 
   
     
 
 
 
 

 

RSS
   
   
   
   
   
   
   
   
   
   
   
   
   
   
   
   
   
   
   
   
   

POLL
What type of environmental regulation do you think will be most beneficial for the tech industry?
Proper recycling and disposal
Push for power efficiency and energy conservation
Chemical/lead regulation
View results


 
     
 
Power Technology E-newsletter 
Power.org Releases Power Architecture 32-bit Application Binary Interface Supplement
EDNA, May 11
POL Regulators Designed for Energy-efficient Computing
EDNA, March 11
Fairchild Revolutionizes Power Savings
EDNA, January 11
Lattice Transforms Board Power and Digital Management
EDNA, November 10
 
Analog E-newsletter 
12V Dual-channel Synchronous Buck Converter Features Integrated FETs
EDNA, February 10
Power MOSFETs features reduced top-side thermal impedanc
EDNA, January 10
 
     
 
KNOWLEDGE CENTER
 
Texas Instruments: DaVinci™ Technology
 
Texas Instruments: Safe Bet Series
 
 
INDUSTRY LINKS
 
Photonics Association (Singapore)
Singapore Industrial Automation Association (SIAA)
Taiwan Semiconductor Industry Association (TSIA)
 
 
OUR SPONSORS
 






Keithley Instruments
With more than 60 years of measurement expertise, Keithley Instruments has become a world leader in advanced electrical test instruments and systems from DC to RF (radio frequency). Our products solve emerging measurement needs in production testing, process monitoring, product development, and research...
 
 
 
     
 

EDN India | EDN Taiwan | EDN Korea | EDN Japan | EDN China | EDN | EDN Europe

 
ABOUT EDN Asia | CONTACT US
   
© 2012 EDN Asia All rights reserved.