Going to sleep/waking up in interrupt handler

Discussion created by lpcware Employee on Jun 15, 2016
Latest reply on Jun 15, 2016 by lpcware
Content originally posted in LPCWare by mhjerde on Wed Sep 19 01:51:01 MST 2012
I am trying to implement an on/off button on a LPC1752. It is a momentary button connected to P2.10. Each time the button is pressed I get an interrupt on EINT0. That is, if I comment out the two lines that puts the mcu in sleep mode. (LPC_SC->PCON = 0x00; __WFI(); below)

void EINT0_IRQHandler(void)
LPC_SC->EXTINT |= 0x1;  //clear the EINT0 flag

if ((LPC_SC->PCON & CLKPWR_PCON_SMFLAG) != 0){// mcu is in sleep mode
LPC_SC->PCON |= (CLKPWR_PCON_SMFLAG);// clear flag by writing
// waking up
} else {
// going to sleep
LPC_SC->PCON = 0x00;

If the mcu goes to sleep, I no longer get the interrupt.
Is the problem that the mcu can not re-enter the IRQ handler? If so, what is the best strategy? I should probably mention that the plan is to implement PowerDown, I just trying to get it working with Sleep Mode first...