EmbeddedRelated.com
Forums

lpc2129 external interrupt 1 rising edge not working

Started by Sandhya P C January 5, 2012
Hi,

I am trying to interface a PIR sensor to LPC2129. below is how I have
configured the interrupt:

//
void ext(void) __irq //P0.3 as external interrupt 1
{

CMDWRT(0x01);
LCD_DATA_WR("OBJECT DETECTED");
motor_stop();
EXTINT=0X02; //clear interrupt flag
VICVectAddr = 0x00000000;
VICIntEnable |= 0x00008000;
}
// in main program
PINSEL0|=0X000000C0; // PINSEL0<7:0>
EXTPOLAR=0x00; // falling edge sensitive
EXTMODE=0x02; //edge sensitive
VICIntEnable = 0x00008000;
VICVectCntl10 = 0x0000002F;
VICVectAddr10=(unsigned)ext;

This is working fine and executing ISR when falling edge occurs on P0.3

But since the sensor output is high, I would like it to execute ISR on
rising edge. So I changed the setting of EXTPOLAR to =0x02; // rising edge
sensitive

But its not working. I cant find out any configurations that i have missed
out. Read the errata on VPBDIV and EINT1, and tried the below code:

unsigned char vpb;
vpb = VPBDIV ;
VPBDIV = 0x00;
EXTPOLAR=0x02; // falling edge sensitive
EXTMODE=0x02;
VPBDIV = vpb;

This also doesnt work.

Can someone please help?

Thanks. --
Regards,
Sandhya.

--
Thanks and Regards,
Sandhya P C


An Engineer's Guide to the LPC2100 Series

I didn't read your code, but early revs of LPC21xx lacked the edge-triggered pin interrupt capability. The LPC2106/00 is an example.
This is in NXP's errata docs.

Hi,
>
>I am trying to interface a PIR sensor to LPC2129. below is how I have
>configured the interrupt:
>
>//
>void ext(void) __irq //P0.3 as external interrupt 1
>{
>
>CMDWRT(0x01);
>LCD_DATA_WR("OBJECT DETECTED");
>motor_stop();
>EXTINT=0X02; //clear interrupt flag
>VICVectAddr = 0x00000000;
>VICIntEnable |= 0x00008000;
>}
>// in main program
>PINSEL0|=0X000000C0; // PINSEL0
>EXTPOLAR=0x00; // falling edge sensitive
>EXTMODE=0x02; //edge sensitive
>VICIntEnable = 0x00008000;
>VICVectCntl10 = 0x0000002F;
>VICVectAddr10=(unsigned)ext;
>
>This is working fine and executing ISR when falling edge occurs on P0.3
>
>But since the sensor output is high, I would like it to execute ISR on
>rising edge. So I changed the setting of EXTPOLAR to =0x02; // rising edge
>sensitive
>
>But its not working. I cant find out any configurations that i have missed
>out. Read the errata on VPBDIV and EINT1, and tried the below code:
>
>unsigned char vpb;
>vpb = VPBDIV ;
>VPBDIV = 0x00;
>EXTPOLAR=0x02; // falling edge sensitive
>EXTMODE=0x02;
>VPBDIV = vpb;
>
>This also doesnt work.
>
>Can someone please help?
>
>Thanks. --
>Regards,
>Sandhya.
>
>--
>Thanks and Regards,
>Sandhya P C
>
>
>
The description of the CORTEX about level and edge interrupt is requires
careful interpretation because what it actually say there is not likely to
achieve what you achieve!

This section need rewrite and further clarification in my view, after all it
is datasheet rather than programmer guide.

Hope this help.

Riscy

====================================
I'd pretend I was one of those deaf-mutes. Or should I?

From: l... [mailto:l...] On Behalf Of
c...@gmail.com
Sent: Friday, January 06, 2012 6:13 AM
To: l...
Subject: [lpc2000] Re: lpc2129 external interrupt 1 rising edge not working

I didn't read your code, but early revs of LPC21xx lacked the edge-triggered
pin interrupt capability. The LPC2106/00 is an example.
This is in NXP's errata docs.

Hi,
>
>I am trying to interface a PIR sensor to LPC2129. below is how I have
>configured the interrupt:
>
>//
>void ext(void) __irq //P0.3 as external interrupt 1
>{
>
>CMDWRT(0x01);
>LCD_DATA_WR("OBJECT DETECTED");
>motor_stop();
>EXTINT=0X02; //clear interrupt flag
>VICVectAddr = 0x00000000;
>VICIntEnable |= 0x00008000;
>}
>// in main program
>PINSEL0|=0X000000C0; // PINSEL0
>EXTPOLAR=0x00; // falling edge sensitive
>EXTMODE=0x02; //edge sensitive
>VICIntEnable = 0x00008000;
>VICVectCntl10 = 0x0000002F;
>VICVectAddr10=(unsigned)ext;
>
>This is working fine and executing ISR when falling edge occurs on P0.3
>
>But since the sensor output is high, I would like it to execute ISR on
>rising edge. So I changed the setting of EXTPOLAR to =0x02; // rising edge
>sensitive
>
>But its not working. I cant find out any configurations that i have missed
>out. Read the errata on VPBDIV and EINT1, and tried the below code:
>
>unsigned char vpb;
>vpb = VPBDIV ;
>VPBDIV = 0x00;
>EXTPOLAR=0x02; // falling edge sensitive
>EXTMODE=0x02;
>VPBDIV = vpb;
>
>This also doesnt work.
>
>Can someone please help?
>
>Thanks. --
>Regards,
>Sandhya.
>
>--
>Thanks and Regards,
>Sandhya P C
>
>
>