esp32s3 ble作为中心设备,连接多个外围设备的时候,有时候会出现assert failed错误

hake36
Posts: 1
Joined: Fri May 05, 2023 2:02 am

esp32s3 ble作为中心设备,连接多个外围设备的时候,有时候会出现assert failed错误

Postby hake36 » Fri May 05, 2023 2:04 am

esp32s3 ble作为中心设备,连接多个外围设备的时候,有时候会出现assert failed: tlsf_free tlsf.c:1049 (!block_is_free(block) && "block already marked as free")失败的错误(连接的设备越多,出现的概率越大)

1,基于example gattc_multi_connect 工程,修改了remote_device_name和 外围设备的UUID
2,4个外围设备ble连接成功后,会每隔10S往中心设备发送300字节的数据
3,反复重启esp32s3 ,概率性出现assert failed: tlsf_free tlsf.c,
4,通过coredump,我定位到是在函数gatt_cl_send_next_cmd_inq中的osi_free出现的assert

Debug Logs.
ssert failed: tlsf_free tlsf.c:1049 (!block_is_free(block) && "block already marked as free")


Backtrace: 0x40379fca:0x3fcab330 0x4038386d:0x3fcab350 0x40389b8d:0x3fcab370 0x4038908f:0x3fcab490 0x403889e4:0x3fcab4b0 0x4037a2de:0x3fcab4d0 0x40389bbd:0x3fcab4f0 0x42024ae0:0x3fcab510 0x42024dbe:0x3fcab540 0x4202666a:0x3fcab580 0x420268f6:0x3fcab5a0 0x42030649:0x3fcab5c0 0x420211ca:0x3fcab600 0x4203867a:0x3fcab620 0x40386f1d:0x3fcab650




ELF file SHA256: 46778c7b4c1eacf0

CPU halted.

下面是coredump数据:

(gdb)
(gdb) backtrace
#0 0x40379fd5 in panic_abort (
details=0x3fcac87b "assert failed: tlsf_free tlsf.c:1049 (!block_is_free(block) && \"block already marked as free\")") at D:/esp/Espressif/frameworks/esp-idf-v5.0/components/esp_system/panic.c:412
#1 0x40383878 in esp_system_abort (
details=0x3fcac87b "assert failed: tlsf_free tlsf.c:1049 (!block_is_free(block) && \"block already marked as free\")") at D:/esp/Espressif/frameworks/esp-idf-v5.0/components/esp_system/esp_system.c:135
#2 0x40389c70 in __assert_func (file=0x3fc9f683 "tlsf.c", line=<optimized out>, func=<optimized out>,
expr=0x3fc9fa20 "!block_is_free(block) && \"block already marked as free\"")
at D:/esp/Espressif/frameworks/esp-idf-v5.0/components/newlib/assert.c:78
#3 0x40389172 in tlsf_free (tlsf=0x3fca566c, ptr=0x3fcb2ef0)
at D:/esp/Espressif/frameworks/esp-idf-v5.0/components/heap/tlsf/tlsf.c:1049
#4 0x40388ac7 in multi_heap_free_impl (heap=0x3fca5658, p=0x3fcb2ef0)
at D:/esp/Espressif/frameworks/esp-idf-v5.0/components/heap/multi_heap.c:241
#5 0x4037a2e9 in heap_caps_free (ptr=0x3fcb2ef0)
at D:/esp/Espressif/frameworks/esp-idf-v5.0/components/heap/heap_caps.c:353
#6 0x40389ca0 in free (ptr=0x3fcb2ef0) at D:/esp/Espressif/frameworks/esp-idf-v5.0/components/newlib/heap.c:39
#7 0x420264cd in gatt_cl_send_next_cmd_inq (p_tcb=0x3fcb0838)
at D:/esp/Espressif/frameworks/esp-idf-v5.0/components/bt/host/bluedroid/stack/gatt/gatt_cl.c:1043
#8 0x420267a5 in gatt_client_handle_server_rsp (p_tcb=0x3fcb0838, op_code=<optimized out>, len=<optimized out>,
p_data=0x3fcb3b06 <error: Cannot access memory at address 0x3fcb3b06>)
at D:/esp/Espressif/frameworks/esp-idf-v5.0/components/bt/host/bluedroid/stack/gatt/gatt_cl.c:1167
#9 0x42028051 in gatt_data_process (p_tcb=0x3fcb0838, p_buf=0x3fcb3af4)
at D:/esp/Espressif/frameworks/esp-idf-v5.0/components/bt/host/bluedroid/stack/gatt/gatt_main.c:1004
#10 0x420282dd in gatt_le_data_ind (chan=<optimized out>,
bd_addr=0x3fcb0c1c <error: Cannot access memory at address 0x3fcb0c1c>, p_buf=0x3fcb3af4)
at D:/esp/Espressif/frameworks/esp-idf-v5.0/components/bt/host/bluedroid/stack/gatt/gatt_main.c:587
#11 0x42032030 in l2c_rcv_acl_data (p_msg=0x3fcb3af4)
at D:/esp/Espressif/frameworks/esp-idf-v5.0/components/bt/host/bluedroid/stack/l2cap/l2c_main.c:275
#12 0x42022bbd in btu_hci_msg_process (param=0x3fcb3af4)
--Type <RET> for more, q to quit, c to continue without paging--
at D:/esp/Espressif/frameworks/esp-idf-v5.0/components/bt/host/bluedroid/stack/btu/btu_task.c:144
#13 0x4203a061 in osi_thread_run (arg=<optimized out>)
at D:/esp/Espressif/frameworks/esp-idf-v5.0/components/bt/common/osi/thread.c:165
#14 0x40387000 in vPortTaskWrapper (pxCode=0x4203a02c <osi_thread_run>, pvParameters=0x3fcf7c90)
at D:/esp/Espressif/frameworks/esp-idf-v5.0/components/freertos/FreeRTOS-Kernel/portable/xtensa/port.c:151
(gdb)
(gdb)
(gdb)

Who is online

Users browsing this forum: No registered users and 81 guests