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

NRF_Fstorage Address Issue

Hi i am working on project where i need to store logs on flash, i included nrf_storage and set start address 0x42000 and end address 0x50000 according to my application, my product contains softdevice, application and bootloader.... but when i try to read write or erase specific address it get stuck ... my application is based on FreeRTOS 

Parents Reply
  • The following line seems to cause a hardfault in your application:

    NRF_LOG_INFO("Data: %s read at flash", readdata);

    You declare readdata as a char pointer, and set this to NULL. Then you pass a reference to this pointer to the nrf_fstorage_read function, but this will not store the pointer to the actual data in the readdata pointer, this will still be NULL after the function call.

    You can read the data like this:

    char readdata[12] = {0x00};
    
    rc = nrf_fstorage_read(&fstorage, 0x42000, readdata, 12);
    APP_ERROR_CHECK(rc);
    
    NRF_LOG_INFO("Data: %s read at flash", readdata);
    
    wait_for_flash_ready(&fstorage);

Children
Related