乐鑫技术交流
直播中

郭大

10年用户 973经验值
擅长:嵌入式技术
私信 关注
[问答]

ble_hs_hci_cmd_send .函数重入导致申请内存失败死机的原因?怎么解决?

ble_hs_hci_cmd_send at D:/ESP-IDF/components/bt/host/nimble/nimble/nimble/host/src/ble_hs_hci_cmd.c:89 (discriminator 15)

ble_hs_hci_cmd_send_buf at D:/ESP-IDF/components/bt/host/nimble/nimble/nimble/host/src/ble_hs_hci_cmd.c:134

ble_hs_flow_tx_num_comp_pkts at D:/ESP-IDF/components/bt/host/nimble/nimble/nimble/host/src/ble_hs_flow.c:95

ble_hs_flow_event_cb at D:/ESP-IDF/components/bt/host/nimble/nimble/nimble/host/src/ble_hs_flow.c:116

ble_npl_event_run at D:/ESP-IDF/components/bt/host/nimble/nimble/porting/npl/freertos/include/nimble/nimble_npl_os.h:125

(inlined by) nimble_port_run at D:/ESP-IDF/components/bt/host/nimble/nimble/porting/nimble/src/nimble_port.c:78

mesh_host_task at d:cwqcodelightbuild/../components/ble_light/src/bt_init.c:160

vPortTaskWrapper at D:/ESP-IDF/components/freertos/port/xtensa/port.c:168

//---------------------------------------------------------------------------------------------------------------------------

ble_hs_hci_cmd_send at D:/ESP-IDF/components/bt/host/nimble/nimble/nimble/host/src/ble_hs_hci_cmd.c:113

ble_hs_hci_cmd_send_buf at D:/ESP-IDF/components/bt/host/nimble/nimble/nimble/host/src/ble_hs_hci_cmd.c:139

ble_hs_hci_cmd_tx at D:/ESP-IDF/components/bt/host/nimble/nimble/nimble/host/src/ble_hs_hci.c:304

ble_gap_adv_set_data at D:/ESP-IDF/components/bt/host/nimble/nimble/nimble/host/src/ble_gap.c:2649

bt_le_adv_start at D:/ESP-IDF/components/bt/esp_ble_mesh/mesh_core/nimble_host/mesh_bearer_adapt.c:777

adv_send at D:/ESP-IDF/components/bt/esp_ble_mesh/mesh_core/adv.c:180

(inlined by) adv_thread at D:/ESP-IDF/components/bt/esp_ble_mesh/mesh_core/adv.c:318

vPortTaskWrapper at D:/ESP-IDF/components/freertos/port/xtensa/port.c:168
-------------------------------------------------------------------------------------------------------------------

请教一下大佬  我们使用mesh加手机ble与esp32通信时遇到一个死机问题  手机快速和设备通信的同时如果往mesh网络发送数据大概率会导致死机  经过分析后发现是  ble_hs_hci_cmd_send 函数重入了 (mesh_host_task ,adv_send)此函数调用 ble_hci_trans_buf_alloc(BLE_HCI_TRANS_BUF_CMD) 申请内存  但是此内存池大小被初始化成了 1 导致第二次申请失败 从而引发死机

请教一下有没有大佬遇到过这种情况   需要怎么解决

更多回帖

发帖
×
20
完善资料,
赚取积分