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

nRF52810 buttonless DFU issues

Hello ...

I'm adding buttonless DFU support to my nRF52810 application using the instructions here. I'm using SDK 15.3.0, SD 112 6.1.1.

First question: These instructions state that use of Peer Manager is a prerequisite. If my application does not use bonding, is Peer Manager still a prerequisite?

I was successful in adding buttonless DFU support to the ble_app_blinky example application. Generally, I followed these steps:

1. Generated private/public key pair.

2. Replaced dfu_public_key.c for the example secure bootloader project at: <nRF5 SDK Folder>/examples/dfu/

3. Built application <nRF5 SDK Folder>/examples/dfu/secure_bootloader/pca10040e_ble/ses/secure_bootloader_ble_s112_pca10040e.emProject

4. Updated the ble_app_blinky example app according to Nordic instructions (added dfu .c files to project, added preprocessor definitions, added include directories, made changes to sdk_config.h, added includes and source additions to main.c).

5. Built ble_app_blinky with added buttonless DFU support.

6. Generated the bootloader settings file using nrfutil for the application ble_app_blinky_pca10040e_s112.hex

7. Using mergehex, merged the bootloader settings, bootloader and softdevice together.

8. Merged the output of 7 with the application.

9. Used nrfjprog to erase, program and reset the nRF52 dev kit.

10. Using nRF Connect (mobile for iOS v2.1.1) I verified that the secure DFU service is available.

11. Then I created a version 2 of the ble_app_blinky application (I just changed which LED is turned on when connected via BLE).

12. Created a DFU package for the new application (--application-version 2 --hw-version 52 --sd-req 0xB8).

13. I transferred the package from 12 to my iOS device, then used nRF Connect (mobile) to connect to the nRF52 dev kit and perform a DFU using the package from 12. All worked well.

Then ... I proceeded to follow the same steps to add buttonless DFU support to my own BLE application. My BLE application is the ble_app_uart example app with uart stripped out and TWIM added. The hex file for the built application is 158K.

After programming the dev kit with the bootloader settings + bootloader + v1 of application, I created version 2 of the application, created the DFU package, transferred to my iOS device and tried to DFU to the dev kit. I get timeout error for Data object 2/14. I've attached the nRF Connect mobile log. I tried the same using nRF Connect desktop (macOS, Bluetooth Low Energy v2.3.2). I've attached log for that as well.

This is new learning for me. Appreciate any guidance.

Thanks,

Tim

