Failed to Add GPIO Callback on AVR32UC Microcontroller
Hi everyone, I'm working on setting up an interrupt handler on my AVR32UC microcontroller, but I'm encountering an issue where the interrupt configuration fails.
my setup:
The error I'm encountering:
I've confirmed that interrupt support is enabled in the
prj.conf
file. Does anyone have suggestions on how to fix this?Solution:Jump to solution
hey @Sterling I had fixed the issue, I made sure to define and initialize the
struct gpio_callback my_cb
before using it in gpio_init_callback
. I also added some error handling for functions like device_get_binding
, gpio_pin_interrupt_configure
, and gpio_add_callback
. These adjustments helped to correctly set up the GPIO interrupt, so now the callback function triggers as expected when the GPIO pin detects an edge. thanks buddy3 Replies
Hi @Dtynin , have u ensured sure that the
struct gpio_callback my_cb;
is defined and initialized before using it in gpio_init_callback
?
Check it out, if not then implement it and give me a feedback 😊Thanks for pointing that out @Sterling I completely missed defining and initializing
struct gpio_callback my_cb
. I'll go ahead and implement that now and see if it resolves the issue. I'll let you know how it goes.Solution
hey @Sterling I had fixed the issue, I made sure to define and initialize the
struct gpio_callback my_cb
before using it in gpio_init_callback
. I also added some error handling for functions like device_get_binding
, gpio_pin_interrupt_configure
, and gpio_add_callback
. These adjustments helped to correctly set up the GPIO interrupt, so now the callback function triggers as expected when the GPIO pin detects an edge. thanks buddy