nRF52840 single- vs. dual-bank behavior

Hi,

I'm working on enabling dual-bank updates in our projects (we're using nRF5 SDK v15.3.0), and during this process I've stumbled onto some behavior that confused me a bit. I was testing updating the bootloader from single-bank to dual-bank and found that the application was still present and was started after the update. This surprised me as I thought with single-bank updates the application would always be overwritten by the DFU package. I tested replacing the proper application with dummy data and re-did the test and the dummy data was overwritten (as expected). I then found the following:

https://docs.nordicsemi.com/r/bundle/nrf5_sdk_v15.3.0/page/lib_bootloader_dfu_banks.html specifies that for single-bank updates

"The DFU bootloader checks if a dual-bank update is possible. Only if it is not (because the free memory is not sufficient), it will revert to a single-bank update."

To enable dual-bank updates the macro NRF_DFU_SINGLE_BANK_APP_UPDATES should be set to 0. However, if the macro NRF_DFU_FORCE_DUAL_BANK_APP_UPDATES isn't also set to 1 https://docs.nordicsemi.com/r/bundle/nrf5_sdk_v15.3.0/page/group_nrf_dfu_validation_config.html?section=ga9bd60b6464d75f738bb06845ec8b86a9 specifies

"If not enabled then if there is not enough space to perform dual-bank update application is deleted and single-bank update is performed."

The way I understand this is that only setting NRF_DFU_SINGLE_BANK_APP_UPDATES to 0 will make the bootloader will behave the same way as if it was set to 1: it will prefer dual-bank updates, but fall back to single-bank updates if there isn't enough room to fit the DFU package. Am I missing something? What's the point of separating NRF_DFU_SINGLE_BANK_APP_UPDATES and NRF_DFU_FORCE_DUAL_BANK_APP_UPDATES?

Thanks,
Daniel

Related