I am using the nrf5340PDK and i am trying to have P1.04 trigger an interrupt on a high to low transition.
attached is my overlay file and my main.c to initialize the GPIO.
if i set the pin in the overlay to (almost) any port0 pin this works. but if i set the GPIO to 36 (P1.04) it does not work.
what am i missing?
/ {
buttons {
compatible = "gpio-keys";
MBR_DETECT: mbr_detect {
gpios = <&gpio0 0x24 (GPIO_PULL_UP|GPIO_ACTIVE_LOW)>;
label = "MBR_DETECT";
};
};
};
#define MBR_PORT DT_GPIO_LABEL(DT_NODELABEL(mbr_detect), gpios)
#define MBR_PIN DT_GPIO_PIN(DT_NODELABEL(mbr_detect), gpios)
#define MBR_FLAGS DT_GPIO_FLAGS(DT_NODELABEL(mbr_detect), gpios)
.
.
.
.
void main(void)
{
const struct device *button;
const struct device *led;
int ret;
button = device_get_binding(MBR_PORT);
if (button == NULL) {
printk("Error: didn't find %s device\n", MBR_PORT);
return;
}
ret = gpio_pin_configure(button, MBR_PIN,(GPIO_INPUT |MBR_FLAGS));
if (ret != 0) {
printk("Error %d: failed to configure %s pin %d\n",
ret, MBR_PORT, MBR_PIN);
return;
}
ret = gpio_pin_interrupt_configure(button,
MBR_PIN,
GPIO_INT_EDGE_FALLING);
if (ret != 0) {
printk("Error %d: failed to configure interrupt on %s pin %d\n",
ret, MBR_PORT, MBR_PIN);
return;
}
gpio_init_callback(&button_cb_data, button_pressed, BIT(MBR_PIN));
gpio_add_callback(button, &button_cb_data);