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

SDfile, Bootloadera and Application Files updating using Serial DFU bootloader

Hi All,

We are using NRF52832 in our project. We have implemented the c code to perform nrfutil operations.

We are following below steps to do it.

  1. Erase all files. Upload SD file and Bootloader files from the nrfGo studio.
  2. Combine SDfile, Bootloadera and Application bin files into one file with same order.
  3. Put NRF52832 into DFU mode. 
  4. Send combined file data from st micro controller to NRF52832 using UART.
  5. Once all data sent. Reset the NRF52832 and checked the known FW version.
  6. All are working fine.

But if i try to update file one more time, NRF52832 is accepting SD file and boot loader init file after that its not accepting the data.

To avoid this issue we need to erase all data from the NRF52832 and upload the data.

How to update files without erasing previous data?

Is our procedure is wrong?

Is there any order for files update? like which file should go first and others.

Thanks and regards,

Basavanagouda.

  • Hi Basavanagouda,

    It seems like you may need to update the FW version before you do the DFU update a second time (explained in this link):

    "Firmware version: If the image contains a bootloader, the image is accepted if the new firmware version is greater than (>) the existing version of the bootloader. If the image contains an application, the image is accepted if the new firmware version is greater than or equal to (>=) the existing version of the application. If the image contains a SoftDevice and no SoftDevice is already present, the fw_version is checked against the existing application's version to determine whether the update can overwrite it."

    This documentation assumes you are using sdk v15.2, but you can select the version you are using here:

    Also, this blog post could be helpful.

    Kind Regards,

    Bjørn Kvaale

  • Hi Bjorn,

    Thank you for the reply,

    How we can avoid version check? 

    Is it possible?

    Best Regards,

    Basava.

  • Hi Basava,

    Assuming you are using the secure uart serial bootloader in sdk v15.2, take a look at this function inside the nrf_dfu_ver_validation.c file:

    // This function assumes p_init->has_fw_version.
    static bool fw_version_ok(dfu_init_command_t const * p_init)
    {
        ASSERT(p_init != NULL);
        ASSERT(p_init->has_fw_version);
    
        if (  (p_init->type == DFU_FW_TYPE_APPLICATION)
           || (p_init->type == DFU_FW_TYPE_SOFTDEVICE))
        {
            return ((p_init->fw_version >= s_dfu_settings.app_version) || !NRF_DFU_APP_DOWNGRADE_PREVENTION);
        }
        else
        {
            return  (p_init->fw_version > s_dfu_settings.bootloader_version);
        }
    }

    If you change:

    return  (p_init->fw_version > s_dfu_settings.bootloader_version);

    to:

    return  (p_init->fw_version >= s_dfu_settings.bootloader_version);

    I am pretty sure it should work if you still have the same bootloader version as before.

Related