I am using the LPC11C24 board OM13093 to test the deep-sleep mode.
According to the manual of LPC11xx and the application note AN11027, I set three pins (p0.6, p0.11, p1.0) connect the start logic. But the chip couldn't wake up when I triggered the pins. I tried to set the main clock to the IRC and WDTOSC, but both didn't work. I didn't go into the Wakeup_IRQhandler ever when I set 'SCB->SCR |= (1<<2); '(let the chip be deep-sleep). But when I comment this line, I can enter the wakeup_IRQHandler.
Please help me find the reasons if you have experience with this problem.
Thanks in advance.
There are related configurations:
//Deep-Sleep according to the manual UM10398 3.9.3.2
//1 SET PMU PCON register to 0
Chip_PMU_SleepState(LPC_PMU);
//2 BOD is powered down but WTD is powered up
Chip_SYSCTL_SetDeepSleepPD(SYSCTL_DEEPSLP_BOD_PD);
//LPC_SYSCTL->PDSLEEPCFG = 0x000018BF;
//2 WTD oscillator is powered up
Chip_SYSCTL_PowerUp(SYSCTL_POWERDOWN_IRC_PD);
Chip_SYSCTL_PowerUp(SYSCTL_POWERDOWN_IRCOUT_PD);
Chip_SYSCTL_PowerUp(SYSCTL_POWERDOWN_WDTOSC_PD);
Chip_Clock_SetWDTOSC(WDTLFO_OSC_0_60, 20);
// switch the clock source
//Chip_Clock_SetMainClockSource(SYSCTL_MAINCLKSRC_WDTOSC);
Chip_Clock_SetMainClockSource(SYSCTL_MAINCLKSRC_IRC);
//select the power configuration after wakeup
Chip_SYSCTL_SetWakeup(SYSCTL_SLPWAKE_IRC_PD|SYSCTL_SLPWAKE_IRCOUT_PD|SYSCTL_SLPWAKE_FLASH_PD|SYSCTL_SLPWAKE_SYSPLL_PD|SYSCTL_SLPWAKE_WDTOSC_PD);
// Disable all peripherals except WDT
Chip_Clock_DisablePeriphClock(SYSCTL_CLOCK_I2C); //!< 5: I2C clock, not on LPC110x
Chip_Clock_DisablePeriphClock(SYSCTL_CLOCK_CT16B0); //!< 7: 16-bit Counter/timer 0 clock
Chip_Clock_DisablePeriphClock(SYSCTL_CLOCK_CT16B1); //!< 8: 16-bit Counter/timer 1 clock
Chip_Clock_DisablePeriphClock(SYSCTL_CLOCK_CT32B0); //!< 9: 32-bit Counter/timer 0 clock
Chip_Clock_DisablePeriphClock(SYSCTL_CLOCK_CT32B1); //!< 10: 32-bit Counter/timer 1 clock
Chip_Clock_DisablePeriphClock(SYSCTL_CLOCK_SSP0); //!< 11: SSP0 clock
Chip_Clock_DisablePeriphClock(SYSCTL_CLOCK_UART0); //!< 12: UART0 clock
Chip_Clock_DisablePeriphClock(SYSCTL_CLOCK_ADC); //!< 13: ADC clock
Chip_Clock_DisablePeriphClock(SYSCTL_CLOCK_CAN); //!< 17: CAN clock, LPC11Cxx only
Chip_Clock_DisablePeriphClock(SYSCTL_CLOCK_SSP1); //!< 18: SSP1 clock, LPC11A/C/E/Uxx//1125 only
/*set external pins for wakeup*/
Chip_SYSCTL_SetStartPin(PIO1_0_WKUP, EDGE_FALL);
Chip_SYSCTL_ResetStartPin(PIO1_0_WKUP);
Chip_SYSCTL_EnableStartPin(PIO1_0_WKUP);
Chip_SYSCTL_SetStartPin(PIO0_6_WKUP, EDGE_FALL);
Chip_SYSCTL_ResetStartPin(PIO0_6_WKUP);
Chip_SYSCTL_EnableStartPin(PIO0_6_WKUP);
Chip_SYSCTL_SetStartPin(PIO0_11_WKUP, EDGE_FALL);
Chip_SYSCTL_ResetStartPin(PIO0_11_WKUP);
Chip_SYSCTL_EnableStartPin(PIO0_11_WKUP);
NVIC_ClearPendingIRQ(PIO1_0_IRQn);
NVIC_EnableIRQ(PIO1_0_IRQn);
NVIC_ClearPendingIRQ(PIO0_6_IRQn);
NVIC_EnableIRQ(PIO0_6_IRQn);
NVIC_ClearPendingIRQ(PIO0_11_IRQn);
NVIC_EnableIRQ(PIO0_11_IRQn);
// Specify Deep Sleep mode before entering mode
SCB->SCR |= (1<<2); //Set SLEEPDEEP bit
__WFI();
void WAKEUP_IRQHandler(void){
Board_LED_Toggle(1);
Chip_SYSCTL_ResetStartPin(PIO1_0_WKUP);
Chip_SYSCTL_ResetStartPin(PIO0_6_WKUP);
Chip_SYSCTL_ResetStartPin(PIO0_11_WKUP);
}