How to Ensure Atomic Access to Queue in ESP32 FreeRTOS Project?
Hey guys so while i was developing an ESP32 IoT project using FreeRTOS, I'm encountering intermittent data corruption when two tasks share a queue for sensor data (readSensorTask: Reads temperature, humidity, and pressure data from sensors (BME280) every 1 second and the processDataTask: Processes the sensor data and sends it to a cloud server (MQTT) every 10 seconds.) Despite using mutexes, I'm seeing the following error:
Guru Meditation Error: Core 0 panic'ed (LoadProhibited)
Guru Meditation Error: Core 0 panic'ed (LoadProhibited)
Error message:
pc 0x400f36d6 ps 0x6000003f (crash log attached)
pc 0x400f36d6 ps 0x6000003f (crash log attached)
I was trying to send sensor data to the queue using: