I'm working on a project using the LCPXpresso LPC11C24 Board Rev B with LPC-Link and I need to implement Deep Sleep mode for low power consumption usage. I'm also using MCUXpresso 10.2.1.
I followed the CMSIS example code regarding the PMU and I've a bit adapted it to my setup (it wakes up with pin 0.2), and apparently the chip CAN go to Deep Sleep (I stressed the "can" because I'm not entirely sure, as there's no debug option available) but when it wakes up it gets stuck in IntDefaultHandler().
I followed the example code and the WAKEUP_IRQ handler as explained, but there must be something I missed.
Here's the code:
LPC_SYSCTL->SYSAHBCLKCTRL |= (1<<6);
LPC_SYSCTL->STARTAPRP0 = 0x00000000; //SET FALLING EDGE on INTR pins
LPC_SYSCTL->STARTRSRP0CLR = 0x344;
LPC_SYSCTL->STARTERP0 = 0x344;
LPC_SYSCTL->STARTSRP0 = 0x344;
LPC_PMU->PCON = 0x00000000;
LPC_SYSCTL->PDRUNCFG &= ~ ((1<<0) | (1<<1) | (1<<2));
LPC_SYSCTL->MAINCLKSEL = 0x0;
LPC_SYSCTL->MAINCLKUEN = 0x0;
LPC_SYSCTL->MAINCLKUEN = 0x1;
while (!(LPC_SYSCTL->MAINCLKUEN & 0x01));
LPC_SYSCTL->PDSLEEPCFG = 0x000018F7; //WDT off, BOD off
LPC_SYSCTL->PDWAKECFG = LPC_SYSCTL->PDRUNCFG;
//DEEP SLEEP mode
SCB->SCR |= 0x04;
reg = LPC_SYSCTL->STARTSRP0;
if (reg != 0) LPC_SYSCTL->STARTRSRP0CLR = reg;
When it enters Deep Sleep mode, the debugger on MCUXpresso says (as expected) that there's no connection to the target, and this happens until I connect pin 0.2 to GND (as interrupt is on falling edge).
When I then suspend the code execution, it gets stuck in the line right after __WFI() and it says <signal handler called>() at 0xfffffff9.
Any suggestion or help will be really appreciated.
Thank you in advance!