On 6/5/2013 9:33 PM, ravim wrote: > Hello Everyone, > > We are working on a simple data logging application using MSP-EXP430F5529 > and Ez430-RF2500 devices using mspgcc. Thanks to excellent resources and > this forum, everything is working fine. I had a simple question about > SD-Card write. > > Our application writes a data packet to SD-Card as soon as it receive on > EXP board. The packet size is 40Bytes and may increase more. The binary data > is stored in files on SD card which we later run through our interpreter. > Now if someone pulls the SD-Card in midst of write operation what will > happen? > > I wanted to ask - is it possible that portion of data packet may be written > to file when SD card is suddenly pulled out? Because if this happens the > whole series of binary data will not make any sense or may give us totally > wrong information. > > If this happens how do we handle it? Is there a way to make this write > operation atomic?? You are about to open a can of worms. You will have to worry about three things: 1. Flash translation layer integrity. Nothing you can do here except finding a supplier that guarantees it. I heard Swissbit makes some such guarantees. With a random supplier you are likely to end up with a dead SD card if you keep yanking power. 2. Filesystem integrity. For example FAT is not power fail safe. It does not do changes to file and file allocation table in atomic fashion. There are journaling filesystems such as ext3 that are designed to handle power failures but the size and complexity is beyond what MSP430 can handle. 3. Atomicity of write operation. With a few exception filesystems make no guarantees as to atomicity of write operation. This is up to user code to implement it. For example, rename operation is usually atomic and you can take advantage of that.
Regards, Sergei ------------------------------------------------------------------------------ How ServiceNow helps IT people transform IT departments: 1. A cloud service to automate IT design, transition and operations 2. Dashboards that offer high-level views of enterprise services 3. A single system of record for all IT processes http://p.sf.net/sfu/servicenow-d2d-j _______________________________________________ Mspgcc-users mailing list Mspgcc-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/mspgcc-users