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

How to read data by using fstorage

Hii all,

I am working on a project where I need to store data to persistent storage and retrieve back when the board is restart. but now we are migrated to simultaneous central and peripheral role and I found some thing like fstorage and I read this is just like pstorage but efficient than pstorage
So I would like to use this for my operation but its something wondering like when I look at the doc of fstorage we only have fs_store() and fs_erase() but nothing like fs_load(). Can any one suggest me is there any way to do that

I'm using nRF5_SDK_11.0.0_89a8197 Thank you

  • You also need to erase previous value if you updating value, i.e.

    {

    fs_erase(&fs_config, fs_config.p_start_addr, 1);

    }

  • Is there really not a way of simply loading data using the fstorage module? It seems really unthought, given that pstorage has been deprecated. The module that is supposed to replace it doesn't provide the same functionality?

    Anyway. In my application I have to store a single struct and retrieve it on startup. I don't want to use a complicated Flash Data Storage with files and records. I ended up using your way with a dummy word that I write to and retrieve the data from the pointer upon getting the completed event.

    But that's a rather silly workaround for a flash storage module...

  • @siddhantmodi There is no flaw. In the "Experimental: Flash Storage" documentation for SDK 11 if you look at the section "Priority for Flash Usage" you'll see how it works. You assign each chunk of registered flash memory a priority when you configure it. Assuming the contents of the flash do not change between restarts, the chunk with the same priority will always be assigned to the same memory location. You also cannot change the number of pages dedicated to each chunk as this would mess up the spacing.

  • @BjørnSpockeli Can you please be kind enough as to respond to the message chain and clear out any confusions that are lingering around the capabilities of fstorage module - to load,update,store,and erase the persistent data? Also, speaking from a end-user's perspective it would be highly inefficient if fstorage - a higher and advanced version of pstorage module, is not able to support the basic and developer friendly techniques of storing and loading the chunks of data.

  • @abeshek: Firstly, fstorage is the replacement of pstorage, i.e. the fstorage module provides the functionality to store data to flash and erase flash pages just like pstorage. Nothing more and nothing less. You can store your data chunks at a specific flash address so that you know where to retrieve the data by dereferencing the pointer to that specific flash address.

Related