I'm able to make my LPC11u68 into deep sleep mode, but i cannot wake it up. Please help.
this is how I make it to sleep:
crntPowerSetting = PMU_MCU_DEEP_SLEEP;
ProcessPowerState(crntPowerSetting);
Before you go into deep sleep mode you need to prepare the potential wakeup sources. For example a GPIO pin, the WAKEUP pin (if there is one), the RTC etc. Otherwise how should a GPIO know that it is supposed to act as a wakeup pin?
Regards,
Bernhard.
This is what I did on the code. If I don’t do ProcessPowerState which puts MCU into sleep, I’m able to get the GPIO interrupt into PININT_IRQ_HANDLER. However, I cannot wake up the MCU.
#define GPIO_PININT_PIN 0
#define GPIO_PININT_PORT 1
#define GPIO_PININT_INDEX 0
#define PININT_IRQ_HANDLER PIN_INT0_IRQHandler
#define PININT_NVIC_NAME PIN_INT0_IRQn
void PININT_IRQ_HANDLER(void)
{
Chip_PININT_ClearIntStatus(LPC_PININT, PININTCH(GPIO_PININT_INDEX));
}
int main(void)
{
CHIP_PMU_MCUPOWER_T crntPowerSetting;
SystemCoreClockUpdate();
Board_Init();
SysTick_Config(SystemCoreClock / 10000 / 30);
Chip_IOCON_PinMuxSet(LPC_IOCON, GPIO_PININT_PORT, GPIO_PININT_PIN,
(IOCON_FUNC0 | IOCON_MODE_PULLUP | IOCON_CLKDIV(0) | IOCON_S_MODE(3)));
Chip_GPIO_SetPinDIRInput(LPC_GPIO, GPIO_PININT_PORT, GPIO_PININT_PIN);
Chip_Clock_EnablePeriphClock(SYSCTL_CLOCK_PINT);
Chip_SYSCTL_SetPinInterrupt(GPIO_PININT_INDEX, GPIO_PININT_PORT, GPIO_PININT_PIN);
Chip_PININT_ClearIntStatus(LPC_PININT, PININTCH(GPIO_PININT_INDEX));
Chip_PININT_SetPinModeEdge(LPC_PININT, PININTCH(GPIO_PININT_INDEX));
Chip_PININT_EnableIntLow(LPC_PININT, PININTCH(GPIO_PININT_INDEX));
NVIC_ClearPendingIRQ(PININT_NVIC_NAME);
NVIC_EnableIRQ(PININT_NVIC_NAME);
Chip_SYSCTL_EnablePeriphWakeup(SYSCTL_WAKEUP_GPIOINT1);
crntPowerSetting = PMU_MCU_DEEP_SLEEP;
while (1) {
ProcessPowerState(crntPowerSetting);
}
return 0;
}