Looks like I face a bug in Bluetooth interrupt handlers. It happens when OTA task is writing chunks of downloaded image to the flash and at the same time BLE GATT server gets some read/write requests from the client
So based on my investigation, the root causes of the issue could be related to the Bluetooth interrupt handlers. At the same time as OTA code is writing something to the FLASH memory, a Bluetooth interrupt handler called and trying to execute the code from the same FLASH memory. As a result, it causes ESP32 exception.
There is the log:
Code: Select all
I (183741) Ota.c: Written image length 786432
Guru Meditation Error: Core 0 panic'ed (Cache disabled but cached memory region accessed)
Core 0 register dump:
PC : 0x4012a11c PS : 0x00060634 A0 : 0x80044715 A1 : 0x3ffbe220
0x4012a11c: chnl_map_check at ??:?
A2 : 0x00000000 A3 : 0x00000006 A4 : 0x00000001 A5 : 0x3ffb2c7a
A6 : 0x000000ce A7 : 0x00000000 A8 : 0x80088aa2 A9 : 0x3ffbe200
A10 : 0x3ffb2c7b A11 : 0x0000000a A12 : 0x00060021 A13 : 0x00000021
A14 : 0x00000078 A15 : 0x3ffbe990 SAR : 0x0000001d EXCCAUSE: 0x00000007
EXCVADDR: 0x00000000 LBEG : 0x4000c2e0 LEND : 0x4000c2f6 LCOUNT : 0xffffffff
Core 0 was running in ISR context:
EPC1 : 0x40095df7 EPC2 : 0x4000bff0 EPC3 : 0x00000000 EPC4 : 0x4012a11c
0x40095df7: portENTER_CRITICAL_NESTED at C:/esp/esp-idf/components/freertos/include/freertos/portmacro.h:330
(inlined by) xPortInIsrContext at C:/esp/esp-idf/components/freertos/port.c:338
0x4012a11c: chnl_map_check at ??:?
ELF file SHA256: 07362c11fa02e6aa
Backtrace: 0x4012a119:0x3ffbe220 0x40044712:0x3ffbe240 0x4008a563:0x3ffbe270 0x400893ad:0x3ffbe2a0 0x40089141:0x3ffbe2c0 0x4008ae2a:0x3ffbe2e0 0x4008bd53:0x3ffbe300 0x40085dd5:0x3ffbe320 0x4008cc5a:0x3ffb7d90 0x400853ef:0x3ffb7db0 0x40095cf1:0x3ffb7dd0
0x4012a119: llm_update_duplicate_scan_exceptional_list at ??:?
0x4008a563: r_lld_pdu_rx_handler at ??:?
0x400893ad: r_lld_evt_end at ??:?
0x40089141: r_lld_evt_end_isr at ??:?
0x4008ae2a: r_rwble_isr at ??:?
0x4008bd53: r_rwbtdm_isr_wrapper at intc.c:?
0x40085dd5: _xt_lowint1 at C:/esp/esp-idf/components/freertos/xtensa_vectors.S:1153
0x4008cc5a: spi_flash_op_block_func at C:/esp/esp-idf/components/spi_flash/cache_utils.c:81
0x400853ef: ipc_task at C:/esp/esp-idf/components/esp_common/src/ipc.c:62
0x40095cf1: vPortTaskWrapper at C:/esp/esp-idf/components/freertos/port.c:143
CPU halted.