Memory corruption when using a queue between two cores?
Posted: Wed Feb 27, 2019 11:08 pm
Hi,
I have a queue of size 1 which contains a struct of some status fields. The queue is produced on core 1 and consumed on core 0.
Here is how I am producing the queue
Here is how I am consuming the queue
I am having lots of strange crash issues when I am attempting to read and write this queue at high speed. I'm seeing everything from a "stack overflow has been detected" (Even though uxTaskGetStackHighWaterMark() shows plenty of free space right up until the event) to a dump which literally takes almost a full minute to output (which usually leads back to some unhandled core exception, like an illegalload or illegalinstruction or something)
Removing the reading of the queue results in stable code. Any ideas as to what is going on here? FreeRTOS should guarantee that there is never a data hazard when overwriting the queue, while the other core is reading, correct?
I have a queue of size 1 which contains a struct of some status fields. The queue is produced on core 1 and consumed on core 0.
Here is how I am producing the queue
Code: Select all
xQueueOverwrite(thing_telemetry_queue, &tlm);
Code: Select all
bool Thing_GetTelemetry(ThingTelemetry_t* state)
{
return (xQueuePeek(thing_telemetry_queue, &state, 0) == pdPASS);
}
Removing the reading of the queue results in stable code. Any ideas as to what is going on here? FreeRTOS should guarantee that there is never a data hazard when overwriting the queue, while the other core is reading, correct?