I'm working on LPC1768. I have enabled EINT0 and EINT2 interrupts both in falling-edge sensitive mode. This is the code :
LPC_PINCON->PINSEL4 |= (0x01 << 20); // function: EINT0
LPC_SC->EXTMODE |= 1 << 0; // Edge sensitive
LPC_SC->EXTPOLAR &= ~(1 << 0); // falling-edge sensitive
LPC_SC->EXTINT = (1 << 0); // clear flag
LPC_PINCON->PINSEL4 |= (0x01 << 24); // function: EINT2
LPC_SC->EXTMODE |= 1 << 2; // Edge sensitive
LPC_SC->EXTPOLAR &= ~(1 << 2); // falling-edge sensitive
LPC_SC->EXTINT = (1 << 2); // clear flag. not important
I have connected EINT0 to a push button switch and EINT2 to the RING output pin of a GSM module to know when a SMS has arrived.
I have couple of problems. First after running above code it goes straight to the EINT2_IRQHandler (or sometimes EINT0_IRQHandler) while there has not been a signal (a falling edge situation) that would cause this. Now why is that?
Another problem is that sometimes it goes to the EINT0_IRQHandler while the push button switch has not been pressed!
Or sometimes after turning on the GSM module and/or receiving a SMS (which generates a falling edge on RING pin connected to EINT2 after receiving a SMS) the EINT0_IRQHandler gets called!
I don't understand. Why there would be a connection between these two pins? There are two different and separate pins, right?
Have I done something wrong in the code? Or am I missing something?