Forums

failure to wake up LPC2148 from power down mode

Started by manaskant 4 months ago4 replieslatest reply 4 months ago38 views
Hello Community,

I have been trying to implement the power down mode in LPC2148 controller. The problem is once it enters the power down mode, it is unable to wake-up due to external interrupt. This is the code I have written.....plz do tell me the problem in it.

#include <lpc214x.h>

volatile int f;

void delayMS(unsigned int msec)
{
unsigned int i,j;
for(i=0;i<msec;i++)
for(j=0;j<7500;j++);
}

__irq void EXT0_ISR()
{
f = 0;
PLL0CON = 0x01;
PLL0CFG = 0x24;
PLL0FEED = 0xAA;
PLL0FEED = 0x55;
while((PLL0STAT & 0x00000400)==0);
PLL0CON = 0x03;
PLL0FEED = 0xAA;
PLL0FEED = 0x55;
VPBDIV = 0x00000000;
EXTINT = 0x01;
VICVectAddr = 0x00000000;
}

int main()
{
int i = 0;
f = 0;
PINSEL0 = 0x0000000C;
IO0DIR = 1<<11;
IO0CLR = 1<<11;
EXTMODE = 0x01;
EXTPOLAR = 0x00;
EXTINT = 0x01;
INTWAKE = 0x0001;
VICVectAddr0 = (unsigned)EXT0_ISR;
VICVectCntl0 = (1<<5)|14;
VICIntSelect = 0x00000000;
VICIntEnable = 1<<14;
VPBDIV = 0x00000000;
while(1)
{
while(f==0)
{
for(i=0;i<4;i++)
{
IO0PIN ^= (1<<11);
delayMS(500);
}
f = 1;
}
PCONP = 0x00000000;
PCON = 0x02;
}
}

By the way, I have tested the idle mode and it runs perfectly and is able to wake up from interrupt.

Thanks and regards

MANASKANT MISHRA
Embedded Researcher
SMEC Labs, Bangalore,
Karnataka, India
[ - ]
Reply by KocsonyaMay 30, 2020

The power-down mode does not call the IRQ handler when it wakes up, in fact interrupts can be disabled both on the CPU and the VIC. You need to enable the wake up in INTWAKE, you must clear EINTx and write to PCON. When you wake the chip up with the external signal, it will simply continue after the PCON set instruction as if nothing happened, except that your PLL is disconnected and you run from the oscillator. But no interrupt is generated.

It is all spelled out in Chapter 4 (System control) of the user manual.


[ - ]
Reply by manaskantMay 31, 2020

So ur sayin that instead of using vic i shud set power down mode after intwake and extint registers?.....n btw i have enabled intwake and cleared eintx

[ - ]
Reply by KocsonyaMay 31, 2020

no wht m sayn iz that when the chip wakes up u shud set pll and pincon and pindir and all aftr PCON=2 instead of ISR cos thats where execution will continue after wakeup ..... btw can we plz use propr englsh i dont hav SMS on my computr keybrd


[ - ]
Reply by manaskantMay 31, 2020

Yeah I did that and it works....thanks.....n my bad....just got a habit of typing everything in short....oh n there's no need to re mux the pins after PCON....works fine without that too....just need to re initialize the PLL