Does ESP32-Arduino Have a WDT Running on Core 1?

gfvalvo
Posts: 36
Joined: Thu Dec 24, 2020 3:06 pm

Does ESP32-Arduino Have a WDT Running on Core 1?

Postby gfvalvo » Fri Jun 04, 2021 2:33 pm

Hi all.
So, I asked this question over at the Arduino forum but did not get a satisfactory answer. I’ve seen some folks on that forum report getting WDT resets even if their code only used the standard Arduino setup() / loop() paradigm.

Since that paradigm runs on Core 1, I wondered how that core could be made to WDT reset. The code below uses a task running at highest possible priority to lock the core in a tight, endless loop.

If this task is created on Core 0, you’ll be treated to endless WDT resets.

But, if created on Core 1, things are totally quiet. No WDT resets.

This leads me to two possible conclusions:

* There is no task running on Core 1 whose job it is to periodically tickle the WDT to prevent resets. Hence, there is no WDT or WDT interrupt set up on Core 1.

* The WDT tickling task is also running at the highest possible priority. Thus, it gets time to do its job thanks to the FreeRTOS system tick interrupts.

But, if either of the above are true, how do Arduino people still manage to get WDT resets?

FWIW, I ran my test on an Adafruit ESP32 Huzzah.

Thanks.

Code: Select all

#include "Arduino.h"

void hungTask(void *pvParameters);

void setup() {
	Serial.begin(115200);
	delay(1000);
	Serial.printf("%d\n", configMAX_PRIORITIES);

	BaseType_t createdTask = xTaskCreatePinnedToCore(hungTask, "Hung Task", 2000, NULL, configMAX_PRIORITIES, NULL, 1);
	if (createdTask == pdFAIL) {
		Serial.printf("Failed to create handleEncoder task.\n");
	}
}

void loop() {
}

void hungTask(void *pvParameters) {
	Serial.printf("Entered Hung Task\n");
	for(;;){
	}
}

ullixesp
Posts: 83
Joined: Wed Oct 16, 2019 9:34 am
Location: Germany

Re: Does ESP32-Arduino Have a WDT Running on Core 1?

Postby ullixesp » Fri Jun 04, 2021 3:53 pm

This is interesting. I am struggling with the problem of ESPAsyncWebserver crashing due to WDT on large files (>100k), detailed here: https://github.com/me-no-dev/ESPAsyncWe ... issues/984

so, I ran your script as posted. Indeed, just the output '25', then 'Entered Hung Task' and then nothing. Strange.

On my problem I get WDT crashes like this:

Code: Select all

E (30449) task_wdt: Task watchdog got triggered. The following tasks did not reset the watchdog in time:
E (30449) task_wdt:  - async_tcp (CPU 0/1)
E (30449) task_wdt: Tasks currently running:
E (30449) task_wdt: CPU 0: IDLE0
E (30449) task_wdt: CPU 1: loopTask
E (30449) task_wdt: Aborting.
In this example, out of a total of 293 crashes, 292 were of this (CPU 0/1) type, and only 1 of (CPU 1) type, none of (CPU 0) type. I don't know what `(CPU 0/1)` means. And why nothing on `(CPU 0)`, where the webserver runs?

Your observation makes this even more mysterious.

gfvalvo
Posts: 36
Joined: Thu Dec 24, 2020 3:06 pm

Re: Does ESP32-Arduino Have a WDT Running on Core 1?

Postby gfvalvo » Sat Jun 05, 2021 12:08 am

I am struggling with the problem of ESPAsyncWebserver crashing due to WDT on large files (>100k), detailed here:
Quite frankly, tl;dr and way too far in to the weeds.
But, did you get any clue from running the Exception Decoder? Any idea of which task / function is the actual culprit?

Who is online

Users browsing this forum: No registered users and 74 guests