LPC1768 wake up from DeepSleep using a GPIO IRQ

取消
显示结果 
显示  仅  | 搜索替代 
您的意思是: 
已解决

LPC1768 wake up from DeepSleep using a GPIO IRQ

跳至解决方案
643 次查看
laurianussss
Contributor II

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();
}

 

 

标签 (2)
0 项奖励
回复
1 解答
596 次查看
laurianussss
Contributor II

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.

在原帖中查看解决方案

0 项奖励
回复
2 回复数
597 次查看
laurianussss
Contributor II

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.

0 项奖励
回复
606 次查看
Alice_Yang
NXP TechSupport
NXP TechSupport

Hello @laurianussss 

How about testing the low - power demo under LPCopen on your side first?

 

88889999.jpg

It uses timer as wake up source.

 

BR

Alice

0 项奖励
回复