Watchdog Reset

cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

Watchdog Reset

2,028 Views
lpcware
NXP Employee
NXP Employee
Content originally posted in LPCWare by pcalton on Thu Nov 07 11:18:08 MST 2013
I have been trying to add the watchdog to my application to reset the processor if the software hangs using the following setup routine

#define MHz(x) (x * 1000000)

#define WDT_MAX_TIME 5000 // 5 seconds (Max 5592)
#define WDT_MIN_TIME 1 // 1 millisecond

void Board_WWDT_Init(void)
{
// Windowed watchdog runs from internal RC osc at 12MHz with fixed div by 4 prescale.
// 24 bit counter decremented from timeout value to zero (reset core at zero)
// feed resets counter to timeout value
// feed with counter above window value results in a core reset
const uint32_t wdt_count_per_ms = (MHz(12) / 4) / 1000;
const uint32_t wdt_timeout = WDT_MAX_TIME * wdt_count_per_ms;
const uint32_t wdt_window = (WDT_MAX_TIME - WDT_MIN_TIME) * wdt_count_per_ms;

Chip_WWDT_Init(LPC_WWDT);
Chip_WWDT_SetTimeOut(LPC_WWDT, wdt_timeout);
Chip_WWDT_SetOption(LPC_WWDT, WWDT_WDMOD_WDRESET);
Chip_WWDT_ClearStatusFlag(LPC_WWDT, WWDT_WDMOD_WDTOF | WWDT_WDMOD_WDINT);
Chip_WWDT_SetWindow(LPC_WWDT, wdt_window);
Chip_WWDT_Start(LPC_WWDT);
}


To test my setup I purposefully allowed the watchdog to expire, expecting the software to reset and restart. The software certainly stopped after 5 seconds, but didnt restart.

To check whether I had missed anything I loaded up the keil lpcopen peripheral example for the watchdog on a clean un-modded MCB4357 board

That application allows interaction via usart3 with the option to disable the feed and reset the device. When I selected this option the flashing led that indicated program life stopped and then to my surprise the LCD lit up showing MCB4300 Demo Example.

If I press the external reset button, the watchdog example starts again and runs until I select the option to disable feeding at which point the MCB4300 Demo Example appears. I can only assume that following the watchdog reset the processor is booting out of external memory even though there is a valid application in the internal flash.

Could someone please explain what is happening and how to rectify it so that the internal flash application starts following a watchdog reset?
Labels (1)
0 Kudos
Reply
2 Replies

1,763 Views
lpcware
NXP Employee
NXP Employee
Content originally posted in LPCWare by pcalton on Wed Nov 20 11:14:39 MST 2013
For anyone facing a similar problem, I managed to get the following response from NXP support


Quote:
That looks like an issue with the MCB4350 board.
Remove C97 (in parallel to the ISP pushbutton).

When populated, C97 charges to a level which depends on A9 address line activity.
After a watchdog reset, the device almost immediately checks P2_7 (=A9). If low, the device boots depending on the four boot switches on the board. These may well be in the position to boot the demo code from external memory.



Removing C97 fixed my problem
0 Kudos
Reply

1,763 Views
lpcware
NXP Employee
NXP Employee
Content originally posted in LPCWare by pcalton on Wed Nov 13 11:20:10 MST 2013
Is anyone able to provide any feedback on this please?
0 Kudos
Reply