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 

  • You can use FDS or Fstorage, or low level write.

    See examples: 

    NordicSDK\examples\peripheral\flash_fds

    NordicSDK\examples\peripheral\flash_fstorage

    NordicSDK\examples\peripheral\flashwrite

    Good luck!

  • Hi ,

    I am using NordicSDK\examples\peripheral\flash_fstorage this example to write on flash,But when i called the function

    rc = nrf_fstorage_init(&fstorage, p_fs_api, NULL); my code stucks and harf fault error comes.

    I think i am passing wrong start and end address.

    Please suggest how to set the start and end adress for read and write.

    Thanks,

    Raj

     

  • Hi,

    I am still waiting for your reply,

    with debug log as shown below there is a problem in nrf_fstorage_init().

    <info> app_timer: RTC: initialized.
    <error> nrf_fstorage: p_api check failed in nrf_fstorage_init() with value 0xE.
    <error> app: Fatal error

    Thanks 

    Raj

  • 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