Pinpong irq not working

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/”, line 20, in
btn.irq(trigger=Pin.IRQ_FALLING, handler=btn_falling_handler)
File “/usr/lib/python3.9/site-packages/pinpong/”, line 339, in irq
self.obj.irq(trigger, handler)
File “/usr/lib/python3.9/site-packages/pinpong/”, line 266, in irq
File “/usr/lib/python3.9/site-packages/pinpong/extension/”, line 144, in irq
gpio_fd =“/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?

Usually, what you’re showing means you haven’t switched the pin to the right mode.

In my case, the snippet you referenced here doesn’t produce error messages.
Moreover, it immediately reported

pin =  0

Which pins are you using in your code, and what are their pin multiplexing settings?
Can check with duo-pinmux -r and change with duo-pinmux -w:

[root@milkv-duo]~# for pinID in 16 25; do duo-pinmux -r "GP$pinID"; done;
GP16 function:
[v] GP16

register: 0x300103c
value: 3
GP25 function:
[v] GP25
[ ] IIS1_DI
[ ] IIS2_DO
[ ] IIS1_DO

register: 0x300112c
value: 3

Thanks for the answer @hannahKobain :slight_smile:
You are correct that the example code works, I did not even try to use GP0 that the example was using :blush:
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:
[v] GP0

register: 0x300104c
value: 3
GP1 function:
[v] GP1

register: 0x3001050
value: 3
GP16 function:
[v] GP16

register: 0x300103c
value: 3
GP22 function:
[v] GP22

register: 0x3001068
value: 3

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?