Content originally posted in LPCWare by dsw on Thu Dec 26 15:33:54 MST 2013
I’m having trouble getting the watchdog timer to start on the LPC4357.
I use the code:
void Main_Watchdog_Init(void)
{
LPC_WWDT->TC = 0xffff; //relatively small value for timeout.
LPC_WWDT->MOD = //See page 964 of LPC4357 spec
(1 << 1) //Watchdog timeout will cause a chip reset.
+(1 << 4);
LPC_WWDT->MOD = //See page 964 of LPC4357 spec
(1 << 0); //Enable watchdog timer.
Main_Watchdog_Feed(); //Feeding the watchdog once should start it.
LPC_WWDT->FEED = 0x01; //This should cause immediate reset.
LPC_WWDT->FEED = 0x02;
LPC_WWDT->FEED = 0x03;
}
///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
static __INLINE void Main_Watchdog_Feed(void)
{
LPC_WWDT->FEED = 0xAA;
LPC_WWDT->FEED = 0x55;
}
but the watchdog timer never starts decrementing, LPC_WWDT->TV never changes from its reset value of 0x000000FF.
Even though I never feed the watchdog again, I never get a reset.
Thru the debugger I can verify that LPC_WWDT->MOD = 0x00000013, which should be the correct value to enable it to run.
Can anyone think of something I’m missing?
Thanks