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

FDS update returns or changes some part of data randomly.

Hi,

We are using NRF 15.03 SDK and used NUS application for the project. We need to store some data into flash and we are using FDS example based code to do the same.

We are storing two files. File 1 has 6KB data (divided into 500 records of 12 Bytes) , file 2 contains 268B of single record. We are using same file ID for both and a different record ID for all the records.

The code works fine as expected. But randomly, the data gets corrupted(old data is retained instead of new) when we do update of records.

This occurs very randomly and we could not find the sequence it is occurring.

Has anyone seen this kind of behavior? How do we make sure that we are storing the data correctly?

Are there any corner cases we need to handle while using FDS?

Thank you,

Bharath

Parents
  • Hi Einar Thorsrud,

    Thanks for your reply.

    I added a variable to check if the write/update is complete in the fds_evnt_callback switch cases. Every time, the variable becomes true and I write data, it succeeds.

    At some point when the fds_gc gets called, the callback function calls "FDS_EVT_GC" & I call my write pending function to write back the pending data. But the callback never gets called for update complete after this .

    Thank you,

    Bharath

  • Hi Bharath,

    Good to hear you fixed the initial issue.

    Bharath Gopal said:
    At some point when the fds_gc gets called, the callback function calls "FDS_EVT_GC" & I call my write pending function to write back the pending data. But the callback never gets called for update complete after this .

    It is difficult to say anything specific without seeing your code. But another typical issue when people test FDS is problems with interrupt priorities. Do you by any chance call the write function from the event handler (or a function that is called from there or in another interrupt context)? If so, and if you also wait for the event in a loop, then you will have a deadlock. This is all just guesses though. Please share and explain your code if it does not fit so that I can see what you are actually doing.

  • Thanks for the update Einar.

    I am calling write function from UART interrupt on receiving some commands. Also, the update pending write is called from FDS_EVT handler.

    When I check for the return code inside FDS_EVT  handler, it returns code 3 (FDS_ERR_UNALIGNED_ADDR).

    What does this error mean?

    Thank you,

    Bharath

Reply Children
Related