Help with ISRs in Zephyr 😅 - Part One #88179
Replies: 1 comment
-
Hi, what are you trying to achieve, exactly? In Zephyr, most common subsystems have an interrupt-driven API that can be used directly. Here, you just register your callback and configure how to the interrupt should be triggered (failing/rising edge, or on level). For instance, to implement a push button, you would typically use leverage the GPIO subsystem. See basic button example. Next, ISRs are special beast. ISR overtakes everything in the system. It runs on its own stack. You are restricted in what you can do. Only the API marked "ISR-ok" are OK to be used in ISR (some API might be ISR-ok but not documented as such). If your ISR takes 500ms to complete, you block your system for 500ms (busy processing your ISR). You can't block or wait. So if a function takes a timeout, it should be always uses That being said, you should declare the interrupt counter variable as volatile. Otherwise the compiler might optimize out the load operation, because it sees no one is calling the ISR. Indeed, this function is called by the Interrupt Controller/CPU when the IRQ line is asserted. volatile int interrupt_counter; // you need volatile |
Beta Was this translation helpful? Give feedback.
-
I'm trying to understand how to use the dynamic ISR API in Zephr and have developed the following code snippet based on the interrupt test suite (mostly from this file), which just checks if the interrupt has been triggered.
However, it seems like the ISR never runs in the first place:
Can anyone help me understand why is that? Have I made something wrong?
Here's the
.conf
:Beta Was this translation helpful? Give feedback.
All reactions