This post is older than 2 years and might not be relevant anymore
More Info: Consider searching for newer posts

[NRF52840 - pc-ble-driver-py] - Disconnection/reconnection issue

Hello,

I am developing a Python script (Windows 10, Python 2.7.16, pc-ble-driver-py 0.12.0) to use a NRF52840 board to simulate the BLE part of an application running on a smartphone.
The smartphone connects on a device, then executes bonding with passkey, and send commands to the device.
The Python script is able to execute the same scenario.

I have an issue with the script for disconnection/reconnection. I don't have this problem with the smartphone.
Here is what is done:

With the smartphone:
Once bonding is done between the smartphone and the device, the smartphone can send commands to the device.
I enable the flight mode on the smartphone: a disconnection occurs with reason 0x13 (Remote User Terminated Connection), seen on log of the device.
Then I disable the flight mode on the smartphone. It reconnects to the device and it can send again commands to the device.

With the Python script:
After bonding, the script can send commands to the device.
I do a disconnection thanks to the function ble_gap_disconnect of ble_driver.py. On the device (log), I can see a disconnection with reason 0x13.
Then, I do a reconnection, discover services. Log on device shows that the board is connected to the device.
But when the script sends a command to the device after the reconnection, an authentication error occurs.
The authentication error is avoided with a new bonding and the same passkey.

The disconnection is different: The device keeps the bonding when the smartphone is used, but not with the board/script.

Could you please explain what should I do with pc-ble-driver-py to do the same disconnection done with the smartphone?
Is this disconnection supported with the current version of pc-ble-driver-py (0.12.0) or is there a limitation?

Thank you for your support.

Regards,
Christophe

Related