Page 1 of 1
What mechanism is appropriate?
Posted: Thu Jun 09, 2016 11:49 am
by rew
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?
Re: What mechanism is appropriate?
Posted: Thu Jun 09, 2016 11:55 am
by RoccoMarco
Is it an internal or external interrupt? (in case of STM32 EXTI or NVIC)?
Re: What mechanism is appropriate?
Posted: Thu Jun 09, 2016 12:02 pm
by Giovanni
All the one you mentioned can be used except messages.
If you don't need to pass data then binary semaphores else mailboxes.
Giovanni
Re: What mechanism is appropriate?
Posted: Thu Jun 09, 2016 12:07 pm
by rew
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 ?
Re: What mechanism is appropriate?
Posted: Thu Jun 09, 2016 1:14 pm
by RoccoMarco
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.
Re: What mechanism is appropriate?
Posted: Thu Jun 09, 2016 2:47 pm
by Giovanni
The serial driver sets events flags on various I/O conditions, buffers, errors etc.
Giovanni