nRF5 SDK  v12.2.0
Choose documentation:
 All Data Structures Functions Variables Typedefs Enumerations Enumerator Groups Pages
Experimental: Flash Data Storage

The Flash Data Storage (FDS) module is a minimalistic file system for the flash storage on the chip that minimizes the risk of data corruption and simplifies your interaction with the persistent storage. It does this by organizing data in files, which consist of one or more records. The records contain the actual data and can be written, deleted, updated, or retrieved.

The concept of treating data as files provides a high level of abstraction. You can use the FDS module without detailed knowledge of the actual data format that is used internally. Instead, you can just work with files and records and use the module as a black box.

The module has been designed to provide the following benefits:

  • Minimizing the risk of accessing corrupted data by constant validation: In case of power loss, data might be written incompletely. Validation ensures that FDS recognizes invalid data and never returns corrupted data to the user.
  • Offering (optional) CRC verification when opening a record to ensure that data has not changed since it was written.
  • Minimizing flash operations (updating and deleting): Instead of deleting full pages, FDS stores copies of new data and invalidates outdated data by a single word write.
  • Basic wear leveling: Sequential writes and garbage collection provide for an even level of flash usage.
  • Making it easy to access data without copying it, which makes the impact of accessing data independent of the size of the data.
  • Minimizing memory usage by allowing for flexible data size.
  • Offering full flexibility regarding the data that is stored: A record can be composed of several chunks of data that might be non-contiguous in memory, but are stored together in flash. Also, there are not restrictions on the content of the data (which means that it can contain special characters).

FDS uses Experimental: Flash Storage as backend to write to flash. Flash Storage, in turn, relies on the SoftDevice to execute the write. Flash Data Storage supports synchronous read operations and asynchronous writes.

See Functionality for an explanation of the functionality that FDS provides. Storage format shows how records are stored in flash. Usage presents code examples and shows how to use FDS in an application.