Unable to Mount LittleFS File System On External Flash On NRF54L15-DK

Hi everyone,

I'm new to both nRF Connect SDK and Zephyr RTOS, and I’m trying to modify the official LittleFS FileSystem Sample to mount an external SPI flash as the storage backend.

So far, I haven't been successful in getting it to work.

I've attached the relevant files:

  • .overlay file with external flash node

  • prj.conf with the necessary config options

  • boards/<board_name>.yaml if needed

I'd really appreciate any advice, corrections, or working examples from anyone who has managed to get LittleFS working on external flash (especially using nordic,pm-ext-flash or similar).

Thanks in advance for your help!

Best regards,
Khalil

pm_static.yaml

nrf54l15dk_nrf54l15_cpuapp.conf2860.nrf54l15dk_nrf54l15_cpuapp.overlay

Parents
  • Hello Khalil,

    Could you please follow these steps:

    1. Remove your pm_static.yml from the project
    2. Build pristine once
    3. Verify that features in this build work. Stop here if this step failed.
    4. Copy the partitions.yml from that build directory as a new pm_static.yml
    5. Reconfigure the littlefs partition to external flash, remember to add some properties under the partitions as followed:
      affiliation:
        -disk
      extra_params: {
          disk_name: "littlefs",
          disk_cache_size: 4096,
          disk_sector_size: 512,
          disk_read_only: 0
        }

      Here is an example:
      littlefs_storage:
        address: 0xe7600
        end_address: 0x800000
        region: external_flash
        device: mx25r6435f
        size: 0x718000
        affiliation:
          -disk
        extra_params: {
            disk_name: "littlefs",
            disk_cache_size: 4096,
            disk_sector_size: 512,
            disk_read_only: 0
          }

    Hieu

Reply
  • Hello Khalil,

    Could you please follow these steps:

    1. Remove your pm_static.yml from the project
    2. Build pristine once
    3. Verify that features in this build work. Stop here if this step failed.
    4. Copy the partitions.yml from that build directory as a new pm_static.yml
    5. Reconfigure the littlefs partition to external flash, remember to add some properties under the partitions as followed:
      affiliation:
        -disk
      extra_params: {
          disk_name: "littlefs",
          disk_cache_size: 4096,
          disk_sector_size: 512,
          disk_read_only: 0
        }

      Here is an example:
      littlefs_storage:
        address: 0xe7600
        end_address: 0x800000
        region: external_flash
        device: mx25r6435f
        size: 0x718000
        affiliation:
          -disk
        extra_params: {
            disk_name: "littlefs",
            disk_cache_size: 4096,
            disk_sector_size: 512,
            disk_read_only: 0
          }

    Hieu

Children
  • Thank you, Hieu, for your prompt response.

    I tried implementing your suggestion, but unfortunately, the modified LittleFS sample still throws the following runtime error:

    Sample program to r/w files on littlefs
    E: FAIL: unable to find flash area 1: -2

    I: littlefs partition at /lfs1
    I: LittleFS version 2.9, disk version 2.1
    E: can't open flash area 1
    E: fs mount error (-19)
    E: Automount /lfs1 failed: -19

    Below is the compiled partitions.yaml output after applying your changes:

    app:
    address: 0x0
    end_address: 0x165000
    region: flash_primary
    size: 0x165000
    bootconf:
    address: 0xffd080
    end_address: 0xffd084
    region: bootconf
    size: 0x4
    external_flash:
    address: 0x6000
    end_address: 0x800000
    region: external_flash
    size: 0x7fa000
    littlefs_storage:
    address: 0x0
    device: DT_CHOSEN(nordic_pm_ext_flash)
    end_address: 0x6000
    placement:
    before:
    - tfm_storage
    - end
    region: external_flash
    size: 0x6000
    otp:
    address: 0xffd500
    end_address: 0xffd9fc
    region: otp
    size: 0x4fc
    sram_primary:
    address: 0x20000000
    end_address: 0x2002f000
    region: sram_primary
    size: 0x2f000

    And here's the pm_static.yaml content I'm using:

    littlefs_storage:
    address: 0xe7600
    end_address: 0x800000
    region: external_flash
    device: mx25r6435f
    size: 0x718000
    affiliation:
    -disk
    extra_params: {
    disk_name: "littlefs",
    disk_cache_size: 4096,
    disk_sector_size: 512,
    disk_read_only: 0
    }

    It’s worth noting that the generated partitions.yaml looks exactly the same even when I used a simplified pm_static.yaml like this:

    littlefs_ext_storage:
    address: 0x00000000
    size: 0x00800000
    region: external_flash
    placement:
    before: end


    I’m still stuck and wondering if you or anyone else could share a working sample project targeting the nRF54L15-DK that successfully mounts LittleFS on external SPI flash. That would be incredibly helpful for learning and troubleshooting.

    Thanks again for your support!

    Best regards,
    Khalil

Related