Task event management

giso1 wrote on Friday, April 27, 2018:

Hi,

I have the following pseudo code

task_run()
{
while (true)
{
xTaskNotifyWait(eventA|eventB)
if (eventA)
{
send RF command
xTaskNotifyWait(eventA)
}
if (eventB)
{
process command
}
do something else
}
}

EventA is triggered by interrupt when RF data is received.
EventB is triggered when application request to trigger a cmd
I have the following issue when I have the following sequence

  • EventA received
  • task is woken up
  • EventB occurs before the second xTaskNotifyWait is called
    the first xTaskNotifyWait(eventA|eventB) will not detect eventB.

to simulate I do the following
task_run()
{
while (true)
{
xTaskNotifyWait(eventA|eventB)
if (eventA)
{
trigger EventB
send RF command
xTaskNotifyWait(eventA)
}
if (eventB)
{
process command
}
do something else
}
}

Is that the expected behaviour?
I would have expected that when waiting for a specific event, xTaskNotifyWait would only retrieve these specific events and if other event have been set they would be kept and available for other call to xTaskNotifyWait.

Thanks for feedback.

rtel wrote on Friday, April 27, 2018:

This has been answered here: https://sourceforge.net/p/freertos/discussion/382005/thread/d0a7ccd2/