LPC1225 and watchdog settings

For the last few weeks I only played with my LPC1225 board connected to the debugger and was working fine. When I tried to play with it not connected the board keep reseting itself after a short period. After some research I realised that this is caused by the watchdog, which is activated by default. Strange since when I created the project I choose to disable the watchdog…

Anyway, tried to “disable it” by setting the MOD register, WDEN bit to “0”:

lpc1225 MOD WDEN

However, even so I could not make it work. The easy way to go around it is to set up the watchdog and “feed” it before it time out. First initialize the watchdog and its clock during board initialisation part:


	LPC_SYSCON->WDTOSCCTRL = 0x003F;	// 001 11111 ~8kHz
	LPC_SYSCON->SYSAHBCLKCTRL |= (1<<15);	// Enable clock to WDT
 	LPC_SYSCON->PDRUNCFG &= ~(0x1<<6);	// ensure watchdog is powered
 	LPC_WWDT->CLKSEL = 0x01;		// Watchdog Oscillator as source 0001
	LPC_WWDT->WARNINT = 0x00;		// Interrupt warning value
	NVIC_EnableIRQ(WDT_IRQn);		// Enable the interrupt
	LPC_WWDT->TC = 0xFF;			// once WDEN is set, the
	LPC_WWDT->MOD = 0x0001;			// start in Chip Reset Mode
	LPC_WWDT->FEED = 0xAA;			// Feeding sequence
	LPC_WWDT->FEED = 0x55;

Send the WDT feed sequence every time when a WDT interrupt occur:

void WDT_IRQHandler(void){
	LPC_WWDT->FEED = 0xAA;			// Feeding sequence
	LPC_WWDT->FEED = 0x55;


Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Google+ photo

You are commenting using your Google+ account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )


Connecting to %s