I am trying to implement the WWDT function in the LPC4357, Watchdog Register is configured successful, watchdog reset can performed when not feed. The can always reset , but as this run about 2 hours, the watchdog can't reset?
void WatchDogStart( uint32 Xms )
{
WDTC = (12000000*Xms)/(1000*4); // Xms=5000, 5s reset
WDWARNINT = 32;
WDMOD = WDEN|WDRESET|WDINT;
WDFEED = 0xAA; /* Feeding sequence */
WDFEED = 0x55;
NVIC_EnableIRQ(WWDT_IRQn);
return;
}
Regards,
Haibin Xiao
Hello haibin xiao ,
Sorry I was wondering what's he meaning of "but as this run about 2 hours, the watchdog can't reset?".
Do you mean Watchdog work well only in 2 hours, after that, it can' work well ? Could you please tell me detail
about this case, also show the more code about how to use Wtachdog .
And there is a demo code about Watchdog under LPCOpen, you can download it and have a look:
LPCOpen Software for LPC43XX|NXP
Hope it helps,
Have a great day,
TIC
-----------------------------------------------------------------------------------------------------------------------
Note: If this post answers your question, please click the Correct Answer button. Thank you!
-----------------------------------------------------------------------------------------------------------------------
Thanks, I mean Watchdog work well only in 2 hours, after that, it can' work well.
void WatchDogStart( uint32 Xms )
{
WDTC = (12000000*Xms)/(1000*4); // Xms=5000, 5s reset
WDWARNINT = 32;
WDMOD = WDEN|WDRESET|WDINT;
WDFEED = 0xAA; /* Feeding sequence */
WDFEED = 0x55;
NVIC_EnableIRQ(WWDT_IRQn);
return;
}
void WatchDogClear( void )
{
__disable_irq();
WDFEED = 0xAA; /* Feeding sequence */
WDFEED = 0x55;
__enable_irq();
return;
}
int main(void)
{
uint32 i = 0;
CGU_Init();
WatchDogStart(5000);
Timer0Initialize();
SetDefaultUart1();
Init_LED();
HC595SendData(0xff);
DelayMS(500);
while(1)
{
for(i=0;i<8;i++)
{
HC595SendData(~(0x1<<i));
DelayMS(500);
}
HC595SendData(0xFF);
//WatchDogClear();
}
return 0;
}
it can reset in 2 hours, after that, it can‘t work well.
Regards,
Haibin Xiao
If it is always the same period of 2 hours, then the system runs into a kind of boundary. This could be a maximum counter value (for example you defined a variable as "int", but still continue to increment the value when reaching the maximum.
It could also be a memory leak, for example an overflow of the heap, which takes effect after a specific time.
You should implement some debug code in the loop, just make some checks whether the watchdog is (still) enabled. Also give it a try without the watchdog interrupt.
Regards,
Bernhard.
Thank you!