Quantcast
Channel: Raspberry Pi Forums
Viewing all articles
Browse latest Browse all 8013

SDK • Re: GPIO interrupts only received if interrupt enabled on core 0?

$
0
0
I figured it out.

Code:

  gpio_set_irq_enabled(RECEIVER_PIN, GPIO_IRQ_EDGE_FALL, true);  gpio_set_irq_callback(+[](uint gpio, uint32_t event_mask) {    (void)gpio;    (void)event_mask;    BaseType_t higher_priorty_task_awoken = false;    xEventGroupSetBitsFromISR(Events(), kEventIrqReceived,                              &higher_priorty_task_awoken);    portYIELD_FROM_ISR(higher_priorty_task_awoken);  });  irq_set_enabled(IO_IRQ_BANK0, true);
If you use gpio_set_irq_enabled and gpio_set_irq_callback separately, you have to additionally call irq_set_enabled(IO_IRQ_BANK0). This issue doesn't arise when you call gpio_set_irq_enabled_with_callback, because it does it for you. I don't really understand why gpio_set_irq_enabled doesn't do this too. It's a very annoying behavior difference.

This is such a gotcha. I wonder if they'd let me fix it.

Statistics: Posted by jags84 — Wed May 08, 2024 12:03 am



Viewing all articles
Browse latest Browse all 8013

Trending Articles