Why use watchdog variable timer

Most of embedded microcontrollers contain watchdog timer. Watchdog variable timer is literally a „watchdog“. Watchdog timer continuously inspects the program float. Basically if microcontroller program hangs, then watchdog timer resets it and brings embedded system back to life.

The idea is very simple. Lets say, you know, that your program has to be executed during 20ms. And you know that worst case scenario is 30ms. Then you set watchdog variable timer connected to highest priority interrupt – RESET. Once Watchdog timer is triggered, timer counts up to time you set and then it resets the MCU. The only way to avoid reseting is to send command to watchdog timer to start counting over. Technically watchdog variable timer is nothing more that retriggerable one shot multivibrator.

The use of watchdog timer may be various. The one mentioned above is like a program execution loop. Once all procedures are performed, the MCU resets and starts over. Another more valuable and mostly used is for system reset if code failure occur. You may set some flags indicating was procedure successful or not. If not, than you can fire watchdog timer to restart MCU and start over.

wdt.PNG

The only problem with watchdog timer is that it runs independently of the res of the system. It makes problems with debugging because you may suspend system while debugging and then watchdog timer runs out and resets embedded system. But you can always enable or disable the watchdog timer. It is internal it can be done in software, if watchdog timer is external, than the easiest way to do this to put a jumper that breaks the connection between watchdog timer and reset circuit.

Watchdog timer plays important part in RTOS systems. Usually the main task (high priority task) checks the sanity of program float. And if check fails the watchdog timer is triggered to reset the MCU.

Blogsphere: TechnoratiFeedsterBloglines
Bookmark: Del.icio.usSpurlFurlSimpyBlinkDigg
RSS feed for comments on this post
 |  TrackBack URI for this post

New on WinAVR Tutorial
Running TX433 and RX433 RF modules with AVR microcontrollers,
Sometimes in embedded design you may want to go wireless. Might be you will want to log various readi …
Programming AVR ADC module with WinAVR,
Most of AVR microcontrollers have Analog to Digital Converter (ADC) integrated in to chip. Such solut …
New on WinARM Tutorial
What are differences between WinARM and WinAVR,
Everyone who is working with AVR microcontrollers knows this powerful tool – WinAVR (http://win …
LPC2000 watchdog timer,
As in all microcontrollers watchdog timers purpose isto reset microcontroller after reasonable amount …

Leave a Reply