Flash Storage Read and Write w/out FDS


I am developing on the nRF52840 using the SDK15.2.0. I have the option of using either mac or windows OS, but have been working more on mac. I am trying to use either the flash_fds, flash_storage, or flashwrite examples to write and read individual 8 bit words to flash. Currently, I am using the FDS example and am trying to see if a function I wrote for flashstorage is writing to the correct address. However, when debugging, I keep getting error code 8 when calling nrf_fstorage_write. I read that FDS runs on top of fstorage so I assumed the storage functions would work as well, and when it didn't I also tried to #include "nrf_fstorage.h" in the main, but still got the same error. Any thoughts on how to squish this bug? Are nrf_fstoratge and fds even compatible? I am relatively new to programming so even if the solution is obvious, I would really appreciate the help.



  • Hi,

    While it is true that FDS runs on top of fstorage, you should still use the same library for reading things back as you did for writing them in the first place. The main reason for that is that fstorage and FDS work on different abstraction levels. FDS does not give you access to specific addresses, but rather you write a "record" that can be put anywhere within the FDS region of flash, and then you search for that record in order to read it back out.

    I suggest that you read up on Flash Storage (fstorage) and/or Flash Data Storage (FDS), and choose one of them to use for storing/retrieving your data. Which one is the best alternative depends on your needs. For instance, if you need to use a particular, fixed, flash address then you cannot use FDS. If you have any issues using either of the libraries then please provide a description of what you do and what issue you see.