If I use it as it is, it somehow manages to skip the else branch of the if statement completely, resulting in some garbage in the uuid variable. But once I add anything there, it starts to work. It works with this patch:
diff --git a/components/bt/esp_ble_mesh/mesh_core/nimble_host/mesh_bearer_adapt.c b/components/bt/esp_ble_mesh/mesh_core/nimble_host/mesh_bearer_adapt.c
index a651b54284..5e5af02f91 100644
--- a/components/bt/esp_ble_mesh/mesh_core/nimble_host/mesh_bearer_adapt.c
+++ b/components/bt/esp_ble_mesh/mesh_core/nimble_host/mesh_bearer_adapt.c
@@ -1299,6 +1299,8 @@ int bt_mesh_gatts_service_start(struct bt_mesh_gatt_service *svc)
uuid = BLE_UUID16_DECLARE(BT_UUID_MESH_PROXY_VAL);
} else {
uuid = BLE_UUID16_DECLARE(BT_UUID_MESH_PROV_VAL);
+ // just add this line and it works:
+ BT_ERR("(bt_mesh_gatts_service_start:else) abcabcabca");
}
rc = ble_gatts_find_svc(uuid, &handle);
Hello. I've stumbled upon a peculiar error which was quite hard to trace.
The minimal reproducible example app: https://github.com/ok32/esp-rs-ble-miscomp. I build it in the default devcontainer.
Build target:
xtensa-esp32s3-espidf
.esp-idf
versions tried:5.0.5
,5.1.1
,5.1.2
.I tried to initialize BLE Mesh (with the Nimble stack) by replicating the sequence of C calls from an example from the esp-idf repo. I ended up getting an internal assertion violation during one of the calls (
esp_ble_mesh_node_prov_enable()
). Furhter investigation showed that the problem was not in that particular function. Instead, it was here: https://github.com/espressif/esp-idf/blob/482a8fb2d78e3b58eb21b26da8a5bedf90623213/components/bt/esp_ble_mesh/mesh_core/nimble_host/mesh_bearer_adapt.c#L1293-L1312If I use it as it is, it somehow manages to skip the
else
branch of theif
statement completely, resulting in some garbage in theuuid
variable. But once I add anything there, it starts to work. It works with this patch:What's in the log when it fails: https://github.com/ok32/esp-rs-ble-miscomp/blob/master/debug_stuff/log_fail.txt What's in the log when it's ok (with the patch)': https://github.com/ok32/esp-rs-ble-miscomp/blob/master/debug_stuff/log_ok.txt
Anybody has any ideas what can be causing this and how to debug it further?