I am trying my own sketch based on your sketch from
Your code is OK, no watchdog event occurs. But in my code task watchdog got triggered about 5 seconds after tasks was created.
My Task1code() in core 0 resends inputString to USB serial port.
My Task2code() in core 1 is listerning on 2nd serial port and it fills string variable inputString until ‘\n’ char reseived..
Here’s a cut from my serial monitor:
17:28:03.698 -> My tasks are going to create now …
17:28:03.698 -> … task1 was created just now!
17:28:04.168 -> … task2 was created just now!
17:28:08.726 -> E (11178) task_wdt: Task watchdog got triggered. The following tasks did not reset the watchdog in time:
17:28:08.726 -> E (11178) task_wdt: – IDLE0 (CPU 0)
17:28:08.726 -> E (11178) task_wdt: Tasks currently running:
17:28:08.726 -> E (11178) task_wdt: CPU 0: Task1
17:28:08.726 -> E (11178) task_wdt: CPU 1: loopTask
17:28:08.726 -> E (11178) task_wdt: Aborting.
17:28:08.726 -> abort() was called at PC 0x400d5e07 on core 0
17:28:08.726 -> Backtrace: 0x400853ec:0x3ffbe250 0x40085619:0x3ffbe270 0x400d5e07:0x3ffbe290 0x400814b5:0x3ffbe2b0 0x400d0b44:0x00000000
17:28:08.726 -> Rebooting…
Note please, that there is no delay() calling in my Task1code(), because I dont want any delay there.
But if I place any delay() calling there ( e.g. delay(1); ), then no task watchdog event occurs.
I found this:
1/ It seems that delay() function clears the task watchdog hiddenly (in the background).
2/ Task2code() asigned to core 1 does not need any delay() call. Because core 1 probably does not need to handle watchdog explicitly.
3/ It seems that any Task assigned to core 0 requires to clear the watchdog explicitly.
Here is my question: Is there another way (other than delay() calling) how to handle the task watchdog?
There is no word about watchdog in yout eBooks. I know what watchdog is and for what does it serve. But please can you help me to orientate myself faster in ESP32 watchdog timer clearing in Arduino ?
Unfortunately I’m not very familiar with this subject.
I think you really need to add that delay on core 0, otherwise the watchdog will be triggered. Here is a discussion about this subject that may help you: https://github.com/espressif/arduino-esp32/issues/595
Additionally, here is some information about watchdogs in ESP32 that may be useful: https://docs.espressif.com/projects/esp-idf/en/latest/api-reference/system/wdts.html
I’m sorry that I can’t help much. Meanwhile, if you find a solution let us know. It may be useful for other readers.