Configure task watchdog to always reset chip

RichPiano
Posts: 123
Joined: Mon May 18, 2020 2:51 pm

Configure task watchdog to always reset chip

Postby RichPiano » Thu Oct 13, 2022 4:29 pm

I currently have some problems using the http/tls libraries from esp in that they sometimes trigger watchdog timeouts when the connection is bad.

As the app is stuck if only one core is reset, I intend to change it so that the whole cpu resets (practically making the esp32 reboot). Now from https://www.espressif.com/sites/default ... ual_en.pdf I read that:
The expiry action and time period for each stage can be configured individually.

If that is so where can I find the configuration? idf.py menuconfig only offers the config documented in https://docs.espressif.com/projects/esp ... /wdts.html :
CONFIG_ESP_TASK_WDT - the TWDT is initialized automatically during startup. If this option is disabled, it is still possible to initialize the Task WDT at runtime by calling esp_task_wdt_init().

CONFIG_ESP_TASK_WDT_CHECK_IDLE_TASK_CPU0 - CPU0 Idle task is subscribed to the TWDT during startup. If this option is disabled, it is still possible to subscribe the idle task by calling esp_task_wdt_add() at any time.

CONFIG_ESP_TASK_WDT_CHECK_IDLE_TASK_CPU1 - CPU1 Idle task is subscribed to the TWDT during startup.
But I can't find any configuration for the individual stages? Do I have to manually set some registers?

supercachai
Posts: 3
Joined: Mon May 22, 2023 9:25 pm

Re: Configure task watchdog to always reset chip

Postby supercachai » Fri Nov 01, 2024 1:20 am

in `components/esp_system/task_wdt/task_wdt.c`
you'll find

Code: Select all

    if (esp_task_wdt_isr_user_handler != NULL) {
        esp_task_wdt_isr_user_handler();
    }
which has a declaration in components/esp_system/include/esp_task_wdt.h:

Code: Select all

 /**
 * @brief User ISR callback placeholder
 *
 * This function is called by task_wdt_isr function (ISR for when TWDT times out). It can be defined in user code to
 * handle TWDT events.
 *
 * @note It has the same limitations as the interrupt function. Do not use ESP_LOGx functions inside.
 */
void __attribute__((weak)) esp_task_wdt_isr_user_handler(void);

So you just need to `#include <esp_task_wdt.h>` and define esp_task_wdt_isr_user_handler() in your app's code.

Who is online

Users browsing this forum: Bing [Bot], Lobelois, ltsm0265 and 99 guests