I'm at my wits end with this one.
Okay, so we've got an MCP23017 with its INTA wired to the Pi gpio12 (bcm) in /boot/config.txt
so far so good. I'm looking to detect an event on gpio502 so, I've exported gpio502, direction in, edge both I've also exported gpio12, direction in
If I look in /proc/interrupts I can see that the interrupts are being seen at the kernel level:
160: 4 pinctrl-bcm2835 12 Level 1-0020 168: 4 gpio-mcp23xxx 6 Edge gpiolib
The interrupts increment whenever I trigger pin 502
160: 10 pinctrl-bcm2835 12 Level 1-0020 168: 10 gpio-mcp23xxx 6 Edge gpiolib
So far so good..... Looks like everything should be working. Here is my code to capture the event in Python
import RPi.GPIO as GPIO GPIO.setmode(GPIO.BCM) GPIO.setup(12, GPIO.IN, pull_up_down=GPIO.PUD_UP) def getDigit(): #Callback when interrupt goes low print "received interrupt" GPIO.add_event_detect(12, GPIO.BOTH, callback=getDigit, bouncetime=100)
Can anyone.... PLEASE..... tell me why my event detect is not seeing the interrupt.... It never gets set to the callback.... I'm at a complete loss.... I've researched for DAYS. The only conclusion I've possibly reached is, I notice that in /proc/interrupts, its listing gpio12 as level instead of edge.... but with the mcp23017 overlay loaded, I'm locked out of changing it.... the driver defaults to level and won't let me change it.
I'm new to coding python.... so I'm not sure if I'm just missing something really stupid and painfully obvious, or what..... Any assistance or guidance would be greatly greatly appreciated.