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

Coexistence of 2 stacks: NRF SDK and Wirepas SDK

Hi all.

The current devices we are developing are made with NRF52832 based on the NRF SDK v16. We also plan to use the Wirepas stack.
Initially, we want to implement support for OTA DFU upgrades from the NRF SDK stack to the Wirepas stack.
In this regard, we have a number of questions:

1 Can we use the image which contains the Wirepas SDK as an application when creating the zip file for the OTA DFU (secure bootloader).
Perhaps there is a recommendation for this operation.

2 Can we change the Flash memory layout for the NRF SDK. I.e. e.g. MBR + Softdevice moves from the start of the Flash memory to another area.
Are there any recommendations on this?. Would there be any problems with interrupt handling in this case?. I.e. on the starting address, we want to place either Wirepas bootloader or our own bootloader. This is still at the discussion stage.

Thanks in advance for the answer.

  • Hi, 

    We at Nordic are not developing the Wirepas stack ant not familiar with it. Could you kindly provide more detail for us?

    1. Will the updated image replace softdevice?

    2. Is it not possible to keep the mbr at address 0? 

    Regards,
    Amanda

  • Hi, Amanda. Thank you for your reply.

    1. During OTA-DFU process, the Softdevice of course cannot be removed until the Wirepas stack image is loaded into Flash memory. After rebooting the device, the Softdevice can be removed.

    2. The Wirepas stack bootloader also assumes a location at address 0. However, it allows user functions to be executed during the early boot phase.

    Regards,
    Djaison

  • Hi, 

    It's not possible to safely update the MBR through DFU, so you should ideally relocate the wirepas bootloader to where we have the nRF5 bootloader.  Then, you could update wirepas bootloader and the wirepas application image in one go by calling it a Softdevice+bootloader (SoftDevice and bootloader) update. So, this is able to overwrite the softdevice with the wirepas app. However, it did require some minor modifications to the existing bootloader to make it accept the wirepas application as a Softdevice image as the following

    nrf_bootloader_fw_activation.c, in function sd_activate():

    if (SD_MAGIC_NUMBER_GET(src_addr) != SD_MAGIC_NUMBER)
    {
        NRF_LOG_ERROR("Source address does not contain a valid SoftDevice.")
        //return NRF_ERROR_INTERNAL;     << commented out this line
    }

    nrf_dfu_validation.c, in function softdevice_info_ok():

    static bool softdevice_info_ok(uint32_t sd_start_addr, uint32_t sd_size)
    {
        bool result = true;
    
        if (SD_MAGIC_NUMBER_GET(sd_start_addr) != SD_MAGIC_NUMBER)
        {
            NRF_LOG_ERROR("The SoftDevice does not contain the magic number identifying it as a SoftDevice.");
            //result = false; //hack to accept zephyr images
        }

    Here is the SDK nRF5_SDK_16.0.0_98a08e2_accept_application_as_Softdevice.zip with the above modifications.

    The package generate command might look like this:

    nrfutil pkg generate --hw-version 52 --app-boot-validation VALIDATE_GENERATED_CRC ^
    --bootloader-version 3 ^
    --sd-req 0x0000 ^
    --softdevice wirepas_app_update.hex ^
    --bootloader wirepas_bootloader.hex ^
    --key-file private.pem wirepas_bt_app.zip

    -Amanda

  • Hi, sorry for the long reply and thank you for your help with this issue.

    The problem is that the Wirepas bootloader also needs to be at 0 address in memory as well as the MBR.

    Is there any way to overwrite MBR+Softdevice not in the OTA DFU stage, but from a custom application? I.e. first we get an image of the Wirepas stack via OTA DFU and write it to the flash, and then after a device reboot, we overwrite the MBR+Softdevice with the Wirepas stack?

  • Hi, 

    The bootloader protects itself, the MBR, and the Softdevice with BPROT before booting the application. You can disable (not enable) BPROT, then it might work.   

    -Amanda

Related