Single bank DFU update in SDK16 fails

Hello,

I am trying to do a single bank DFU update using nRF Connect app and have SDK 16 on my device. I have set NRF_DFU_SINGLE_BANK_APP_UPDATES to 1. Bot looking at postvalidate (attached below) in nrf_dfu_validation.c, it automatically swicthes to Bank 1. Is there some settings that I am missing?

Thank you.

nrf_dfu_result_t postvalidate(uint32_t data_addr, uint32_t data_len, bool is_trusted)
{
nrf_dfu_result_t ret_val = NRF_DFU_RES_CODE_SUCCESS;
dfu_init_command_t const * p_init = mp_init;

if (!fw_hash_ok(p_init, data_addr, data_len))
{
ret_val = EXT_ERR(NRF_DFU_EXT_ERROR_VERIFICATION_FAILED);
}
else
{
if (p_init->type == DFU_FW_TYPE_APPLICATION)
{
if (!postvalidate_app(p_init, data_addr, data_len, is_trusted))
{
ret_val = NRF_DFU_RES_CODE_INVALID_OBJECT;
}
}
#if NRF_DFU_SUPPORTS_EXTERNAL_APP
else if (p_init->type == DFU_FW_TYPE_EXTERNAL_APPLICATION)
{
if (!is_trusted)
{
// This function must be implemented externally
ret_val = nrf_dfu_validation_post_external_app_execute(p_init, is_trusted);
}
else
{
s_dfu_settings.bank_1.bank_code = NRF_DFU_BANK_VALID_EXT_APP;
}
}
#endif // NRF_DFU_SUPPORTS_EXTERNAL_APP
else
{
bool with_sd = p_init->type & DFU_FW_TYPE_SOFTDEVICE;
bool with_bl = p_init->type & DFU_FW_TYPE_BOOTLOADER;

if (!postvalidate_sd_bl(p_init, with_sd, with_bl, data_addr, data_len, is_trusted))
{
ret_val = NRF_DFU_RES_CODE_INVALID_OBJECT;
if (is_trusted && with_sd && !DFU_REQUIRES_SOFTDEVICE &&
(data_addr == nrf_dfu_softdevice_start_address()))
{
nrf_dfu_softdevice_invalidate();
}
}
}
}

if (!is_trusted)
{
if (ret_val == NRF_DFU_RES_CODE_SUCCESS)
{
s_dfu_settings.bank_current = NRF_DFU_CURRENT_BANK_1;
}
else
{
dfu_progress_reset();
}
}
else
{
if (ret_val == NRF_DFU_RES_CODE_SUCCESS)
{
// Mark the update as complete and valid.
s_dfu_settings.bank_1.image_crc = crc32_compute((uint8_t *)data_addr, data_len, NULL);
s_dfu_settings.bank_1.image_size = data_len;
}
else
{
nrf_dfu_bank_invalidate(&s_dfu_settings.bank_1);
}

dfu_progress_reset();
s_dfu_settings.progress.update_start_address = data_addr;
}

return ret_val;
}

Parents
  • Hi,

    The references to bank 1 that you refer to are to the value stored in the DFU settings. From what I understand, those settings will contain the correct values for when doing single bank DFU, so that the functionality of the DFU bootloader is correct for that scenario. (E.g. containing same data for both bank_0 and bank_1 when single bank is used.)

    Setting NRF_DFU_SINGLE_BANK_APP_UPDATES should ensure single-bank update is used for the application.

    In addition, there is an NRF_DFU_FORCE_DUAL_BANK_APP_UPDATES (which may conflict with NRF_DFU_SINGLE_BANK_APP_UPDATES), please check that you have not set that one as well.

    Apart from that, do you see any error or is it failing in any way, or is your inquiry based only on code inspection?

    Regards,
    Terje

Reply
  • Hi,

    The references to bank 1 that you refer to are to the value stored in the DFU settings. From what I understand, those settings will contain the correct values for when doing single bank DFU, so that the functionality of the DFU bootloader is correct for that scenario. (E.g. containing same data for both bank_0 and bank_1 when single bank is used.)

    Setting NRF_DFU_SINGLE_BANK_APP_UPDATES should ensure single-bank update is used for the application.

    In addition, there is an NRF_DFU_FORCE_DUAL_BANK_APP_UPDATES (which may conflict with NRF_DFU_SINGLE_BANK_APP_UPDATES), please check that you have not set that one as well.

    Apart from that, do you see any error or is it failing in any way, or is your inquiry based only on code inspection?

    Regards,
    Terje

Children
No Data
Related