Hello,
I am currently using the nrf9160dk and would like to use the external flash available on the development kit. I want to use LittleFS on the external flash.
I found several articles all covering different aspects, but I was unable to arrive to a working solution for using LittleFS on the external flash.
- I first tested the external flash using the NVS sample and got that working.
- Then I proceeded to the LittleFS sample located in the 'zephyr/samples/subsys/fs/littlefs' directory. Now the board has two different build targets, the nrf9160_9160 and the nrf9160_9160_ns version. I first tried the non-"ns" version (so secure) as per this post of someone getting it to work. It built successfully, but unlike the post, I received this message in the log indicating that it was using the internal flash rather than the external flash chip. (Using strictly the sample code only). Calculating the size (6 * 0x1000 = ~24kB) which indicates it is the internal flash.
[00:00:00.406,524] <inf> littlefs: FS at NRF_FLASH_DRV_NAME:0xfa000 is 6 0x1000-byte blocks with 512 cycle
Then, I replicated the prj.conf and the overlay to match the first post on the thread. Flashing it to the board, the shell would not appear and the file system would still be mounted on the internal flash. How can I change it to external flash and verify that it is indeed on external flash? That same post the person said that he could get it working on the secure but not the "ns" version. I can't get it working on either secure or non-secure.
Here is my current configuration:
Hardware: nrf9160dk v1.1.0
Sample: zephyr/samples/subsys/fs/littlefs
Ncs: v1.7.0
prj.conf
# fs_dirent structures are big. CONFIG_MAIN_STACK_SIZE=2048 # Let __ASSERT do its job CONFIG_DEBUG=y CONFIG_LOG=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 CONFIG_FLASH=y CONFIG_LOG=y #CONFIG_FS_LOG_LEVEL_DBG=y CONFIG_HEAP_MEM_POOL_SIZE=16384 CONFIG_SHELL=y CONFIG_SHELL_LOG_LEVEL_INF=y CONFIG_FILE_SYSTEM=y CONFIG_FILE_SYSTEM_SHELL=y CONFIG_FILE_SYSTEM_LITTLEFS=y CONFIG_FLASH_MAP=y CONFIG_FLASH_PAGE_LAYOUT=y CONFIG_SPI=y CONFIG_SPI_NOR=y CONFIG_SPI_NOR_FLASH_LAYOUT_PAGE_SIZE=4096
app.overlay:
/delete-node/ &storage_partition; &mx25r64 { // spi-max-frequency = <1000000>; partitions { compatible = "fixed-partitions"; #address-cells = <1>; #size-cells = <1>; storage_partition: partition@0 { label = "storage"; reg = <0x00000000 0x00800000>; }; }; };
When I tried it on the non-secure build target, it would fail to compile (can't find mx25r64). So, I modified one of the spi interfaces to get it to work as per this post. It then would "work", but still failed to use the external flash (which is interesting as the same overlay would use the external flash on the NVS sample).
I read something about a partition manager, this post on something very similar, and also configured the board controller.
So, in summary: How do you configure LittleFS to utilize the external flash (preferably for the ns version)? And, how can you verify LittleFS is utilizing the external flash?
Thank you in advance for the help,
Ben