Utilize external flash with nrf9160 SiP on Custom board.

Hi,

I would like to use the external flash to increase the internal flash, no intention, at the moment, to use it for MCUBoot file or FOTA .

How do I configure it, if it is even possible.

Info:

- nRF Connect SDK: 2.0.0

- nrf9160 SiP on custom board.

- Flash commuincate over SPI.

- Flash is working.

Thanks in advance.

Parents
  • Hi,

    Yes, this is possible.

    On our nRF9160DK, we have an external flash, and you can see a sample for testing this at nRF9160: HTTP application update using the nRF9160DK's external flash.
    This sample is for v1.7.0, but it is possible to do the same for v2.0.0.

    Regards,
    Sigurd Hellesvik

  • Thank you.

    After setting up the external flash in the .overlay file:

    nordic,pm-ext-flash = &mx25r16;
    It builds fine but when running the program this is what I get:
    When getting the partition_manager_report:
    external_flash (0x200000 - 2048kB):
    +---------------------------------------------+
    | 0x0: mcuboot_secondary (0xe8000 - 928kB) |
    | 0xe8000: external_flash (0x118000 - 1120kB) |
    +---------------------------------------------+
    
    flash_primary (0x100000 - 1024kB):
    +--------------------------------------------------+
    | 0x0: mcuboot (0xc000 - 48kB) |
    | 0xc000: EMPTY_0 (0x4000 - 16kB) |
    +---0x10000: mcuboot_primary (0xe8000 - 928kB)-----+
    +---0x10000: tfm_secure (0xc200 - 48kB)------------+
    | 0x10000: mcuboot_pad (0x200 - 512B) |
    +---0x10200: mcuboot_primary_app (0xe7e00 - 927kB)-+
    | 0x10200: tfm (0xc000 - 48kB) |
    +---0x1c200: tfm_nonsecure (0xdbe00 - 879kB)-------+
    | 0x1c200: app (0xdbe00 - 879kB) |
    +---0xf8000: nonsecure_storage (0x2000 - 8kB)------+
    | 0xf8000: settings_storage (0x2000 - 8kB) |
    +--------------------------------------------------+
    | 0xfa000: EMPTY_1 (0x6000 - 24kB) |
    +--------------------------------------------------+
    
    otp (0x2f4 - 756B):
    +------------------------------+
    | 0xff8108: otp (0x2f4 - 756B) |
    +------------------------------+
    
    sram_primary (0x40000 - 256kB):
    +--------------------------------------------------+
    +---0x20000000: sram_secure (0x10000 - 64kB)-------+
    | 0x20000000: tfm_sram (0x10000 - 64kB) |
    +---0x20010000: sram_nonsecure (0x30000 - 192kB)---+
    +---0x20010000: nrf_modem_lib_sram (0x44e8 - 17kB)-+
    | 0x20010000: nrf_modem_lib_ctrl (0x4e8 - 1kB) |
    | 0x200104e8: nrf_modem_lib_tx (0x2000 - 8kB) |
    | 0x200124e8: nrf_modem_lib_rx (0x2000 - 8kB) |
    +--------------------------------------------------+
    | 0x200144e8: sram_primary (0x2bb18 - 174kB) |
    +--------------------------------------------------+
    When I tried to add this to the .prj file:
    CONFIG_PM_EXTERNAL_FLASH_MCUBOOT_SECONDARY=n
    This works as expected.
    My question is now; Is it possible to utilize the external flash compile time?
    The HTTP sample uses it run time, correct me if I'm wrong on that.
    Another question is: the external flash do not have the correct size, even though I have added the size to the spi setup in the .overlay file. Do I need to add a pm_static.yml for getting the correct sized configured?
  • Remember also to use the other configurations from the sample, such as child_image/mcuboot/prj.conf.

    Okay, I'll try added it.

    How should external flash be used in compile time?

    What meant was, when the bootloader_seondary is not placed in external flash then there is noting placed in external flash. I had hoped that some other data e.q. .text .data would be placed in external flash instead. I can only utilize the external flash when something is placed there at run time. Like in http_update\full_modem_update, where the update is first placed in external flash and when installed.

  • Hi,

    Our Partition Manager handles the partitioning and decides what should go into internal or external flash.

    When external flash is enabled, the partition manager generally places partitions into external flash automatically.
    You can configure that using CONFIG_PM_EXTERNAL_FLAH_[...] to configure this or using pm_static.yml.

    If you need to put some generic data into external flash, I would advise using either a File System or NVS.

    Replay said:
    I had hoped that some other data e.q. .text .data would be placed in external flash instead

    I have not seen use-cases where you need to place something in external flash in compile time.

    If you need to, you can use nrfjprog to write data to external flash manually. See nrfjprog --help for more information.

    Regards,
    Sigurd Hellesvik

  • Hi Sigurd,

    I was wondering why the size of the external flash is 0x200000 (seen in the partition_manager_report).

    If I add a pm_static.yml file with:

    external_flash:
      address: 0x0
      end_address: 0x1000000
      region: external_flash
      size: 0x1000000

    When running pristine build. I get an error:

    What am I misunderstanding?

  • Hi,

    Try to fill the whole external flash with partitions.
    Does it work, then?

    Regards,
    Sigurd Hellesvik

  • Try to fill the whole external flash with partitions.

    How do I fill the external flash with partitions?

    The external flash I use is: MX25R1635F.

Reply Children
Related