00:16:30.942	Application data folder: /Users/timsenger/Library/Application Support/nrfconnect/pc-nrfconnect-ble
00:16:36.099	Validating connectivity firmware for device with serial number 000682909244...
00:16:44.487	Connectivity firmware is valid.
00:16:44.488	Note: Adapters with Segger JLink debug probe requires MSD to be disabled to function properly on MacOS and Linux. Please visit www.nordicsemi.com/nRFConnectOSXfix for further instructions.
00:16:44.488	Getting information from J-Link debugger...
00:16:45.011	Found device type: unknown. J-Link firmware: J-Link OB-SAM3U128-V2-NordicSemi compiled Jan 7 2019 14:07:15.
00:16:45.011	Connectivity firmware version: 4.1.1. SoftDevice API version: 3. Baud rate: 1000000.
00:16:45.012	Opening adapter connected to /dev/tty.usbmodem1421
00:16:45.939	Successfully opened /dev/tty.usbmodem1421. Baud rate: 1000000. Flow control: none. Parity: none.
00:16:45.940	Reset performed on adapter /dev/tty.usbmodem1421
00:16:47.011	Adapter connected to /dev/tty.usbmodem1421 opened
00:16:52.685	Scan started
00:16:55.268	Connecting to device
00:16:55.492	Connected to device F8:19:52:5B:2D:9E
00:16:55.509	ATT MTU changed, new value is 247
00:16:55.715	Attribute value read, handle: 0x03, value (0x): 62-65-61-6D-20-38
00:17:35.160	Disconnected from device F8:19:52:5B:2D:9E, reason: undefined
00:17:35.162	Performing DFU with file: /Users/timsenger/Documents/my_buttonless_dfu/my_app_v2.zip
00:17:35.549	Attribute value changed, handle: 0x17, value (0x): 02-00
00:17:35.564	Attribute value changed, handle: 0x16, value (0x): 01
00:17:35.567	Attribute value changed, handle: 0x16, value (0x): 20-01-01
00:17:40.584	Attribute value changed, handle: 0x10, value (0x): 01-00
00:17:40.614	Attribute value changed, handle: 0x0F, value (0x): 02-00-00
00:17:40.615	Attribute value changed, handle: 0x0F, value (0x): 60-02-01
00:17:40.673	Attribute value changed, handle: 0x0F, value (0x): 06-01
00:17:40.703	Attribute value changed, handle: 0x0F, value (0x): 60-06-01-00-02-00-00-8D-00-00-00-1D-CE-52-43
00:17:40.734	Attribute value changed, handle: 0x0F, value (0x): 04
00:17:40.734	Attribute value changed, handle: 0x0F, value (0x): 60-04-01
00:17:40.764	Attribute value changed, handle: 0x0F, value (0x): 06-02
00:17:40.766	Attribute value changed, handle: 0x0F, value (0x): 60-06-01-00-10-00-00-00-00-00-00-00-00-00-00
00:17:40.794	Attribute value changed, handle: 0x0F, value (0x): 06-02
00:17:40.794	Attribute value changed, handle: 0x0F, value (0x): 60-06-01-00-10-00-00-00-00-00-00-00-00-00-00
00:17:40.824	Attribute value changed, handle: 0x0F, value (0x): 01-02-00-10-00-00
00:17:40.825	Attribute value changed, handle: 0x0F, value (0x): 60-01-01
00:17:42.360	Received status with code 4 Unknown value, message: 'Error sending packet to target. Code: 0x802a'
00:17:42.384	Attribute value changed, handle: 0x0F, value (0x): 01-02-00-10-00-00
00:17:42.385	Attribute value changed, handle: 0x0F, value (0x): 60-01-01
00:17:43.901	Received status with code 4 Unknown value, message: 'Error sending packet to target. Code: 0x802a'
00:17:43.929	Attribute value changed, handle: 0x0F, value (0x): 01-02-00-10-00-00
00:17:43.931	Attribute value changed, handle: 0x0F, value (0x): 60-01-01
00:17:46.884	DFU failed with error: When writing data to DFU Packet Characteristic on DFU Target: Failed to write to attribute with handle: 13: Error occured when writing. Errorcode: Unknown value (0x8005) .
00:17:46.888	Received status with code 4 Unknown value, message: 'Error sending packet to target. Code: 0x802a'
File Name: my_app_v2.zip
Parts: 1
Application Size: 56 KB
Soft Device Size: Zero KB
Bootloader Size: Zero KB
[Callback] Central Manager did update state to: Powered ON
Connecting to device 8...
centralManager.connect(peripheral, options: nil)
[Callback] Central Manager did connect peripheral
Connected to device 8
Discovering services...
peripheral.discoverServices(nil)
Services discovered
Starting Secure DFU...
Connected to device 8
Services discovered
Secure DFU Service found
Discovering characteristics in DFU Service...
peripheral.discoverCharacteristics(nil, for: FE59)
DFU characteristics discovered
Enabling indications for 8EC90003-F315-4F60-9FB8-838830DAEA50...
peripheral.setNotifyValue(true, for: 8EC90003-F315-4F60-9FB8-838830DAEA50)
Indications enabled for 8EC90003-F315-4F60-9FB8-838830DAEA50
Buttonless DFU indications enabled
Application with buttonless update found
Trying setting bootloader name to Dfu37937
Writing to characteristic 8EC90003-F315-4F60-9FB8-838830DAEA50...
peripheral.writeValue(0x02084466753337393337, for: 8EC90003-F315-4F60-9FB8-838830DAEA50, type: .withResponse)
Data written to 8EC90003-F315-4F60-9FB8-838830DAEA50
Indication received from 8EC90003-F315-4F60-9FB8-838830DAEA50, value (0x):200201
Response (Op Code = 2, Status = 1) received
Bootloader name changed successfully
Writing to characteristic 8EC90003-F315-4F60-9FB8-838830DAEA50...
peripheral.writeValue(0x01, for: 8EC90003-F315-4F60-9FB8-838830DAEA50, type: .withResponse)
Data written to 8EC90003-F315-4F60-9FB8-838830DAEA50
Indication received from 8EC90003-F315-4F60-9FB8-838830DAEA50, value (0x):200101
Response (Op Code = 1, Status = 1) received
[Callback] Central Manager did disconnect peripheral
Disconnected by the remote device
Scanning for the DFU Bootloader...
DFU Bootloader found with name Dfu37937
Connecting to Dfu45409...
centralManager.connect(peripheral, options: nil)
[Callback] Central Manager did connect peripheral
Connected to Dfu45409
Discovering services...
peripheral.discoverServices([FE59])
Services discovered
Secure DFU Service found
Discovering characteristics in DFU Service...
peripheral.discoverCharacteristics(nil, for: FE59)
DFU characteristics discovered
MTU set to 183
Enabling notifications for 8EC90001-F315-4F60-9FB8-838830DAEA50...
peripheral.setNotifyValue(true, for: 8EC90001-F315-4F60-9FB8-838830DAEA50)
Notifications enabled for 8EC90001-F315-4F60-9FB8-838830DAEA50
Secure DFU Control Point notifications enabled
Writing to characteristic 8EC90001-F315-4F60-9FB8-838830DAEA50...
peripheral.writeValue(0x0601, for: 8EC90001-F315-4F60-9FB8-838830DAEA50, type: .withResponse)
Data written to 8EC90001-F315-4F60-9FB8-838830DAEA50
Notification received from 8EC90001-F315-4F60-9FB8-838830DAEA50, value (0x): 600601000200000000000000000000
Command object info (Max size = 512, Offset = 0, CRC = 00000000) received
Writing to characteristic 8EC90001-F315-4F60-9FB8-838830DAEA50...
peripheral.writeValue(0x01018d000000, for: 8EC90001-F315-4F60-9FB8-838830DAEA50, type: .withResponse)
Data written to 8EC90001-F315-4F60-9FB8-838830DAEA50
Notification received from 8EC90001-F315-4F60-9FB8-838830DAEA50, value (0x): 600101
Writing to characteristic 8EC90001-F315-4F60-9FB8-838830DAEA50...
peripheral.writeValue(0x020000, for: 8EC90001-F315-4F60-9FB8-838830DAEA50, type: .withResponse)
Data written to 8EC90001-F315-4F60-9FB8-838830DAEA50
Notification received from 8EC90001-F315-4F60-9FB8-838830DAEA50, value (0x): 600201
Packet Receipt Notif disabled (Op Code = 2, Value = 0)
Writing to characteristic 8EC90002-F315-4F60-9FB8-838830DAEA50...
peripheral.writeValue(0x128a010a4408011240080210341a02b80120002800300038b8b603422408031220d29ec18cc65be291437748f142a55feee729505020cbf9c9a9af87ef55b696a0480052040801120010001a40a2dfcda638c137922be3925b1263b6c3224b4cfb80e4a3bddfaaa336648b9e587914b9285623fe53aecdfe4191c75549d534f347393f355e572aa092cc56dcef, for: 8EC90002-F315-4F60-9FB8-838830DAEA50, type: .withoutResponse)
Command object sent (CRC = 2798F715)
Writing to characteristic 8EC90001-F315-4F60-9FB8-838830DAEA50...
peripheral.writeValue(0x03, for: 8EC90001-F315-4F60-9FB8-838830DAEA50, type: .withResponse)
Data written to 8EC90001-F315-4F60-9FB8-838830DAEA50
Notification received from 8EC90001-F315-4F60-9FB8-838830DAEA50, value (0x): 6003018d00000015f79827
Checksum (Offset = 141, CRC = 2798F715) received
Writing to characteristic 8EC90001-F315-4F60-9FB8-838830DAEA50...
peripheral.writeValue(0x04, for: 8EC90001-F315-4F60-9FB8-838830DAEA50, type: .withResponse)
Data written to 8EC90001-F315-4F60-9FB8-838830DAEA50
Notification received from 8EC90001-F315-4F60-9FB8-838830DAEA50, value (0x): 600401
Command object executed
Writing to characteristic 8EC90001-F315-4F60-9FB8-838830DAEA50...
peripheral.writeValue(0x020c00, for: 8EC90001-F315-4F60-9FB8-838830DAEA50, type: .withResponse)
Data written to 8EC90001-F315-4F60-9FB8-838830DAEA50
Notification received from 8EC90001-F315-4F60-9FB8-838830DAEA50, value (0x): 600201
Packet Receipt Notif enabled (Op Code = 2, Value = 12)
Writing to characteristic 8EC90001-F315-4F60-9FB8-838830DAEA50...
peripheral.writeValue(0x0602, for: 8EC90001-F315-4F60-9FB8-838830DAEA50, type: .withResponse)
Data written to 8EC90001-F315-4F60-9FB8-838830DAEA50
Notification received from 8EC90001-F315-4F60-9FB8-838830DAEA50, value (0x): 600601001000000000000000000000
Data object info (Max size = 4096, Offset = 0, CRC = 00000000) received
Writing to characteristic 8EC90001-F315-4F60-9FB8-838830DAEA50...
peripheral.writeValue(0x010200100000, for: 8EC90001-F315-4F60-9FB8-838830DAEA50, type: .withResponse)
Data written to 8EC90001-F315-4F60-9FB8-838830DAEA50
Notification received from 8EC90001-F315-4F60-9FB8-838830DAEA50, value (0x): 600101
Data object 1/14 created
wait(400)
Uploading firmware...
Sending firmware to DFU Packet characteristic...
Writing to characteristic 8EC90001-F315-4F60-9FB8-838830DAEA50...
peripheral.writeValue(0x03, for: 8EC90001-F315-4F60-9FB8-838830DAEA50, type: .withResponse)
Data written to 8EC90001-F315-4F60-9FB8-838830DAEA50
Notification received from 8EC90001-F315-4F60-9FB8-838830DAEA50, value (0x): 60030100100000291a7307
Checksum (Offset = 4096, CRC = 07731A29) received
Writing to characteristic 8EC90001-F315-4F60-9FB8-838830DAEA50...
peripheral.writeValue(0x04, for: 8EC90001-F315-4F60-9FB8-838830DAEA50, type: .withResponse)
Data written to 8EC90001-F315-4F60-9FB8-838830DAEA50
Notification received from 8EC90001-F315-4F60-9FB8-838830DAEA50, value (0x): 600401
Data object executed
Writing to characteristic 8EC90001-F315-4F60-9FB8-838830DAEA50...
peripheral.writeValue(0x010200100000, for: 8EC90001-F315-4F60-9FB8-838830DAEA50, type: .withResponse)
Data written to 8EC90001-F315-4F60-9FB8-838830DAEA50
Notification received from 8EC90001-F315-4F60-9FB8-838830DAEA50, value (0x): 600101
Data object 2/14 created
Uploading firmware...
Sending firmware to DFU Packet characteristic...
[Callback] Central Manager did disconnect peripheral
Disconnected by the remote device
Connecting to Dfu45409...
centralManager.connect(peripheral, options: nil)
centralManager.cancelPeripheralConnection(peripheral)
[Callback] Central Manager failed to connect to peripheral (timeout)

