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

old data gets overwritten in fds when i read the data after setting a new one.

I have written a flash code using fds in which i am trying to save the data 7pages(1024 each). I have defined array of record key and fie ID for it.The problem it saves for first time  but then due to some pointer problem or something, it gets old data and overwrites in it. Here is the flash file.

Parents Reply
  • I suspect that instead of updating the record, the code actually creating new record with same File id and key. Note that, fds allow to have multiple record having same file ID and key. Each time you use fds_record_find() with the previous token, it will try to find the next record that matches File ID and key. 

    Please add some debug log especially inside get_flash_data()

    I would suggest instead of using 

     if (err_code == FDS_SUCCESS)

    if (err_code == FDS_ERR_NOT_FOUND)

    You use : 

    else {if (err_code == FDS_ERR_NOT_FOUND)

    And then check if there is any other err_code. 

    And on each of the return code of any other API call, you need to check if it's success or not. 

Children
Related