Android-DFU-Library icon indicating copy to clipboard operation
Android-DFU-Library copied to clipboard

Issue with updating devices with legacy boot loader

Open tpevahouse25 opened this issue 3 years ago • 6 comments

I am having an issue updating my devices that have the legacy boot loader that is used with the Adafruit library. This android dfu library works fine with the secured boot loader.

tpevahouse25 avatar May 09 '22 14:05 tpevahouse25

Hello,

Could you elaborate more on the issue? What is the issue? What phone? Android version? Library version? Which nRF SDK are you using? Are you using bonding? And please, provide logs from LogCat.

philips77 avatar May 10 '22 10:05 philips77

Could you elaborate more on the issue? What is the issue?

I am using a dart package that uses the Android-DFU-Library. When i try to update a device that i have a legacy boot loader on, it never finishes the update. It will act like it is sending the update but restarts the update multiple times and leaves the device in DFU mode.

What phone?

This occurs on any android phone when compiled with android sdk 31 and up.

Android version?

This issue started when android 12 was release and I was forced to upgrade my code to compile with android sdk version 31.

Library version?

Adafruit library version 0.18.5

Which nRF SDK are you using?

On the hardware side Unsure of actual Nordic SDK version. However, matching up release dates on Github between the nrfx drivers (https://github.com/NordicSemiconductor/nrfx/releases/tag/v2.1.0) and the Adafruit Library Version 0.18.5 (https://github.com/adafruit/Adafruit_nRF52_Arduino/releases/tag/0.18.5), it looks like version 2.1.0 of the nrfx drivers would have been used.

nRF52832 v6.1.1 s132 Soft Device

On the app side this is from the Build.gradle file of the dart library

android {
    compileSdkVersion 32
    sourceSets {
        main.java.srcDirs += 'src/main/kotlin'
    }
    defaultConfig {
        minSdkVersion 18
    }
}

dependencies {
    implementation 'no.nordicsemi.android:dfu:2.0.2'
    implementation "org.jetbrains.kotlin:kotlin-stdlib-jdk7:$kotlin_version"
}

Are you using bonding?

I am not using bonding.

And please, provide logs from LogCat.

I have attached my LogCat printout for when the device is trying to update. Android DFU LogCat Printout.txt

tpevahouse25 avatar May 10 '22 20:05 tpevahouse25

Here's the relevant part of the logs:

2022-05-10 15:10:16.385 I/DfuImpl: Reading DFU version number...
2022-05-10 15:10:16.515 I/DfuImpl: Version number read: 0.8 -> Bootloader from SDK 9.0 or newer. Signature supported
2022-05-10 15:10:16.516 W/DfuImpl: Legacy DFU bootloader found
2022-05-10 15:10:16.516 I/DfuImpl: Requesting MTU = 517
2022-05-10 15:10:16.607 I/DfuImpl: MTU changed to: 247
2022-05-10 15:10:17.609 I/DfuImpl: Enabling notifications...
2022-05-10 15:10:18.733 I/DfuImpl: Sending Start DFU command (Op Code = 1, Upload Mode = 4)
2022-05-10 15:10:18.902 I/DfuImpl: Sending image size array to DFU Packet (0b, 0b, 181388b)
2022-05-10 15:10:19.531 I/DfuImpl: Sending the Initialize DFU Parameters START (Op Code = 2, Value = 0)
2022-05-10 15:10:19.711 I/DfuImpl: Sending 14 bytes of init packet
2022-05-10 15:10:19.712 I/DfuImpl: Sending init packet (Value = 52-00-FF-FF-FF-FF-FF-FF-01-00-B7-00-A6-E4)
2022-05-10 15:10:19.717 I/DfuImpl: Sending the Initialize DFU Parameters COMPLETE (Op Code = 2, Value = 1)
2022-05-10 15:10:19.981 I/DfuImpl: Sending Receive Firmware Image request (Op Code = 3)
2022-05-10 15:10:20.086 I/DfuImpl: Uploading firmware...

Do you get any progress updates, or state changes? Did you try setting MTU to the default 23 instead of 517 using https://github.com/NordicSemiconductor/Android-DFU-Library/blob/4509630bf9dbae20a977d794fbe973bc9fe8bd2a/lib_dfu/src/main/java/no/nordicsemi/android/dfu/DfuServiceInitiator.java#L372-L375 Also, try enabling Package Receipt Notifications using https://github.com/NordicSemiconductor/Android-DFU-Library/blob/4509630bf9dbae20a977d794fbe973bc9fe8bd2a/lib_dfu/src/main/java/no/nordicsemi/android/dfu/DfuServiceInitiator.java#L228-L231 and https://github.com/NordicSemiconductor/Android-DFU-Library/blob/4509630bf9dbae20a977d794fbe973bc9fe8bd2a/lib_dfu/src/main/java/no/nordicsemi/android/dfu/DfuServiceInitiator.java#L246-L249

philips77 avatar May 11 '22 10:05 philips77

Hello, Did you manage to solve your problem? Can we close the issue?

philips77 avatar Aug 08 '22 08:08 philips77

I'm about to release version 2.1 of the library. Could you give it a spin, when it's out?

philips77 avatar Aug 08 '22 13:08 philips77

So I am using the nordic_dfu package for flutter. I will contact the author of the package and see if he will update the android dfu library and I will test it then. Thank you for your followup.

tpevahouse25 avatar Aug 08 '22 16:08 tpevahouse25

I'll close the issue now. Feel free to reopen if needed.

philips77 avatar Aug 11 '22 08:08 philips77