Continue to Site

Welcome to EDAboard.com

Welcome to our site! EDAboard.com is an international Electronics Discussion Forum focused on EDA software, circuits, schematics, books, theory, papers, asic, pld, 8051, DSP, Network, RF, Analog Design, PCB, Service Manuals... and a whole lot more! To participate you need to register. Registration is free. Click here to register now.

lpc1768 gpio interrupt not working

Status
Not open for further replies.

oahmad

Newbie level 5
Joined
Aug 17, 2010
Messages
8
Helped
1
Reputation
2
Reaction score
1
Trophy points
1,283
Location
us
Activity points
1,370
I have setup a board with a momentary button on Port 2.10; I setup the code as a gpio interrupt on falling edge, it doesn't interrupt. I am using an LPC1768 and CMSIS. Also, I read in the user's manual that gpio interrupts on ports 0 and 2 are tied to external interrupt 3. Why have 'external' interrupts on these pins when the gpio interrupts accomplish the same functionality?

Here's my non working code:

Code:
// Setup External Interrupt
void EINT3_init (void)
{
   // Set PINSEL4 [21:20] = 01 for P2.10 as gpio
   LPC_PINCON->PINSEL4 &= ~(0x11 << 20);
   //LPC_PINCON->PINSEL4 |= (0x01 << 20);

   //set the interrupt 2.10 for falling edge
   LPC_GPIOINT->IO2IntEnF &= ~(1<<10);

   // Enabled External Interrupt 0 (the ISP button on RDB1768).
   NVIC_EnableIRQ(EINT3_IRQn );
}

// ***** EINT2 Interrupt Handler*****

void EINT3_IRQHandler(void)
{
   // Clear interrupt
   //LPC_SC->EXTINT = EINT0_CLR;

   //*****why doesn't this work???
   LPC_GPIOINT->IO2IntClr |= (1<<10);

}
 

Hi

To enable falling edge interrupt on P2.10 you need to set
IO2IntEnF |= 0x0000400;
rather than clear it.

To clear the interrupt in the EXINT3 IRQ you can write
IO2IntClr = 0x0000400;
There is no need to read and OR the content beforehand.

The EXINT3 shares interrupts with the port change interrupts. Both can be used at the same time by checking the interrupt source when handling it.
EXINT3 has the advantage that it supports also level sensitive interrupt rather than just port changes, which means that it can also operate when the device is in an idle state (no active clocks) to wake up the device, which port changes will not be able to (I didn't verify this but it is usually the case).

Regards

Mark
NO SIGNATURE LINKS ALLOWED
 

Status
Not open for further replies.

Part and Inventory Search

Welcome to EDABoard.com

Sponsor

Back
Top