Regarding Simultaneous DFU for app core, net core and wifi patch

Hello,

I am working on a custom board with my own custom project. I want to perform DFU for all the images I mentioned. 
The mechanism for the OTA update will be as follows:
1. The OTA binary will be downloaded over the WIFI and stored to the SDCard
2. The OTA binary(from the SDCard) will be written to the respective memory in the flash and verified through my application core(if possible) or any other mechanism which is possible in the device runtime
3. The image will be verified and confirmed to be booted on the next reboot

I need help for the 2nd and 3rd step in the context of APIs and configuration options(already referred to Dev academy and nordic documentation but still in case I miss any).

Important details:
1. The nrf7002ek(for the wifi patch) is on the SPI interface.
2. The toolchain used is ncs v3.0.2(sysbuild and partition manager enabled)

Thanks in advance!  

Parents Reply Children
  • I think I am not able to make explain you what I want. Can you please float this ticket to someone else? 

  • No can do, sir. You're stuck with me. Please review the resources, as you should have everything you need from there. 

    AHaug said:
    Doesn't this work?

    This is the API you need to write contents to a specific memory address. You need to separate the contents of the .bin you download and initially write to the SD card. TBH I can't see the reason for why you have the SD card as a temporary storage when you already have an external flash and you can download the candidate images directly to the external flash in the first place.

    Kind regards,
    Andreas

  • Because the application will download the firmware from a specific secure API and then when the file is succesfully downloaded, we will go for writing the contents into the external flash.
    Writing the downloaded chunk directly into the external flash does not seem to be a good idea for now but I will still consider it and try.

    Still the part "how to write the content into the external flash" is not clarified. What you have given me in the last response is a write function of FAT FS library: fs_write which takes an initialised file descriptor(through fs_open) as an input and the FAT FS takes care of handling the address stuff.

    What you are essentially saying is I should mount the external flash with the FAT FS library, then open a file in external flash for which I don't know how I am assigning a path, then write the content into it knowing that I am not giving any input for a specific address in this whole process.

    Is this even possible and the correct way to do this?

    Please correct me bluntly if I am wrong.

  • Ok lets take it back a step 

    Based on the motivation I still don't see the need to OTA the files into an SD card placed on the device you will update, before you move it to mcuboot secondary on an external flash and then do the image swapping. I can see the need to have an SD card as a replacement for UART/USB/Serial recovery as a physical option for DFU in a industrial device, where external operators will have to update the firmware of the device, but if the device that will be updated has WiFi I would skip the part where you OTA to an intermittent device (the SD card) and just go directly to the external flash.

    Nonetheless, if you have a device without OTA options, you will have to have a physical DFU option, where you have 3 options; UART, USB or FS on a SD card. In your case I understand your design as having chosen SD card as the physical alternative. 

    Does this resonate with what you're aiming to do, am I misunderstanding anything, or are insisting on having the SD card as an intermittent storage for WiFi OTA as well?

    Here's what I would recommend

    If WiFi-OTA:

    1. Download the candidate images directly to the respective mcuboot secondary partitions for the candidate images and do DFU with MCUMgr as described in the academy course on DFU 

    If DFU over SD card

    1. Load the update binaries to the SD card by plugging it into Machine A (computer, SD card writer, wherever you will obtain the candidate images from), then plug it into Machine B which you will update.
    2. Write the files to the addresses corresponding to the various secondary partitions you've defined that are located on the external flash. You can either use the FS write functions with the destination addresses being the partitions or the MCUmgr filesystem https://docs.nordicsemi.com/bundle/ncs-latest/page/nrf/app_dev/bootloaders_dfu/dfu_tools_mcumgr_cli.html#filesystem_management
    3. Validate, confirm, reset and swap old and new images

     Kind regard,s
    Andreas

  • You were right, storing the file in the sdcard is just an overhead. Also, I could do the simultaneous DFU through the "dfu milti image" and "dfu target" library. Thanks a lot for your help.
    I am closing this issue for now

    Although I wanted to raise another ticket for this question but in a case you can tell me, we set the pm_static.yml for the application core which includes the primary and secondary partitions for app core, secondary partitions for net core and wifi patch.

    The question is-> Do we also have to declare a pm_static.yml for the network core application. 
    Just for information sysbuild is being used to handle multiple images. 

Related