This discussion has been locked.
You can no longer post new replies to this discussion. If you have a question you can start a new discussion

littlefs sample on nrf5340dk not running

Hello,

I would like to use littlefs on the nrf5340dk board with the OnBoard Flash. So I selected the Zephyr/samples/subsys/fs/littlefs sample Project with the nrf5340dk board. Unfortunately the sample Project contains only nrf52840dk_nrf52840 conf and overlay files. So I renamed them to nrf5340dk_nrf5340_cpuapp and everything compiled.

The Flash area seems to be existing as the Flash_area_open/close functions in the beginning of main.c work. But the rest, which is the real stuff I would like to use not.

fs_statvfs Reports an error as could not find a mount Point fs_mnt_list, which is even empty. According main.c it seems that it should have been automounted. But that seems not to be the case. When I therefore include a call of fs_mound(mp), the call is also not successfully. This function tries to get a Flash device, which is not existing. So that doesn't work either.

It seems that some configuration (in device tree or prj.conf) is missing.

Can someone help me to get a Project that uses the DK OnBoard Flash as file System?

BTW: I'm using nRF Connect SDK v1.9.0

Regards
Erwin

Parents
  • Hi Erwin

    I ran the littlefs sample with the added board files as you described. It seems to run fine at my end, but I might have missed something.
    You might have to reset the device once after flashing before it works.

    Could you send the serial log from the littlefs sample?
    (use insert->code in the editor)

    Regards,
    Sigurd Hellesvik

  • Here is the output

    Area 0 at 0x0 on MX25R64 for 65536 bytes
    /lfs1 automounted
    FAIL: statvfs: -2
    /lfs1 unmount: -22
    [00:00:00.249,755] <inf> littlefs: littlefs partition at /lfs1
    [00:00:00.249,786] <inf> littlefs: LittleFS version 2.4, disk version 2.0
    [00:00:00.249,786] <err> littlefs: can't get flash device: MX25R64
    [00:00:00.249,816] <err> fs: fs mount error (-19)
    [00:00:00.249,816] <err> littlefs: Automount /lfs1 failed: -19
    [00:00:47.808,532] <err> fs: mount point not found!!
    [00:00:47.810,211] <err> fs: fs not mounted (mp == 0x20000138)

  • Hello,

    I thought it doesn't harm to upload the whole Project. It's practically the sample Project except that I copied and renamed the conf and overlay file to the nrf5340 board.

    1134.littlefs.zip

    May be someone gets it running on the development board.

    Erwin

  • Hi

    Good idea to upload your project!
    I tried to run your project,  and I get the same error as you.

    So I selected the Zephyr/samples/subsys/fs/littlefs sample Project with the nrf5340dk board.

    Did you edit the project, other than changing the names of the overlay files?

    Anyhow, here is my edited littlefs project,

    Here is the littlefs sample(from zephyr) where I have only added overlay files:

    littlefs2.zip

    EDIT: Clarified some of my writing

    Regards,
    Sigurd Hellesvik

Reply
  • Hi

    Good idea to upload your project!
    I tried to run your project,  and I get the same error as you.

    So I selected the Zephyr/samples/subsys/fs/littlefs sample Project with the nrf5340dk board.

    Did you edit the project, other than changing the names of the overlay files?

    Anyhow, here is my edited littlefs project,

    Here is the littlefs sample(from zephyr) where I have only added overlay files:

    littlefs2.zip

    EDIT: Clarified some of my writing

    Regards,
    Sigurd Hellesvik

Children
  • Before simply trying it: ist littlefs2.zip running on your side on a nrf5340dk board?

  • Yep, it is running without error on my nRF5340dk board.
    Here is the output I get:

    *** Booting Zephyr OS build v2.7.99-ncs1  ***
    Area 0 at 0x0 on MX25R64 for 65536 bytes
    /lfs1 automounted
    52,563] lfs1: bsize = 16 ; frsize = 4096 ; blocks = 16 ; bfree = 14
    [0m<inf> /lfs1/boot_count stat: 0
    	fn 'boot_count' size 4
    littl/lfs1/boot_count read count 11: 4
    /lfs1/boot_count seek start: 0
    /lfs1/boot_count write new boot count 12: 4
    efs:/lfs1/boot_count close: 0
     litt/lfs1 opendir: 0
    lefs parti  F 4 boot_count
    End of files
    /lfs1 unmount: 0
    tion at /lfs1
    [00:00:00.252,563] <inf> littlefs: LittleFS version 2.4, disk version 2.0
    [00:00:00.252,593] <inf> littlefs: FS at MX25R64:0x0 is 16 0x1000-byte blocks with 512 cycle
    [00:00:00.252,624] <inf> littlefs: sizes: rd 16 ; pr 16 ; ca 64 ; la 32
    [00:00:00.254,577] <inf> littlefs: /lfs1 mounted
    [00:00:00.254,608] <inf> littlefs: Automount /lfs1 succeeded
    [00:00:00.295,745] <inf> littlefs: /lfs1 unmounted
    

    Regards,
    Sigurd Hellesvik

  • Great, it works for me too.

    I think I know my error: as there are special board files in the samble board directory I thought a special device tree update would be required for my board too. But that's wrong. All stuff is already in the provided device tree (which makes sense). so no need to copy any device tree file.

    Thanks
    Erwin

  • ErwinCes said:
    I thought a special device tree update would be required for my board too. But that's wrong. All stuff is already in the provided device tree

    There should be board overlays in the littlefs2.zip.

    You need the overlay to tell the nRF5340 to use the external flash for littlefs instead of internal flash.
    Here is the sample built without overlays, and you can see it use NRF_FLASH_DRV_NAME:

    *** Booting Zephyr OS build v2.7.99-ncs1  ***
    Area 6 at 0xfa000 on NRF_FLASH_DRV_NAME for 24576 bytes
    /lfs mount: 0
    /lfs: bsize = 16 ; frsize = 4096 ; blocks = 6 ; bfree = 4
    /lfs/boot_count stat: 0
    	fn 'boot_count' size 4
    /lfs/boot_count read count 3: 4
    /lfs/boot_count seek start: 0
    /lfs/boot_count write new boot count 4: 4
    /lfs/boot_count close: 0
    /lfs opendir: 0
      F 4 boot_count
    End of files
    /lfs unmount: 0
    [00:00:00.261,444] <inf> littlefs: LittleFS version 2.4, disk version 2.0
    [00:00:00.261,596] <inf> littlefs: FS at NRF_FLASH_DRV_NAME:0xfa000 is 6 0x1000-byte blocks with 512 cycle
    [00:00:00.261,627] <inf> littlefs: sizes: rd 16 ; pr 16 ; ca 64 ; la 32
    [00:00:00.262,115] <inf> littlefs: /lfs mounted
    [00:00:00.290,313] <inf> littlefs: /lfs unmounted
    

    Regards,
    Sigurd Hellesvik

Related