lpcware

LPC1769 - Use WDT to Wake-up from Power-Down

Discussion created by lpcware Employee on Jun 15, 2016
Latest reply on Jun 15, 2016 by lpcware
Content originally posted in LPCWare by Scorpio on Wed Nov 12 00:46:36 MST 2014
Hello,

I am using LPCXpresso, LPC 1769. I am trying to wake up the device from Power-down mode, using the WDT. I would like to perform a reset upon wake-up.

I do the following to setup the WDT and put the device in power-down. LED should blink, then device should go to sleep, WDT overflows and a reset is performed. After the reset I should see the LED blink again.

void WDT_Enable( uint32_t timeout_ms )
{
// Internal RC osc.
LPC_WDT->WDCLKSEL = 0x00;
uint64_t wdt_clk = 4000000/ 4;
uint64_t wdtc = ( ( uint64_t )timeout_msec * wdt_clk ) / 1000;
LPC_WDT->WDTC = ( uint32_t )wdtc;
LPC_WDT->WDMOD = 0x03;
LPC_WDT->WDFEED = 0xAA;
LPC_WDT->WDFEED = 0x55;
}

void Power_Down_Mode_Set( void )
{

SCB->SCR = 0x4;
LPC_SC->PCON = 0x9;
__WFI();
}

int main( void )
{
Led2_init( );
Led2_Toggle( );
delay( 1000 );
Led2_Toggle( );
WDT_Enable( 2000 ); // 2 sec
Power_Down_Mode_Set( );

return 1;
}


The problem is that the device never comes out of Power-Down mode. If I use Sleep mode then the above code works correctly.

Any insights on this?

Regards

Outcomes