I am having problems getting interrupts to work with the MCP23S17.
I have managed to get the GPIO pins working in a simple scenario driving LEDs both with and without Rob Tillaarts library. I am, however, struggling to get interrupts to work. The line stays either high or low and the interrupt does not fire.
I have set up a simple script to drive a LED on PORT A pin D7 and an input on PORT A pin D0. The Arduino has been set up to receive the signal from INTA on pin D2. When an interrupt is detected on D2, the INTCAPA register should get read and the LED toggled on or off. Having consulted the MCP23x17 datasheet, the various registers have been configured as follows:
- INTPOL bit on IOCON set to 0 for active low
- INTCON set to 0x00 so bit values (including bit 0) are compared to the previous setting
- GPINTENA set to 0x01 to enable an interrupt to be triggered when GPIO port A bit 0 changes state
I am monitoring both the SPI bus and the INTA signal on an oscilloscope using its logic analyser feature. I can see the correct sequences being sent to the chip, but don't see the INTA signal changing at all. Consequently the INTCAPA register never gets read and the result acted upon.
There was a suggestion on another forum to set the ODR bit on the IOCON register. I tried this as well but the interrupt still does not fire:
https://forum.microchip.com/s/topic/a5C3l000000MLhbEAG/t313483?comment=P-2445112
I'm not sure whether there is something else I need to set?
MCP23S17-test.ino (7.6 KB)