Using QSPI flash to store image on OTA

I'm using the nrf/tests/modules/mcuboot/external_flash as a template to use the external flash to OTA my Pinnacle 100 module.  By allowing automatic generation of the partitions, it creates the primary and secondary partitions in internal flash and OTA works fine.  But, when I add the child_image directory, pretty much straight from the test directory (except that I get rid of the uart update option) and the attached pm_static.yml.

It builds and uses the bulk of the internal flash for my application now, but OTA is broken.  When I try  to OTA, it now immediately resets my unit and after reatttaching, I get the following output;

[00:00:09.145,568] <inf> main: Updated MTU: TX: 23 RX: 23 bytes
[00:00:09.147,064] <inf> main: Connected
[00:00:10.808,807] <inf> main: Updated MTU: TX: 498 RX: 498 bytes
[00:00:11.172,119] <inf> mcuboot_util: Swap type: test
[00:00:11.172,607] <inf> mcuboot_util: Swap type: test
[00:00:11.172,637] <err> mcumgr_img_grp: Image upload inspect failed: 5




app:
  address: 0x18200
  end_address: 0xf8000
  region: flash_primary
  size: 0xDFE00
mcuboot:
  address: 0x0
  end_address: 0x18000
  placement:
    before:
    - mcuboot_primary
  region: flash_primary
  size: 0x18000
mcuboot_pad:
  address: 0x18000
  end_address: 0x18200
  placement:
    align:
      start: 0x1000
    before:
    - mcuboot_primary_app
  region: flash_primary
  size: 0x200
mcuboot_primary:
  address: 0x18000
  end_address: 0xf8000
  orig_span: &id001
  - mcuboot_pad
  - app
  region: flash_primary
  sharers: 0x1
  size: 0xE0000
  span: *id001
mcuboot_primary_app:
  address: 0x18200
  end_address: 0xf8000
  orig_span: &id002
  - app
  region: flash_primary
  size: 0xDFE00
  span: *id002
mcuboot_primary_1:
  address: 0x0
  size: 0x40000
  device: flash_ctrl
  region: ram_flash
mcuboot_secondary: 
  address: 0x0000000
  end_address: 0x000E0000
  device: MX25R64
  region: external_flash
  size: 0x000E0000
mcuboot_secondary_1:
  address: 0xe0000
  size: 0x40000
  device: MX25R64
  region: external_flash
external_flash:
  address: 0x120000
  size: 0x6e0000
  device: MX25R64
  region: external_flash
settings_storage:
  address: 0xf8000
  end_address: 0x100000
  placement:
    align:
      start: 0x1000
    before:
    - end
  region: flash_primary
  size: 0x8000
sram_primary:
  address: 0x20000000
  end_address: 0x20040000
  region: sram_primary
  size: 0x40000

  • Hi Randall, 

    Attached is the partitions.yml when I build the for nRF52840 DK: 

    app:
      address: 0xc200
      end_address: 0x100000
      region: flash_primary
      size: 0xf3e00
    external_flash:
      address: 0xf4000
      end_address: 0x800000
      region: external_flash
      size: 0x70c000
    mcuboot:
      address: 0x0
      end_address: 0xc000
      placement:
        before:
        - mcuboot_primary
      region: flash_primary
      size: 0xc000
    mcuboot_pad:
      address: 0xc000
      end_address: 0xc200
      placement:
        before:
        - mcuboot_primary_app
      region: flash_primary
      size: 0x200
    mcuboot_primary:
      address: 0xc000
      end_address: 0x100000
      orig_span: &id001
      - mcuboot_pad
      - app
      region: flash_primary
      size: 0xf4000
      span: *id001
    mcuboot_primary_app:
      address: 0xc200
      end_address: 0x100000
      orig_span: &id002
      - app
      region: flash_primary
      size: 0xf3e00
      span: *id002
    mcuboot_secondary:
      address: 0x0
      device: DT_CHOSEN(nordic_pm_ext_flash)
      end_address: 0xf4000
      placement:
        align:
          start: 0x4
      region: external_flash
      share_size:
      - mcuboot_primary
      size: 0xf4000
    sram_primary:
      address: 0x20000000
      end_address: 0x20040000
      region: sram_primary
      size: 0x40000
    

    As you can find there was no mcuboot_primary_1 and no mcuboot_secondary_1 partition. 
    Could you please explain why you want to have that in your pm_static.yml ? 
    Usually have such partitions when we have to update multiple cores, for example on the thingy53.

    Are simply copying the pm_static_thingy53_nrf5340_cpuapp.yml to your project ? If you are, then it's not correct. It's for nRF5340 not nRF52840. 

  • My yml file was an amalgam of the information in my .dts file which I copied over from the pinnacle 100 DVK dts file, what was in the generated partition.yml file from previous builds and what was in the test directory for mcuboot using extneral flash.  So there is probably a fair amount of contamination.  So I took your yml file and modified it to be consistent with my .dts file (attached).  But i still get the same thing.

    app:
      address: 0x18200
      end_address: 0xf8000
      region: flash_primary
      size: 0xdfe00
    storage:
      address: 0xf8000
      end_address: 0x100000
      region: flash_primary
      size: 0x8000
    external_flash:
      address: 0xE0000
      end_address: 0x800000
      region: external_flash
      size: 0x720000
    mcuboot:
      address: 0x0
      end_address: 0x18000
      placement:
        before:
        - mcuboot_primary
      region: flash_primary
      size: 0x18000
    mcuboot_pad:
      address: 0x18000
      end_address: 0x18200
      placement:
        before:
        - mcuboot_primary_app
      region: flash_primary
      size: 0x200
    mcuboot_primary:
      address: 0x18000
      end_address: 0x100000
      orig_span: &id001
      - mcuboot_pad
      - app
      - storage
      region: flash_primary
      size: 0xE8000
      span: *id001
    mcuboot_primary_app:
      address: 0x18200
      end_address: 0xf8000
      orig_span: &id002
      - app
      region: flash_primary
      size: 0xdfe00
      span: *id002
    mcuboot_secondary:
      address: 0x0
      device: DT_CHOSEN(nordic_pm_ext_flash)
      end_address: 0xE0000
      placement:
        align:
          start: 0x4
      region: external_flash
      share_size:
      - mcuboot_primary
      size: 0xE0000
    sram_primary:
      address: 0x20000000
      end_address: 0x20040000
      region: sram_primary
      size: 0x40000
    5127.4723_iot_module.dts

  • Hi Randall, 
    I'm not so sure how mcuboot_primary_1 and mcuboot_secondary_1  would be related to your dts file. 

    Error 5 in the log "Image upload inspect failed: 5" means :     MGMT_ERR_ENOENT  /** No such file/entry. */

     

    It seems that the mcu_mgr couldn't find the mcuboot_secondary for some reason. 

    Could you try simply compile the test project as the nRF52840 DK board (instead of the Pinnacle) to see if it can access the external flash and do DFU update ?

    Could you try to remove zephyr,external-flash = &mx25r64; in the iot_module.dts file ? I can see that you have both: 
    zephyr,external-flash = &mx25r64;
    nordic,pm-ext-flash = &mx25r64;

Related