Im having trouble setting up and using flash on nRF5340dk.
Is there any example on how to use LittleFS on external flash that is on the dev kit?
Im having trouble setting up and using flash on nRF5340dk.
Is there any example on how to use LittleFS on external flash that is on the dev kit?
Hi,
Here is the example https://github.com/nrfconnect/sdk-zephyr/tree/main/samples/subsys/fs/littlefs.
Please duplicate this https://github.com/nrfconnect/sdk-zephyr/blob/main/samples/subsys/fs/littlefs/boards/nrf52840dk_nrf52840_qspi.conf config file and rename it to nrf5340dk_nrf5340_cpuapp.conf.
Duplicate https://github.com/nrfconnect/sdk-zephyr/blob/main/samples/subsys/fs/littlefs/boards/nrf52840dk_nrf52840_qspi.overlay overlay file, rename it to nrf5340dk_nrf5340_cpuapp.overlay and update with the following content:
/* * Copyright (c) 2019 Peter Bigot Consulting, LLC * * SPDX-License-Identifier: Apache-2.0 */ /delete-node/ &storage_partition; / { chosen { nordic,pm-ext-flash = &mx25r64; }; fstab { compatible = "zephyr,fstab"; lfs1: lfs1 { compatible = "zephyr,fstab,littlefs"; mount-point = "/lfs1"; partition = <&lfs1_part>; automount; read-size = <16>; prog-size = <16>; cache-size = <64>; lookahead-size = <32>; block-cycles = <512>; }; }; }; &mx25r64 { partitions { compatible = "fixed-partitions"; #address-cells = <1>; #size-cells = <1>; lfs1_part: partition@0 { label = "storage"; reg = <0x00000000 0x00010000>; }; }; };
Then, you could get the output like this
Regards,
Amanda H.
Ok, an Update. As soon as I add
nrf5340dk_nrf5340_cpuapp.overlay
/delete-node/ &storage_partition; / { chosen { nordic,pm-ext-flash = &mx25r64; }; fstab { compatible = "zephyr,fstab"; lfs1: lfs1 { compatible = "zephyr,fstab,littlefs"; mount-point = "/lfs1"; partition = <&lfs1_part>; automount; read-size = <16>; prog-size = <16>; cache-size = <64>; lookahead-size = <32>; block-cycles = <512>; }; }; }; &mx25r64 { partitions { compatible = "fixed-partitions"; #address-cells = <1>; #size-cells = <1>; lfs1_part: partition@0 { label = "storage"; reg = <0x00000000 0x00800000>; }; }; };
added CONFIG_PM_PARTITION.... to prj.conf
CONFIG_MAIN_STACK_SIZE=2048 # Let __ASSERT do its job CONFIG_DEBUG=y CONFIG_LOG=y CONFIG_LOG_MODE_MINIMAL=y CONFIG_FLASH=y CONFIG_FLASH_MAP=y CONFIG_FLASH_PAGE_LAYOUT=y CONFIG_FILE_SYSTEM=y CONFIG_FILE_SYSTEM_LITTLEFS=y CONFIG_PM_PARTITION_REGION_LITTLEFS_EXTERNAL=y
pm_static.yml is:
littlefs_storage: address: 0 end_address: 0x800000 placement: before: - end region: external_flash size: 0x800000
Now Im getting:
I: LittleFS version 2.5, disk version 2.0
I: FS at mx25r6435f@0:0x0 is 6 0x1000-byte blocks with 512 cycle
I: sizes: rd 16 ; pr 16 ; ca 64 ; la 32
I: /lfs1 mounted
I: Automount /lfs1 succeeded
*** Booting Zephyr OS build v3.2.99-ncs2 ***
Sample program to r/w files on littlefs
Area 1 at 0x0 on mx25r6435f@0 for 24576 bytes
/lfs1 automounted
/lfs1: bsize = 16 ; frsize = 4096 ; blocks = 6 ; bfree = 3
at least its on mx25, but the size is wrong, it should be 8mb
found what was wrong. There were several issues. First and most stupid was that directive in CMakeLists.txt was set to root of project and not to boards folder.
littlefs_storage: address: 0x0 end_address: 0x800000 placement: before: - end device: mx25r64 region: external_flash size: 0x800000 filesystem: littlefs
Now if only you could help with pm_static.yml for DFU ?
Hi,
If you enable the partition manager and let it decide the memory layout without the pm_static.yml.
Here is my test project smp_svr_nRF5340.7z for NCS v2.3.0. You can build it with overlay-bt.conf to support BLE DFU. Here is the command for west build:west build -p -b nrf5340dk_nrf5340_cpuapp -d build_nrf5340dk_nrf5340_cpuapp -- -DOVERLAY_CONFIG=overlay-bt.conf
I will be out of the office for one month and will not be able to reply to the case during this period. If you are urgent for support, please create a new support case.
-Amanda H.