Dtynin
Dtynin
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:
#include <zephyr.h>
#include <device.h>
#include <drivers/gpio.h>

#define GPIO_PIN 15
#define GPIO_PORT "GPIO_0"

void gpio_callback(const struct device *dev, struct gpio_callback *cb, uint32_t pins) {
printk("Interrupt triggered!\n");
}

void main(void) {
const struct device *dev = device_get_binding(GPIO_PORT);
gpio_pin_interrupt_configure(dev, GPIO_PIN, GPIO_INT_EDGE_TO_ACTIVE);
gpio_init_callback(&my_cb, gpio_callback, BIT(GPIO_PIN));
gpio_add_callback(dev, &my_cb);
}
#include <zephyr.h>
#include <device.h>
#include <drivers/gpio.h>

#define GPIO_PIN 15
#define GPIO_PORT "GPIO_0"

void gpio_callback(const struct device *dev, struct gpio_callback *cb, uint32_t pins) {
printk("Interrupt triggered!\n");
}

void main(void) {
const struct device *dev = device_get_binding(GPIO_PORT);
gpio_pin_interrupt_configure(dev, GPIO_PIN, GPIO_INT_EDGE_TO_ACTIVE);
gpio_init_callback(&my_cb, gpio_callback, BIT(GPIO_PIN));
gpio_add_callback(dev, &my_cb);
}
The error I'm encountering:
error: Failed to add GPIO callback
error: Failed to add GPIO callback
I've confirmed that interrupt support is enabled in the prj.conf file. Does anyone have suggestions on how to fix this?
5 replies