DFU Init Command Format

We are developing an application that will download an application update image over cellular HTTP. We want to skip the DFU transport altogether and directly write the image we receive over cellular to flash bank1 and then trigger the update activation.  It looks like we need to spoof the DFU transport portions that receive and execute the Init command, so the bootloader can perform its normal validations and then activate the new image.

How can we spoof the Init command?  Is the DFU Init command format documented?  I know the nrfutils create an update zip package that includes a *.dat file that (I think) is the Init packet, which gets executed to create the Init Command that is used to perform the FW update.  We are using the older SDK 17.

https://infocenter.nordicsemi.com/topic/sdk_nrf5_v17.1.0/lib_bootloader_dfu_validation.html?cp=9_1_3_5_1_1_0#lib_bootloader_dfu_init

Thanks!

Ron

Parents
  • Hello Ron, 

    The Init command is encoded with Protobuf and can be parsed with the protobuf parser included in the bootloader. However, the content of the init command should be transparent to both the sender and the transport layer, as it is normally only used by the bootloader to decide whether to accept the update and for subsequent validation and activation.

    To have the FW update activated by the bootloader, you will need to do the following:

    1. Ensure the bootloader is built with NRF_BL_DFU_ALLOW_UPDATE_FROM_APP and application with NRF_DFU_IN_APP.

    2. Store the FW image in bank 1. Note: The start address changes dynamically based on the size of the current application and the SoftDevice. Use nrf_dfu_bank1_start_addr() to retrieve the current start address.

    3. Update the nrf_dfu_settings_t  elements that the application are permitted to change. This is needed to signal the bootloader that a new update is available in bank 1. The init command (*.dat) must also be copied to the .init_command[] buffer. I recommend using the DFU settings module to update this page.

    4. After the update image has been stored in bank 1, and the settings page has been updated, the application can call NVIC_SystemReset() to perform a reboot and let the bootloader activate the update.

    Please refer these other forum threads for additional reference:

      - Booting an application image without using DFU to transport  

      -  Modifying Bootloader Settings Page from Main App  

    Best regards,

    Vidar

  • Hi Vidar.

    Thanks for your quick response.  It was just the help I needed.  I have the upgrade working now.  The biggest ah-ha moment was realizing that the *.dat file is literally the init command. Once I copied it to the dfu settings and updated the appropriate fields, everything else fell into place.

    Thanks!

    Ron

Reply Children
No Data
Related