PlatformIO Community

ERROR: COR/home/runner/xQueue "work/esp32-arduino-lib-builder/esp32-arduino-li

Please help me.
This message is meaningless for me!

The error happens in the beginning of code execution.

void setup()
{
  Serial.begin(115200);

...

  xTaskCreatePinnedToCore( 
      Core0_Setup,
      "Core 0 Setup",
      10000, 
      NULL, 
      1,
      &Core0_Setup_hdl,
      0);
...
}

The task comprehends:

void Core0_Setup(void *pvParameters)
{
    Serial.printf("\n\t[Core %u]: CORE 0 SETUP em %lums.",  xPortGetCoreID(), millis());
 
  startTimer();

  vQ_1s000 = xQueueCreate(10, sizeof(unsigned long));
  
  vTaskDelete(NULL);
};

Function startTimer:

void startTimer()
{
  timer = timerBegin(0, 80, true);
  timerAttachInterrupt(timer, &Contagem, true);
  timerAlarmWrite(timer, base_de_tempo, true);
  timerAlarmEnable(timer);
}

And the complete failure message:
"

    [Core 0]:duino-lib-builder/esp32-arduino-lib-builder/esp-idf/compone
    xQueue "nts/freertos/queue.c:1442 (xQueueGenericReceive)- assert failed!

abort() was called at PC 0x40086d39 on core 0

ELF file SHA256: 0000000000000000

Backtrace: 0x40085d80:0x3ffc6980 0x40085ffd:0x3ffc69a0 0x40086d39:0x3ffc69c0 0x400d1810:0x3ffc6a00 0x4008700e:0x3ffc6a30

Rebooting…
"

What should I check first?

Thank you.
Regards,
Ciro.

Is there any code calling into xQueueReceive? Is this the full code?

Yes, there is.
It happens in:

void vT_1s000(void *pvParameters) //                            *** CORE 0 - TASK vT_1s000
{ 
  unsigned long T_Chamada = 0;
  unsigned long atraso = 0;

  while (true)
  {
    if (xQueueReceive(vQ_1s000, &T_Chamada, portMAX_DELAY))
    {
      atraso = millis() - T_Chamada;

   Serial.printf("\n\t[Core %u]: TIMER - tempo de chamada = %lums, delay = %lums.", xPortGetCoreID(), T_Chamada, atraso);
    }
  }
}

Which is also created in setup() like:

  xTaskCreatePinnedToCore( //   função que monitora a chegada de elementos na queue vQ_1s000
      vT_1s000, 
      "Task 1s000",
      10000, 
      NULL,
      1, 
      &vT_1s000_hdl,
      0);   

But then that’s a race condition? What if the vT_1s000() task is executed first before the Core0_Setup() task had a chance to vQ_1s000 = xQueueCreate()..? The queue creation should happen in setup(), before anything tries to access it…

WORKING…

I’ve moved the queue creation to the setup, before all tasks creation, and now it’s working perfectly.

Thank you very much.