Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Working on ESP32-S3, but the priority must be set with 0, otherwise the CPU will falt to reset。 #349

Open
kylongmu opened this issue May 7, 2024 · 3 comments

Comments

@kylongmu
Copy link

kylongmu commented May 7, 2024

`
xTaskCreatePinnedToCore(
taskModbus,
"taskModbus",
1 << 14,
NULL,
0, //Must be 0
NULL,
0); //ARDUINO_RUNNING_CORE is 1

}

void taskModbus(void* parameter) {
Serial1.begin(9600, SERIAL_8N2, RX_PIN, TX_PIN);
mb.begin(&Serial1);
mb.slave(Hreg_file[0]);
mb.addHreg(0, 0, 16);
mb.addHreg(Hreg_address, 0, Hreg_size);
//Serial.printf("Running task taskModbus%d\n", xPortGetCoreID());
while (1) {
mb.task();
yield();
}
Serial.println("Ending task taskModbus");
vTaskDelete(NULL);
}

`
When the priority set to others, CPU reboot with this output:

E (10135) task_wdt: Task watchdog got triggered. The following tasks did not reset the watchdog in time:
E (10135) task_wdt: - IDLE (CPU 0)
E (10135) task_wdt: Tasks currently running:
E (10135) task_wdt: CPU 0: taskModbus
E (10135) task_wdt: CPU 1: IDLE
E (10135) task_wdt: Aborting.

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

@MeisterQ
Copy link

Is there any work in progress here? I came to this issue aswell.

@emelianov
Copy link
Owner

Waiting of -s3 board to arrive

@M4E5TR0-MUN1R
Copy link

Hello,

  • The way to solve this issue is to replace the yield(); with vTaskDelay(pdMS_TO_TICKS(100));
  • Explanation: yield(); will only allow higher priority tasks to run, but the watchdog runs in the idle task (priority 0) so it won't get a chance to run if the taskModbus has a higher priority.
  • Long Story Short: If you want taskModbus to run at a higher priority than 0. Dont use yield(); function.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

4 participants