EmbeddedRelated.com
Forums
The 2024 Embedded Online Conference

Configure Port2 pin as an interrupt

Started by ninan April 3, 2009
Hi,

I'm using  LPC2378 for my current project. I want to configure Port2.7 Pin
as an interrupt. I have already used up all the 3 External
Interrupts(EXINT0,EXTIN1,EXINT2). It been said tat EXTINT3 Pin can be
configured as an interrupt for a GPIO Pin, which i am not clear with. 

Please help me in this regard,

Ninan,
India


On Fri, 03 Apr 2009 05:32:18 -0500, "ninan" <arunninank@gmail.com>
wrote:

>Hi, > >I'm using LPC2378 for my current project. I want to configure Port2.7 Pin >as an interrupt. I have already used up all the 3 External >Interrupts(EXINT0,EXTIN1,EXINT2). It been said tat EXTINT3 Pin can be >configured as an interrupt for a GPIO Pin, which i am not clear with.
EINT3 is bound to P2.13. However, you can setup a "GPIO interrupt" for pins on P0 and P2. -- Rich Webb Norfolk, VA
>On Fri, 03 Apr 2009 05:32:18 -0500, "ninan" <arunninank@gmail.com> >wrote: > >>Hi, >> >>I'm using LPC2378 for my current project. I want to configure Port2.7
Pin
>>as an interrupt. I have already used up all the 3 External >>Interrupts(EXINT0,EXTIN1,EXINT2). It been said tat EXTINT3 Pin can be >>configured as an interrupt for a GPIO Pin, which i am not clear with. > >EINT3 is bound to P2.13. However, you can setup a "GPIO interrupt" for >pins on P0 and P2. > >-- >Rich Webb Norfolk, VA >
Could u please let me know how to setup "GPIO interrupt" for
>pins on P0 and P2.
On Sat, 04 Apr 2009 04:18:47 -0500, "ninan" <arunninank@gmail.com>
wrote:

>>On Fri, 03 Apr 2009 05:32:18 -0500, "ninan" <arunninank@gmail.com> >>wrote: >> >>>Hi, >>> >>>I'm using LPC2378 for my current project. I want to configure Port2.7 >Pin >>>as an interrupt. I have already used up all the 3 External >>>Interrupts(EXINT0,EXTIN1,EXINT2). It been said tat EXTINT3 Pin can be >>>configured as an interrupt for a GPIO Pin, which i am not clear with. >> >>EINT3 is bound to P2.13. However, you can setup a "GPIO interrupt" for >>pins on P0 and P2.
>Could u please let me know how to setup "GPIO interrupt" for >pins on P0 and P2.
From Chapter 10, section 5.6, using P2 bit 7 falling edge as an example, and with the PINSEL and DIR registers already setup: IO2IntEnF |= 0x00000080; VICIntEnable |= 0x00020000; VICVectAddr17 = ExtInt3Isr; VICVectPriority17 = EINT3_PRIORITY; Your compiler may have different symbolic names for the registers, and a symbolic name should probably be used for the VIC channel to mitigate typing errors. -- Rich Webb Norfolk, VA
Thanks a lot Rich.

Your posting did help me a lot, but didn't work as desired. I wanted to
generate an interrupt for the first falling edge of a clock cycle. But now,
inspite of absence of a falling edge an interrupt is generated for the
corresponding Pin.

Here i have configured P2.7(CLOCK Signal) as a GPIO Pin which generates an
interrupt in External 




>On Sat, 04 Apr 2009 04:18:47 -0500, "ninan" <arunninank@gmail.com> >wrote: > >>>On Fri, 03 Apr 2009 05:32:18 -0500, "ninan" <arunninank@gmail.com> >>>wrote: >>> >>>>Hi, >>>> >>>>I'm using LPC2378 for my current project. I want to configure
Port2.7
>>Pin >>>>as an interrupt. I have already used up all the 3 External >>>>Interrupts(EXINT0,EXTIN1,EXINT2). It been said tat EXTINT3 Pin can be >>>>configured as an interrupt for a GPIO Pin, which i am not clear with.
>>> >>>EINT3 is bound to P2.13. However, you can setup a "GPIO interrupt" for >>>pins on P0 and P2. > >>Could u please let me know how to setup "GPIO interrupt" for >>pins on P0 and P2. > >From Chapter 10, section 5.6, using P2 bit 7 falling edge as an example, >and with the PINSEL and DIR registers already setup: > > IO2IntEnF |= 0x00000080; > VICIntEnable |= 0x00020000; > VICVectAddr17 = ExtInt3Isr; > VICVectPriority17 = EINT3_PRIORITY; > >Your compiler may have different symbolic names for the registers, and a >symbolic name should probably be used for the VIC channel to mitigate >typing errors. > >-- >Rich Webb Norfolk, VA >
Thanks a lot Rich for your kind and timely response.

