Watchdog?

cancel
Showing results for 
Search instead for 
Did you mean: 

Watchdog?

375 Views
lpcware
NXP Employee
NXP Employee
Content originally posted in LPCWare by IanB on Tue Jul 22 23:51:59 MST 2014
My project runs when connected to the LPClink, but won't run standalone when I disconnect the LPClink.

I'm guessing at a watchdog timer reset. Trouble is, I don't know where the watchdog reset is occurring.

What's the best way to find out?
Is there a better way that to watch the outputs on an oscilloscope?
Is there a way to switch on the watchdog whilst debugging?

Any suggestions gratefully received!

I don't need the watchdog (I only used the LPC1225 because the pins are arranged in a sensible order!)
I tried unsuccessfully to switch it off.

This paragraph (on the WDEN bit) puzzles me:

"The watchdog timer is running. The watchdog timer is automatically enabled
at reset without requiring a valid feed sequence. Any subsequent writes to
this bit require a valid feed sequence before the change can take effect."

Labels (1)
0 Kudos
6 Replies

177 Views
lpcware
NXP Employee
NXP Employee
Content originally posted in LPCWare by nxp_apps on Sun Aug 03 20:17:48 MST 2014
Hi,

Also, just for information purposes, I would like to add that there is also a SYSRESSTAT register which allows the user to check if the watchdog reset has occurred or not (bit 2 in the register).

Thanks.

nxp support
0 Kudos

177 Views
lpcware
NXP Employee
NXP Employee
Content originally posted in LPCWare by IanB on Fri Aug 01 07:31:36 MST 2014
Tried it and it works. Thanks.
0 Kudos

177 Views
lpcware
NXP Employee
NXP Employee
Content originally posted in LPCWare by IanB on Wed Jul 23 12:17:23 MST 2014
That makes sense of it.

"Any subsequent writes to this bit require a valid feed sequence before the change can take effect"

means that after changing MOD, the change doesn't take effect until after the next feed.

That's why I couldn't get it to work - I didn't do the FEED routine afterwards!

Thanks.
0 Kudos

177 Views
lpcware
NXP Employee
NXP Employee
Content originally posted in LPCWare by lpcxpresso-support on Wed Jul 23 06:40:00 MST 2014
IIRC you need to feed afterwards, not before. The LPC12xx startup code generated by LPCXpresso IDE contains a sample code sequence to disable the watchdog - a snippet of which is…


    typedef struct
    {
        volatile unsigned int MOD;  // Offset: 0x000 - Watchdog mode register
        unsigned int dummy;         // Offset: 0x004 - not used by startup code
        volatile unsigned int FEED; // Offset: 0x008 - Watchdog feed sequence register
    } cr_wdt_TypeDef;
    volatile cr_wdt_TypeDef * watchdog_temp = (cr_wdt_TypeDef *) WATCHDOG_BASE_ADDRESS;
    watchdog_temp->MOD = 0x0;// CMSIS: LPC_WDT->MOD = 0x00;
    watchdog_temp->FEED = 0xAA;// CMSIS: LPC_WDT->FEED = 0xAA;
    watchdog_temp->FEED = 0x55; // CMSIS: LPC_WDT->FEED = 0x55;


Regards,
LPCXpresso Support
0 Kudos

177 Views
lpcware
NXP Employee
NXP Employee
Content originally posted in LPCWare by IanB on Wed Jul 23 02:33:32 MST 2014
Thanks for that.

. . and if I want to disable the watchdog in the software, am I correct in thinking that what is it means by saying that "Any subsequent writes to this bit require a valid feed sequence before the change can take effect" is that I should do the feed sequence then reset bit 0 of MOD immediately afterwards:

LDR R3,=LPC_WDT_BASE   /* reset watchdog timer */
MOVS R2,#0xAA
STR R2,[R3,FEED]
MOVS R2,#0x55
STR R2,[R3,FEED]
LDR R2,[R3,MOD]
MOVS R1,#0b00000001
BICS R2,R2,R1
STR R2,[R3,MOD]
0 Kudos

177 Views
lpcware
NXP Employee
NXP Employee
Content originally posted in LPCWare by lpcxpresso-support on Wed Jul 23 00:46:42 MST 2014
The LPCXpresso IDE will disable the watchdog when you make a debug connection. Thus when your code is running outside of the debug environment, it either needs to feed the watchdog or disable it as well. I suggest that you start by reading:

http://www.lpcware.com/content/faq/lpcxpresso/lpc12-watchdog

Regards,
LPCXpresso Support
0 Kudos