Main Site Documentation

SD-CARD data loss with Cerberus


#1

Anyone have experienced a data loss with cerberus?
I’ve developed a firmware that simply read some files (only read) and read/write some others. I read a value, process it and save to file periodically (10 minutes) so that the file contains always a value only (the last). I use this file as a counter while the read-only file are the settings of my application.
I’ve tested the app in my laboratory from last friday, this morning when I’ve extracted the SD-Card from the board all files where disappeared. The card was completly empty. This is the second time that happens so I don’t think it’s casual.
Any one has eperienced a similar issue?
I’m using cerberus firmware 4.2.6.2


#2

I close always tha file handles!


...
using (FileStream fs = new FileStream(FileName, FileMode.OpenOrCreate, FileAccess.ReadWrite))
{
    Write(fs, value);
    fs.Close();
}
...

Write function body:

protected void Write(FileStream fs, object value)
{
  byte[] buf = Encoding.UTF8.GetBytes(value.ToString());
   fs.SetLength(buf.Length);
   fs.Seek(0, SeekOrigin.Begin);
   fs.Write(buf, 0, buf.Length);
}

I never remove the card!


#3

which can be done after the last write operation with


VolumeInfo[] vi = VolumeInfo.GetVolumes();
                        for (int i = 0; i < vi.Length; i++)
                            vi[i].FlushAll();