Dear Nordic Bluetooth Experts,
My project is quite simple: A BT Mesh device (generic level server model) powered by a Nordic nRF53832 and an Android app that is used to provision nodes and operate the mesh. The Android app uses Nordic's BLE and Mesh libraries. The product is working well, except for one occasional issue during provisioning, for which I would appreciate your advise:
When adding a new node to the mesh, the app:
- Provisions the device.
- Connects to the new node.
- Assigns the keys.
The problem is that sometimes after connecting to the freshly provisioned node, the Bluetooth connection updates to status 19 (BLE_HCI_REMOTE_USER_TERMINATED_CONNECTION), which apparently means that the mesh node terminated the connection. If it happens, this is whats showing up at Android's logcat:
14:02:12.177 21374-21374/com.xxx.mesh D/BluetoothGatt: connect() - device: F2:8A:20:B2:57:A6, auto: false
14:02:12.177 21374-21374/com.xxx.mesh D/BluetoothAdapter: isSecureModeEnabled
14:02:12.178 21374-21374/com.xxx.mesh D/BluetoothGatt: registerApp()
14:02:12.178 21374-21374/com.xxx.mesh D/BluetoothGatt: registerApp() - UUID=1db0e7d0-7f91-4213-841c-a65df21b4e94
14:02:12.181 21374-21399/com.xxx.mesh D/BluetoothGatt: onClientRegistered() - status=0 clientIf=10
14:02:14.152 21374-21399/com.xxx.mesh D/BluetoothGatt: onClientConnectionState() - status=0 clientIf=10 device=F2:8A:20:B2:57:A6
14:02:14.467 21374-21374/com.xxx.mesh D/BluetoothGatt: discoverServices() - device: F2:8A:20:B2:57:A6
14:02:14.768 21374-21399/com.xxx.mesh D/BluetoothGatt: onConnectionUpdated() - Device=F2:8A:20:B2:57:A6 interval=198 latency=0 timeout=400 status=0
14:02:16.377 21374-21399/com.xxx.mesh D/BluetoothGatt: onConnectionUpdated() - Device=F2:8A:20:B2:57:A6 interval=6 latency=0 timeout=500 status=19
14:02:16.378 21374-21374/com.xxx.mesh E/BleManager: onConnectionUpdated received status: 19, interval: 6, latency: 0, timeout: 500
14:02:16.385 21374-21399/com.xxx.mesh D/BluetoothGatt: onClientConnectionState() - status=19 clientIf=10 device=F2:8A:20:B2:57:A6
The last three lines is where the disconnect happens.
Now the question is what can possibly cause this sporadic disconnect? And how can it be prevented? Please note that the mesh node is in range and powered on.
Here's a little detail that could be relevant:
In both, the error case and the OK case, two log messages starting with "D/BluetoothGatt: onConnectionUpdated()....." appear in logcat. In the error case, the second message shows status 19 (like above), whereas in the OK case the status is 0. Oddly enough, the second messages always appears about a 1.6 seconds after the first one, in both the error and the OK case. I don't know if it's relevant, but it's a remarkable consistent timing...
What makes this problem so difficult to debug is that it happens only once every 10-20 provisioned nodes, so any advise is very much appreciated. Thank you.