gpio_default_irq_handler() calls callback with incorrect gpio parameter #879

Closed
opened 2022-06-23 21:00:23 -05:00 by earlephilhower · 1 comment
earlephilhower commented 2022-06-23 21:00:23 -05:00 (Migrated from github.com)

In the develop branch, after #850 was merged, it seems like the GPIO sent to the user callback is not correct.

I have called the init function as follows for any change on GPIO 9:

gpio_set_irq_enabled_with_callback(9 /*gpio #9*/, 12 /* rise or fall */, true /*enabled*/, _gpioInterruptDispatcher /* userland irq handler */);

When I set a breakpoint in GDB I can see that a toggle on GPIO #9 does result in a callback to the SDK gpio_default_irq_handler(), so the interrupt enables are set properly, but the callback routine gets called with 8 as the interrupting GPIO, not 9.

Right now the code is only returning GPIO 0, 8, 16, or 24:
github.com/raspberrypi/pico-sdk@4c49427bf3/src/rp2_common/hardware_gpio/gpio.c (L152-L157)

Line 155 should be

         callback(i, events); 
In the develop branch, after #850 was merged, it seems like the GPIO sent to the user callback is not correct. I have called the init function as follows for any change on GPIO 9: ```` gpio_set_irq_enabled_with_callback(9 /*gpio #9*/, 12 /* rise or fall */, true /*enabled*/, _gpioInterruptDispatcher /* userland irq handler */); ```` When I set a breakpoint in GDB I can see that a toggle on GPIO #9 does result in a callback to the SDK `gpio_default_irq_handler()`, so the interrupt enables are set properly, but the callback routine gets called with `8` as the interrupting GPIO, not `9`. Right now the code is only returning GPIO 0, 8, 16, or 24: https://github.com/raspberrypi/pico-sdk/blob/4c49427bf3048a12569f9890188c4be33e082838/src/rp2_common/hardware_gpio/gpio.c#L152-L157 Line 155 should be ```` callback(i, events); ````
kilograham commented 2022-06-24 03:58:48 -05:00 (Migrated from github.com)

merged into develop

merged into develop
Sign in to join this conversation.
No milestone
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set

Reference
gh-raspberrypi/pico-sdk#879
No description provided.