I'm having problems with configuring/using interrupts on TCA8418 in GPI Mode. Polling the INT register results in alternating interrupt and no-interrupt signals regardless of if a change in pin state has actually occurred. I am attempting to monitor 6 lines attached to the GPIO of the TCA8418 via a USB-MSSP(I2C) adapter and a custom PC application. I have established communications between the PC and the TCA8418 successfully. I am able to monitor the inputs successfully via polling, but am having issues configuring the interrupt properly as to be able to poll the interrupt register to determine if a read is necessary.
Here is the procedure I am currently following:
Since the lines I'm monitoring are on GPI, I am sending a 0x02 to the CFG register (0x01). This should enable interrupts coming from changes of state on the GPI pins.
I am then writing a 0x3F to the GPIO_INT_EN1 register (0x1A). This should enable interrupts only on the specific pins I want to monitor (GPI[5]-GPI[0]/ROW[5]-ROW[0]).
The lines I am monitoring are low-active, so I want an INT to trigger on transitions from HIGH to LOW. If I'm not mistaken, the GPIO_INT_LVL_1 register (0x26) should be, by default, configured for this on powerup.
I then proceed to poll the INT_STAT register (0x02) and mask the GPI_INT bit (INT_STAT[1]). If I have received an interrupt, I read the GPI port to determine the GPI that has transitioned low. I then clear the interrupt by writing a '1' to the GPI_INT bit of INT_STAT.
The issue occurs when polling the GPI_INT. Each time I read the signal inverts. First read results in a 0, next read results in a 1, 3rd read results in a 0, and so on.
Is there a configuration I need to make or an issue with the fashion in which I am polling the interrupt? Am I misunderstanding how GPI interrupts work on this chip?
Thanks in advance for any advice.