It is running in normal mode. When watchdog times out, the mcu will freeze (application stopped running) instead of resetting.
Here is the modified sample code from lpcopen_3_02_lpcxpresso_mcb4357 (nohost):
#include "board.h"
static volatile int wdtFeedState;
static volatile bool On = false, On1 = false;
static void wdt_handle(void) {
uint32_t wdtStatus = Chip_WWDT_GetStatus(LPC_WWDT);
On = (bool) !On;
if (wdtStatus & WWDT_WDMOD_WDTOF) {
Chip_WWDT_ClearStatusFlag(LPC_WWDT, WWDT_WDMOD_WDTOF);
if (wdtFeedState == 2) {
Chip_WWDT_Start(LPC_WWDT);
}
}
if (wdtStatus & WWDT_WDMOD_WDINT) {
Chip_WWDT_ClearStatusFlag(LPC_WWDT, WWDT_WDMOD_WDINT);
if (wdtFeedState == 1) {
Chip_WWDT_Feed(LPC_WWDT);
}
}
}
void EVRT_IRQHandler(void)
{
On1 = !On1;
Chip_EVRT_ClrPendIntSrc(EVRT_SRC_WWDT);
wdt_handle();
}
void WDT_IRQHandler(void)
{
wdt_handle();
}
void SysTick_Handler(void)
{
if (wdtFeedState == 0) {
Chip_WWDT_Feed(LPC_WWDT);
}
On = (bool) !On;
}
int main(void)
{
uint8_t ch;
SystemCoreClockUpdate();
Board_Init();
wdtFeedState = 0;
Chip_WWDT_Init(LPC_WWDT);
Chip_EVRT_Init();
Chip_WWDT_SetTimeOut(LPC_WWDT, WDT_OSC / 10);
Chip_WWDT_SetWarning(LPC_WWDT, 512);
Chip_WWDT_SetWindow(LPC_WWDT, WDT_OSC - (WDT_OSC / 10));
Chip_WWDT_SetOption(LPC_WWDT, WWDT_WDMOD_WDRESET);
Chip_WWDT_ClearStatusFlag(LPC_WWDT, WWDT_WDMOD_WDTOF | WWDT_WDMOD_WDINT);
Chip_EVRT_ConfigIntSrcActiveType(EVRT_SRC_WWDT, EVRT_SRC_ACTIVE_RISING_EDGE);
Chip_EVRT_SetUpIntSrc(EVRT_SRC_WWDT, ENABLE);
Chip_WWDT_Start(LPC_WWDT);
SysTick_Config(Chip_Clock_GetRate(CLK_MX_MXCORE) / 20);
NVIC_EnableIRQ(WWDT_IRQn);
DEBUGOUT("Press '1' to enable watchdog feed on systick interrupt\n\r");
DEBUGOUT("Press '2' to enable watchdog feed on warning interrupt\n\r");
DEBUGOUT("Press '3' to disable watchdog feed (will reset device)\n\r");
DEBUGOUT("Press '4' to switch from WDT interrupt to event router handler\n\r");
CPU_LED_SEL;
STAT_LED_SEL;
RUN_LED_SEL;
CPU_LED_DIR;
STAT_LED_DIR;
RUN_LED_DIR;
#define DELAY_COUNT 208000000/4
unsigned long count1 = 0;
Board_LED_Set(0, true);
count1 = DELAY_COUNT;
while (count1--);
Board_LED_Set(0, false);
count1 = DELAY_COUNT;
while (count1--);
Board_LED_Set(0, true);
count1 = DELAY_COUNT;
while (count1--);
Board_LED_Set(0, false);
count1 = DELAY_COUNT;
while (count1--);
Board_LED_Set(0, true);
count1 = DELAY_COUNT;
while (count1--);
Board_LED_Set(0, false);
count1 = DELAY_COUNT;
while (count1--);
while (1) {
count1 = DELAY_COUNT/4;
do {
Board_LED_Set(0, On);
Board_LED_Set(1, On1);
} while (count1--);
wdtFeedState = 2;
do {
ch = (uint8_t) DEBUGIN();
Board_LED_Set(0, On);
Board_LED_Set(1, On1);
} while ((ch < '1') || (ch > '4'));
switch (ch) {
case '1':
default:
wdtFeedState = 0;
DEBUGOUT("Watchdog feed on systick interrupt\r\n");
break;
case '2':
wdtFeedState = 1;
DEBUGOUT("Watchdog feed on warning interrupt\r\n");
break;
case '3':
wdtFeedState = 2;
DEBUGOUT("No feeding - board will reset\r\n");
break;
case '4':
DEBUGOUT("using event router instead of WDT interrupt\r\n");
NVIC_DisableIRQ(WWDT_IRQn);
NVIC_EnableIRQ(EVENTROUTER_IRQn);
break;
}
}
}