Parents
  • First question: These instructions state that use of Peer Manager is a prerequisite. If my application does not use bonding, is Peer Manager still a prerequisite?

    No, if you're application does not use bonding then the Peer Manager is not strictly needed. 

    Then ... I proceeded to follow the same steps to add buttonless DFU support to my own BLE application. My BLE application is the ble_app_uart example app with uart stripped out and TWIM added. The hex file for the built application is 158K.

    After programming the dev kit with the bootloader settings + bootloader + v1 of application, I created version 2 of the application, created the DFU package, transferred to my iOS device and tried to DFU to the dev kit. I get timeout error for Data object 2/14. I've attached the nRF Connect mobile log. I tried the same using nRF Connect desktop (macOS, Bluetooth Low Energy v2.3.2). I've attached log for that as well.

     I assume that the code size of the application is smaller than 158K, otherwise the image would have been rejected as this is to large for the flash left when one subtracts the SD( 100kB) and the bootloader(24kB). Anyways, from the log I see that the init packet is received correctly and that the fist part of the firmware image transfer is initiated, but you're getting an error when the actual data transfer starts

    , i.e. after the END IF in the attached sequence diagram. 

     

    Is possible for you to use the pca10056e_ble_debug bootloader and capture te log from the DFUtarget as well? Or will there then not be enough space for your application?

    Best regards

    Bjørn

  • Sorry, Bjørn, for not closing the loop on this. We were originally using Laird's BL651 module which has nRF52810 and 192K of flash. I was using the nRF52 DK in nRF52810 emulation mode. When I switched to nRF52832 with 512K of flash, the above issue went away. Haven't taken time to investigate further. 

Reply Children
No Data
Related