Hi
I am trying to wake up an LPC1768 using a GPIO IRQ from Deep sleep. Now it works but only using WDT and it resets the MCU. Also need help with what should I do the program to be resumed when IRQ is detected and not reset.
When I try to use a GPIO intrerupt it does not even reset it.
PINSEL_CFG_Type PinCfg;
PinCfg.Funcnum = 1;
PinCfg.OpenDrain = 0;
PinCfg.Pinmode = PINSEL_PINMODE_PULLUP;
PinCfg.Portnum = 2;
PinCfg.Pinnum = 10;
PINSEL_ConfigPin(&PinCfg);
NVIC_SetPriority(EINT0_IRQn, 0);
NVIC_ClearPendingIRQ(EINT0_IRQn);
LPC_PINCON->PINSEL4 |= (0x01 << 20); // function: EINT0
LPC_SC->EXTMODE |= ~(1 << 0); // Edge sensitive
//LPC_SC->EXTPOLAR &= ~(1 << 0); // falling-edge sensitive
LPC_SC->EXTPOLAR &= 1 << 0; // falling-edge sensitive
LPC_SC->EXTINT = (1 << 0); // clear flag
NVIC_EnableIRQ(EINT0_IRQn);
//---------- Disable and disconnect the main PLL0 before enter into Deep-Sleep
// or Power-Down mode <according to errata.lpc1768-16.March.2010> ------------
LPC_SC->PLL1CON = 2; // Turn off the main PLL (PLL0)
LPC_SC->PLL1FEED = 0xAA; // Feed
LPC_SC->PLL1FEED = 0x55; // Feed
while ((LPC_SC->PLL1STAT & (1<<9)) == 0); // Check connect bit status
LPC_SC->PLL0CON &= ~(1<<1); // Disconnect the main PLL (PLL0)
LPC_SC->PLL0FEED = 0xAA; // Feed
LPC_SC->PLL0FEED = 0x55; // Feed
while ((LPC_SC->PLL0STAT & (1<<25)) != 0x00); // Wait for main PLL (PLL0) to disconnect
LPC_SC->PLL0CON &= ~(1<<0); // Turn off the main PLL (PLL0)
LPC_SC->PLL0FEED = 0xAA; // Feed
LPC_SC->PLL0FEED = 0x55; // Feed
while ((LPC_SC->PLL0STAT & (1<<24)) != 0x00); // Wait for main PLL (PLL0) to shut down
//------------Then enter into PowerDown mode ----------------------------------
CLKPWR_DeepSleep();
void EINT0_IRQHandler(void)
{
NVIC_SystemReset();
}
解決済! 解決策の投稿を見る。
Thanks for reply. I found the problem after all. I was just need to disconnect debuger and make a power cycle. I was confused because watch dog wake up reset was working with debuger connected. Anyway GPIO wake up and continue the code was not working with debuger connected even after a power cycle. I think this was is not so clear explained in datasheet even now when I read it says something about this.
Thanks for reply. I found the problem after all. I was just need to disconnect debuger and make a power cycle. I was confused because watch dog wake up reset was working with debuger connected. Anyway GPIO wake up and continue the code was not working with debuger connected even after a power cycle. I think this was is not so clear explained in datasheet even now when I read it says something about this.
Hello @laurianussss
How about testing the low - power demo under LPCopen on your side first?
It uses timer as wake up source.
BR
Alice