Hello,
I have used the pinpong lib to turn on and off the IO and that works good.
Now I trying to use a Lora module sx1278 and would like to use the interrupt to know when a new message is received.
I found this example and have tried to use that on GP22 and GP16:
I get following error:
Traceback (most recent call last):
File “/root/interrupt.py”, line 20, in
btn.irq(trigger=Pin.IRQ_FALLING, handler=btn_falling_handler)
File “/usr/lib/python3.9/site-packages/pinpong/board.py”, line 339, in irq
self.obj.irq(trigger, handler)
File “/usr/lib/python3.9/site-packages/pinpong/board.py”, line 266, in irq
self.board.res"irq"
File “/usr/lib/python3.9/site-packages/pinpong/extension/milkvDuo.py”, line 144, in irq
gpio_fd = os.open(“/sys/class/gpio/gpio508/value”, os.O_RDONLY)
FileNotFoundError: [Errno 2] No such file or directory: ‘/sys/class/gpio/gpio508/value’
I have checked and I do not have any gpio508.
Not sure if I have missed something important or if this is expected?
Thanks for the answer @hannahKobain
You are correct that the example code works, I did not even try to use GP0 that the example was using
But I still have issues with using the other GPIOs
Yes, I using pinmux as you describe to secure the pin functionality.
[root@milkv-duo]~# for pinID in 0 1 16 22; do duo-pinmux -r “GP$pinID”; done;
GP0 function:
JTAG_TDI
UART1_TX
UART2_TX
[v] GP0
IIC0_SCL
WG0_D0
DBG_10
When using GP0 as in the example the gpio508 is created so I don’t get the error message anymore after that.
But… I have not tested all GPIOs but I only getting it to work on GP0. When changing “btn = Pin(Pin.D0, Pin.IN)” to let say “btn = Pin(Pin.D1, Pin.IN)” it is still using GP0 for the interrupt and not GP1 but [print("pin = ", pin] prints “pin = 1”.
So I only getting irq to working on GP0 and when trying to use another GPIO it is still using GP0 to listen for an interrupt signal.
I don’t know but I guess it has something to do with the creation of gpio508 and gpio508 configruation?