trying to enable INT on MCP23017 so that, in case of a state change on any PIN from Port A (e.g from low to high) an interrupt should be triggered on INTA.
Unfortunately the INTA pin remains high as long the pin on port A is high. So I can not clear the INTA pin
What I have done so far. Requirement is to use pure CMD and no framework for it. I took i2cset and i2cget tools from raspberry pi 4. wrote a simple script for configuration and added an oscilloscope to INTA.
#!/bin/bash
i2cset -y 1 0x20 0x00 0xff # all ports bank A to inputs
sleep 0.5
i2cset -y 1 0x20 0x0a 0x02 # set Bit 1(INTPOL) to HIGH
sleep 0.5
i2cset -y 1 0x20 0x08 0xff # set Bit 1(INTCONA) to HIGH
sleep 0.5
i2cset -y 1 0x20 0x04 0xff # High on all pins to enable all pins to interrupt on a change of polarity (i.e switch change)
After executing the code, the level on INTA is low. Adding a high level via cable (so connecting +3.3V to any pin of the port A ==> all pins are wired via 10k to GND) to a pin of PORT A triggers a high level signal on INTA. It goes back to low if also the high level on the pin from PORT A disapears. No way of resetting (clearing) the interrupt via CMD like i2cget -y 1 0x20 0x10 # ==> this is always showing the pin who was triggering the INT or i2cget -y 1 0x20 0x12 # ==> this is always showing the right state of the inputs (so which pin is high and which is low... )
Any ideas what's wrong?
I am using IOCON.BANK = 0 therefore IOCON Register for Port A should be according to table 3-5 IOCON Address=0x0a. According to datasheet the bit 1 should be set to 1 or 0.
In my top post I think I must have a bug.
i2cset -y 1 0x20 0x0a 0x02 # set Bit 1(INTPOL) to HIGH
I must set it instead of 0x02 to 0x01 but how can I define to set exactly the bit 1 to value 1?
i2cset -y 1 0x20 0x0a 0x01 1 # ????? that does not work :-(