This message was posted on behalf of Intel Corporation
I have tested scripts that used more than one interrupt, however I would not recommend to activate them at the same time to avoid issues on the code. However, the documentation found in http://iotdk.intel.com/docs/master/mraa/classmraa_1_1_gpio.html does not mention if Edison can set priority for an interrupt above another.
arfoll, what do you think? Am I missing something?
The Linux kernel can handle multiple parallel interrupts coming from different GPIOs.
I don't know about mraa. I think it launches multiple threads that listen to interrupts independently.
There are usually two other problems if you connect a button and handle interrupts when the button is pushed.
1. You want to quickly handle multiple subsequent button pushes. Then the interrupt handler must be very short. It should set a flag and exit, then the main program should do something when the flag is set.
2. Button debouncing. One button push can trigger multiple interrupts. After the first interrupt, other interrupts should be ignored for the predefined amount of time like 50ms.
Thank you for your input.
However, I am afraid it is not a choice for me to activate only one interrupt at a time in my application because I have no idea which interrupt will come first. For Arduino, I believe that it can handle only one interrupt at a time meaning other interrupts will be ignored when one is executing. This is fine for me actually. I am just concerned whether some unexpected behaviour will happen on Intel Edison if such an incident happens.
Thank you very much.
1 of 1 people found this helpful
lyfkyle a 'real' arduino will behave as you say. Mraa is capable of calling your interrupt handlers at the same time, there's no blocking there unless you're in a high level language like node.js or python where each interrupt will be executed whilst the main interpreter thread is locked. There's no issue with interrupt2 occurring when InterruptHandler1 and you even be executing your ISRs at the same time.
Vincenze kernel does support this but there's no userspace API to do it (at least I haven't found a good way), multiple threads works well and costs very little since they essentially get woken by the interrupt.
1. Subsequent pushes of the same button/gpio then yes you need to get in/out of ISR fast. For multiple GPIOs no, you can be slow. But remember userspace Linux cannot give guarantees on how fast we will treat the ISR so performance can be v.variable.
2. We're way too slow to notice that. Kernel drivers typically have denouncing protection anyways and if you're really worried just hog the ISR thread with a sleep.