6 years, 3 months ago.

Queueing up tasks from a frequent ISR

Great explanation of the EventQueue. If I were to add a function (ie: printf) to a queue inside my ISR and the ISR is called frequently, how can I expect the queue buffer to respond? I have seen in the documentation how to adjust the size of the queue when instantiated, but it is still somewhat unclear to me.

Question relating to:

1 Answer

6 years, 3 months ago.

Hello Stephen,

If I am interpreting your question correctly, you are asking how Mbed responds when the event queue fills up. When you make the call to 'call', it returns a "unique id that represents the posted event and can be passed to cancel, or an id of 0 if there is not enough memory to allocate the event". EventQueue API

So from this it appears that you will get a zero as a return value from the call and your code could make appropriate decisions.

I hope this helps,

++ Earl, team Mbed

Accepted Answer

Ahhh yes. The "call" function has a return value. Thanks Earl. (Sorry about my late response.)

posted by Stephen Davis 26 Sep 2018

Hey Earl, It seems that my EventQueue/Thread pairs are causing a hard fault and I am not able to track down the specific cause nor the correct solution. I have played around with increasing the event queue depth and the size of the stack of the thread I run it on and I have checked to make sure that I don't have any memory leaks from not cleaning up after myself - yet I know when a particular event queue gets hammered with calls I will get a hard fault. Is it possible that this could be happening? Could my event queue has sufficient depth and yet run out of stack on its thread, creating a hard fault?

Thanks, Stephen

posted by Stephen Davis 28 Jan 2019