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

Flash write works, but when i do hard/soft reset data is lost ?

Hi, i'm using a code to save 4 bytes on the flash memory and it works. In, fact i checked the data address concerned using the keil and i see the changes when i write and it works well (data address 0x0003F400 ). I used this method before on another project (using another SDK and SD 130 0.9alpha) and now i'm using s130_nrf51_2.0.0-7.alpha_softdevice and another SDK of course.. It 's really strange, every thing is ok, i can write and change data values , only when i reset, every thing become FF FF FF FF :( Any idea please to check my code ?

Parents
  • if you are using pstorage then you can configure in pstorage_platform.h of how many pages you need for your application.

    #define PSTORAGE_NUM_OF_PAGES       2
    #define PSTORAGE_SWAP_ADDR          PSTORAGE_DATA_END_ADDR   
    

    I am assuming you are using nRF51, 0X3FC00 is used for swap page. if you have PSTORAGE_NUM_OF_PAGES set to 2 then your address 0x3F400 is used by pstorage and that module will clear the page when it is initialized after reset. use the page that is not used by pstorage or other modules.

Reply
  • if you are using pstorage then you can configure in pstorage_platform.h of how many pages you need for your application.

    #define PSTORAGE_NUM_OF_PAGES       2
    #define PSTORAGE_SWAP_ADDR          PSTORAGE_DATA_END_ADDR   
    

    I am assuming you are using nRF51, 0X3FC00 is used for swap page. if you have PSTORAGE_NUM_OF_PAGES set to 2 then your address 0x3F400 is used by pstorage and that module will clear the page when it is initialized after reset. use the page that is not used by pstorage or other modules.

Children
No Data
Related