What mechanism is appropriate?
Moderators: RoccoMarco, lbednarz, tfAteba
What mechanism is appropriate?
I have an application where there are two interrupts happening, and I think I want a thread waiting for the (one of the) interrupt(s) to happen or a timeout. What is the easiest/best way to do this? Semaphores? Events? Messages? Mailboxes?
- RoccoMarco
- Posts: 655
- Joined: Wed Apr 24, 2013 4:11 pm
- Has thanked: 83 times
- Been thanked: 67 times
Re: What mechanism is appropriate?
Is it an internal or external interrupt? (in case of STM32 EXTI or NVIC)?
- Giovanni
- Site Admin
- Posts: 14895
- Joined: Wed May 27, 2009 8:48 am
- Has thanked: 1202 times
- Been thanked: 997 times
Re: What mechanism is appropriate?
All the one you mentioned can be used except messages.
If you don't need to pass data then binary semaphores else mailboxes.
Giovanni
If you don't need to pass data then binary semaphores else mailboxes.
Giovanni
Re: What mechanism is appropriate?
One is EXTI. The other is DMA done.
Is the "output" of the EXTI module not handled just like any other (NVIC) interrupt?
Regarding data. Yes there is data.... 512 bytes worth... Let's just keep that data in the buffer that we allocated for that.
So, for all practical purposes, there is no data to pass.
Last time I had something like this, I guessed at an appropriate mechanism, and later found out there was another one much better suited. Rewriting the existing code didn't happen.... That it CAN be done with all is not really my question. I would like a recommendation on which to use. which fits best?....
Ok. Binary semaphores it is....
UPDATE: It works!
Thanks.
Oh! Wait! One more thing that I need to figure out. How do I wait for the serial port output buffer to drain ?
Is the "output" of the EXTI module not handled just like any other (NVIC) interrupt?
Regarding data. Yes there is data.... 512 bytes worth... Let's just keep that data in the buffer that we allocated for that.
Last time I had something like this, I guessed at an appropriate mechanism, and later found out there was another one much better suited. Rewriting the existing code didn't happen.... That it CAN be done with all is not really my question. I would like a recommendation on which to use. which fits best?....
Ok. Binary semaphores it is....
UPDATE: It works!
Oh! Wait! One more thing that I need to figure out. How do I wait for the serial port output buffer to drain ?
- RoccoMarco
- Posts: 655
- Joined: Wed Apr 24, 2013 4:11 pm
- Has thanked: 83 times
- Been thanked: 67 times
Re: What mechanism is appropriate?
Is the "output" of the EXTI module not handled just like any other (NVIC) interrupt?
Yes it is. My inaccurate question was to figure out if interrupt sources was from an internal peripheral or an external pin since if you are using HAL internal IRQ are used by specific drivers. Just ignore my question.
- Giovanni
- Site Admin
- Posts: 14895
- Joined: Wed May 27, 2009 8:48 am
- Has thanked: 1202 times
- Been thanked: 997 times
Re: What mechanism is appropriate?
The serial driver sets events flags on various I/O conditions, buffers, errors etc.
Giovanni
Giovanni