This discussion has been locked.
You can no longer post new replies to this discussion. If you have a question you can start a new discussion

Integrating external flash memory on nRF9160DK

Hi again Nordic, I need some pointers. Håkon, a very patient man here, sent me an example code repo of usage of external flash memory on the nRF9160DK.
I've tried the sample and it builds, however, it resets in a loop with this error:



The sample used: /cfs-file/__key/support-attachments/beef5d1b77644c448dabff31668f3a47-5fb0013b61b2439f9a87a5b02f135e47/ncs1_5F00_7_5F00_nrf9160dk_5F00_ext_5F00_flash_5F00_littlefs.zip

Thanks!

Edit: I've tried to increase sector size and changing the id of the external flash spi to ff ff ff, that error then disappears, I do however think this is a separate problem and my solution an incorrect one.

Edit2: I also get this when building, even though it completes: "could not find memory mapped address for XIP. Generated update hex files will not have the correct base address. Hence they can not be programmed directly to the external flash"

  • I was not able to open your attached sample, but I guess it is the same as this one https://devzone.nordicsemi.com/support-private/support/280236#permalink=716890

    • First I programmed the hello world sample with an overlay file like this to nrf9160dk_nrf52840 (set SW10 to 'nRF52' first)
    • Then I programmed this sample to the nRF9160 DK v1.0.0 using the board nrf9160dk_nrf9160_ns
    • Then turn your board off and on. Initially it failed for me, but after powercycling, it worked fine.
    • You should then get the following output in the terminal:

    *** Booting Zephyr OS build v2.6.99-ncs1  ***
    I: Starting bootloader
    I: Primary image: magic=unset, swap_type=0x1, copy_done=0x3, image_ok=0x3
    I: Secondary image: magic=unset, swap_type=0x1, copy_done=0x3, image_ok=0x3
    I: Boot source: none
    I: Swap type: none
    I: Bootloader chainload address offset: 0x10000
    *** Booting Zephyr OS build v2.6.99-ncs1  ***
    Flash regions           Domain          Permissions
    00 03 0x00000 0x20000   Secure          rwxl
    04 31 0x20000 0x100000  Non-Secure      rwxl
    
    Non-secure callable region 0 placed in flash region 3 with size 32.
    
    SRAM region             Domain          Permissions
    00 07 0x00000 0x10000   Secure          rwxl
    08 31 0x10000 0x40000   Non-Secure      rwxl
    
    Peripheral              Domain          Status
    00 NRF_P0               Non-Secure      OK
    01 NRF_CLOCK            Non-Secure      OK
    02 NRF_RTC0             Non-Secure      OK
    03 NRF_RTC1             Non-Secure      OK
    04 NRF_NVMC             Non-Secure      OK
    05 NRF_UARTE1           Non-Secure      OK
    06 NRF_UARTE2           Secure          SKIP
    07 NRF_TWIM2            Non-Secure      OK
    08 NRF_SPIM3            Non-Secure      OK
    09 NRF_TIMER0           Non-Secure      OK
    10 NRF_TIMER1           Non-Secure      OK
    11 NRF_TIMER2           Non-Secure      OK
    12 NRF_SAADC            Non-Secure      OK
    13 NRF_PWM0             Non-Secure      OK
    14 NRF_PWM1             Non-Secure      OK
    15 NRF_PWM2             Non-Secure      OK
    16 NRF_PWM3             Non-Secure      OK
    17 NRF_WDT              Non-Secure      OK
    18 NRF_IPC              Non-Secure      OK
    19 NRF_VMC              Non-Secure      OK
    20 NRF_FPU              Non-Secure      OK
    21 NRF_EGU1             Non-Secure      OK
    22 NRF_EGU2             Non-Secure      OK
    23 NRF_DPPIC            Non-Secure      OK
    24 NRF_REGULATORS       Non-Secure      OK
    25 NRF_PDM              Non-Secure      OK
    26 NRF_I2S              Non-Secure      OK
    27 NRF_GPIOTE1          Non-Secure      OK
    
    SPM: NS image at 0x20200
    SPM: NS MSP at 0x200161e8
    SPM: NS reset vector at 0x22c05
    SPM: prepare to jump to Non-Secure image.
    *** Booting Zephyr OS build v2.6.99-ncs1  ***
    Area 7 at 0xea000 on MX25R64 for 90112 bytes
    /lfs mount: 0
    /lfs: bsize = 16 ; frsize = 4096 ; blocks = 22 ; bfree = 20
    /lfs/boot_count stat: 0
            fn 'boot_count' siz 4
    /lfs/boot_count read count 12: 4
    /lfs/boot_count seek start: 0
    /lfs/boot_count write new boot count 13: 4
    /lfs/boot_count close: 0
    /lfs opendir: 0
      F 4 boot_count
    End of files
    /lfs unmount: 0
    [00:00:00.211,547] <inf> littlefs: LittleFS version 2.2, disk version 2.0
    [00:00:00.211,791] <inf> littlefs: FS at MX25R64:0xea000 is 22 0x1000-byte blocks with 512 cycle
    [00:00:00.211,822] <inf> littlefs: sizes: rd 16 ; pr 16 ; ca 64 ; la 32
    [00:00:00.217,742] <inf> littlefs: /lfs mounted
    [00:00:00.262,145] <inf> littlefs: /lfs unmounted
    

    Please get back to me if it still doesn't work.

    Best regards,

    Simon

  • Hi Simon!

    I tried the steps but still the same error. I'll describe what I did.

    I turned board off, switched to nrf52840 on the board, started it and flashed it with hello world and the overlay file in src folder of the hello world sample. I then switched back to nrf9160 (without powering the board off) and flashed the littlefs sample from the thread you linked (that I made, the zip sent by Håkon at the end was the sample I assumed you meant). When flashing littlefs I get the same repeating error as I posted. I then turned the board off and on again on the switch, same error. I reflashed it, same error. Did I missunderstand a step?

    Thank you for helping!
    Regards

  • Hmm.. That's interesting

    Could you test with the hex files as well?

    What nRF9160 DK version do you have?

    I created another sample using the nRF9160 DK's external flash earlier, https://github.com/simon-iversen/sdk-nrf/tree/ext_flash_mcuboot_91dk/samples/nrf9160/http_update/application_update#testing are you able to get that to work?

  • Hi Simon. I'm embarrassed. I have an older version of the nrf9160DK. I'm putting in an order for a new one and getting a new brain for myself while I'm at it. Sorry for wasting your time, hopefully it will help someone else.

    Regards

  • Ah, ok. That explains everything, older versions of the nRF9160 DK's does not have external flash. No worry, I'm glad you found the cause of the issues Slight smile

Related