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

pstorage example for storage data in the FLASH

I need to store a data base into an area of the FLASH. I understand I need to use the pstorage capability. All the reference I found about it , are just part of the code where the entire project is missing. For example, I need to use pstorage_init but I don't know which library it come from. the same is for pstorage_register which I don't know where it defne. 

Is there a basic project example with all the C&h files requere to make a data storage in the FLASH and simple example in the main for store it?

I use SES 4.12 with nRF5_SDK_15.2.0_9412b96.

Thanks

Bar. 

Parents
  • As says, fstorage is the new pstorage. It changed around SDK12 if I don't remember wrong. Check out the examples SDK15.2.0\examples\peripheral\flash_fstorage or SDK15.2.0\examples\peripheral\flash_fds.

    fstorage is a very simple flash write library, where you have to manage the addresses yourself.

    FDS uses fstorage, and creates records that you can write, edit and delete. It ensures an even wear of the flash, and you don't need to worry about where you want to put your records (addresses). 

    Hint: If you want to update or delete something you write in flash, you can't use the same address without deleting the entire flash page. This is what FDS handles for you.

    Best regards,

    Edvin

  • Thanks .

    I see the example of the FDS.

    I want to write a record which is a struct with a unique name so I can find it even on the next power up. As I look inside it is look that 

    ret_code_t fds_record_write(fds_record_desc_t * const p_desc, fds_record_t const * const p_record)

    do the job. If so I still don't know if the descriptor is written automatically by the file system or I need to give it the data like:

    file_id , key. For the p_data I assume this is a pointer to my data to store. Is there a specific structure need or any length just to be u32 size? 

    ANd how the rec can be const if I dynamically put data to?

    Is there a user guide explain the process for writing, reading & delete on that example?

    Regards

    Bar.

Reply
  • Thanks .

    I see the example of the FDS.

    I want to write a record which is a struct with a unique name so I can find it even on the next power up. As I look inside it is look that 

    ret_code_t fds_record_write(fds_record_desc_t * const p_desc, fds_record_t const * const p_record)

    do the job. If so I still don't know if the descriptor is written automatically by the file system or I need to give it the data like:

    file_id , key. For the p_data I assume this is a pointer to my data to store. Is there a specific structure need or any length just to be u32 size? 

    ANd how the rec can be const if I dynamically put data to?

    Is there a user guide explain the process for writing, reading & delete on that example?

    Regards

    Bar.

Children
Related