Hi,
I am currently working on a project including the LPC11C24 board (in particular, we're testing using LPCXpresso LPC11C24 Rev B board) and I would like to implement deep-sleep mode.
I searched through Internet but I couldn't find some example code, so I tried to write something using the User Manual (UM10398) but I got some problems... In particular, the chip didn't wake up after the watchdog finished.
Here's the code:
void enter_sleep_state()
{
//TODO: comment out all instructions
LPC_PMU->PCON = 0x00000100;
LPC_SYSCTL->PDRUNCFG = 0x0000EDBC;
LPC_SYSCTL->MAINCLKSEL = 0x00000002;
LPC_SYSCTL->PDSLEEPCFG = 0x000018BF; //WDT on, BOD off
LPC_SYSCTL->PDWAKECFG = 0x0000ED48;
Chip_WWDT_Init(LPC_WWDT);
Chip_WWDT_SetTimeOut(LPC_WWDT, 100000); //Sets WDT timeout (ms?) TODO: check this out
NVIC_EnableIRQ(WDT_IRQn);
LPC_SYSCTL->SYSAHBCLKCTRL = 0x00008000 /*<< 1 ??*/;
SCB->SCR |= (1<<2);
__WFI();
}
After calling this mode I entered LPC_SYSCTL->MAINCLKSEL = 0x00000000 to set the main clock source back to normal.
Apparently there's something that I miss and I'd like to know.
Thank you in advance :smileywink:
P.S: I also noticed that the deep-sleep mode is not really available for lpc11c24, though it's present as an option in both the user manual and the datasheet. Why is that?