Esp32 corruption issue freeRTOS

hi team,

I'm getting the below issue very few times a day, but it makes our device esp32 reset.
so please help me to fix issue,

15:56:13.737 -> QUEUE COUNT : 1
15:56:13.737 -> CAR-PRARAMS POSTING
15:56:13.737 -> ::: SIM TIMEOUT DETECTED ::::
15:56:25.698 -> ::: SIM TIMEOUT DETECTED ::::
15:56:25.698 -> E (858634) task_wdt: Task watchdog got triggered. The following tasks did not reset the watchdog in time:
15:56:25.698 -> E (858634) task_wdt: - IDLE (CPU 0)
15:56:25.698 -> E (858634) task_wdt: Tasks currently running:
15:56:25.698 -> E (858634) task_wdt: CPU 0: Task2
15:56:25.698 -> E (858634) task_wdt: CPU 1: loopTask
15:56:25.698 -> E (858634) task_wdt: Aborting.
15:56:25.698 ->
15:56:25.698 -> abort() was called at PC 0x400e3061 on core 0
15:56:25.698 ->
15:56:25.698 ->
15:56:25.698 -> Backtrace: 0x40083a41:0x3ffbea7c |<-CORRUPTED
15:56:25.698 ->
15:56:25.698 ->
15:56:25.698 ->
15:56:25.698 ->
15:56:25.698 -> ELF file SHA256: fe5f9b0ca3095255
15:56:25.698 ->
15:56:25.698 -> Rebooting...

Here our freeRTOS setup , as i guess, it could be issue with configuration :

 delay(1000);
  xTaskCreatePinnedToCore(
    task1,   /* Task function. */
    "Task1",     /* name of task. */
    50000,       /* Stack size of task */
    NULL,        /* parameter of the task */
    3,           /* priority of the task */
    &Task1,      /* Task handle to keep track of created task */
    1);          /* pin task to core 1 */
  delay(500);
  xTaskCreatePinnedToCore(
    task2,   /* Task function. */
    "Task2",     /* name of task. */
    50000,       /* Stack size of task */
    NULL,        /* parameter of the task */
    3,           /* priority of the task */
    &Task2,      /* Task handle to keep track of created task */
    0);          /* pin task to core 0 */
  delay(500);
  xTaskCreatePinnedToCore(
    HarshMovementDetect,   /* Task function. */
    "Task3",     /* name of task. */
    5000,       /* Stack size of task */
    NULL,        /* parameter of the task */
    1,           /* priority of the task */
    &Task3,      /* Task handle to keep track of created task */
    1);          /* pin task to core 1 */
  delay(500);

here our readdata function of sim module, A7672s , AT command using uart :

void ReadData() {
  int start = millis(); char inData_PIC;
  BuildINString = "";
  while (true) {
    if (Serial2.available() > 0)
      { inData_PIC = Serial2.read(); BuildINString = BuildINString + char(inData_PIC); }
    if (BuildINString.indexOf(">") != -1) 
      { if (BuildINString.indexOf("NO DATA") != -1 or BuildINString.indexOf("CAN ERROR") != -1  ) 
          { BuildINString = ""; return; } 
        if (BuildINString.indexOf("STOPPED") != -1 )
          { Serial.println(F(":::: STOPPED ERROR ::::")); Serial.println(BuildINString);
            BuildINString = ""; return; 
          }
        return;
      }
    else if (millis() - start > 4000)
    { Serial.println(F(":::: PID TIMEOUT DETECTED ::::")); Serial.println(BuildINString);
      return; 
    }
  }
}

Pleas let me know, possible cause, so i can try to fix my code.

Thanks

you need to find what's causing this

adding a delay(1); or a yield(); in your while (true) loop might help. (don't get stuck for too long into the loop or the watchdog barks basically. delay() will pat the dog, may be yield() will do too.

1 Like

Post your complete code all in one shot so we don't have to put it together from piecemeal snippets.

Thanks, actually code is too long, I found, the problem is with the above section only. But I'll try to post after removing secure APIs etc. if i could't solve issue as @J-M-L suggestion.

This topic was automatically closed 180 days after the last reply. New replies are no longer allowed.