Re: A question about SD-Card write on MSP-EXP430F5529

"David W. Schultz" <[email protected]>
Newsgroups gmane.comp.hardware.texas-instruments.msp430.gcc.user
Organization State of Total Disorganization
Message-ID <[email protected]>
On 06/05/2013 09:33 PM, ravim wrote:
> 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??
> 

All writes are of 512 byte blocks. The SD card will buffer the data you
transfer to it and only once you have sent a full block will it begin
its internal write operation.

So if the card is pulled in the middle of the transfer, then all data in
that block is lost. If it is pulled after the transfer is complete but
before the internal write operation is finished, then the results are
unknown.

If users pulling out a card in the middle of an operation is expected to
be a problem then you must use a data structure that will tolerate that.

-- 
David W. Schultz
http://home.earthlink.net/~david.schultz
Returned for Regrooving



------------------------------------------------------------------------------
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
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.