EmbeddedRelated.com
Forums

LPC2138 EINT strange interrupt behaviour

Started by hus_kalydonios June 1, 2007
Hi All,

I'm having a problem with an EINT interrupt. It's set for rising
edge, but only enters the ISR on falling edge. I can't see where I've
gone wrong. I'm using freeRTOS. Here is my code:

/**** inits ****/
PINSEL0 |= mainP0_14__EINT_1;
EXTMODE = mainEINT_1_EDGE_SENSITIVE /*0x2*/ |
mainEINT_2_EDGE_SENSITIVE /*0x4*/;

EXTPOLAR = mainEINT_1_RISING_EDGE_SENSITIVE /*0x2*/ |
mainEINT_2_RISING_EDGE_SENSITIVE /*0x4*/ ;

/* Setup the VIC for EINT 1. */
VICIntSelect &= ~mainEINT_1_VIC_CHANNEL_BIT;
VICIntEnable |= mainEINT_1_VIC_CHANNEL_BIT;
VICVectAddr1 = ( portLONG ) vButtonISR;
VICVectCntl1 = mainEINT_1_ENABLE_BIT | mainEINT_1_CHANNEL;
/**** ISR ****/
portENTER_SWITCHING_ISR();
xSemaphoreGiveFromISR( xButtonSemaphore, pdFALSE );
EXTINT |= isrCLEAR_EINT_1;
VICVectAddr = 0;
portEXIT_SWITCHING_ISR( pdTRUE );

Any ideas? Help much appreciated.

Thanks.

An Engineer's Guide to the LPC2100 Series

I think it's coming from the wiring of my evaluation board. When I set
EXTPOLAR to falling edge, the ISR fires on rising edge and vice
versa... Strange.

Thanks anyway.
hus_kalydonios wrote:
>
> I think it's coming from the wiring of my evaluation board. When I set
> EXTPOLAR to falling edge, the ISR fires on rising edge and vice
> versa... Strange.
>

IIRC, there is an errata on programming the external interrupts. I had
a great deal of grief getting them to work on the LPC2138 and thought it
was just my inexperience with the ARM7TDMI core. However, on the
LPC2214 I ran into the same problems. Researching this, I found an
errata sheet for the LPC2214 that explains why the external interrupt
setup wasn't working correctly.

Try looking on the NXP website for any errata sheets.

TomW
--
Tom Walsh - WN3L - Embedded Systems Consultant
http://openhardware.net http://cyberiansoftware.com http://openzipit.org
"Windows? No thanks, I have work to do..."
----------------