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 Reply Children
  • Hi,

    Bharath Gopal said:
    If it is so, why does it fail only some time? I am using a global buffer every time and the address is always same.

    I cannot explain that. Can you double-check?

    Bharath Gopal said:
    If it is a address alignment issue, how to make sure that the buffer is word aligned?

    This is only an issue if you are using non-4 byte data types, or for instance structs with some members that are not 4 bytes. Then depending on the packing of the struct, the data may not be aligned. See this post for how to fix it in that case. If that does not help, please share some code showing the data structure you are trying to write to flash and how you write it.

Related