Why Can't I WDT-Crash ESP32 Core 1?

Not that I'm complaining mind you, just curious. Compiling and running code below on an Adafruit ESP32 feather. The high-priority task invokes function hungTask() that locks up in a tight loop. Yet, no WDT time-out crashes. Is this expected?

Try this same nonsense with Core 0 (the core running the WiFi handler as I understand) and you're in for a world of hurt.

Thanks.

#include "Arduino.h"

void hungTask(void *pvParameters);

void setup() {
  Serial.begin(115200);
  delay(1000);

  xTaskCreatePinnedToCore(hungTask, "Hung Task", 2000, NULL, 10, NULL, 1);
}

void loop() {
}

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

Whiles you only assigned 1 task to core1 there are, actually, 2 tasks being assigned to core1; your task and loop(). One of the subtle differences between core0 and core1 is that core1 is assigned the task of loop(), which, when empty and run by freeRTOS, will do various housekeep chores.

So, what is the priority of said "housekeep" task? Can I give my "Hung Task" a high enough priority such that "housekeep" task will never run and I'll thus get a WDT Crash on Core 1?

My interest is not crashing the ESP32's I use, please experiment and report here on your results.

If you want to crash the core make a task with a small stack space and have it work with an array size bigger then the task stack size.

Alrighty then. Obviously allocating insufficient stack space to a task will cause a crash. But, just as obviously, not one related to the WDT.

My interest is also not in crashing the processor, but in understanding what (if any) tasks are running on Core 1, besides the one I created.

The code below prints out 'configMAX_PRIORITIES' (as defined in FreeRTOSConfig.h) and then proceeds to assign that priority to hungTask. Still, no WDT-related crashes. So, I still see no evidence supporting the assertion that there is a task running on Core 1 whose job it is (in part) to tickle the WDT in order to prevent a crash caused by an interrupt from same. Unless this task is also assigned priority of 'configMAX_PRIORITIES'. I shall continue to dig.

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

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