FOTA with external Flash.

Hi Team,
NCS v2.3.0

I need put the second slot FOTA on an external flash for nrf52840.

 Is there any feasibility for use bluetooth dfu with SINGLE_APPLICATION_SLOT?

1. I added CONFIG_PM_EXTERNAL_FLASH_MCUBOOT_SECONDARY=y  to prj.conf
2. I added to overlay:
  
/ {
	chosen {
		nordic,pm-ext-flash = &mx25r64;
	};
};


What else needs to be added to make it work?




Thank you.



Parents
  • Hi,

    You need to add the overlay with pm-ext-flash to both the application and MCUboot. If you have added this to an overlay file called something like <board_name>.overlay, then the structure should look like this:

    project_dir
    |__ src
    |__ CMakeLists.txt
    |__ prj.conf
    |__ boards
        |__<board_name>.overlay
    |__ child_image
        |__mcuboot
           |__ boards
               |__ <board_name>.overlay

    Best regards,
    Marte

Reply
  • Hi,

    You need to add the overlay with pm-ext-flash to both the application and MCUboot. If you have added this to an overlay file called something like <board_name>.overlay, then the structure should look like this:

    project_dir
    |__ src
    |__ CMakeLists.txt
    |__ prj.conf
    |__ boards
        |__<board_name>.overlay
    |__ child_image
        |__mcuboot
           |__ boards
               |__ <board_name>.overlay

    Best regards,
    Marte

Children
  • Hi Marte,
    Thanks, I've already added what you said.
    How can I understand that an external flash is already in use?

    00> Connected to SMP service: err 0 id 1
    00> [00:01:20.553,955] <inf> mcuboot_util: boot_swap_type_multi: Swap type: none
    00> [00:01:20.555,236] <inf> mcuboot_util: boot_swap_type_multi: Swap type: none
    00> [00:01:20.819,061] <inf> mcuboot_util: boot_swap_type_multi: Swap type: none
    00> [00:01:20.819,519] <inf> mcuboot_util: boot_swap_type_multi: Swap type: none
    00> [00:01:23.269,561] <inf> mcumgr_img_mgmt: img_mgmt_erase_image_data: Erased 0x6c000 bytes of image slot
    00> [00:01:23.319,854] <inf> mcumgr_img_mgmt: img_mgmt_erase_image_data: Erased 0x1000 bytes of image slot trailer

    Best regards,
    Serhii

  • Hi Marte,
    How can I make sure that the external flash is already involved in the update process?


    Best regards,
    Serhii

  • Hi Marte,
    the issue seems to be resolved, but still, how to make sure, check?

    Best regards,
    Serhii

  • Hi Serhii,

    I have checked this internally. There is no straightforward way to see that external flash is already in use.

    If it is enough to check the generated build files, then you can look at the generated partition manager and devicetree files. In build/partitions.yml you can look for the partition that should be in external flash and look at the region. For example:

    mcuboot_secondary:
      address: 0x0
      device: MX25R64
      end_address: 0xf4000
      region: external_flash
      size: 0xf4000

    For devicetree you can look in build/zephyr/zephyr.dts and in build/mcuboot/zephyr/zephyr.dts, where pm-ext-flash should show up under 'chosen', and you can search for the external flash node itself to make sure the status is set to okay, similar to this:

    / {
        chosen {
            ...
            nordic,pm-ext-flash = &mx25r64;
    	};
    
    ...
    
    qspi: qspi@40029000 {
        ...
        status = "okay";
        ...
        mx25r64: mx25r6435f@0 {
            ...
        };
    };

    On the device itself you can for example check how much data is erased, since the slot is larger for external flash.

    Best regards,
    Marte

Related