当前位置:   article > 正文

ESP32 E (10309) task_wdt: Task watchdog got triggered. The following tasks did not reset the watchdo

task watchdog got triggered. the following tasks did not reset the watchdog

ESP32,在开发时,在以下代码片中(功能很简单,定时改变PWM的Duty):

// A code block
while (1)
    {
        for (int i = 0; i < 100; i++)
        {
            /* code */
            // Set duty to 50%
            ledc_set_duty(LEDC_MODE, LEDC_CHANNEL, i*40);
            // Update duty to apply the new value
            ledc_update_duty(LEDC_MODE, LEDC_CHANNEL);
            //delay 1ms
            usleep(1000);
        }
    }
  • 1
  • 2
  • 3
  • 4
  • 5
  • 6
  • 7
  • 8
  • 9
  • 10
  • 11
  • 12
  • 13
  • 14

会报以下错误:E (115309) task_wdt: Task watchdog got triggered. The following tasks did not reset the watchdog in time:

E (115309) task_wdt: Task watchdog got triggered. The following tasks did not reset the watchdog in time:
E (115309) task_wdt:  - IDLE (CPU 0)
E (115309) task_wdt: Tasks currently running:
E (115309) task_wdt: CPU 0: main
E (115309) task_wdt: CPU 1: IDLE
E (115309) task_wdt: Print CPU 0 (current core) backtrace


Backtrace:0x400D7A87:0x3FFBE7400x40082B29:0x3FFBE760 0x40008544:0x3FFB2680 0x400D4D4E:0x3FFB26A0 0x400D4F66:0x3FFB26C0 0x400E60FF:0x3FFB26F0 0x40088115:0x3FFB2710 
0x400d7a87: task_wdt_isr at C:/Espressif/frameworks/esp-idf-v4.4.2/components/esp_system/task_wdt.c:183 (discriminator 3)

0x40082b29: _xt_lowint1 at C:/Espressif/frameworks/esp-idf-v4.4.2/components/freertos/port/xtensa/xtensa_vectors.S:1111

0x400d4d4e: usleep at C:/Espressif/frameworks/esp-idf-v4.4.2/components/newlib/time.c:210

0x400d4f66: app_main at G:/WorkingData/BoardFrame/SW/Code/main/boardframe.c:89 (discriminator 3)

0x400e60ff: main_task at C:/Espressif/frameworks/esp-idf-v4.4.2/components/freertos/port/port_common.c:141 (discriminator 2)

0x40088115: vPortTaskWrapper at C:/Espressif/frameworks/esp-idf-v4.4.2/components/freertos/port/xtensa/port.c:131


E (115309) task_wdt: Print CPU 1 backtrace


Backtrace:0x40084761:0x3FFBED400x40082B29:0x3FFBED60 0x4000BFED:0x3FFB3510 0x400883C6:0x3FFB3520 0x400D7CE4:0x3FFB3540 0x400D7CEF:0x3FFB3570 0x400D19A1:0x3FFB3590 0x40086BE6:0x3FFB35B0 0x40088115:0x3FFB35D0
0x40084761: esp_crosscore_isr at C:/Espressif/frameworks/esp-idf-v4.4.2/components/esp_system/crosscore_int.c:92

0x40082b29: _xt_lowint1 at C:/Espressif/frameworks/esp-idf-v4.4.2/components/freertos/port/xtensa/xtensa_vectors.S:1111

0x400883c6: vPortClearInterruptMaskFromISR at C:/Espressif/frameworks/esp-idf-v4.4.2/components/freertos/port/xtensa/include/freertos/portmacro.h:571
 (inlined by) vPortExitCritical at C:/Espressif/frameworks/esp-idf-v4.4.2/components/freertos/port/xtensa/port.c:319

0x400d7ce4: esp_task_wdt_reset at C:/Espressif/frameworks/esp-idf-v4.4.2/components/esp_system/task_wdt.c:330
  • 1
  • 2
  • 3
  • 4
  • 5
  • 6
  • 7
  • 8
  • 9
  • 10
  • 11
  • 12
  • 13
  • 14
  • 15
  • 16
  • 17
  • 18
  • 19
  • 20
  • 21
  • 22
  • 23
  • 24
  • 25
  • 26
  • 27
  • 28
  • 29
  • 30
  • 31
  • 32
  • 33
  • 34

看了很多的帖子都是说没有及时喂狗导致的,实际是系统执行过程中无暇喂狗,只需要在死循环中添加适当延时即可,将上述代码中的delay延长,即可解决问题:

// A code block
while (1)
    {
        for (int i = 0; i < 100; i++)
        {
            /* code */
            // Set duty to 50%
            ledc_set_duty(LEDC_MODE, LEDC_CHANNEL, i*40);
            // Update duty to apply the new value
            ledc_update_duty(LEDC_MODE, LEDC_CHANNEL);
            //delay 10ms
            usleep(10000);
        }
    }
  • 1
  • 2
  • 3
  • 4
  • 5
  • 6
  • 7
  • 8
  • 9
  • 10
  • 11
  • 12
  • 13
  • 14

亲测延迟到10ms及以上,就不会报watchdog的问题了,9ms还是会报watchdog的错

感谢:
Task watchdog got triggered错误

声明:本文内容由网友自发贡献,不代表【wpsshop博客】立场,版权归原作者所有,本站不承担相应法律责任。如您发现有侵权的内容,请联系我们。转载请注明出处:https://www.wpsshop.cn/w/知新_RL/article/detail/196176
推荐阅读
相关标签
  

闽ICP备14008679号