wdt
-
- Posts: 9711
- Joined: Thu Nov 26, 2015 4:08 am
Re: wdt
Also, which wdt? There are two; an interrupt wdt as well as a task wdt. You normally shouldn't have to disable them; if they trigger, in 98% of the time they do it because the design or implementation of your program is wrong. In that case, the wdt is only showing you that something is wrong; disabling it will fix the symptom but not the original issue.
Re: wdt
Looking at the API docs, we see that the recommended solution is to call esp_task_wdt_feed() to feed the watch dog. I have also seen recipes such as vTaskDelay(1). Are there any pros or cons between these (assuming both work). Is RTOS "taskYIELD" an option as well (http://www.freertos.org/a00020.html#taskYIELD)?
Free book on ESP32 available here: https://leanpub.com/kolban-ESP32
Re: wdt
esp_task_wdt_feed() is required for a watched task to feed the watchdog
vTaskDelay will allow other watched tasks including the idle task to run and feed the watchdog
taskYIELD will only allow higher priority tasks to run and feed the watchdog
In general, don't hog the CPU(s)
vTaskDelay will allow other watched tasks including the idle task to run and feed the watchdog
taskYIELD will only allow higher priority tasks to run and feed the watchdog
In general, don't hog the CPU(s)
-
- Posts: 9711
- Joined: Thu Nov 26, 2015 4:08 am
Re: wdt
Expanded slightly: The task watchdog is capable of, as the name implies, watching tasks. Now, a task needs to elect itself to be watched, that is, it has to tell the task watchdog it will feed it every now and then and there's something weird going on if a task that promised that, doesn't feed the task watchdog. Normally (but this is configurable in menuconfig), the idle tasks will do this: every time they run, they will feed the watchdog. This is useful because if a task with a higher priority is spinning, the idle tasks can't feed the watchdog, and the watchdog will tell you something is wrong.
Now, if you have a thread you expect to do the same thing periodically and something is wrong if it doesn't, you can also elect to have the watchdog watch this thread. You do this by putting esp_task_wdt_feed() in the main loop of the task. The first time the task calls esp_task_wdt_feed(), the task watchdog will register the task as watched, and will expect it to call esp_task_wdt_feed() for the duration of the life of the task. So, calling esp_task_wdt_feed() in a thread randomly does *not* affect the idle threads watchdog timeout message, that will still happen if you starve the idle threads.
Now, if you have a thread you expect to do the same thing periodically and something is wrong if it doesn't, you can also elect to have the watchdog watch this thread. You do this by putting esp_task_wdt_feed() in the main loop of the task. The first time the task calls esp_task_wdt_feed(), the task watchdog will register the task as watched, and will expect it to call esp_task_wdt_feed() for the duration of the life of the task. So, calling esp_task_wdt_feed() in a thread randomly does *not* affect the idle threads watchdog timeout message, that will still happen if you starve the idle threads.
Re: wdt
Hi,
This topic is quite old, but I have the same idle task wdt feed issue.
I created a ble gatt service referring to gatts_demo in esp_idf, and I have a task which calculates some data using digital inputs and sensors. I initialized ble gatt in app_main, and then created a task for calculations as below:
Even if I call vTaskDelay in task loop, I get these prints: "Task watchdog got triggered. The following tasks did not feed the watchdog in time".
My questions:
- Does esp_ble_gatts_app_register() function create a thread? or is it a blocking function?
- What is the idle task here?
- How can I feed wdt? Where should I call esp_task_wdt_feed()?
- I tried taskYIELD instead of vTaskDelay in task while loop, result is same. Why?
I'm new to ESP32 and freeRTOS, so forgive me if my questions are silly.
Thanks,
This topic is quite old, but I have the same idle task wdt feed issue.
I created a ble gatt service referring to gatts_demo in esp_idf, and I have a task which calculates some data using digital inputs and sensors. I initialized ble gatt in app_main, and then created a task for calculations as below:
Code: Select all
void app_main()
{
/* Ble gatts initializations here...*/
xTaskCreate(measurementTask, "measurementTask", 2048, NULL, 5, NULL);
esp_ble_gatts_register_callback(gatts_event_handler);
esp_ble_gap_register_callback(gap_event_handler);
esp_ble_gatts_app_register(PROFILE_A_APP_ID);
return;
}
My questions:
- Does esp_ble_gatts_app_register() function create a thread? or is it a blocking function?
- What is the idle task here?
- How can I feed wdt? Where should I call esp_task_wdt_feed()?
- I tried taskYIELD instead of vTaskDelay in task while loop, result is same. Why?
I'm new to ESP32 and freeRTOS, so forgive me if my questions are silly.
Thanks,
Re: wdt
Does the diagnostic message written to serial output contain the identity of which task is being starved?
Free book on ESP32 available here: https://leanpub.com/kolban-ESP32
Re: wdt
here is the serial output I get:kolban wrote:Does the diagnostic message written to serial output contain the identity of which task is being starved?
Code: Select all
Task watchdog got triggered. The following tasks did not feed the watchdog in time:
- IDLE (CPU 1)
Tasks currently running:
CPU 0: IDLE
CPU 1: speedCalInit
In addition, if I disable "Task watchdog watches CPU0 idle task" option by menuconfig, the warning disappears as it should be.
many thanks
-
- Posts: 9711
- Joined: Thu Nov 26, 2015 4:08 am
Re: wdt
What do you do in speedCalInit? Do you happen to spin for multiple seconds without calling a FreeRTOS function which waits for something? If so, then that may be your problem.
Who is online
Users browsing this forum: No registered users and 59 guests