Watchdog changes from V3.1 to V4.1

CharlesSeartech
Posts: 19
Joined: Fri Oct 06, 2017 10:27 am

Watchdog changes from V3.1 to V4.1

Postby CharlesSeartech » Mon Nov 23, 2020 11:04 am

Good day,

After upgrading from IDF V3.1 to V4.1 the watchdog does not behave the same and I can't find documentation relating to the issue I have.
If I run the task_watchdog example and only enable the interrupt watchdog, sdconfig setting below:
CONFIG_ESP_INT_WDT=y
CONFIG_ESP_INT_WDT_TIMEOUT_MS=300
CONFIG_ESP_INT_WDT_CHECK_CPU1=y
# CONFIG_ESP_TASK_WDT is not set
# CONFIG_ESP_PANIC_HANDLER_IRAM is not set

I get the following output:
Initialize TWDT
Delay for 10 seconds
E (6309) task_wdt: Task watchdog got triggered. The following tasks did not reset the watchdog in time:
E (6309) task_wdt: - IDLE0 (CPU 0)
E (6309) task_wdt: Tasks currently running:
E (6309) task_wdt: CPU 0: IDLE0
E (6309) task_wdt: CPU 1: IDLE1
E (9309) task_wdt: Task watchdog got triggered. The following tasks did not reset the watchdog in time:
E (9309) task_wdt: - IDLE0 (CPU 0)
E (9309) task_wdt: Tasks currently running:
E (9309) task_wdt: CPU 0: IDLE0
E (9309) task_wdt: CPU 1: IDLE1
E (12309) task_wdt: Task watchdog got triggered. The following tasks did not reset the watchdog in time:
E (12309) task_wdt: - IDLE0 (CPU 0)
E (12309) task_wdt: Tasks currently running:
E (12309) task_wdt: CPU 0: IDLE0
E (12309) task_wdt: CPU 1: IDLE1
Unsubscribing and deleting tasks
Complete

I then activate the TWDT in the config:
CONFIG_ESP_INT_WDT=y
CONFIG_ESP_INT_WDT_TIMEOUT_MS=300
CONFIG_ESP_INT_WDT_CHECK_CPU1=y
CONFIG_ESP_TASK_WDT=y
CONFIG_ESP_TASK_WDT_PANIC=y
CONFIG_ESP_TASK_WDT_TIMEOUT_S=5
CONFIG_ESP_TASK_WDT_CHECK_IDLE_TASK_CPU0=y
CONFIG_ESP_TASK_WDT_CHECK_IDLE_TASK_CPU1=y

and re-running the code I get the following output:
Initialize TWDT
Delay for 10 seconds
E (6306) task_wdt: Task watchdog got triggered. The following tasks did not reset the watchdog in time:
E (6306) task_wdt: - IDLE0 (CPU 0)
E (6306) task_wdt: Tasks currently running:
E (6306) task_wdt: CPU 0: IDLE0
E (6306) task_wdt: CPU 1: IDLE1
E (9306) task_wdt: Task watchdog got triggered. The following tasks did not reset the watchdog in time:
E (9306) task_wdt: - IDLE0 (CPU 0)
E (9306) task_wdt: Tasks currently running:
E (9306) task_wdt: CPU 0: IDLE0
E (9306) task_wdt: CPU 1: IDLE1
E (12306) task_wdt: Task watchdog got triggered. The following tasks did not reset the watchdog in time:
E (12306) task_wdt: - IDLE0 (CPU 0)
E (12306) task_wdt: Tasks currently running:
E (12306) task_wdt: CPU 0: IDLE0
E (12306) task_wdt: CPU 1: IDLE1
Unsubscribing and deleting tasks
Complete

i.e. the same result. I then commented out the line:
//CHECK_ERROR_CODE(esp_task_wdt_reset(), ESP_OK); //Comment this line to trigger a TWDT timeout
and get the same result. So the IDLE task is not resetting the watchdog.

My questions are as follows:
1.) In V3.1 I had the following sdconfig setting:
CONFIG_INT_WDT=y
CONFIG_INT_WDT_TIMEOUT_MS=500
CONFIG_INT_WDT_CHECK_CPU1=y
CONFIG_TASK_WDT=y
CONFIG_TASK_WDT_PANIC=y
CONFIG_TASK_WDT_TIMEOUT_S=3
CONFIG_TASK_WDT_CHECK_IDLE_TASK_CPU0=y
CONFIG_TASK_WDT_CHECK_IDLE_TASK_CPU1=y
and I added one of my own tasks to the TWDT list and all worked as expected, if the Wi-Fi hung or my task hung the WDT would reset.
But now it just prints a panic message and doesn't reset. Why?

2.) With V3.1 I didn't get the IDLE task triggered messages so I'm assuming the IDLE tasks were resetting the WDT, is this the case?

3.) If I have to handle the WDT reset in the IDLE tasks now how do I hook into the CPU 0 IDLE task to reset the WDT, I currently have access to the CPU 1 IDLE task via vApplicationIdleHook()?

4.) How do I get the application to reset if there is a TWDT and not just print the panic message?
The CONFIG_ESP32_PANIC_PRINT_REBOOT=y is set to print and reboot.

Regards,
Charles

Who is online

Users browsing this forum: Bing [Bot] and 51 guests