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

Flash data storage with external SPI flash

Hi,

I need some very simple file system to use on an external SPI flash. I gave a quick look at Flash Data Storage and it should be ok for me. I am not sure though why it is often referred to it as an "internal flash only" solution. If I understand correctly, FDS is based on Flash Storage which supports different backends. Assuming I implement a working backend for my SPI flash, is anything preventing it from working? I see that the most commonly used FS on embedded devices is some form of FAT FS, but I fear it may just be a bad choice due to non existing wear levelling, poor power-off resilience etc.

Thanks!

  • Hi,

    You are right that FDS is only intended to be used with the internal flash. That is the only thing the Flash Storage library provide backends for (either directly or via SoftDevice API's), and it is the only thing we have tested, and what have been the focus for the architectural decisions. I am not aware that anyone have implemented a fstorage backend for external flash and used it with FDS, but it might be possible. I expect you will have to make some adjustments though, as the underlying assumption of both fstorage and FDS is that it is using the internal flash in the same address space etc. (There is no memory mapping for external flash in the nRF52832).

  • Hi,

    I was somewhat expecting that I needed to implement write, read and erase methods to conform to the Flash Storage interface, and have FDS happily use them, but your answer makes me thing I must be missing something. I'll have to check the code...

    Question is: are there other filesystems suggested to use reliably on a battery powered device? I know and used FAT in the past but I am not very fond of it as it lacks several important features such as wear leveling and power outage resilience.

  • Hi,

    I do not have experience with any other file systems than FAT on external flash, but I see your point. There are several file systems out there, but Nordic does not have any recommendations or examples with anything else. Perhaps someone in the community can suggest better file systems for external flash?

  • May be you can try little fs or spiffs file system, which looks a bit simpler and small in size. i think these are mainly intended for NOR flash. you can also have a look at usbd msc example for nrf52840

    i am also trying to add a NAND flash to my application but didn't figure out how to proceed with the fs.

  • I gave a look to littlefs and other similar file systems, but they all expect SPI operations to be synchronous/blocking. At the moment I am using just bare drivers and nrf scheduler. Moving to blocking code would require to put an RTOS into the scheme, since I can't just put a while loop calling __WFE(). I also have SoftDevice and other stuff running.

Related