Yahoo Groups archive

Lpc2000

Index last updated: 2026-04-28 23:31 UTC

Message

Re: Watch dog funnies again

2004-09-18 by lpc2100

This solution will cure problem only if an ISR is doing a write to 
the WD register space.

Tom

excerpt from the UM

Watchdog Feed Register (WDFEED - 0xE0000008)

Writing 0xAA followed by 0x55 to this register will reload the 
Watchdog timer to the WDTC value. This operation will also start
the Watchdog if it is enabled via the WDMOD register. Setting the 
WDEN bit in the WDMOD register is not sufficient to
enable the Watchdog. A valid feed sequence must first be completed 
before the Watchdog is capable of generating an interrupt/
reset. Until then, the Watchdog will ignore feed errors. 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. The interrupt/
reset will be generated during the second pclk following an incorrect 
access to a watchdog timer register during a feed sequence.


--- In lpc2000@yahoogroups.com, "Mark Butcher" <mjbcswitzerland@y...> 
wrote:
> Hi Owen
> 
> Chance your watchdog routine as follows:
> 
> void watchdogfeed(void){
>  __disable_interrupt();
>  WDFEED=0xAA;
>  WDFEED=0x55;
>  __enable_interrupt();
> }
> 
> This will almost certainly cure your problem. The reason is that the
> feed sequence should not be interrupted - if you read the data sheet
> carefully it is explained that an interrupted feed sequence will be
> interpreted as an error and the processor resets.
> 
> If you call the watchdog without protection more frequently the 
chance
> of an interrupt arriving between the two instructions increases and
> would explain your observations.
> 
> If this works you can buy me a beer one day.
> 
> Cheers
> 
> Mark Butcher
> 
> www.mjbc.ch
> 
> 
> 
> 
> --- In lpc2000@yahoogroups.com, Owen Mooney <ojm@s...> wrote:
> > Well - I am still having watch dog problems on the 2106 !!
> > 
> > I implimented the code as below. If I didn't call watchdogfeed I 
would
> > get a regular reset every 20 seconds (though I calculated it at 
about
> > 1/4 seconds with 14Mhz Xtal)
> > 
> > I modified the code to call watchdogfeed ever 20 micro seconds or 
so (in
> > my main loop) and the processor started resetting erratically 
every 10
> > seconds or so!
> > 
> > Calling watchdogfeed every second has stopped this and the 
processor
> > APPEARS to be operating properly. BUT !!! if calling watchdogfeed 
has a
> > 1 in 1000000 chance of resetting the processor, have I just 
reduced my
> > random resets to once per 10 days or so !
> > 
> > Does anyone have any knowlege of this?
> > 
> > Owen Mooney
> > 
> > 
> > void watchdogfeed(void){
> > WDFEED=0xAA;
> > WDFEED=0x55;
> > }
> > 
> > int main(void) {
> > 
> > ...
> > 
> > WDTC = 0x1000000;
> > WDMOD= 0x03;
> > WDFEED=0xAA;
> > WDFEED=0x55;
> > 
> > ...
> > 
> > }

Attachments

Move to quarantaine

This moves the raw source file on disk only. The archive index is not changed automatically, so you still need to run a manual refresh afterward.