Update custom net core image on nrf5340 with NCS v2.7.0 using external SPI flash

Hello,

I've spend some time updating our nrf5340 application to NCS v2.7.0, including using the new hardware model and using sysbuild. We have a custom application that we are running on the network core.
It seems that mcuboot, b0, and both our applications for the app core and net core all build and run.

We have an external SPI flash that we would like to use for the secondary image slot for both the app and net core image.

So far, I'm able to get the app core updated via Bluetooth with SMP, but I'm not able to upgrade the network core.

If I try to send the file signed_by_mcuboot_and_b0_net_app.bin, the device just boot loops. My guess is that mcuboot copied this image meant for the net core onto the app core.

I've seen lots of information about simultaneous updates to both net core and app core. This isn't too much of a concern for me and I'm ok updating each core individually from different files. That is how it worked before in the previous version of our SDK (v2.1.0). In that version, there was a single secondary slot in internal flash that either the app core or net core image would be downloaded to. mcuboot would then somehow know whether to copy it to the app or net core. That no longer seems to be the case when using the external flash on the new SDK.

(I'm not opposed to supporting simultaneous updates if that's the only way to do it)

To simplify things, I've tried several samples to try and get this working, including nrf5340_audio, light_switch (modified to allow SMP over Bluetooth), and smp_svr. They were all quite a chore to even build, but they all also fail to let me update the network core.
I tried the advice given in this post to modify the smp_svr app for a nrf5340dk, and it also just boot loops when I try to update the net core.

Are there any sample projects that include all of:
1. Secondary slot for app and net core on external flash

2. Updateable network core

3. Custom network core firmware

?

Sorry for the long post, but I'm having a difficult time figuring out what is and isn't supported and how one can go about getting this to work. Is there a basic sample that can demonstrate updating the net core from a secondary slot on external flash?

Thanks very much!

  • Any possible solutions to this would be appreciated. I’ve been facing the same exact problem for a while and have been looking for a solution.

    Thank you. 

  • Hello,

    Sorry for the delayed response. I'm not aware of any samples in v2.7.0 that do exactly this, so I will try to create a small demo to see if I can get it to work. Before starting, could you please confirm whether you use encrypted DFU images or not? I know  the detection mechanism used to determine if the image in the secondary slot belongs to the app or netcore does not work with encrypted images.

    Best regards,

    Vidar

    ykavi said:
    Any possible solutions to this would be appreciated. I’ve been facing the same exact problem for a while and have been looking for a solution.

    Could you please confirm if your application has the exact same requirements as OP? i.e., non-simultaneous DFU, external SPI flash, and B0n + MCUBoot bootloader with SDK v2.7.0?

  • No problem! Thanks for the reply.

    Currently I'm trying with non-encrypted images. We are using signed images though.
    Encryption could be an option in the future, but we can keep it simple for now Slight smile

    I'm looking forward to seeing your sample!

  • Unfortunately, one of the developers has confirmed that it's currently not possible to update the network core from external flash unless simultaneous updates are enabled. Do you have any existing devices that need to be updated? The reason I ask is that it's not possible to change the memory layout through DFU.

    Attached below is the simultaneous DFU demo sample I created. It uses the nRF immutable bootloader (B0) + MCUBoot, and SPI flash for the secondary DFU slots. Is tested on a nRF5340DK.

    0410.peripheral_lbs_ble_fota.zip

    Limitations:

    - This patch: https://github.com/nrfconnect/sdk-nrf/pull/16894 needs to be applied to the 'nrf' repo to allow the signing key for mcuboot (SB_CONFIG_BOOT_SIGNATURE_KEY_FILE) to be set with a path relative to the project directory.

    - The mcuboot, application, and netcore image need to be updated and confirmed individually from the advanced menu in the nRF Device Manager app on iOS/Android. 

  • Hi Vidar,

    Thanks very much for putting that together.

    Do you have any existing devices that need to be updated? The reason I ask is that it's not possible to change the memory layout through DFU.

    Fortunately we are still in development so we have the freedom to make these changed right now.

    I also have a nRF5340DK that I have used to try out your sample.
    I built it using the nRF Connect VS Code extension. I set up the build for a nrf5340dk/nrf5340/cpuapp and selected "Use sysbuild".

    After flashing, I placed the generated dfu_application.zip onto my phone and opened it with the nRF Device Manager app.

    It looks like it was able to send the file, but the console of my nrf5340dk printed out the following:

    I: Image index: 0, Swap type: none
    I: Image index: 1, Swap type: none
    E: Failed to open flash area ID 2: -2
    I: Image index: 1, Swap type: none
    I: Erased 0x2c000 bytes of image slot
    I: Erased 0x4000 bytes of image slot trailer
    E: Failed to open flash area ID 2: -2
    I: Image index: 1, Swap type: none
    I: Image index: 0, Swap type: none
    I: Image index: 1, Swap type: none
    E: Failed to open flash area ID 2: -2

    I'm a bit concerned about those flash errors. Is that expected?
    Also, how can I confirm that the upgrade was indeed successful?

    Thanks again!

Related