Page 1 of 1

关于ESP32 任务看门狗复位问题

Posted: Tue Dec 28, 2021 7:06 am
by hhh5215
想要用看门狗实现程序跑飞复位的功能,看了一下以前的帖子,说任务看门狗默认不会复位,需要勾上Invoke panic handler on Task Watchdog timeout
这个选项,我勾上了。尝试循环喂狗10次后不喂狗,看到的现象和我想象中的复位不太一样?
一直在反复打印这些信息:
E (23247) task_wdt: Task watchdog got triggered. The following tasks did not reset the watchdog in time:
E (23247) task_wdt: - reset task (CPU 0/1)
E (23247) task_wdt: Tasks currently running:
E (23247) task_wdt: CPU 0: IDLE0
E (23247) task_wdt: CPU 1: IDLE1
E (23247) task_wdt: Print CPU 0 (current core) backtrace


Backtrace:0x400D4644:0x3FFBE370 0x4008290D:0x3FFBE390 0x4019B87B:0x3FFBBD00 0x400D491E:0x3FFBBD20 0x400902FD:0x3FFBBD40 0x4008F965:0x3FFBBD60
0x400d4644: task_wdt_isr at C:/Users/15459/esp-idf/components/esp_common/src/task_wdt.c:187

0x4008290d: _xt_lowint1 at C:/Users/15459/esp-idf/components/freertos/xtensa/xtensa_vectors.S:1105

0x4019b87b: esp_pm_impl_waiti at C:/Users/15459/esp-idf/components/esp32/pm_esp32.c:501

0x400d491e: esp_vApplicationIdleHook at C:/Users/15459/esp-idf/components/esp_common/src/freertos_hooks.c:63

0x400902fd: prvIdleTask at C:/Users/15459/esp-idf/components/freertos/tasks.c:3386 (discriminator 1)

0x4008f965: vPortTaskWrapper at C:/Users/15459/esp-idf/components/freertos/xtensa/port.c:143


E (23247) task_wdt: Print CPU 1 backtrace


Backtrace:0x40081BE7:0x3FFBE970 0x4008290D:0x3FFBE990 0x4019B87B:0x3FFBC460 0x400D491E:0x3FFBC480 0x400902FD:0x3FFBC4A0 0x4008F965:0x3FFBC4C0
0x40081be7: esp_crosscore_isr at C:/Users/15459/esp-idf/components/esp32/crosscore_int.c:80

0x4008290d: _xt_lowint1 at C:/Users/15459/esp-idf/components/freertos/xtensa/xtensa_vectors.S:1105

0x4019b87b: esp_pm_impl_waiti at C:/Users/15459/esp-idf/components/esp32/pm_esp32.c:501

0x400d491e: esp_vApplicationIdleHook at C:/Users/15459/esp-idf/components/esp_common/src/freertos_hooks.c:63

0x400902fd: prvIdleTask at C:/Users/15459/esp-idf/components/freertos/tasks.c:3386 (discriminator 1)

0x4008f965: vPortTaskWrapper at C:/Users/15459/esp-idf/components/freertos/xtensa/port.c:143

Re: 关于ESP32 任务看门狗复位问题

Posted: Mon Jan 24, 2022 7:17 am
by ripper
遇到了跟楼主一模一样的问题
不知道是否有乐鑫官方来解答一下
我的是ESP32-PICO-MINI-02, ESP-IDF版本v4.2.2

Re: 关于ESP32 任务看门狗复位问题

Posted: Tue Jan 25, 2022 6:41 am
by ripper
我已经找到问题所在了,
仅仅在配置里面使能Invoke panic handler on Task Watchdog timeout是不够的,还需要在程序里:
  1. if(esp_task_wdt_init(WDT_TIMEOUT_S, true) != ESP_OK)
  2. {
  3.     printf("Task WDG init Error\r\n");
  4. }
初始化init的第二个参数是panic,要是true,在任务看门狗超时后才会复位芯片。