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

SDK10 DFU Problems Freezing

Hi,

I'm using the SDK10 bootloader and DFU mechanism. I can update the firmware using Master Control Panel 3.10.14 on a PC, but the update fails using the iOS library or iOS Nordic tools. The iOS library and tools start the update successfully, but gives "Error 202" and the device disconnects and freezes. Does anyone have any clues? Why would Master Control Panel work, but not these other tools?

Here is my iOS library log:

  • I: Services discovered
  • V: Legacy DFU Service found
  • V: Discovering characteristics in DFU Service...
  • D: peripheral.discoverCharacteristics(nil, for: 00001530-1212-EFDE-1523-785FEABCD123)
  • I: DFU characteristics discovered
  • V: Reading DFU Version number...
  • D: peripheral.readValue(00001534-1212-EFDE-1523-785FEABCD123)
  • I: Read Response received from 00001534-1212-EFDE-1523-785FEABCD123, value (0x): 0400
  • A: Version number read: 0.4
  • V: Enabling notifications for 00001531-1212-EFDE-1523-785FEABCD123...
  • D: peripheral.setNotifyValue(true, for: 00001531-1212-EFDE-1523-785FEABCD123)
  • Changed state to: Starting
  • V: Notifications enabled for 00001531-1212-EFDE-1523-785FEABCD123
  • A: DFU Control Point notifications enabled
  • V: Writing to characteristic 00001531-1212-EFDE-1523-785FEABCD123...
  • D: peripheral.writeValue(0x0104, for: 00001531-1212-EFDE-1523-785FEABCD123, type: .withResponse)
  • V: Writing image sizes (0b, 0b, 52664b) to characteristic 00001532-1212-EFDE-1523-785FEABCD123...
  • D: peripheral.writeValue(0x0000000000000000b8cd0000, for: 00001532-1212-EFDE-1523-785FEABCD123, type: .withoutResponse)
  • I: Data written to 00001531-1212-EFDE-1523-785FEABCD123
  • A: Start DFU (Op Code = 1, Upload Mode = 4) request sent
  • D: [Callback] Central Manager did disconnect peripheral
  • I: Disconnected by the remote device
  • Error 202: Device disconnected unexpectedly
  • I solved the issue. For the Nordic tools other than Master Control panel (for some reason), the DFU revision characteristic is used to determine state information about the firmware. With SDK10 buttonless update, the DFU revision in the main application needs to be set to 0.1. The Nordic tools use this to tell that the device is operating in application mode rather than bootloader mode. In the bootloader, the revision needs to be set to specific values so the tools/libraries know how to communicate with the update service. This revision number is tied to the specific SDK version or DFU features you are using.

    I was using this characteristic to store version information about my app. The main headache was that MCP wasn't using it for some reason. It made it hard to debug.

    I found this comment about DFU revision in the iOS DFU library helpful:

    • 0.1 - Device is in a mode that supports buttonless jump to the DFU Bootloader

    • 0.5 - Device can handle DFU operation. Extended Init packet is required. Bond information is lost in the bootloader mode and after updating an app. Released in SDK 7.0.0.

    • 0.6 - Bond information is kept in bootloader mode and may be kept after updating application (DFU Bootloader must be configured to preserve the bond information).

    • 0.7 - The SHA-256 firmware hash is used in the Extended Init Packet instead of CRC-16. This feature is transparent for the DFU Service.

    • 0.8 - The Extended Init Packet is signed using the private key. The bootloader, using the public key, is able to verify the content. Released in SDK 9.0.0 as experimental feature. Caution! The firmware type (Application, Bootloader, SoftDevice or SoftDevice+Bootloader) is not encrypted as it is not a part of the Extended Init Packet. A change in the protocol will be required to fix this issue.

  • Where do you change this value? I've looked in main.c for both the app and the bootloader but can't find it. Thanks.

  • Search your project for where you initialize the ble_dfu_init_t struct. The .revision struct member contains this value. It should be defined in two places: dfu_transport_ble.c for the bootloader and somewhere in your application when you setup the DFU service.

  • Thanks for the reply @jward. I can't find anywhere in SDK12 that has the .revision struct member. I think I must have a different problem with similar effect as you. I'll post a new question in Devzone. Thanks again.

Related