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

Android OTA DFU not working with latest SDK, DFU library

Hi,

I have an issue that is urgent for me, as we wish to add DFU capabilities via pre and post production hardware.

I am using Android 10 on Samsung Galaxy A10 to test.

I clone the repository from nRF Toolbox, run the app on the phone - and the DFU process succeeds.

I then copy paste that code as much as I can for my specific use case, and the device goes into bootloader mode but the connection is lost before the DFU process starts.

I have put more detail in the Github issue comment here:
https://github.com/NordicSemiconductor/Android-DFU-Library/issues/250#issuecomment-656074123

To my knowledge the configuration code is the same as the nRFTool Box - but I must be missing something?

The error log I get states the generic issue:

E/DfuBaseService: Connection state change error: 133 newState: 0
E/DfuBaseService: An error occurred while connecting to the device:133

and we are using the latest SDKs with the DFU implementation that is out of the box implementation provided by Nordic firmware sample (I am paraphrasing hardware team here). This isn't an issue coming from Legacy DFU, besides we know it works with nRF Toolbox app running on the same device so it shouldn't be a hardware issue.

I have created a stripped down sample project and shared it on github here:

https://github.com/oliver-ep/android-nordic-dfu

it is basically a Kotlin version of the nRF Toolbox code, copy pasted as much as I can, with a simple UI and one use case. The device address is hard-coded, and the app will immediately open a file picker to select the firmware file - and we are only using the .zip file. All the hard-coded values used for configuring the DFU initialiser was obtained from debugging with a functional nRF Toolbox clone app.

What am I missing? 
Is it possible that I need to establish a BLE connection and discover the services exposed before referencing the DFU library? 

Thanks,

Oliver

Parents
  • Hi, so very fortunately I discovered the issue.

    The issue was that in the sample code referenced above (and the specific activity code I was working on) wasn't asking for location permission. Turned on location permission from the settings and the entire DFU process worked.

    I think this will trip up anyone who took the same approach as me to make a single activity to integrate DFU library and use cases - not knowing that location permission was required for the DFU process to complete. 

    Without it, obviously BLE works, turns the device into bootloader mode - but you will get a generic error message that doesn't help at all.


    In my opinion the library should have picked up on this, and perhaps the nRF Toolbox repository should mention this too as a comment or part of the documentation for the DFU feature activity. 

    I hope this helps someone down the line. Thanks

Reply
  • Hi, so very fortunately I discovered the issue.

    The issue was that in the sample code referenced above (and the specific activity code I was working on) wasn't asking for location permission. Turned on location permission from the settings and the entire DFU process worked.

    I think this will trip up anyone who took the same approach as me to make a single activity to integrate DFU library and use cases - not knowing that location permission was required for the DFU process to complete. 

    Without it, obviously BLE works, turns the device into bootloader mode - but you will get a generic error message that doesn't help at all.


    In my opinion the library should have picked up on this, and perhaps the nRF Toolbox repository should mention this too as a comment or part of the documentation for the DFU feature activity. 

    I hope this helps someone down the line. Thanks

Children
Related