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?
  • Replay said:
    CONFIG_PM_EXTERNAL_FLASH_MCUBOOT_SECONDARY=n

    Remember also to use the other configurations from the sample, such as child_image/mcuboot/prj.conf.

    Replay said:
    My question is now; Is it possible to utilize the external flash compile time?

    If you use MCUboot as an immutable bootloader, you must use pm_static.yml to ensure that partitions do not change between updates.
    From Partition Manager, static configuration:

    "if a device includes a non-upgradable first-stage bootloader and an upgradable application, the application image to be upgraded must be linked to the same address as the one that is deployed."

    CONFIG_PM_EXTERNAL_FLASH_MCUBOOT_SECONDARY=n will make it so that MCUboot do no longer use the external flash. I suspect that you want MCUboot to use external flash?
    > My question is now; Is it possible to utilize the external flash compile time?
    I do not understand the question. How should external flash be used in compile time?

    Regards,
    Sigurd Hellesvik

  • 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.

Reply
  • 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.

Children
Related