Hi,
I am utilise Watchdog Timer to reset when something goes wrong, but I found that watchdog in LPC2138 is not reliable. Does any one has issue with Watchog Timer in LPC2138?
The following is my Setting at start of program:
WDTC = 0x01FFFFFF; // Setting Timer WDMOD = 0x03; // Reset and Interrupt WDFEED = 0xAA; // Sequence Feeding WDFEED = 0x55; // Sequence Feeding
Then every interval one second feed the watchdog as follow:
WDFEED = 0xAA; WDFEED = 0x55;
The problem is watchdog reset un-reliable. The following is the log: Ext,Last Reset:20 Feb 2009 10:36:43 WDT,Last Reset:20 Feb 2009 10:43:29 WDT,Last Reset:20 Feb 2009 10:48:47 WDT,Last Reset:20 Feb 2009 10:54:05 WDT,Last Reset:20 Feb 2009 10:59:23
Above log data is in my application that trace current situation. Ext is external reset just after down load program in device. WDT is reset because of Watchdog timer.
Is there any idea or errata note regarding watchdog timer?
Rudy
Best way to check for errata is if you download the errata document for your processor.
By the way - do you disable interrupts around the two feed assigns?
I see you did take a closer look at the documentation while I wrote my answer. But are you sure that it is enough to just block task switches? Shouldn't you disable the interrupts?
Hi Per Westermark,
Thankyou for your reply, I try to find errata in NXP website, but did not find it. But today after I post this question to forum, I tried again, and I found it.
If no bug in the device (LPC2138) do I need to disable interrupt before feeding the watchdog? (This question for my understanding) because in datasheet say:
Once 0xAA is written to the WDFEED register the next operation in the Watchdog register space should be a WRITE (0x55) to the WDFFED register otherwise the watchdog is triggered.
Is it mean only operation on "Watchdog register"?
Now the problem solved.
Thanks for reply. Rudy
You are correct, I have to disable all Interrupts because of bug in the device.
The following is the feeding register. So far no watchdog reset triggered. But this kind of test need days or weeks to find out either Ok or still have some issue.
void Feed_WatchDog(void) { unsigned int liCurrISR; if (!giResetNow) { tsk_lock (); liCurrISR = VICIntEnable; VICIntEnClr = liCurrISR; WDFEED = 0xAA; WDFEED = 0x55; VICIntEnable = liCurrISR; tsk_unlock (); } }
If you notice, I disable all isr after I lock task then return all isr values before unlock task.
Also, I have variable flag "giResetNow", if this variable is set, the feeding section never been served. And the watchdog will reset the device.
Is there any other better way to achive disable isr and reset the device?
You are correct, I have to disable all Interrupts because of bug in the device
The LPC2478 user manual says: Interrupts should be disabled during the feed sequence. An abort condition will occur if an interrupt happens during the feed sequence.
is it indeed a bug?