Ariles
Ariles

Reputation: 333

Bluetooth in DFU mode: connection always fails for some devices

I'm using Nordic Semiconductor's Android-DFU-Library in order to update the firmware of a bluetooth low energy (BLE) device. I've already asked for help on the github, but I figured more people can see the issue here (either to help and eventually to find and answer).

So, here is my description on the github issue :


I've been struggling with this the last two days and I can't find any clue. I hope someone here can give me a hint, I would really appreciate it.

I have 4 devices :

After I connect with the bluetooth device to update, I send a few specific commands to make go to DFU mode, then it disconnects after a few seconds. All ok up to this step.

Then, I use Android-DFU-Library to start the fw update process. It works greate with the android 5.1 samsung device but fails to connect [status 133] with the other 3 devices. Any idea what's happening ?

Thank you very much for your help.


It works when I do it manually in nRF Connect. It even works when I use my app to enable DFU mode first, then nRF Connect to connect to the device right after a little scan to find the device.

The way I do it in my app is : after DFU mode is enabled, I scan for 10s in order to find the new mac address and to make sure there is only one device in DFU mode at a time. Then, I use this library to do the actual firmware update.

It takes about 30s to throw the status=133 error, so it looks like it is because of a timeout.

07-26 10:49:47.525 ... D/BluetoothGatt: connect() - device: ... , auto: false

07-26 10:50:17.543 ... D/BluetoothGatt: onClientConnectionState() - status=133 clientIf=5...

Some more logs :

07-26 10:49:46.590 ... I/DfuBaseService: DFU service created. Version: 1.6.1

07-26 10:49:47.524 ... I/DfuBaseService: Connecting to the device...

07-26 10:50:17.543 ... E/DfuBaseService: Connection state change error: 133 newState: 0

07-26 10:50:17.544 ... E/DfuBaseService: Device not reachable. Check if the device with address [MAC] is in range, is advertising and is connectable

07-26 10:50:17.549 ... I/DfuBaseService: Refreshing result: true

07-26 10:50:17.549 ... I/DfuBaseService: Cleaning up...

07-26 10:50:18.186 ... I/DfuBaseService: DFU service destroyed

Upvotes: 2

Views: 2475

Answers (1)

Ariles
Ariles

Reputation: 333

I finally managed to get it working thanks to philips77.

I was using BluetoothLeScanner with a delayed batch report, through ScanSettings.

   ScanSettings scanSettings = new ScanSettings.Builder()
       ...
       .setReportDelay(delay)
       .build();

So, by getting rid of the delayed report, I was able to successfully connect to the device in DFU mode.

I don't fully understand the root cause as of now, but you can find more about it in the github issue.

Upvotes: 1

Related Questions