Enabling Bluetooth to the Littlefs sample app will make the littlefs **NOT** use external flash.


I built the littlefs zephyr example found in "/zephyr/samples/subsys/fs/littlefs"and then modified it to use the external  flash "MX25R64" by adding an app.overlay file. I have also added to the prj.conf the following:

  • CONFIG_NORDIC_QSPI_NOR=y
  • CONFIG_NORDIC_QSPI_NOR_FLASH_LAYOUT_PAGE_SIZE=4096

That worked great and the example code worked as expected.

The example code will NOT use the qspi flash if I add "CONFIG_BT" to the prj.conf


Below is my setup:

  •  Base code:  "/zephyr/samples/subsys/fs/littlefs"
  •  Building:  west build -b nrf5340dk_nrf5340_cpuapp
  •  Eval board:  NRF5340DK
  •  Zephyr:  build v3.0.99-ncs1

prj.conf


# Copyright (c) 2019 Peter Bigot Consulting, LLC
#
# SPDX-License-Identifier: Apache-2.0
#

# Optionally force the file system to be recreated
#CONFIG_APP_WIPE_STORAGE=y

# fs_dirent structures are big.
CONFIG_MAIN_STACK_SIZE=2048
#CONFIG_BT=y

# Let __ASSERT do its job
CONFIG_DEBUG=y

CONFIG_LOG=y
CONFIG_LOG_MODE_MINIMAL=y

# enable QSPI flash
CONFIG_NORDIC_QSPI_NOR=y
CONFIG_NORDIC_QSPI_NOR_FLASH_LAYOUT_PAGE_SIZE=4096

CONFIG_FLASH=y
CONFIG_FLASH_MAP=y
CONFIG_FLASH_PAGE_LAYOUT=y

CONFIG_FILE_SYSTEM=y
CONFIG_FILE_SYSTEM_LITTLEFS=y

# My options
CONFIG_COMPILER_COLOR_DIAGNOSTICS=n

```

app.overlay

```
/*
* Copyright (c) 2022 Nordic Semiconductor ASA
*
* SPDX-License-Identifier: LicenseRef-Nordic-5-Clause
*/

/ {
    chosen {
       nordic,nus-uart = &uart0;
    };
};

/delete-node/ &storage_partition;

/ {
       fstab {
       compatible = "zephyr,fstab";
       lfs1: lfs1 {
          compatible = "zephyr,fstab,littlefs";
          mount-point = "/lfs";
          partition = <&lfs1_part>;
          automount;
          read-size = <16>;
          prog-size = <16>;
          cache-size = <64>;
          lookahead-size = <32>;
          block-cycles = <512>;
       };
    };
};

// add QSPI flash partition and use the "storage"
// label so LittleFS will reference it
&mx25r64 {
    partitions {
       compatible = "fixed-partitions";
       #address-cells = <1>;
       #size-cells = <1>;

      lfs1_part: partition@0 {
          label = "storage";
          reg = <0x00000000 0x00010000>;
       };
    };
};

Output with: "#CONFIG_BT=y"

(Commented out) Works using external flash (DESIRED OUTPUT)

I: littlefs partition at /lfs
I: LittleFS version 2.4, disk version 2.0
I: FS at MX25R64:0x0 is 16 0x1000-byte blocks with 512 cycle
I: sizes: rd 16 ; pr 16 ; ca 64 ; la 32
I: /lfs mounted
I: Automount /lfs succeeded
*** Booting Zephyr OS build v3.0.99-ncs1 ***
Sample program to r/w files on littlefs
Area 0 at 0x0 on MX25R64 for 65536 bytes
/lfs automounted
/lfs: bsize = 16 ; frsize = 4096 ; blocks = 16 ; bfree = 12


Output with: "CONFIG_BT=y"

(Bluetooth Enabled) Uses internal flash (BAD OUTPUT)


I: littlefs partition at /lfs
I: LittleFS version 2.4, disk version 2.0
I: FS at NRF_FLASH_DRV_NAME:0xfa000 is 6 0x1000-byte blocks with 512 cycle
I: sizes: rd 16 ; pr 16 ; ca 64 ; la 32
I: /lfs mounted
I: Automount /lfs succeeded
*** Booting Zephyr OS build v3.0.99-ncs1 ***
Sample program to r/w files on littlefs
Area 7 at 0xfa000 on NRF_FLASH_DRV_NAME for 24576 bytes
/lfs automounted
/lfs: bsize = 16 ; frsize = 4096 ; blocks = 6 ; bfree = 1

Parents Reply Children
No Data
Related