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
Hi guys,
I solved the problem.
It is in Errata. www.standardics.nxp.com/.../errata.lpc2138.pdf
WDT.1:Accessing non-Watchdog APB registers during the feed sequence causes a reset. Introduction:The Watchdog timer can reset the microcontroller within a reasonable amount of time if it enters an erroneous state. Problem:After writing 0xAA to WDFEED, any APB register access other than writing 0x55 to WDFEED may cause an immediate reset. Workaround:Avoid APB accesses in the middle of the feed sequence. This implies that interrupts and the GPDMA should be disabled while feeding the Watchdog.
So, I have to make sure no other task or task switching between 0xAA and 0x55 when feed to register:
tsk_lock (); WDFEED = 0xAA; WDFEED = 0x55; tsk_unlock ();