1. I try DFU bootloader with OTA, it success.
2. But the Application was gone.
3. If item 2 is real, is that I have to porting the force enter to bootloader mode by botton.
1. I try DFU bootloader with OTA, it success.
2. But the Application was gone.
3. If item 2 is real, is that I have to porting the force enter to bootloader mode by botton.
Hi,
When you update the bootloader (and SoftDevice) this must to be duel bank, as a failed update could brick the device. Therefor the application is deleted so that the new bootloader can be stored there and verified before it is subsequently copied in place by the MBR. This means that you have to upgrade the application after upgrading the bootloader. You should not have to force bootloader mode by a button in this case though, as the bootloader should always enter DFU mode when there is no valid application.
Hi Einar,
Thanks your reply.
As you said:
1. Is that update bootlaoder, it must be flash Application. It means when I finished updated bootloader and reset get in to the bootloader, bootloader will detect the application is no valid, therefore user have to DFU application by BLE OTA.
2. Or the application maybe could recover back, after finished updated bootloader and reset get into bootloader. In my bootloader source code, I have add some judgment, it will jump to start applicati
nrf_bootloader_fw_activation_result_t nrf_bootloader_fw_activate(void) { nrf_bootloader_fw_activation_result_t result; uint32_t ret_val = NRF_SUCCESS; nrf_dfu_bank_t * p_bank = &s_dfu_settings.bank_1; bool sd_update = false; NRF_LOG_DEBUG("Enter nrf_bootloader_fw_activate"); switch (p_bank->bank_code) { case NRF_DFU_BANK_VALID_APP: NRF_LOG_DEBUG("Valid App"); ret_val = app_activate(); break; case NRF_DFU_BANK_VALID_SD: NRF_LOG_DEBUG("Valid SD"); ret_val = sd_activate(); sd_update = true; break; case NRF_DFU_BANK_VALID_BL: NRF_LOG_DEBUG("Valid BL"); ret_val = bl_activate(); break; case NRF_DFU_BANK_VALID_SD_BL: NRF_LOG_DEBUG("Valid SD + BL"); ret_val = sd_bl_activate(); sd_update = true; break; case NRF_DFU_BANK_INVALID: default: NRF_LOG_INFO("No firmware to activate."); return ACTIVATION_NONE; } if (ret_val != NRF_SUCCESS) { NRF_LOG_ERROR("Activation failed with error %d (bank code: 0x%x)", ret_val, p_bank->bank_code); result = ACTIVATION_ERROR; } // Invalidate bank, marking completion. nrf_dfu_bank_invalidate(p_bank); m_flash_write_done = false; ret_val = nrf_dfu_settings_write(flash_write_callback); ASSERT(m_flash_write_done); /* At this point flash module is performing blocking operation. It is expected that operation is already performed. */ if (ret_val == NRF_SUCCESS) { result = ACTIVATION_SUCCESS; if (sd_update && nrf_dfu_app_is_valid(true)) { //If SD was updated and application is valid we want to stay in DFU to receive application. NRF_LOG_DEBUG("A SoftDevice has just been activated. It's likely that an application will come immediately"); result = ACTIVATION_SUCCESS_EXPECT_ADDITIONAL_UPDATE; } } else { NRF_LOG_ERROR("Could not write settings."); result = ACTIVATION_ERROR; } return result; }
Hi,
You are right that the application may be valid even after a bootloader and/or SoftDevice update. This situation is already handled by the bootloader though, so the application will be started if it is still present and valid (i.e. CRC check is OK) and match the current SoftDevice version. You can see this from the SDK 15.2 documentation (DFU procedure):
After completion of the first step which ends with activation of the new SoftDevice (and the bootloader), application may still be valid but is not runnable because of broken SoftDevice dependency. It must be updated in the second step. After activation of a package with a SoftDevice, the bootloader will enter DFU mode expecting an application update. Since application update is optional (not required after SoftDevice minor version update), the inactivity timeout in the bootloader is set to a different (shorter) value than the default one (NRF_BL_DFU_CONTINUATION_TIMEOUT_MS).
OKie, I will test it and replay ASAP.
thanks a lot!