Beware that this post is related to an SDK in maintenance mode
More Info: Consider nRF Connect SDK for new designs

NRF_DFU_SETTINGS_COMPATIBILITY_MODE -- why and when to use

Hi,


Our setup is a new design with SDK 17.1.0 and it is expected to support DFU over BLE. We are using the nRF52832 SoC.

I am trying to understand the role that is being played by the configuration symbol: "NRF_DFU_SETTINGS_COMPATIBILITY_MODE",

I can see where it is being used to 'reinit' the DFU settings page but it is not clear to me as an end user as to when I would want to do so.

  1. Is this only to be used if/when updating the boot loader?
  2. Is it required if our product only allows an update of the main application?
  3. If we do not have any prior history of this product then should we even worry if we should define this to be '1'
    1. Why does the template available under examples\dfu\secure_bootloader\pca10040_s132_ble set this flag value to '1'

Cheers

RMV

Parents
  • Hi, 

    Have a look at the documentation and the code.

    NRF_DFU_SETTINGS_COMPATIBILITY_MODE

    Whether to include code to translate from old settings versions. Enable if any apps on the device will assume settings version 1.

    Set to 1 to activate.

    nRF5_SDK_17.1.0\components\libraries\bootloader\dfu\nrf_dfu_settings.c:

       if (NRF_DFU_SETTINGS_COMPATIBILITY_MODE && !NRF_DFU_IN_APP && (s_dfu_settings.settings_version == 1))
        {
            NRF_LOG_INFO("Old settings page detected. Upgrading info.");
    
            // Old version. Translate.
            memcpy(&s_dfu_settings.peer_data, (uint8_t *)&s_dfu_settings + DFU_SETTINGS_BOND_DATA_OFFSET_V1, NRF_DFU_PEER_DATA_LEN);
            memcpy(&s_dfu_settings.adv_name,  (uint8_t *)&s_dfu_settings + DFU_SETTINGS_ADV_NAME_OFFSET_V1,  NRF_DFU_ADV_NAME_LEN);
    
            // Initialize with defaults.
            s_dfu_settings.boot_validation_softdevice.type = NO_VALIDATION;
            s_dfu_settings.boot_validation_app.type        = VALIDATE_CRC;
            s_dfu_settings.boot_validation_bootloader.type = NO_VALIDATION;
            memcpy(s_dfu_settings.boot_validation_app.bytes, &s_dfu_settings.bank_0.image_crc, sizeof(uint32_t));
    
            s_dfu_settings.settings_version = NRF_DFU_SETTINGS_VERSION;
        }
    

    Regards,
    Amanda

Reply
  • Hi, 

    Have a look at the documentation and the code.

    NRF_DFU_SETTINGS_COMPATIBILITY_MODE

    Whether to include code to translate from old settings versions. Enable if any apps on the device will assume settings version 1.

    Set to 1 to activate.

    nRF5_SDK_17.1.0\components\libraries\bootloader\dfu\nrf_dfu_settings.c:

       if (NRF_DFU_SETTINGS_COMPATIBILITY_MODE && !NRF_DFU_IN_APP && (s_dfu_settings.settings_version == 1))
        {
            NRF_LOG_INFO("Old settings page detected. Upgrading info.");
    
            // Old version. Translate.
            memcpy(&s_dfu_settings.peer_data, (uint8_t *)&s_dfu_settings + DFU_SETTINGS_BOND_DATA_OFFSET_V1, NRF_DFU_PEER_DATA_LEN);
            memcpy(&s_dfu_settings.adv_name,  (uint8_t *)&s_dfu_settings + DFU_SETTINGS_ADV_NAME_OFFSET_V1,  NRF_DFU_ADV_NAME_LEN);
    
            // Initialize with defaults.
            s_dfu_settings.boot_validation_softdevice.type = NO_VALIDATION;
            s_dfu_settings.boot_validation_app.type        = VALIDATE_CRC;
            s_dfu_settings.boot_validation_bootloader.type = NO_VALIDATION;
            memcpy(s_dfu_settings.boot_validation_app.bytes, &s_dfu_settings.bank_0.image_crc, sizeof(uint32_t));
    
            s_dfu_settings.settings_version = NRF_DFU_SETTINGS_VERSION;
        }
    

    Regards,
    Amanda

Children
  • Hi Amanda

    Thanks, but your answer is very self-referential and does not really address my  concerns.

    I asked the question because the code fragment you have pointed out is worthless if I as a user do not really know when or how to use a feature -- it is not enough to say 'here is an example use case of it'.

    Basically it is not clear what I am looking for when I come across a phrase such as "old settings". To further exaggerate it, the comments are in the boot loader design but the reference to 'NRF_DFU_IN_APP' would seem to suggest that there is some dependence on decisions made in the 'application' (is it the 'boot loader application' or the 'main product application').

    In other words, does the choice of parameters when building the boot loader (DFU) firmware depend on how that same person (or someone else) designed the 'primary application'?

    I hope I have sufficiently described the different aspects of the full firmware package and life cycle that led me to ask this question.

    Cheers

    RMV

  • Hi, 

    Sorry for the late reply. Due to the summer holiday in Norway, our support staff is less than usual. 

    This option must be enabled if you are doing DFU from a device that uses settings version 1 (i.e. pre-SDK 15.3.0) Otherwise, it should be ok to disable it. In other words, if you don't have setting version 1 on the device, you don't need to enable it for updating the application. It's only used if the existing page is version 1.

    Hope this is clear.

    -Amanda 

Related