Do not over-feed the Watchdog (?)
2006-04-03 by Danish Ali
Can someone point me to a definitive / application reference for the Watchdog circuit used in the LPC2xxx - )one that is better than the user manual for LPC2292) I recently started trying to use the watchdog in the LPC2292. Knowing no better, I decided to feed the watchdog once every time I went round my event loop. I was careful to disable* interrupts before writing 0xAA and 0x55 to WDFEED, and then re-enable the interrupts afterwards. But I could not get the watchdog to behave - it would cause interrupts no matter what (long) duration I set for the period (for debugging I did not enable the reset, and I placed a breakpoint in a Watchdog interrupt routine). Typical periods I tried were around 1 to 10 seconds, with the PCLK at 60 MHz. *using the macros provided in Crossworks. Note also that my spurious interrupt routine merely writes to VICVectAddr and returns. But if I placed a breakpoint in my event loop, and (from the debugger) said "continue" before the watchdog timed out, the watchdog would not interrupt. My main event loop is pretty tight - it mostly looks to see if data have arrived in buffers (put there by peripheral interrupt-service-routines). Only when enough data are available will time-consuming calculations be performed. Seeing that the system did work if I placed a manual delay between watchdog feeds, I tried only feeding the watchdog once every keyboard scan (polled from a timer flag in the event loop, no faster than once every ten milliseconds). This seemed to work fine, and continues to work now I have enabled the watchdog reset. And the watchdog does cause a reset if I deliberately enter an endless loop. Does this fit with the experience of others? What constitutes over-feeding of the watchdog? Is it documented anywhere? (It is possible that I do not understand what is going on). I invite comments. Regards, Danish