This post is older than 2 years and might not be relevant anymore
More Info: Consider searching for newer posts
This discussion has been locked.
You can no longer post new replies to this discussion. If you have a question you can start a new discussion

Retrieve saved info on restard with pstorage module

Hello,

I need to store some app configuration on the FLASH and I'd like to use the features of pstorage module. I don't understand the following thing ...

When the application starts, it uses the pstorage_register (after the pstorage_init of course) to register itself to the pstorage module and then uses it with load and store feature. On restart I can't read what I stored on the previous execution. How for each reboot of application the pstorage knows what's my app FLASH area with my saved info ? I can't find this information ...

Thanks. Paolo.

rgr_cfg.c rgr_cfg.h

  • I tried your main.c and it works. I did this simple test. I moved your code into files rgr_cfg.c and rgr_cfg.h and call rgr_cfg_init(); that execute your same code. Howerver it doesn't work. Why ? Can you execute a test with above files calling rgr_cfg_init(); from the main ?

    Thanks, Paolo.

  • Of course I removed the code to restart the board. I reset the board manually. However my output is following :

    BLE ANCS *prt = 0 rgr_cfg_save pstorage_block_identifier_get err_code = 0 block_handle.block_id = 260096 pstorage_store err_code = 0 block_handle.block_i_handle=536885612, op_code=2, result=0, p_data=536890128, da ta_len=4 p_data[0] = 16 p_data[1] = 32 p_data[2] = 48 p_data[3] = 64 d = 260096 BLE ANCS *prt = 0 rgr_cfg_save pstorage_block_identifier_get err_code = 0 block_handle.block_id = 260096 pstorage_store err_code = 0 block_handle.block_id p_handle=536885612, op_code=2, result=0, p_data=536890128, data_len=4 p_data[0] = 16 p_data[1] = 32 p_data[2] = 48 p_data[3] = 64 = 260096

    It seems that *ptr is always 0 and save is always executed.

  • I was wrong ... executing your code (your main.c file) the *ptr is 0 on reboot so it always executes the "save" and never "load". So your main.c doesn't work for me.

  • im sorry, I painfully verified it again. it still works for me. Give me your whole project, so that i can debug it. Else I think we have achieved the fact that pstorage works as it should in the given SDK and SD version.

  • Thank you very much for helping me. I'd like to give you our project but I'd like to do that in private. How can I reach you in private for sending it ?

    Paolo.

Related