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

nrf52 DFU package with SD+BL+APPS fails to reconnect on iOS nrfToolbox after updating SD+BL

We're seeing an issue where a dfu package containing SD+BL+Apps gets stuck on iOS nrfToolbox during DFU process after it updated the first part 1/2, which is BL+SD. The same dfu package works on the Android nrfToolbox DFU, it's able to reconnect just fine to update the 2nd part, apps.

last part of iOS log after part 1/2: Application: Upload completed in 158.17 seconds Debug: [Callback] Central Manager did disconnect peripheral Info: Disconnected by the remote device Verbose: Scanning for the DFU Bootloader... <-- stuck here

I've confirmed that the target device did reboot back to DFU and advertises just fine. Again, on Android this usecase works just fine with the same dfu package containing SD+BL+Apps.

  • Hi Francis,

    Would the error happens 100% of the time or occasionally ?

    Have you tried to use nRFConnect instead of nRFToolbox ?

    I assume that after the issue happens, if you do DFU for just the application, it works ?

  • Yes, so far it happens 100% for me. I haven't tried nRFConnect yet. Does nRFConnect do anything differently from nrf Toolbox in terms of the iOS DFULibrary pod? And yes, if i do DFU on iOS for an image that updates without multiple parts, it works, i.e. app only or bl only.

  • I tried nrf Connect on iOS as well, it also wasn't able to reconnect to the robot after updating the sd_bl image of a BL+SD+APP dfu package.

  • Hi Francis,

    I think the problem you have is related to how iOS DFU Libary reconnects to the 'new' bootloader after SD+BL was flashed. In the current version of Secure DFU, and in some cases in Legacy DFU, the new bootloader will advertise with address +1, comparing to what the device in app mode had. The reason for that is that when SD+BL is flashed, the old app is removed and the new bootloader doesn't know if the previous app had Service Changed characteristics or bonding so it must change the address so on device that cache services it can be correctly handled.

    On Android we can just rely on the device address, add +1 to it and look for this new address. On iOS the API does not expose devices addresses, so we have to do some tricks. The DFUPeripheralSelector is used instead. The default one selects a first device having DFU Service UUID in the advertisement packet. If your bootloader advertises with different data you have to override it and set to the DFUServiceInitiator as described in the inline docs. However, this DFUPeripheralSelector, in the current version, will connect to the first device found having the required service UUID so if you have a bunch of devices in DFU mode a random one can be actually updated. A solution for this will come in SDK 14 and 14.1, I suppose, or somewhere in not that far future.

    So, TLDR, the selector scans until it finds a device advertising with something that return true. I hope it solves your issue.

  • Hi, I am having more or less the same issue. In my case, the APP is able to reconnect but it is stuck at:

    99% (1/2)
    100% (1/2)
    Info: Notification received from 8EC90001-F315-4F60-9FB8-838830DAEA50, value (0x):600301502f02005cc7604c
    Application: Response (Op Code = Calculate Checksum, Status = Success) received
    Info: Chunk CRC matches, exetuce!
    Application: Writing Execute last object command...
    Verbose: Writing to characteristic 8EC90001-F315-4F60-9FB8-838830DAEA50...
    Debug: peripheral.writeValue(0x04, forCharacteristic: 8EC90001-F315-4F60-9FB8-838830DAEA50, type: WithResponse)
    Info: Notification received from 8EC90001-F315-4F60-9FB8-838830DAEA50, value (0x):600401
    Application: Response (Op Code = Execute, Status = Success) received
    Verbose: Disconnecting...
    Debug: centralManager.cancelPeripheralConnection(peripheral)
    Verbose: Scanning for the DFU Bootloader...
    Info: Resetting peripheral
    Debug: [Callback] Central Manager did disconnect peripheral without error
    Info: DFU Bootloader found with name iBKSDFU52V3
    Verbose: Connecting to iBKSDFU52V3...
    Debug: centralManager.connectPeripheral(peripheral, options:nil)
    Debug: [Callback] Central Manager did connect peripheral
    Info: Connected to iBKSDFU52V3
    Verbose: Discovering services...
    Debug: periphera.discoverServices(nil)
    Info: Services discovered
    Verbose: Secure DFU Service found
    Verbose: Discovering characteristics in DFU Service...
    Debug: peripheral.discoverCharacteristics(nil, forService:DFUService)
    Info: DFU characteristics discovered
    Verbose: Enabling notifiactions for 00001531-1212-EFDE-1523-785FEABCD123...
    Debug: peripheral.setNotifyValue(true, forCharacteristic: 00001531-1212-EFDE-1523-785FEABCD123)
    Verbose: Notifications enabled for 8EC90001-F315-4F60-9FB8-838830DAEA50
    Application: DFU Control Point notifications enabled
    Application: Writing Read object information command...
    Verbose: Writing to characteristic 8EC90001-F315-4F60-9FB8-838830DAEA50...
    Debug: peripheral.writeValue(0x0601, forCharacteristic: 8EC90001-F315-4F60-9FB8-838830DAEA50, type: WithResponse)

    Any solution?

    Thank you.

Related