LPC1224 Not coming out of Deep-Sleep

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

LPC1224 Not coming out of Deep-Sleep

540 Views
lpcware
NXP Employee
NXP Employee
Content originally posted in LPCWare by thunderBird on Fri Aug 03 20:23:54 MST 2012
Hello Everyone, I'm using a LPC1224 and have designed the hardware such that when there is a falling edge on PIO0_4, an interrupt is executed which puts the controller into Deep Sleep mode. I've configured the deep-sleep mode such that when the NEXT rising edge comes on PIO0_4 the controller should Wake Up. But this doesn't seem to be happening.

Following is the code which puts the controller into deep sleep...
<code>

//Choose Deep sleep mode
SCB->SCR |= ((1 << 2));

LPC_SYSCON->PDSLEEPCFG = 0x0000FFFF;
LPC_SYSCON->PDRUNCFG &= (~(0xFF));
LPC_SYSCON->INTNMI = 0x00000010;


//Next, we set up the Power Management Unit
LPC_PMU->PCON &= (~(1 << 1));//DPDEN = 0


//Set up the wake up
LPC_SYSCON->STARTAPRP0 |= (1 << 4);
LPC_SYSCON->STARTRSRP0CLR |= (1 << 4);
LPC_SYSCON->STARTERP0 |= (1 << 4);

LPC_SYSCON->STARTAPRP0 |= (1 << 10);
LPC_SYSCON->STARTRSRP0CLR |= (1 << 10);
LPC_SYSCON->STARTERP0 |= (1 << 10);

NVIC_EnableIRQ(WAKEUP4_IRQn);
NVIC_EnableIRQ(WAKEUP10_IRQn);

//We are done setting up the PMU

//Now we go to sleep!
__WFI();

</code>

Is there an issue in using the same IO for putting the controller into deep-sleep and then waking it as well?

Any kind of help/advice would be much appreciated!
Labels (1)
0 Kudos
2 Replies

463 Views
lpcware
NXP Employee
NXP Employee
Content originally posted in LPCWare by Daniel Widyanto on Mon Oct 08 21:50:50 MST 2012
You need to switch the MAINCLKSEL to IRC oscillator before going to deep sleep.

The PLL and system oscillator (the crystal oscillator) will be turned off during deep sleep. Hence, waking up from deep sleep using MAINCLKSEL = PLL or system osc is not possible.

0 Kudos

463 Views
lpcware
NXP Employee
NXP Employee
Content originally posted in LPCWare by thunderBird on Mon Aug 06 22:12:13 MST 2012
So after trying to get it to work, I've come to understand the following...
1.) When I use the "__WFI()" instruction, the controller does indeed go into sleep. How do I know this? As per the user manual, the outputs of the controller become static when the controller is in sleep/deep-sleep. That means that the level on outputs is maintained.
2.) When I use the "__WFI()" instruction to go to sleep/deep sleep, the "WAKEUP_IRQHandler" is not executed, when it should. In fact, I can not get the controller to wake up the way I want to, so I use the reset option.
3.) I tried using the "__WFE()" instruction instead of the "__WFI()" and that got me going somewhere. When I use the "__WFE()" instruction, the controller executes the "WAKEUP_IRQHandler" when I give it the input to wake up.

I haven't yet understood the ramifications of this. If it seems obvious to one of you, I would be grateful for that clarity.

Warm Regards,
Yash...
0 Kudos