esp32-c3 喂狗问题
Posted: Fri Aug 11, 2023 3:36 am
起因是在task里执行sntp初始化时,有时会因为网络问题花了太长时间导致log报狗死了。虽然没有重启也不会影响功能但是log很多error看着很困扰,所以想看看能不能喂狗喂上。于是添加了以下代码
error = esp_task_wdt_add(uxTask_Handler);
ESP_LOGI(UX_TAG,"%d",error);
error = esp_task_wdt_reset();
ESP_LOGI(UX_TAG,"%d",error);
HA_Esp_Sntp_Init();
error = esp_task_wdt_reset();
ESP_LOGI(UX_TAG,"%d",error);
HA_delay_ms(6000);
error = esp_task_wdt_reset();
ESP_LOGI(UX_TAG,"%d",error);
sec_print_rtc_notify();
mqtt_client_init();
esp_task_wdt_delete(uxTask_Handler);
在menuconfig里设置的timeout for RTC watchdog是9000ms,我认为如果喂狗喂上了应该狗是不会死的
但是log里还是出了
E (7713) task_wdt: Task watchdog got triggered. The following tasks/users did not reset the watchdog in time:
E (7713) task_wdt: - IDLE (CPU 0)
E (7713) task_wdt: Tasks currently running:
E (7713) task_wdt: CPU 0: ux_task
E (7713) task_wdt: Print CPU 0 (current core) registers
并且看esp_task_wdt_reset的结果都是0应该是成功的,但是还是没喂上
error = esp_task_wdt_add(uxTask_Handler);
ESP_LOGI(UX_TAG,"%d",error);
error = esp_task_wdt_reset();
ESP_LOGI(UX_TAG,"%d",error);
HA_Esp_Sntp_Init();
error = esp_task_wdt_reset();
ESP_LOGI(UX_TAG,"%d",error);
HA_delay_ms(6000);
error = esp_task_wdt_reset();
ESP_LOGI(UX_TAG,"%d",error);
sec_print_rtc_notify();
mqtt_client_init();
esp_task_wdt_delete(uxTask_Handler);
在menuconfig里设置的timeout for RTC watchdog是9000ms,我认为如果喂狗喂上了应该狗是不会死的
但是log里还是出了
E (7713) task_wdt: Task watchdog got triggered. The following tasks/users did not reset the watchdog in time:
E (7713) task_wdt: - IDLE (CPU 0)
E (7713) task_wdt: Tasks currently running:
E (7713) task_wdt: CPU 0: ux_task
E (7713) task_wdt: Print CPU 0 (current core) registers
并且看esp_task_wdt_reset的结果都是0应该是成功的,但是还是没喂上