TL MICRO
  AUTOMATION

   GET IT WORKING!
HOME
DESIGN
PRODUCTS

ARTICLES
IOT DEVICES
DESIGN PKGS

CONTACT

HELP LINE

IOT

Article:Using An External Watchdog

Most microcontrollers available today come with built-in watchdog modules. So the first question that comes to mind is whether an external watchdog should be used at all.

The answer depends on the system being developed. If the system is controlling a critical process which cannot be stopped or suspended for much time then an external watchdog is recommended. This is because internal watchdog modules are dependant on internal reset mechanisms. In some cases watchdog action requires a watchdog ISR to execute and reset action depends on code being run within the ISR. Now both these mechanisms are prone to stop if the microcontroller hangs due to some reason. This is where an external watchdog comes into play.

Working:- An external watchdog circuit connects to the hardware reset circuit of the controller and not the internal reset. This means that moment the reset is activated controller will restart. Most external watchdogs require a signal input from the controller which prevents the reset action.As long as the controller sends this signal reset will not occur.The signal is usually a square wave type with fixed ON and OFF time.Both ON and OFF parts are required to stop resets.

While using an external watchdog it is important to be aware of the timing for the watchdog signal. This signal has to be periodically sent using any GPIO of the controller. The code for this signal can be within a function. While main code is being executed, the watchdog function has to be called at specific intervals to prevent reset. This sometimes gets tricky especially if many interrupts are being used. If a code segment is supposed to execute in say 10ms the arrival of many interrupts could extend its execution time to say 30ms. These cases have to be handled correctly.

While developing the hardware using external watchdog, make sure to have some arrangement which can disable it. This is required during the development phase. Otherwise external watchdog keeps resetting the system and code cannot be tested.

Never forget to tickle the dog!


TL Micro Automation - Electronic Products , Embedded Design Services , Consulting