This post is older than 2 years and might not be relevant anymore
More Info: Consider searching for newer posts

Changing Flash parameters in overlay file

My project is using nRF52840.   Early software development used an nRF52840-DK to develop most of the software.   Software is based on Zephyr using nRF Connect version 1.6.1.     I'm using the "littlefs" file system.   I got most things working using the nRF52840-DK.     I now have my custom board and it uses a slightly different (and larger) qspi-nor flash device.   

I'm still using the nRF52840-DK board file, but "modify" some of the parameters using an overlay file.    I know I need to change some of the parameters w.r.t. the flash.    I was able to modify the jedec-id for the new device, but am looking for some documentation that defines the parameters (keywords) in the board definition file (what some of them mean and format of values)   

Can you point me to these definitions (so I don't have to read through a lot of code :-))?

Thanks!

Parents
  • Hi

    This could to relate to an issue with the automount flag in the .overlay file of NCS. Can you try commenting out the automount flag in the .overlay file to see if the mount error resolves. This is an issue internally that we're currently looking at and the fix will likely be added to a future release of NCS.

    Best regards,

    Simon

  • Hi Simon,

    Thanks...   I commented out the "automount", so the messages shown in the screen capture simply move from before boot to after boot (when I then have to manually mount the file system).

    In reading through the code (and looking through lots of posts), it appears that the problem occurs because the Flash is new (hasn't been written).    It seems that the LittleFS attempts to format the Flash but fails.    I saw a post that recommended using "CONFIG_APP_WIPE_STORAGE=y" in the prj.conf file, but that doesn't seem to be supported in the version I'm using (NCS 1.6.1).       More tracing seems to show that a call to "lfs_dir_compact" (during format? on line 1051 of lfs.c) returns -5 (fffffffb).     Haven't figured out why yet...

Reply
  • Hi Simon,

    Thanks...   I commented out the "automount", so the messages shown in the screen capture simply move from before boot to after boot (when I then have to manually mount the file system).

    In reading through the code (and looking through lots of posts), it appears that the problem occurs because the Flash is new (hasn't been written).    It seems that the LittleFS attempts to format the Flash but fails.    I saw a post that recommended using "CONFIG_APP_WIPE_STORAGE=y" in the prj.conf file, but that doesn't seem to be supported in the version I'm using (NCS 1.6.1).       More tracing seems to show that a call to "lfs_dir_compact" (during format? on line 1051 of lfs.c) returns -5 (fffffffb).     Haven't figured out why yet...

Children
  • Where do you see that the CONFIG_APP_WIPE_STORAGE config is not supported in NCS v1.6.1? It seems to be included as an optional configuration in the littlefs sample project for instance. lfs_dir_compact is not in line 1051 of lfs.c on my end. Can you show me the exact error and return code you're getting?

    Best regards,

    Simon

  • Hi Simon,

    If "CONFIG_APP_WIPE_STORAGE=y" is included in prj.conf I get an error when Cmake executes.

    I then checked: http://developer.nordicsemi.com/nRF_Connect_SDK/doc/latest/kconfig/index-all.html

    and didn't see it listed as a legal CONFIG option, so I assumed it had been removed.

    The call returns -5 (0xfffffffb)

    Sorry, line 1051 should be 1851...

    Thanks!

  • I stepped back and used the littlefs sample project to just test the Flash/LittleFS interface of my new board.   Since the board is new, the flash has never been written, so when booting, the mount fails (as expected with an error at lfs.c line 997 (Corrupted dir pair at (0x0, 0x1))) and it appears LittleFS attempts to format the device.    It looks like it prepares a superblock, then attempts to write it.    A failure occurs during formatting (returning -28).    Looking this up in lfs.h shows that -28 indicates LFS_ERR_NOSPC (no space left on device).     Stepping through, it looks like the error is being thrown at line 1692 of lfs.c due to the comparison at line 1689.  I'm not sure why this is happening yet.    The device is new, so is there some other (erase?) procedure that needs to be performed before running this test?    I would think that formatting would prepare/initialize any information about the device needed for the file system?   

    I removed the comment from the CONFIG_APP_WIPE_STORAGE=y line in prj.conf thinking that perhaps it might erase the device during the formatting process, but got the same error (-28).

    Note that CONFIG_APP_WIPE_STORAGE=y works here, but if I put it in my prj.conf running Cmake fails!   Both are using NCS 1.6.1  Running without the APP_WIPE config statement causes an error -5 (LFS_ERR_IO - Error during device operation).    As mentioned earlier, the device on the new board is very similar to the one on nRF52840DK, except larger.

    Thanks!

Related