AnsweredAssumed Answered

Enabling interrupt on GPIO, hitting wrong interrupt handler

Question asked by rick_moranis on Feb 13, 2019
Latest reply on Feb 19, 2019 by Mark Butcher

I'm working with the MK10DN512VLK10.


I'm trying to configure a GPIO pin as an input and to interrupt when the line goes to zero. For some reason the interrupt works but it always hits an I2C interrupt instead of my GPIO interrupt. 


I'm setting the PORTx_PCRn register(shown here: ) to 0x00080100

   IRQC = 8, interrupt when logic zero

   MUX = 1, Alternative 1 (GPIO)

      Alternative 1 is GPIO, shown here:


I also make sure the direction is set to input by writing to a 0 this register, in the corresponding bit position


My code looks something like this(obviously simplified a bit):



When I run this and the pin goes to zero, that triggers the interrupt but I hit a I2C handler(which I don't have a function for):



Can anyone tell me why I'm hitting the I2C interrupt and not the PORT C interrupt? One thing I have noticed is that the pin I'm using can be used for I2C ( alt function 2). I've also tested other GPIO pins and it seems like it always hits that alt function 2 interrupt, even though I'm configuring the pin as GPIO(alt function 1).