Any suggestions for troubleshooting missed interrupts?

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);
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
4 Replies
Dtynin
Dtynin•3w ago
@Sterling 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
Sterling
Sterling•3w ago
So could this be the reason for the missing interrupts ? 🤔 @Dtynin
Marvee Amasi
Marvee Amasi•3w ago
Yh , @Sterling , where you able to fix it?
Sterling
Sterling•3w ago
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
Want results from more Discord servers?
Add your server
More Posts
What’s the best option if I need a GUI? Anything for IPad?@Middleware & OS So I’m hacking my path to embedded world and have a big project (big to my size anhow can i implement secure communication between IoT devices using Transport Layer Security (TLS)Good day guys how can i implement secure communication between IoT devices using Transport Layer SecHow can I reduce the energy consumption of WiFi and MQTT?Hello guys , I'm working on developing an IoT temperature and humidity sensor for my cellar. I'm usiimplementing secure authentication on edge impulseHey guys, @IoT Cloud so lately I have been working with Edge Impulse , but I'm having trouble implemHow to Install and Secure the Mosquitto MQTT Messaging Broker on Ubuntu 18.04https://www.digitalocean.com/community/tutorials/how-to-install-and-secure-the-mosquitto-mqtt-messagEstablishing MQTT Connection with Private Key - is that secure?In this video, I discuss using a Private Key in the MQTT connection setup. It's crucial to keep the New Embedded Programming Language by AppleLast week at WWDC 2024, Apple unveiled Embedded Swift, a new programming language for resource-limitDoes anybody worked on Quectel EC200 series SIM module for establishing an MQTT connection to cloudAT+QMTCONN=0,"deployment-fc9b6ee2","chara","chara" OK +QMTCONN: 0,1 +QMTSTAT: 0,3 I'm getting thInstalling Minimal Valgrind Components for Embedded Systems to Reduce Footprint@Middleware & OS Hey guys, In other for me to minimize my embedded system's footprint, can I instaFixing 'Missing Operator' Error in Batch Script for Renaming JPG Files on WindowsI'm trying to rename image files (JPGs) on a Windows machine. I want to add an incrementing number (