Beware that this post is related to an SDK in maintenance mode
More Info: Consider nRF Connect SDK for new designs

DFU BLE Connect and NRF Connect

Hello!

I am facing some strange behaviour using nordics dfu update service on android.

Somtimes after starting the dfu upload the app is not able to connect to the dfu target with error 133:

I/DfuBaseService: Connecting to the device...
D/BluetoothGatt: connect() - device: C0:E3:F7:8A:4F:77, auto: false
D/BluetoothGatt: registerApp()
    registerApp() - UUID=18abbf4d-9599-4c80-a028-4ef8fb58e83d
D/BluetoothGatt: onClientRegistered() - status=0 clientIf=9
D/BluetoothGatt: onClientConnectionState() - status=133 clientIf=9 device=C0:E3:F7:8A:4F:77
E/DfuBaseService: Connection state change error: 133 newState: 0
I/DfuBaseService: Connection error after: 30027 ms
E/DfuBaseService: Device not reachable. Check if the device with address C0:E3:F7:8A:4F:77 is in range, is advertising and is connectable
I/DfuBaseService: Attempt: 1
W/e.emotionmobil: Accessing hidden method Landroid/bluetooth/BluetoothGatt;->refresh()Z (unsupported, reflection, allowed)
D/BluetoothGatt: refresh() - device: C0:E3:F7:8A:4F:77
I/DfuBaseService: Refreshing result: true
    Cleaning up...
D/BluetoothGatt: cancelOpen() - device: C0:E3:F7:8A:4F:77
D/BluetoothGatt: close()
    unregisterApp() - mClientIf=9
I/DfuBaseService: Restarting the service
I/DfuBaseService: Starting DFU service in foreground
I/DfuBaseService: Connecting to the device...

When I am starting nrf connect app on the same mobile I suddenly get an connetion and update runs successful.

What does nrf connect at startup to "heal" ble in my app?

Does this question makes sense to anyone?

Thanks!

Andreas

Parents
  • Hello Andreas

    Error code 133 is very famous for being undocumented by Android itself. It is kind of a generic GATT/GAP error, usually related to a timeout where the phone is trying to do something when it is disconnected. This error happens very rarely from Android 8.0 onwards (it sometimes may be on Samsung devices and we almost never see this on Pixels). If the phone is older or has a worse BLE implementation there is a larger chance of this occuring.

    What does nrf connect at startup to "heal" ble in my app?

    So my guess is that it doesn't do anything in particular to heal it. It just restarts it. Solutions to other run-ins with error code 133 includes increasing the connection retries or even increase the delay between each retry, so it would make sense that another attempt would make it work for you.

    Could you tell me how often this happens per DFU attempt? And what phone are you using?

    Best regards,

    Elfving

  • Hello Elfving,

    thank you for your reply.

    I searched a little bit more and found some threads where it says that the change of the MAC address (+1) while booting in bootloader may cause connection problems on android as there will be no ble scan  when starting dfu library update.

    I have to verify this but I changed my android app to start a 10 second ble scan right before starting dfu update and until now connection can be made!

    Andreas!

  • Hello again!

    That sounds great! Thanks for sharing your solution here.

    Best regards,

    Elfving

Reply Children
No Data
Related