The search function on this site seems very unreliable so apologies if this has been brought up elsewhere. I did try to search but I just got blank pages as a result.
I'm using ESP IDF v4.3 with a standard ESP32 module.
According to the menuconfig help, the task watchdog is enabled by default (ESP_TASK_WDT=Y) and initialized on startup.
I have a busy loop in my main task that is calling [Codebox]esp_task_wdt_reset()[/Codebox] and [Codebox]taskYIELD()[/Codebox] to feed the watchdog reliably. This seems to work.
But the docs for [Codebox]esp_task_wdt_reset()[/Codebox] say that it should return ESP_OK when the watchdog has been reset successfully.
However I'm seeing a return value of ESP_ERR_NOT_FOUND which according to the docs means that the current running task (the main task in my case) is not currently subscribed to the TWDT.
Is this expected behaviour?
P.S. what's up with the broken Codebox tags?
Main task is not subscribed to the TWDT, yet esp_task_wdt_reset() does actually reset the TWDT
-
- Posts: 151
- Joined: Thu Jun 15, 2017 4:54 am
- Location: New Zealand
-
- Posts: 151
- Joined: Thu Jun 15, 2017 4:54 am
- Location: New Zealand
Re: Main task is not subscribed to the TWDT, yet esp_task_wdt_reset() does actually reset the TWDT
According to this post: viewtopic.php?t=10560#p43395 the purpose of esp_task_wdt_reset is to reset the watchdog for the current task, but not the watchdog that is fed by the idle task.
However my experiments seem to indicate that not calling this function when using taskYIELD still causes the wdt to starve. Even using vTaskDelay(0) causes starvation, although vTaskDelay(1) does not, suggesting that this function is actually acting on the same watchdog that the idle task is feeding.
I'm finding this confusing - what am I missing please?
However my experiments seem to indicate that not calling this function when using taskYIELD still causes the wdt to starve. Even using vTaskDelay(0) causes starvation, although vTaskDelay(1) does not, suggesting that this function is actually acting on the same watchdog that the idle task is feeding.
I'm finding this confusing - what am I missing please?
Re: Main task is not subscribed to the TWDT, yet esp_task_wdt_reset() does actually reset the TWDT
Sorry, meowsqueak, my comment in that linked thread is wrong: yield will not do the trick.
Because yield, or vTaskDelay(0), don't actually block the calling task, the scheduler will either switch to a higher priority task or, if there are none, continue the calling task. Because the idle task is lower priority, as long as there are any other tasks ready, it will never run and the watchdog will expire.
Because yield, or vTaskDelay(0), don't actually block the calling task, the scheduler will either switch to a higher priority task or, if there are none, continue the calling task. Because the idle task is lower priority, as long as there are any other tasks ready, it will never run and the watchdog will expire.
Who is online
Users browsing this forum: AI-board and 103 guests