Become a leader in the IoT community!
Join our community of embedded and IoT practitioners to contribute experience, learn new skills and collaborate with other developers with complementary skillsets.
Join our community of embedded and IoT practitioners to contribute experience, learn new skills and collaborate with other developers with complementary skillsets.
Hey guys, a friend of mine is currently working on AT91SAM9M10-EKES. The Code registers IRQ for 2 GPIO pins (PA20 & PA21) but only receives 22/26 expected interrupts (random). Could there be an issue in this IRQ handling code?
“` static irqreturn_t wiegand_interrupt(int irq, void *dev_id){
atomic_inc(&counter);
printk(KERN_WARNING “IRQ received, counting… %d\n”, atomic_read(&counter));
return 0;
}
irq1 = gpio_to_irq(AT91_PIN_PA21);
if (irq1 < 0) {
err = irq1;
printk("Unable to get irq number for GPIO %d, error %d\n", AT91_PIN_PA21, err);
goto fail;
}
err = request_irq(irq1, wiegand_interrupt, 0, "wiegand", NULL);
irq2 = gpio_to_irq(AT91_PIN_PA20);
if (irq2 < 0) {
err = irq2;
printk("Unable to get irq number for GPIO %d, error %d\n", AT91_PIN_PA21, err);
goto fail;
}
err = request_irq(irq2, wiegand_interrupt, 0, "wiegand", NULL);
```
Any suggestions for troubleshooting missed interrupts? @Middleware & OS
@ifreakio From what I see so far π« .. I don’t think you should be requesting the same interrupt handler `wiegand_interrupt` for both IRQ lines PA20 and PA21. Interrupt handlers are to be unique for each IRQ line
So could this be the reason for the missing interrupts ? π€ @destynin
Yh , @ifreakio , where you able to fix it?
Yup, I had to define separate interrupt handler functions for each IRQ line. I also found this stuff helpful too
https://linux-kernel-labs.github.io/refs/heads/master/labs/interrupts.html
CONTRIBUTE TO THIS THREAD