Page 1 of 1

does it support ISR event queue?

Posted: Fri Mar 21, 2014 3:28 am
by yushanh
Hi all,

I wonder if ChibiOS support ISR queue? For example, I have an external interrupt driver which will be invoked when button is pressed, and inside the handler the LED will blink one time. But if I press the button 10 times really fast, it won't blink 10 times as what I expected. Is this feature supported or will it be there in the future? Thanks!

S.

Re: does it support ISR event queue?

Posted: Fri Mar 21, 2014 9:21 am
by Giovanni
There is no such a thing like an ISR queue as far I know. An interrupt can be pending or not, if you try to trigger an interrupt that is already pending and not yet served then the second event is lost. It is not matter of operating system, it is how the interrupt controller works.

Since interrupt servicing is *very* fast I would look for a problem in your application.

Giovanni

Re: does it support ISR event queue?

Posted: Thu May 01, 2014 7:30 am
by colin
Giovanni is right. If you need to handle an edge-triggered interrupt event that might happen repeatedly in a short time, you need to write an ISR that will be quickly (in about 12 core clock cycles) be entered on the interrupt event, then the ISR clears the interrupt flag so that a subsequent edge will cause the interrupt to be pend again. Don't do any long handling in the ISR itself -- you would use an RTOS construct like a message queue or semaphore or something if you need to do long processing, and that long processing would then be performed by a thread (not in an interrupt context) after the ISR completes. If you really have very rapid events, and you need to do a lot of processing, then you will possibly have to re-evaluate your design... maybe take advantage of more specialized hardware processing instead of doing it in firmware.