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!

  • Hi

    What flash parameters specifically are you looking to modify? The block size and erase value are set in the qspi_flash_parameters() function in nrf_qspi_nor.c for instance, and all flash parameters can be found in flash.h in \zephyr\include\drivers\flash.h

    Best regards,

    Simon

  • Hi Simon,

    Thanks for your reply.

    To be truthful, I'm not sure right now what parameter(s) I need to change.   I'm transitioning from using the nRF52840-DK for development/evaluation to my custom board for production and trying to get the file system to function using a slightly different Flash device.  The attached image shows the errors I'm seeing (minus the mismatch JEDEC-ID which was easy to fix).   Since the errors occur prior to the call to "main()", I assumed that some parameter set in the device-tree must be the culprit, but then couldn't find documentation/definitions for the variables set there.  The call you referenced would be executed in main (at the earliest), after the error occurs (without editing code that probably shouldn't be changed).    Zephyr must be attempting to initialize the file system and failing.   The Flash interface must be "basically" working since it reads the JEDEC-ID (and the error is not thrown once the correct value was put into the overlay file).   So I'm looking for documentation so I can try to figure out what is happening (without having to read through a lot of Zephyr boot code).     Any pointers would be appreciated!!

    Thanks!

  • 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...

  • 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

Related