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

pstorage_load returning 0xFFFF

hi,

I need to store persistent data of about 32 bytes in flash, so tried using pstorage APIs (SDK v9.0 on nRF51822 -- 256KB).

I followed the sample code given here.

I am getting call-backs, and it notifies that store event is successful (NRF_SUCCESS). But when I do pstorage_load, it returns all 0xFFFF.

I also tried disabling flash r/w protection --> nrf_nvmc_write_word(NRF_UICR_BASE + 4, 0xFFFF);

I even tried using sd_flash_write(), though it returns NRF_SUCCESS the flash memory (0x3F800) is not updated.

Please let me know the issue here or alternative methods. I already read most of the threads related to pstorage issues.

flash.c flash.h

Parents
  • With pstorage_store() the returned NRF_SUCCESS only means that the store was successfully requested.

    You will get an event with opcode PSTORAGE_LOAD_OP_CODE in the registered event handler when the store has actually completed.

    For more information see Store Data in the Pstorage documentation.

    Edit 25.11.2015: I see that you do a pstorage_clear() before you do pstorage_store() in store_device_name(). If you want to clear you should wait for PSTORAGE_CLEAR_OP_CODE before you do the store.

Reply
  • With pstorage_store() the returned NRF_SUCCESS only means that the store was successfully requested.

    You will get an event with opcode PSTORAGE_LOAD_OP_CODE in the registered event handler when the store has actually completed.

    For more information see Store Data in the Pstorage documentation.

    Edit 25.11.2015: I see that you do a pstorage_clear() before you do pstorage_store() in store_device_name(). If you want to clear you should wait for PSTORAGE_CLEAR_OP_CODE before you do the store.

Children
Related