Good morning,
I have a question concerning the Task Watch Dog Timer please.
I have read that when initializing the Task Watch Dog Timer, only the Idle task of each CPU was monitored by
the TWDT.
However, using the method esp_task_wdt_add, one have the possibility to monitor one or more application tasks.
It is written in the documentation that each task that is monitored have to feed the WDT so that it is not triggered.
Could you please explain me how does it work ? Are there more than one counter in the WatchDog timer in order to
monitor each task ? I don't understand how it can work with 5 tasks for example.
Thank you for your explainations,
best regards,
Thomas TRUILHE
Esp32s3 : Question about the Task Watch Dog Timer
-
- Posts: 229
- Joined: Thu Jul 14, 2022 5:15 am
Re: Esp32s3 : Question about the Task Watch Dog Timer
Here's the documentation for `esp_task_wdt_add`. You need to call `esp_task_wdt_reset` periodically from each of the (in your case) 5 registered tasks.
And here's a sample project from the IDF that demonstrates usage of the necessary code.
And here's a sample project from the IDF that demonstrates usage of the necessary code.
-
- Posts: 9739
- Joined: Thu Nov 26, 2015 4:08 am
Re: Esp32s3 : Question about the Task Watch Dog Timer
FWIW, the way it works (a bit simpified) is that esp_task_wdt_reset only sets a flag that for this round, the associated task did reset their watchdog. There's a timer that periodically calls a routine that checks if all the registered tasks have done so, and if that's the case it feeds the hardware watchdog. Failure of one or more tasks to feed the watchdog, or some sort of corruption that makes the timer routine not work, will cause the hardware watchdog to trigger.
-
- Posts: 229
- Joined: Thu Jul 14, 2022 5:15 am
Re: Esp32s3 : Question about the Task Watch Dog Timer
Good morning,
good, I know understand how the watchdog for the tasks works thank you.
So, I have registered my tasks and call the reset function periodically in each one.
Now, if the watchdog is triggered, I would like to reset the chip.
I have seen that for each stage of the watchdogs (TWD), I can define 3 actions (Interrupt, CPU reset, Core reset).
I would like to use the Core reset when the Watchdog is triggered (At the moment only printf are done).
Do you know how to configure the different stages of the watchdogs and how to tell that I would like to do a Core Reset ???
I don't see anything concerning the configuration.
Please, the same question concerning the Interrupt Watchdog. I see that it is activated by default,
but I don't see how to configure the action when the interrupt watchdog is triggered.
Best regards,
Thomas TRUILHE
good, I know understand how the watchdog for the tasks works thank you.
So, I have registered my tasks and call the reset function periodically in each one.
Now, if the watchdog is triggered, I would like to reset the chip.
I have seen that for each stage of the watchdogs (TWD), I can define 3 actions (Interrupt, CPU reset, Core reset).
I would like to use the Core reset when the Watchdog is triggered (At the moment only printf are done).
Do you know how to configure the different stages of the watchdogs and how to tell that I would like to do a Core Reset ???
I don't see anything concerning the configuration.
Please, the same question concerning the Interrupt Watchdog. I see that it is activated by default,
but I don't see how to configure the action when the interrupt watchdog is triggered.
Best regards,
Thomas TRUILHE
-
- Posts: 229
- Joined: Thu Jul 14, 2022 5:15 am
Re: Esp32s3 : Question about the Task Watch Dog Timer
Good morning,
I have finally found the registers concerning the WDT.
I am trying to asks/display the configuration registers of WDT0 which is ON when the
firmware is running (Used to monitor the tasks) and I get the following results :
=====> TIMG_T0_USE_XTAL : 0.
=====> TIMG_T0_ALARM_EN : 0.
=====> TIMG_T0_DIVIDER : 1.
=====> TIMG_T0_AUTORELOAD : 1.
=====> TIMG_T0_INCREASE : 1.
=====> TIMG_T0_EN : 0.
In order to display these values, I am using the lines :
RegValue = REG_GET_FIELD(TIMG_T0CONFIG_REG(0), TIMG_T0_USE_XTAL);
ESP_LOGI(TAG, "=====> TIMG_T0_USE_XTAL : %u.", RegValue);
RegValue = REG_GET_FIELD(TIMG_T0CONFIG_REG(0), TIMG_T0_ALARM_EN);
ESP_LOGI(TAG, "=====> TIMG_T0_ALARM_EN : %u.", RegValue);
RegValue = REG_GET_FIELD(TIMG_T0CONFIG_REG(0), TIMG_T0_DIVIDER);
ESP_LOGI(TAG, "=====> TIMG_T0_DIVIDER : %u.", RegValue);
RegValue = REG_GET_FIELD(TIMG_T0CONFIG_REG(0), TIMG_T0_AUTORELOAD);
ESP_LOGI(TAG, "=====> TIMG_T0_AUTORELOAD : %u.", RegValue);
RegValue = REG_GET_FIELD(TIMG_T0CONFIG_REG(0), TIMG_T0_INCREASE);
ESP_LOGI(TAG, "=====> TIMG_T0_INCREASE : %u.", RegValue);
RegValue = REG_GET_FIELD(TIMG_T0CONFIG_REG(0), TIMG_T0_EN);
ESP_LOGI(TAG, "=====> TIMG_T0_EN : %u.", RegValue);
>This is strange because the tasks watchdog is running but I get the value : TIMG_T0_EN : 0. (Enabled = 0).
Do you have any idea ?
Maybe this is due to the usage of the line TIMG_T0CONFIG_REG(0) => Do you know what I have to use a (0) at the end in order
to access the configuration register ?
Best regards,
I have finally found the registers concerning the WDT.
I am trying to asks/display the configuration registers of WDT0 which is ON when the
firmware is running (Used to monitor the tasks) and I get the following results :
=====> TIMG_T0_USE_XTAL : 0.
=====> TIMG_T0_ALARM_EN : 0.
=====> TIMG_T0_DIVIDER : 1.
=====> TIMG_T0_AUTORELOAD : 1.
=====> TIMG_T0_INCREASE : 1.
=====> TIMG_T0_EN : 0.
In order to display these values, I am using the lines :
RegValue = REG_GET_FIELD(TIMG_T0CONFIG_REG(0), TIMG_T0_USE_XTAL);
ESP_LOGI(TAG, "=====> TIMG_T0_USE_XTAL : %u.", RegValue);
RegValue = REG_GET_FIELD(TIMG_T0CONFIG_REG(0), TIMG_T0_ALARM_EN);
ESP_LOGI(TAG, "=====> TIMG_T0_ALARM_EN : %u.", RegValue);
RegValue = REG_GET_FIELD(TIMG_T0CONFIG_REG(0), TIMG_T0_DIVIDER);
ESP_LOGI(TAG, "=====> TIMG_T0_DIVIDER : %u.", RegValue);
RegValue = REG_GET_FIELD(TIMG_T0CONFIG_REG(0), TIMG_T0_AUTORELOAD);
ESP_LOGI(TAG, "=====> TIMG_T0_AUTORELOAD : %u.", RegValue);
RegValue = REG_GET_FIELD(TIMG_T0CONFIG_REG(0), TIMG_T0_INCREASE);
ESP_LOGI(TAG, "=====> TIMG_T0_INCREASE : %u.", RegValue);
RegValue = REG_GET_FIELD(TIMG_T0CONFIG_REG(0), TIMG_T0_EN);
ESP_LOGI(TAG, "=====> TIMG_T0_EN : %u.", RegValue);
>This is strange because the tasks watchdog is running but I get the value : TIMG_T0_EN : 0. (Enabled = 0).
Do you have any idea ?
Maybe this is due to the usage of the line TIMG_T0CONFIG_REG(0) => Do you know what I have to use a (0) at the end in order
to access the configuration register ?
Best regards,
Who is online
Users browsing this forum: No registered users and 94 guests