LPCXpresso 1769: GPIO Interrupt issues

Discussion created by lpcware Employee on Jun 15, 2016
Latest reply on Jun 15, 2016 by lpcware
Content originally posted in LPCWare by gweppler on Wed Jan 25 22:56:10 MST 2012
I am trying to use GPIO interrupts to interface to 3 button switches to an LPCXpresso 1796. The buttons are active high to 5V, the pins use internal pull-down, rising edge INT. pins 0.0, 0.6, 0.7 are all used in the same configuration.

IO0IntEnR is set to 0xc1 (pins 0.0, 0.6, 0.7 config’d for rising edge event).
  If I press any of the 3 buttons,

[*]- the EINT3_IRQHandler gets invoked as expected.
[*]- Upon entry into the handler, IOIntStatus is 0x1, indicating a GPIO int from port 0.
[*]- However, IO0IntStatR almost always also logs rising edge events on the other two pins – sometimes only on one of the two other pins.
    I confirmed that the pins are electrically isolated from one another (except the common GND or +5V). I verified signals on all pins with the oscilloscope and they all seem clean. I have tried other combinations (using port 2 / other pins instead, using active low buttons with pull-up, etc.) but they're all showing basically the same behavior.
My partial code (lines that are commented out don’t seem to make a difference):

void EINT3_IRQHandler(void)
   unsigned long regVal;

   regVal = LPC_GPIOINT->IntStatus;                       //for debugging only

   if (((LPC_GPIOINT->IO0IntStatR)&(1<<0)) == (1<<0))  {  //rising edge int?
      LPC_GPIOINT->IO0IntClr = (1<<0);
   if (((LPC_GPIOINT->IO0IntStatR)&(1<<6)) == (1<<6))  {  //rising edge int?
      LPC_GPIOINT->IO0IntClr = (1<<6);
   if (((LPC_GPIOINT->IO0IntStatR)&(1>>7)) == (1<<7))  {  //rising edge int?
      LPC_GPIOINT->IO0IntClr = (1<<7);

int main(void) {
   uint32_t KEY_PINS = ( BIT0 | BIT6 | BIT7 );    //keypad button connections (P0.0/6/7). buttons are active high.

   //LPC_SC->PCONP        |= (1<<15);                      //power to GPIO block on (default is on)
   LPC_PINCON->PINSEL0    &= ~((3<<0)|(3<<12)|(3<<14)); //set p0.0/6/7 to GPIO (00) function (button connection)
   LPC_GPIO0->FIODIR      &= ~KEY_PINS;                 //set key pins to input (0)
   LPC_PINCON->PINMODE0   |=  ((3<<0)|(3<<12)|(3<<14)); //pull down
   LPC_GPIOINT->IO0IntEnR |=  KEY_PINS;                 //enable rising edge INT (1)

   NVIC_EnableIRQ(EINT3_IRQn);                  //Enable EINT3 interrupt */
   //LPC_SC->EXTINT = CLEAR_EINT3;              //clr the EINT3 interrupt flags
   //LPC_GPIOINT->IO0IntClr = KEY_PINS;         //clr all pending GPIOINTs

   while (1)
   return 0;
  1) How can I ensure I get only the GPIO interrupt only from the pin that had the actual rising/falling edge?

  2) When I  configured the GPIO pins w/ pull-up and to trigger on falling edge (with buttons connecting to GND and thus, a different configuration as the one above), I measure around 2.04V on the GPIO pins when the button isn’t pressed or when there’s nothing connected at all. That seems to be within what the 17xx defines as “high” level (2V or more). Any ideas why I would see a value this close to an undefined signal state?
  Thanks in advance for any hints.