Dear Nordic Support,
My project is split into two parts: A firmware application that is based on the Generic Level Server model example (from the Mesh SDK) and an Android app written in Flutter. Both are working pretty well - in 99% of the cases.
However, in some rare, and hard to reproduce cases it happens that connecting from the Flutter/Android app to the firmware fails. If it fails, Android logs either error 0x13 or error 0x85. Here's an example:
17:23:20.371 D/BleMeshManager: [BLE LOG] Connected to ED:B0:A7:E1:F7:84 17:23:20.374 D/BleMeshManager: [BLE LOG] wait(300) 17:23:20.677 D/BleMeshManager: [BLE LOG] Discovering services... 17:23:20.677 D/BleMeshManager: [BLE LOG] gatt.discoverServices() 17:23:21.133 D/BleMeshManager: [BLE LOG] Connection parameters updated (interval: 247.5ms, latency: 0, timeout: 4000ms) 17:23:22.865 D/BleMeshManager: [BLE LOG] Connection parameters updated (interval: 7.5ms, latency: 0, timeout: 3000ms) 17:23:22.896 D/BleMeshManager: [BLE LOG] [Callback] Connection state changed with status: 19 and new state: 0 (DISCONNECTED) 17:23:22.897 D/BleMeshManager: [BLE LOG] Error: (0x13): GATT CONN TERMINATE PEER USER 17:23:22.898 D/BleMeshManager: [BLE LOG] Disconnected
Note: The firmware application doesn't log anything suspicions if this error happens.
Softdevice Known Issue:
The following is from the s132_nrf52_7.3.0 release notes:
"The ble_gattc_service_t::uuid field is incorrectly populated in the BLE_GATTC_EVT_PRIM_SRVC_DISC_RSP event if sd_ble_gattc_primary_services_discover() or sd_ble_gattc_read() is called when a Primary Service Discovery by Service UUID is already ongoing. When the application has called sd_ble_gattc_primary_services_discover(), it should wait for the BLE_GATTC_EVT_PRIM_SRVC_DISC_RSP event before calling sd_ble_gattc_primary_services_discover() or sd_ble_gattc_read() (DRGN-11300)."
Looking at the above log messages, could the 0x13 or 0x85 error (and hence the failed connection) be caused by this issue?
Have you ever seen something similar in the past? (Would be great if you could ask around your team mates as well btw.)
Now considering that my firmware application is based on the Generic Lever Server model (from the Mesh SDK examples):
How can you wait for the BLE_GATTC_EVT_PRIM_SRVC_DISC_RSP event before calling sd_ble_gattc_primary_services_discover() or sd_ble_gattc_read()? How would you implement this? Right now, the firmware application neither handles BLE_GATTC_EVT_PRIM_SRVC_DISC_RSP nor does it call sd_ble_gattc_primary_services_discover() or sd_ble_gattc_read(), so I'm a little lost how to implement a workaround for this issue, as well as if it (the known issue) is actually related the the failed connections attempts, so your advise on this is very much appreciated.
Thanks for your help,
Michael.