I’ve been working on getting the zephyr/samples/subsys/fs/littlefs
sample working with the onboard external 4MB flash but can’t seem to make it work.
I’ve followed Jared’s issue on devzone (https://devzone.nordicsemi.com/f/nordic-q-a/62212/external-spi-flash-to-use-with-littlefs-on-nrf9160-w-mcuboot), but it still does not work.
Here is my prj.conf
# Filesystem
CONFIG_SPI=y
CONFIG_SPI_NOR=y
CONFIG_SPI_NOR_FLASH_LAYOUT_PAGE_SIZE=4096
# Enable flash operations.
CONFIG_FLASH=y
CONFIG_FLASH_MAP=y
CONFIG_FLASH_PAGE_LAYOUT=y
# Enable the LittleFS file system.
CONFIG_FILE_SYSTEM=y
CONFIG_FILE_SYSTEM_LITTLEFS=y
# CONFIG_APP_WIPE_STORAGE=y
# Nordic specific external flash stuff
CONFIG_PM_EXTERNAL_FLASH=y
CONFIG_PM_EXTERNAL_FLASH_DEV_NAME="W25Q32JV"
CONFIG_PM_EXTERNAL_FLASH_BASE=0x0
CONFIG_PM_EXTERNAL_FLASH_SIZE=0x2000000
and my .overlay
/delete-node/ &w25q16jv;
&spi3 {
compatible = "nordic,nrf-spim";
status = "okay";
sck-pin = <11>;
mosi-pin = <9>;
miso-pin = <28>;
cs-gpios = <&gpio0 7 GPIO_ACTIVE_LOW>;
w25q32jv: w25q32jv@0 {
compatible = "jedec,spi-nor";
label = "W25Q32JV";
reg = <0>;
spi-max-frequency = <40000000>;
wp-gpios = <&gpio0 8 GPIO_ACTIVE_LOW>;
hold-gpios = <&gpio0 10 GPIO_ACTIVE_LOW>;
size = <0x2000000>;
has-dpd;
t-enter-dpd = <4000>;
t-exit-dpd = <25000>;
jedec-id = [ef 40 16];
has-be32k;
};
};
The source code is the sample’s main.c
This is what I get:
Area 3 at 0xfa000 on NRF_FLASH_DRV_NAME for 24576 bytes
[00:00:01.588,348] [0m<inf> littlefs: LittleFS version 2.2, disk version 2.0[0m
[00:00:01.588,562] [0m<inf> littlefs: FS at NRF_FLASH_DRV_NAME:0xfa000 is 6 0x1000-byte blocks with 512 cycle[0m
[00:00:01.588,562] [0m<inf> littlefs: sizes: rd 16 ; pr 16 ; ca 64 ; la 32[0m
[00:00:01.588,714] [1;31m<err> littlefs: WEST_TOPDIR/modules/fs/littlefs/lfs.c:997: Corrupted dir pair at {0x0, 0x1}[0m
[00:00:01.588,714] [1;33m<wrn> littlefs: can't mount (LFS -84); formatting[0m
[00:00:01.588,775] [1;31m<err> os: ***** MPU FAULT *****[0m
[00:00:01.588,806] [1;31m<err> os: Data Access Violation[0m
[00:00:01.588,806] [1;31m<err> os: MMFAR Address: 0xfa000[0m
[00:00:01.588,867] [1;31m<err> os: r0/a1: 0x00000001 r1/a2: 0x00001000 r2/a3: 0x00000002[0m
[00:00:01.588,867] [1;31m<err> os: r3/a4: 0xffffffff r12/ip: 0x00000010 r14/lr: 0x0001fdfb[0m
[00:00:01.588,928] [1;31m<err> os: xpsr: 0x01000000[0m
[00:00:01.588,958] [1;31m<err> os: s[ 0]: 0x00000000 s[ 1]: 0x00000000 s[ 2]: 0x00000000 s[ 3]: 0x00000000[0m
[00:00:01.588,989] [1;31m<err> os: s[ 4]: 0x00000000 s[ 5]: 0x00000000 s[ 6]: 0x00000000 s[ 7]: 0x00000000[0m
[00:00:01.589,019] [1;31m<err> os: s[ 8]: 0x00000000 s[ 9]: 0x00000000 s[10]: 0x00000000 s[11]: 0x00000000[0m
[00:00:01.589,050] [1;31m<err> os: s[12]: 0x00000000 s[13]: 0x00000000 s[14]: 0x00000000 s[15]: 0x00000000[0m
[00:00:01.589,050] [1;31m<err> os: fpscr: 0x00000000[0m
[00:00:01.589,050] [1;31m<err> os: Faulting instruction address (r15/pc): 0x0001fdfe[0m
[00:00:01.589,080] [1;31m<err> os: >>> ZEPHYR FATAL ERROR 0: CPU exception on CPU 0[0m
[00:00:01.589,080] [1;31m<err> os: Current thread: 0x20020c38 (unknown)[0m
[00:00:01.762,664] [1;31m<err> os: Halting system[0m
Any ideas?