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

How to use pstorage to save and load data for initialize

I need to implement a function to store some parameters such as uart baud rate and use these parameter for device initialization, The parameter could be modified when the application running. How can I use the pstorage operation to be the first function of the main() ? Or any other way to do that.

Please give me some advise.

Thanks a lot

Vic

IC : nRF51422QFAA; SDK : nrf51_sdk_v6_1_0_b2ec2e6; SD : s310_nrf51422_1.0.0

  • From the pstorage documentation,

    The SoftDevice and scheduler must be initialized first before initializing the Persistent Storage 
    Module. Modules that use this storage module shall then be initialized after the storage module.
    

    After this, you can call pstorage initialization and register functions. If this sequence does not change, then pstorage will always get the same memory and the addresses for your configuration parameters should not change. So you should be able to achieve what you want to do even though pstorage functions are not the first functions in main.

Related