Content originally posted in LPCWare by IanJames on Tue Jul 09 05:26:55 MST 2013
Hi,
I am trying to put an LPC1224 in to Deep Sleep mode and wake it with a falling edge on LPC_GPIO0_10. The input has an external 10k pull up on it and I know it works because I output LPC_GPIO->PIN to a UART when processor is awake.
The problem is not going to sleep but waking up.
Grounding LPC_GPIO0_10 does not wake it up - only a power cycle does.
Anyone know what I am doing wrong?
Thanks,
Ian
void GotoSleep(void)
{
LPC_IOCON->PIO0_10 &= ~0x07;
//Choose Deep sleep mode
SCB->SCR |= ((1 << 2));
LPC_SYSCON->PDSLEEPCFG = 0x0000FFFF;
LPC_SYSCON->PDRUNCFG &= (~(0xFF));
LPC_SYSCON->INTNMI = 0x00000010;// PIO0_10 SCL
// Set up the Power Management Unit
LPC_PMU->PCON &= ~(1 << 1); //DPDEN = 0
//Set up the wake up
LPC_SYSCON->STARTAPRP0 &= ~(1 << 10);// Falling edge
LPC_SYSCON->STARTRSRP0CLR |= (1 << 10);
LPC_SYSCON->STARTERP0 |= (1 << 10);
NVIC_EnableIRQ(WAKEUP10_IRQn);
LPC_SYSCON->PDAWAKECFG = ~(0x01 < 1) | ~(0x01 << 7);
LPC_SYSCON->MAINCLKSEL = 0x00; // IRC
LPC_SYSCON->MAINCLKUEN = 0x00; // effect the change
LPC_SYSCON->MAINCLKUEN = 0x01;
/* And so to sleep zzzzzzzzzzzz */
__WFI();
}
void WAKEUP_IRQHandler(void)
{
;
}