Electronics > Microcontrollers
WatchDog patting techniques.
(1/1)
firewalker:
Is it "bad" to pat the dog from a timer interrupt routine?
Alexander.
Rudolfo:
Hello Alexander,
the micro should receive an interrupt from an external independent watchdog (like a monoflop), if it can't restart the watchdog before the timeout is reached. Thus the micro must run a restart software routine triggered by an internal timer. Sometimes there is a second watchdog which resets the micro if the interrupt did not start the routine.
Enjoy the day
Rufus:
--- Quote from: firewalker on December 15, 2011, 08:55:52 pm ---Is it "bad" to pat the dog from a timer interrupt routine?
--- End quote ---
If that is all you do then yes it is bad because the foreground code could hang without causing a watchdog time out.
A simple solution is to maintain a counter in the timer interrupt which counts down to zero and re-trigger the watchdog only while the counter is non-zero. Foreground code can regularly set the count to some appropriate value. You can extend the idea with multiple counters which can ensure different sections of foreground code and even other interrupt handlers run regularly.
ejeffrey:
Unless your entire program runs from the interrupt routine putting the watchdog reset there is probably not very helpful.
Navigation
[0] Message Index
Go to full version