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

Not able to update firmware using bootloader (SDK15.3.0)

Hi,

I am using bootloader and application based on SDK15.3.0 and SD s140_nrf52_6.1.1_softdevice.hex.

I am also using our own BLE transport layer in application to receive new firmware file.

My process is a below.

1. Receive whole firmware image over BLE and store in flash (Bank1) in application code

2. Update botloader settings to inform bootloader that new firmware is available in Bank1

3. Reset system

My issue when I reset system it indefinitely remain in bootloader code and do not jump to application.

However, same process works for SDK15.2.0 in my other device.

I am setting below bootloader setting from application before reset.

/**********************************************************************************/
void update_bl_setting(uint32_t startAddress, uint32_t fwSize)
{
    s_dfu_settings.bank_1.bank_code = NRF_DFU_BANK_VALID_APP;
    s_dfu_settings.bank_0.bank_code = NRF_DFU_BANK_INVALID;
    s_dfu_settings.app_version = 0;
    s_dfu_settings.bank_1.image_crc = crc32_compute((uint8_t *)startAddress, fwSize, NULL);
    s_dfu_settings.bank_1.image_size = fwSize;
    s_dfu_settings.bank_current = NRF_DFU_CURRENT_BANK_1;
    s_dfu_settings.bank_layout = NRF_DFU_BANK_LAYOUT_DUAL;
    
    /* Set the progress to zero and remove the last command */
    memset(&s_dfu_settings.progress, 0, sizeof(dfu_progress_t));
    memset(s_dfu_settings.init_command, 0xFF, DFU_SIGNED_COMMAND_SIZE);
    s_dfu_settings.write_offset = 0;
    s_dfu_settings.progress.update_start_address = startAddress;
}

/******************************************************************

Is there any major change related to bootloader setting in SDK15.3.0? Why it is working in SDK 15.2.0 but not in SDK15.3.0?

How to correctly record the necessary data for the bootloader and pass control to it to update the application?

 

I tested bootloader by setting NRF_BL_DFU_ALLOW_UPDATE_FROM_APP value to 0 and 1 both in SDK15.3.0.

Thanks,

Nirav patel

Parents Reply
  • Thanks Turbo J,

    I used below function to update setting and its take care of backup page also.

    ret_code_t nrf_dfu_settings_write_and_backup(nrf_dfu_flash_callback_t callback)
    {
    #if NRF_DFU_IN_APP
        ret_code_t err_code = nrf_dfu_settings_write(callback);
    #else
        ret_code_t err_code = nrf_dfu_settings_write(NULL);
        if (err_code == NRF_SUCCESS)
        {
            settings_backup(callback, &s_dfu_settings);
        }
    #endif
        return err_code;
    }

Children
Related