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

Using nrf52840 Flash block as EEPROM

Hi,

What is the best approach to use a block of flash in nrf52840 as EEPROM. Are there any pre-existing library support for the same?

Also which is the best flash operation that I should use for this particular feature?

nrf provides multiple APIs like nrf_fstorage, nrf_fds, nrf_nvmc_write_bytes...

Thanks.

Parents
  • Hi,

    What exactly do you mean by using as EEPROM? Using in to persistently store application data, or something more specific? Which approach and library to use depends on the use case, but in most cases the FDS library is a good option. It allows you to write arbitrary size records (within a page size less overhead), and has basic wear leveling etc. It is used by key SDK modules such as the peer manger. The fstorage library is a lower level library which provides basic functions to write and erase flash in a generic way that works both with and without a SoftDevice, and is used by the peer manger, though it can also be used directly.

    As a side note, the reason the SoftDevice is relevant here is that while a SoftDevice is used, flash write and erase operations must be done using SoftDevice APIs, and that is handled by the fstorage library (and thus also FDS). You can also use SoftDevice flash API-s directly, or nrf_nvmc API's if not using a SoftDevice and you want simple low level write and erase support.

Reply
  • Hi,

    What exactly do you mean by using as EEPROM? Using in to persistently store application data, or something more specific? Which approach and library to use depends on the use case, but in most cases the FDS library is a good option. It allows you to write arbitrary size records (within a page size less overhead), and has basic wear leveling etc. It is used by key SDK modules such as the peer manger. The fstorage library is a lower level library which provides basic functions to write and erase flash in a generic way that works both with and without a SoftDevice, and is used by the peer manger, though it can also be used directly.

    As a side note, the reason the SoftDevice is relevant here is that while a SoftDevice is used, flash write and erase operations must be done using SoftDevice APIs, and that is handled by the fstorage library (and thus also FDS). You can also use SoftDevice flash API-s directly, or nrf_nvmc API's if not using a SoftDevice and you want simple low level write and erase support.

Children
Related