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

Flash read/write operation over NRF52810

Hi,

I am using NRF52810, In my project I need to store Float value and uint32_t value in EEPROM/Flash for permanent storage (Non-volatile storage).

With SDK17 i am not getting any sample code to perform flash operation over NRF52810.

  So please suggest how to proceed.

Thanks,

Raj 

Parents Reply Children
  • I think the examples flash_fstorage example show how to do this (depending on whether softdevice is enabled or not):

        NRF_LOG_INFO("fstorage example started.");
    
        nrf_fstorage_api_t * p_fs_api;
    
    #ifdef SOFTDEVICE_PRESENT
        NRF_LOG_INFO("SoftDevice is present.");
        NRF_LOG_INFO("Initializing nrf_fstorage_sd implementation...");
        /* Initialize an fstorage instance using the nrf_fstorage_sd backend.
         * nrf_fstorage_sd uses the SoftDevice to write to flash. This implementation can safely be
         * used whenever there is a SoftDevice, regardless of its status (enabled/disabled). */
        p_fs_api = &nrf_fstorage_sd;
    #else
        NRF_LOG_INFO("SoftDevice not present.");
        NRF_LOG_INFO("Initializing nrf_fstorage_nvmc implementation...");
        /* Initialize an fstorage instance using the nrf_fstorage_nvmc backend.
         * nrf_fstorage_nvmc uses the NVMC peripheral. This implementation can be used when the
         * SoftDevice is disabled or not present.
         *
         * Using this implementation when the SoftDevice is enabled results in a hardfault. */
        p_fs_api = &nrf_fstorage_nvmc;
    #endif
    
        rc = nrf_fstorage_init(&fstorage, p_fs_api, NULL);
        APP_ERROR_CHECK(rc);

    p_fs_api should point to either of nrf_fstorage_nvmc or nrf_fstorage_sd depending on whether softdevice is enabled or not.

Related