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(;;){
}
}