Watchdog on core 0

alanmasutti
Posts: 2
Joined: Tue Apr 28, 2020 1:43 pm

Watchdog on core 0

Postby alanmasutti » Fri Apr 30, 2021 9:43 am

Hi everyone,
preview:
- Working with ESP-WROOM-32 DEVKIT
- ARDUINO IDE with 1.0.6 ESP32 boad manager
Problem:
In setup statement I create a new task pinned to core 0 and I add this task to TWDT supervision.

In the task loop function I reset the TWDT only if a button on GPIO14 is unpressed, else ESP32 waits for TWDT reboot; however the TWDT is trigger by the IDLE0 task (that I don't now what it is) and the backtrace in serial is the following:

Code: Select all

E (30162) task_wdt: Task watchdog got triggered. The following tasks did not reset the watchdog in time:
E (30162) task_wdt:  - IDLE0 (CPU 0)
E (30162) task_wdt: Tasks currently running:
E (30162) task_wdt: CPU 0: TASK0_T
E (30162) task_wdt: CPU 1: IDLE1
E (30162) task_wdt: Aborting.
abort() was called at PC 0x400e0fd3 on core 0

ELF file SHA256: 0000000000000000

Backtrace: 0x40084e9c:0x3ffbe4e0 0x40085111:0x3ffbe500 0x400e0fd3:0x3ffbe520 0x4008382d:0x3ffbe540 0x400d1c61:0x3ffb4650 0x400d0db5:0x3ffb4670 0x400d0f9e:0x3ffb4690 0x400d0fc5:0x3ffb46b0 0x400d0bf1:0x3ffb46d0 0x40086121:0x3ffb46f0

Rebooting...
My code is this:

Code: Select all

#include <soc/rtc_wdt.h>
#include <esp_int_wdt.h>
#include <esp_task_wdt.h>

TaskHandle_t task0_t;

void task0Loop(void *pvParameters) {
  while (1) {
    Serial.println("Resetting task0 WDT...");
    esp_task_wdt_reset();
    while (!digitalRead(14)) {
      delay(10);
    }
  }
}

void taskInit(){
  xTaskCreatePinnedToCore(
    task0Loop,   /* Task function. */
    "TASK0_T",   /* name of task. */
    10000,       /* Stack size of task */
    NULL,        /* parameter of the task */
    3,           /* priority of the task */
    &task0_t,    /* Task handle to keep track of created task */
    0);
}

//WDT
void initWDT() {
  //Intrrupt WTD
  esp_int_wdt_init();

  //TWDT
  esp_task_wdt_init(10, true);
  esp_task_wdt_add(task0_t);
}

void setup() {
  Serial.begin(115200);
  delay(5000);
  taskInit();
  initWDT();
  pinMode(14, INPUT_PULLUP);
  pinMode(13, INPUT_PULLUP);
}

void loop() {

}
Thank you in advance,

Alan Masutti

ESP_Sprite
Posts: 8921
Joined: Thu Nov 26, 2015 4:08 am

Re: Watchdog on core 0

Postby ESP_Sprite » Thu May 06, 2021 8:44 am

The task watchdog does not do what you think it does. In general, it makes sure that whatever task uses it gets regular processor time. By calling the reset function in your own task, what you've accomplished is that it now will also watch your task (and complain if it doesn't call that reset function regularly), but aside from that it'll also still watch the idle task.

Possibly a better question to ask is: why are you insistent on silencing the task watchdog? Things like the idle task not being able to run usually indicate that you're not making proper use of the software framework. Perhaps it's a better idea to solve that instead?

Who is online

Users browsing this forum: No registered users and 64 guests