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

custom DFU package

Hi,

I am using nRF51822, SDK 10, SoftDevice S110 v.8

I am strugling with DFU over BLE using custom DFU package.

I am able to flash bootloader and update FW with pregenerated files in SDK using nrf Connect(\dfu\ble_dfu_send_hex\test_images_update_nrf51\dfu_test_app_hrm_s110.zip).

But strugling with custom made package. Update of application is good enough for me. I do not need to update softdevice nor bootloader.

I use these commands in nrfutil:

nrfutil keys generate privatekey.pem
nrfutil pkg generate --hw-version 51 --sd-req 0x64 --application-version 4 --application nrf51422_xxac_s110.hex --key-file privatekey.pem app_dfu_package.zip

DFU fails in both nrf Connect and nRF Toolbox. Error is: disconnected by remote device .

I followed this tutorial: https://devzone.nordicsemi.com/nordic/short-range-guides/b/software-development-kit/posts/setting-up-device-firmware-updatedfu-on-the-nrf5-d

But there is not much about generating of custom DFU packages. I think problem could be signing. (I do not understand it properly and I am probably missing something... I sign the package but how does the application currently running on nRF51822 know right key?) 

Could you please guide me?

Thanks,

Mila

Parents
  • Hello,

    You must use nrfutil version 0.5.x to generate DFU packages for our legacy DFU solution (ie everything pre-SDK version 12). And instructions on how to generate a legacy DFU packet can be found in the SDK documentation here: Creating an image file

    Note that the legacy bootloader did not support FW signing, so the private key will not be needed.

    Old nrfutil executable:

    https://devzone.nordicsemi.com/cfs-file/__key/support-attachments/beef5d1b77644c448dabff31668f3a47-caeda5fe0e86403d96fd321fac1e3bfd/nrfutil.exe

  • Thank you. Right version of nrfutil helped me to create right package.

    I am now able to perform DFU over BLE several times when I create packege from example project. But i do have issue with my project. I can perform DFU over BLE with my project but only once. Once my application is running I can not update it with anything.

    It is modified ble_app_hrs S110 with DFU example I added Nordic UART service and app_timers for communication with sensors. I did no change to device manager, nor parts of code with compiler switch DFU.

    DFU always fails with this error: [DFU] Disconnected by the remote device

    Log from nrf Connect is attached. Where do you think the issue could be?

    Thank you

    Fullscreen
    1
    2
    3
    4
    5
    6
    7
    8
    9
    10
    11
    12
    13
    14
    15
    16
    17
    18
    19
    20
    21
    nRF Connect, 2020-06-17
    PEPA (E2:E3:43:E4:49:7D)
    V 23:44:04.176 Connecting to E2:E3:43:E4:49:7D...
    D 23:44:04.176 gatt = device.connectGatt(autoConnect = false, TRANSPORT_LE, preferred PHY = LE 1M)
    D 23:44:04.894 [Callback] Connection state changed with status: 0 and new state: CONNECTED (2)
    I 23:44:04.894 Connected to E2:E3:43:E4:49:7D
    D 23:44:04.895 [Broadcast] Action received: android.bluetooth.device.action.ACL_CONNECTED
    V 23:44:04.912 Discovering services...
    D 23:44:04.912 gatt.discoverServices()
    I 23:44:05.232 Connection parameters updated (interval: 7.5ms, latency: 0, timeout: 5000ms)
    D 23:44:05.687 [Callback] Services discovered with status: 0
    I 23:44:05.687 Services discovered
    V 23:44:05.707 Generic Access (0x1800)
    - Device Name [R W] (0x2A00)
    - Appearance [R] (0x2A01)
    - Peripheral Preferred Connection Parameters [R] (0x2A04)
    Generic Attribute (0x1801)
    - Service Changed [I] (0x2A05)
    Client Characteristic Configuration (0x2902)
    Nordic UART Service (6e400001-b5a3-f393-e0a9-e50e24dcca9e)
    - TX Characteristic [N] (6e400003-b5a3-f393-e0a9-e50e24dcca9e)
    XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX

  • chladm said:
    DFU always fails with this error: [DFU] Disconnected by the remote device

    This indicates that the device is not entering bootloader DFU mode as it's supposed to. I suggest you try to debug the application while sending the DFU start command and see if the program reaches bootloader_start() in dfu_app_handler.c

  • It reaches bootloader_start() function.

    It reaches the end of this function but I realized err_code = sd_ble_gatts_sys_attr_get(...);  does not return NRF_SUCCESS. I do not know if it is a problem.

  • Thanks for confirming. Have you enabled the service changed characteristic in your application like in the ble_app_hrs_with_dfu example (this line: ble_enable_params.gatts_enable_params.service_changed = IS_SRVC_CHANGED_CHARACT_PRESENT;)?

    You may also consider commenting out the call to "dfu_app_peer_data_set" in bootloader_start(). This will make the bootloader advertise openly (no whitelisting or directed advertising)

  • It is enabled.

    ble_enable_params.gatts_enable_params.service_changed = IS_SRVC_CHANGED_CHARACT_PRESENT;

    IS_SRVC_CHANGED_CHARACT_PRESENT is defined as 1

    I tried to comment "dfu_app_peer_data_set()" but do not see any difference. Still not successfull

  • Please check if the device advertises in normal app mode or DFU mode after you have received the error. You can usually tell what mode it is based on the device name it advertises. If it's in DFU mode, you can try to re-connect and complete the DFU.

Reply
  • Please check if the device advertises in normal app mode or DFU mode after you have received the error. You can usually tell what mode it is based on the device name it advertises. If it's in DFU mode, you can try to re-connect and complete the DFU.

Children