CAN vs OTA: interrupt watchdog timeouts despite delay in OTA and IRAM_ATTR in CAN
Posted: Wed Apr 03, 2019 10:16 pm
I've tweaked the OTA example to add a delay because large partition updates would cause interrupt watchdog timeouts on most attempts. Now they do not have this problem and instead of failing most of the time, work every time, until...
On attempting to do OTA with a live CAN bus (has about 600 frames per second), I get watchdog timeouts despite adding IRAM_ATTR to the functions in -------------------- Interrupt and Alert Handlers ------------------------
I could disable the CAN bus during OTA if I have to, but would there be a way to keep CAN Rx interrupts running?
Maybe just adding IRAM_ATTR to these functions doesn't cover other functions they call.
If I unplug the CAN bus, OTA works perfectly. It fails every time with CAN bus traffic.
After IRAM_ATTR:
Before IRAM_ATTR:
On attempting to do OTA with a live CAN bus (has about 600 frames per second), I get watchdog timeouts despite adding IRAM_ATTR to the functions in -------------------- Interrupt and Alert Handlers ------------------------
I could disable the CAN bus during OTA if I have to, but would there be a way to keep CAN Rx interrupts running?
Maybe just adding IRAM_ATTR to these functions doesn't cover other functions they call.
If I unplug the CAN bus, OTA works perfectly. It fails every time with CAN bus traffic.
After IRAM_ATTR:
Code: Select all
I (42267) esp_https_ota: Starting OTA...
I (42267) esp_https_ota: Writing to partition subtype 17 at offset 0x400000
Guru Meditation Error: Core 0 panic'ed (Interrupt wdt timeout on CPU0)
Core 0 register dump:
PC : 0x40085cde PS : 0x00060034 A0 : 0x40085304 A1 : 0x3ffb0680
0x40085cde: can_intr_handler_main at C:/Users/jcsba/Documents/C/OBD_DS1/main/can.c:814
0x40085304: _xt_lowint1 at C:/msys32/home/jcsba/esp/esp-idf/components/freertos/xtensa_vectors.S:1154
A2 : 0x00000000 A3 : 0x00000000 A4 : 0x3ffb3f40 A5 : 0x400963bc
0x400963bc: _frxt_int_enter at C:/msys32/home/jcsba/esp/esp-idf/components/freertos/portasm.S:119
A6 : 0x00003004 A7 : 0x00000001 A8 : 0x80085cca A9 : 0x3ffb0660
A10 : 0x3ffda5ac A11 : 0x3ffb0684 A12 : 0x00000000 A13 : 0x00000040
A14 : 0x00060021 A15 : 0x00000000 SAR : 0x0000001a EXCCAUSE: 0x00000005
EXCVADDR: 0x00000000 LBEG : 0x00000000 LEND : 0x00000000 LCOUNT : 0x00000000
Core 0 was running in ISR context:
EPC1 : 0x40082108 EPC2 : 0x00000000 EPC3 : 0x00000000 EPC4 : 0x40085cde
0x40082108: esp_intr_noniram_enable at C:/msys32/home/jcsba/esp/esp-idf/components/esp32/intr_alloc.c:883
0x40085cde: can_intr_handler_main at C:/Users/jcsba/Documents/C/OBD_DS1/main/can.c:814
ELF file SHA256: 73ee34ebef69180f8c1dcf7d2ffd3610d8101f1a0ba3c163c6a081b96e537980
Backtrace: 0x40085cde:0x3ffb0680 0x40085301:0x3ffb06b0 0x40082105:0x3ffbb660 0x40086abb:0x3ffbb680 0x4008216f:0x3ffbb6a0 0x40095329:0
x3ffbb6c0
0x40085cde: can_intr_handler_main at C:/Users/jcsba/Documents/C/OBD_DS1/main/can.c:814
0x40085301: _xt_lowint1 at C:/msys32/home/jcsba/esp/esp-idf/components/freertos/xtensa_vectors.S:1154
0x40082105: esp_intr_noniram_enable at C:/msys32/home/jcsba/esp/esp-idf/components/esp32/intr_alloc.c:883
0x40086abb: spi_flash_op_block_func at C:/msys32/home/jcsba/esp/esp-idf/components/spi_flash/cache_utils.c:201
0x4008216f: ipc_task at C:/msys32/home/jcsba/esp/esp-idf/components/esp32/ipc.c:62
0x40095329: vPortTaskWrapper at C:/msys32/home/jcsba/esp/esp-idf/components/freertos/port.c:435
Core 1 register dump:
PC : 0x401a28be PS : 0x00060934 A0 : 0x800d3a99 A1 : 0x3ffbe080
0x401a28be: esp_pm_impl_waiti at C:/msys32/home/jcsba/esp/esp-idf/components/esp32/pm_esp32.c:487
A2 : 0x00000000 A3 : 0x80000001 A4 : 0x00000000 A5 : 0x00000001
A6 : 0x00060620 A7 : 0x00000000 A8 : 0x800d2936 A9 : 0x3ffbe050
A10 : 0x00000000 A11 : 0x00000001 A12 : 0x80095522 A13 : 0x3ffde6f0
A14 : 0x00000003 A15 : 0x00060023 SAR : 0x00000000 EXCCAUSE: 0x00000005
EXCVADDR: 0x00000000 LBEG : 0x00000000 LEND : 0x00000000 LCOUNT : 0x00000000
ELF file SHA256: 73ee34ebef69180f8c1dcf7d2ffd3610d8101f1a0ba3c163c6a081b96e537980
Backtrace: 0x401a28be:0x3ffbe080 0x400d3a96:0x3ffbe0a0 0x400943d1:0x3ffbe0c0 0x40095329:0x3ffbe0e0
0x401a28be: esp_pm_impl_waiti at C:/msys32/home/jcsba/esp/esp-idf/components/esp32/pm_esp32.c:487
0x400d3a96: esp_vApplicationIdleHook at C:/msys32/home/jcsba/esp/esp-idf/components/esp32/freertos_hooks.c:86
0x400943d1: prvIdleTask at C:/msys32/home/jcsba/esp/esp-idf/components/freertos/tasks.c:4439
0x40095329: vPortTaskWrapper at C:/msys32/home/jcsba/esp/esp-idf/components/freertos/port.c:435
Code: Select all
I (208020) esp_https_ota: Starting OTA...
I (208021) esp_https_ota: Writing to partition subtype 17 at offset 0x400000
Guru Meditation Error: Core 0 panic'ed (Interrupt wdt timeout on CPU0)
Core 0 register dump:
PC : 0x40093767 PS : 0x00060734 A0 : 0x800dc94c A1 : 0x3ffb0650
0x40093767: vTaskEnterCritical at C:/msys32/home/jcsba/esp/esp-idf/components/freertos/tasks.c:4439
A2 : 0x3ffb11a0 A3 : 0x3ffb0684 A4 : 0x00000000 A5 : 0x00000020
A6 : 0x00060721 A7 : 0x00000000 A8 : 0x80093998 A9 : 0x3ffb0650
A10 : 0x00000003 A11 : 0x00060723 A12 : 0x00060721 A13 : 0x00000000
A14 : 0x3ffe43c0 A15 : 0x00060723 SAR : 0x00000018 EXCCAUSE: 0x00000005
EXCVADDR: 0x00000000 LBEG : 0x4008d6e1 LEND : 0x4008d715 LCOUNT : 0xffffffff
0x4008d6e1: memcpy at /home/jeroen/esp8266/esp32/newlib_xtensa-2.2.0-bin/newlib_xtensa-2.2.0/xtensa-esp32-elf/newlib/libc/machine/xte
nsa/../../../../.././newlib/libc/machine/xtensa/memcpy.S:291
0x4008d715: memcpy at /home/jeroen/esp8266/esp32/newlib_xtensa-2.2.0-bin/newlib_xtensa-2.2.0/xtensa-esp32-elf/newlib/libc/machine/xte
nsa/../../../../.././newlib/libc/machine/xtensa/memcpy.S:324
Core 0 was running in ISR context:
EPC1 : 0x400dc9da EPC2 : 0x00000000 EPC3 : 0x00000000 EPC4 : 0x40093767
0x400dc9da: can_intr_handler_main at C:/Users/jcsba/Documents/C/OBD_DS1/main/can.c:814
0x40093767: vTaskEnterCritical at C:/msys32/home/jcsba/esp/esp-idf/components/freertos/tasks.c:4439
ELF file SHA256: e74d38b6767207ef213a9bb689b40da14ccc9f60c557eec6a8a3c91b1024618f
Backtrace: 0x40093767:0x3ffb0650 0x400dc949:0x3ffb0680 0x400852d5:0x3ffb06b0 0x400dc9d7:0x3ffbb660 0x400866d3:0x3ffbb680 0x40082143:0
x3ffbb6a0 0x40094f41:0x3ffbb6c0
0x40093767: vTaskEnterCritical at C:/msys32/home/jcsba/esp/esp-idf/components/freertos/tasks.c:4439
0x400dc949: can_intr_handler_main at C:/Users/jcsba/Documents/C/OBD_DS1/main/can.c:814
0x400852d5: _xt_lowint1 at C:/msys32/home/jcsba/esp/esp-idf/components/freertos/xtensa_vectors.S:1154
0x400dc9d7: can_intr_handler_main at C:/Users/jcsba/Documents/C/OBD_DS1/main/can.c:814
0x400866d3: spi_flash_op_block_func at C:/msys32/home/jcsba/esp/esp-idf/components/spi_flash/cache_utils.c:201
0x40082143: ipc_task at C:/msys32/home/jcsba/esp/esp-idf/components/esp32/ipc.c:62
0x40094f41: vPortTaskWrapper at C:/msys32/home/jcsba/esp/esp-idf/components/freertos/port.c:435
Core 1 register dump:
PC : 0x401a2cca PS : 0x00060734 A0 : 0x800d3ab5 A1 : 0x3ffbe080
0x401a2cca: esp_pm_impl_waiti at C:/msys32/home/jcsba/esp/esp-idf/components/esp32/pm_esp32.c:487
A2 : 0x00000000 A3 : 0x80000001 A4 : 0x00000000 A5 : 0x00000001
A6 : 0x00060620 A7 : 0x00000000 A8 : 0x00060023 A9 : 0x3ffbe170
A10 : 0x00000001 A11 : 0x00000001 A12 : 0x8009513a A13 : 0x3ffde6f0
A14 : 0x00000003 A15 : 0x00060023 SAR : 0x00000000 EXCCAUSE: 0x00000005
EXCVADDR: 0x00000000 LBEG : 0x00000000 LEND : 0x00000000 LCOUNT : 0x00000000
ELF file SHA256: e74d38b6767207ef213a9bb689b40da14ccc9f60c557eec6a8a3c91b1024618f
Backtrace: 0x401a2cca:0x3ffbe080 0x400d3ab2:0x3ffbe0a0 0x40093fe9:0x3ffbe0c0 0x40094f41:0x3ffbe0e0
0x401a2cca: esp_pm_impl_waiti at C:/msys32/home/jcsba/esp/esp-idf/components/esp32/pm_esp32.c:487
0x400d3ab2: esp_vApplicationIdleHook at C:/msys32/home/jcsba/esp/esp-idf/components/esp32/freertos_hooks.c:86
0x40093fe9: prvIdleTask at C:/msys32/home/jcsba/esp/esp-idf/components/freertos/tasks.c:4439
0x40094f41: vPortTaskWrapper at C:/msys32/home/jcsba/esp/esp-idf/components/freertos/port.c:435