I am using the same sort of queue i/o in many places in my code, and all was working (RT1050 from NXP).
Updating my stack from NXP SDK 2.10 to 2.11, which also updates FreeRTOS from V10.4.3 to V10.4.3 LTS Patch 2.
With this update, just one of my many queues is getting stuck, so same method (I think) works in most places except one.
rando_task
sends a message to audio_task
(both at pri 3), then waits for audio_task
to message back via an EventGroup.
In the last version, this was working fine. I have plenty of RTOS stack headroom.
Basic code:
static void audio_task(void *pvParameters){
BaseType_t x_status;
audio_queue_event_t cmd_event;
if (audio_events == NULL){
audio_events = xEventGroupCreate();
}
x_audio_queue = xQueueCreate(3, sizeof(audio_queue_event_t));
//edit for posterity - this is where the freeze happened - thanks Richard :
buzzer(SOUND_PWRUP); //(added after the fact)
for (;;) {
x_status = xQueueReceive( x_audio_queue, &cmd_event, portMAX_DELAY );
if( x_status == pdPASS ) {
buzzer(cmd_event.sound_clip_e);
xEventGroupSetBits(audio_events, ON_SOUND_STARTED);
}
}
}
For ^^^, x_audio_queue
was successfully created and allocated, same with audio_events
group.
The caller that gets stuck (also on a task @ pri 3:
void audio_play_sound(soundclip_enum_t sc){
EventBits_t event_bits;
BaseType_t x_status;
static audio_queue_event_t cmd_event;
cmd_event.sound_clip_e = sc;
x_status = xQueueSendToBack(x_audio_queue, &cmd_event, 0);
if (x_status != pdPASS) {
return;
}
event_bits = xEventGroupWaitBits(audio_events, ON_SOUND_STARTED, pdTRUE, pdFALSE, portMAX_DELAY);
if ((event_bits & ON_SOUND_STARTED) != ON_SOUND_STARTED){
// return kStatus_Fail; //shouldn't happen
}
}
Any ideas on what I may be doing that could cause a break between FreeRTOS/SDK versions? I am doing the same queue->eventgroup pingpong kind of wait in other areas of code without issue…
What I am seeing is that the audio_task
never gets out of the xQueueReceive (so it doesn’t even try to call the buzzer
function).
Tried also increasing audio_task’s priority to 4, but that doesn’t help.