espressif / esp-idf

Espressif IoT Development Framework. Official development framework for Espressif SoCs.
Apache License 2.0
13.35k stars 7.21k forks source link

NimBLE Gatt Server & ESP-BLE-MESH provisioner coexistence (IDFGH-13522) #14413

Open buganini opened 3 weeks ago

buganini commented 3 weeks ago

Answers checklist.

General issue report

ESP-IDF: v5.3

sdkconfig includes:

CONFIG_BLE_MESH_SUPPORT_BLE_ADV=y
CONFIG_BLE_MESH_BLE_ADV_BUF_COUNT=2

I used to have Bluedroid Gatt Server + ESP-BLE-MESH coexistence by using esp_ble_mesh_start_ble_advertising, it will send both advertisements and both gatts_profile_event_handler/esp_ble_mesh_prov_callback are invoked to handle BLE pairing/bonding and BLE-MESH provisioning.

But due to the following issue I have to move to NimBLE https://github.com/meshtastic/firmware/issues/266

NimBLE GATT Server works and ESP-IDF-MESH works, but when both are enabled, only one of them functions correctly.

With NimBLE I have to call ble_gap_adv_start to register GAP event handler for pairing/bonding, I have tried different combinations and orders of esp_ble_mesh_start_ble_advertising, ble_gap_adv_start, esp_ble_mesh_init/esp_ble_mesh_provisioner_prov_enable , but I just cannot get both handlers to work simultaneously. It seems that ESP-BLE-MESH is not integrated with NimBLE. Can someone confirm this?

Laosepy commented 6 days ago

HI,must use nimble-mesh,This comes from the accompanying code for nimble,But the examples provided in the idf seem to have bugs,first running ,I found that it wouldn't broadcast, and there was a stack error after I corrected the sample code as explained in the comments