Here i have configured P2.7(CLOCK) as a GPIO Pin which is configured to
generate an interrupt on External Interrupt3 if a falling edge is detected.
Now, when my device is connected, an interrupt is generated inspite of
absence of a falling edge.

I have pasted my source code below for your kind reference.
 
Please help me in this regard. 

	/****************************KBW_CLK[P2.7]********************************************/
PINSEL4  =( (PINSEL4 & 0xFFFF3FFF)|0x00000000); //P2.7 KBW_CLK as GPIO
Pin

FIO2DIR	 =((FIO2DIR  & 0xFFFFFF7F) | 0x00000000); //P2.7 KBW_CLK configure
as input.

PINMODE4 =( ( PINMODE4 & 0xFFFF3FFF ) | 0x00000000); //p2.7 'pull up'
enabled. 
	
	/*************************************************************************************/

	/****************************KBW_DATA[P2.11]******************************************/
PINSEL4  =( ( PINSEL4 &  0xFF3FFFFF )  | 0x00000000 ); //p2.11 KBW_DATA;
Set as GPIO
	
FIO2DIR	 =((FIO2DIR  & 0xFFFFF7FF) | 0x00000000); //P2.11 KBW_DATA
configure as input.
	
PINMODE4 = ( ( PINMODE4 & 0xFF3FFFFF ) | 0x00000000); //p2.11 KBW_DATA;
'pull up' enabled. 
	/*************************************************************************************/

	
EXTMODE  =	( ( EXTMODE  & 0xF7 ) | 0x08 ); //p2.7 edge Sensitive

EXTPOLAR =	( ( EXTPOLAR & 0xF7 ) | 0x00 ); //P2.7 Active LOW

    
    
EXTINT 	|= EINT3; //Interrupt Flag to be cleared before making any changes
in EXTMODE and EXTPOLAR

	
IO2_INT_CLR =  ( ( IO2_INT_CLR & 0x7F)	| 0x80); //CLEAR P2.7 GPIO Int
Status

IO2_INT_EN_F = ( ( IO2_INT_EN_F & 0x7F) | 0x80 ); //enable Falling Edge on
Port2.7

	

VICIntEnClr = 1 << 17;	/* Disable External Interrupt 3*/


VICVectAddr17 = (DWORD)HandlerAddr;	/* set interrupt vector */
	
VICVectPriority17 = 10;

VICIntEnable = 1 << 17;	/* Enable External Interrupt 3 */
	





>On Sat, 04 Apr 2009 04:18:47 -0500, "ninan" <arunninank@gmail.com> >wrote: > >>>On Fri, 03 Apr 2009 05:32:18 -0500, "ninan" <arunninank@gmail.com> >>>wrote: >>> >>>>Hi, >>>> >>>>I'm using LPC2378 for my current project. I want to configure
Port2.7
>>Pin >>>>as an interrupt. I have already used up all the 3 External >>>>Interrupts(EXINT0,EXTIN1,EXINT2). It been said tat EXTINT3 Pin can be >>>>configured as an interrupt for a GPIO Pin, which i am not clear with.
>>> >>>EINT3 is bound to P2.13. However, you can setup a "GPIO interrupt" for >>>pins on P0 and P2. > >>Could u please let me know how to setup "GPIO interrupt" for >>pins on P0 and P2. > >From Chapter 10, section 5.6, using P2 bit 7 falling edge as an example, >and with the PINSEL and DIR registers already setup: > > IO2IntEnF |= 0x00000080; > VICIntEnable |= 0x00020000; > VICVectAddr17 = ExtInt3Isr; > VICVectPriority17 = EINT3_PRIORITY; > >Your compiler may have different symbolic names for the registers, and a >symbolic name should probably be used for the VIC channel to mitigate >typing errors. > >-- >Rich Webb Norfolk, VA >

The 2024 Embedded Online Conference