Don't Format SD cards with OS utilities!

and if I use a video camera formatter (there is an option on my camera) will it work within the appropriate standards?

hey does any one has diagram and code for the RFID RC522 and SD card working together. I have project in which ihave to show the RFID tags ID has to be stored in SD card module

While cluster sizes and so forth selected by the Association's formatter may be correct, I believe there is a major disadvantage to using the Overwrite option. This option writes zeros to the entire card, which has the effect of filling up the card and leaving no unerased sectors. So every time you want to write something to the card, something has to be erased first. If write speed is important, Overwrite leaves the card in the worst possible state.

By contrast, the SdFormatter example in the most excellent SdFat.h library completely erases the card. Erasing flash memory is not the same as writing ones or zeros - the memory is in the erased state, which means it can be written to without erasing it first. High speed data logging performace will be improved by logging to an erased card.

DSLR cameras also need fast writing speed so as to maximize the frame rate during burst mode or video recording. These cameras have a "low level" formatting option which also erases the card.

I confirmed this by formatting the same card using the Association's Overwrite option, the SdFormatter example in SdFat, and my Canon DSLR set for low level format. Overwrite took about 10 minutes to get half way through the card, and left the first half all zeroes. The other two took about 15-20 seconds, and left the card with all FFs. SD cards have a register bit that tells you the "erased state" of the card, which varies by brand. This Transcend card says its erased state is FF. So it's pretty clear that Overwrite is, as it says, literally overwriting the entire card with zeros, which is the exact opposite of what you want it to do.

So I think the Association formatter is fine for a Quick format, but the Overwrite option should not be used.

ShermanP: SD cards have a register bit that tells you the "erased state" of the card, which varies by brand. This Transcend card says its erased state is FF.

Hi Sherman. Where is this "erased state" bit? I looked in the SD spec (simplified) and didn't see anything. Do you know which register?

I found this:

https://superuser.com/questions/568041/after-an-sd-card-is-erased-what-value-is-read-from-the-card-all-bits-clear-or

Thanks. Found it in the spec:

5.6 SCR register DATA_STAT_AFTER_ERASE Defines the data status after erase, whether it is 0 or 1 (the status is card vendor dependent).

just seems to me after doing everything I can the SD UNIT works with Adaptor and Ultra Small SD card. normal SD card formatted using this tool does no good. thing is that one is 2 GB Card and the other is 8 GB… The 8GB HDSD works, Smart Card as it is called. Toshiba SD Memory Card 2 GB… Fails time and time again in the Arduino SD unit. The other fly’s right though and the BUG I noticed is that Card can be removed and the Arduino keeps on writing to a file even if the card is removed. Which should in all reality stop completely and fail according to the code.

There is error and I have no clue where to being to look… but this is a issue as the hardware and code is not working right and no way to know for sure if the right files are being compiled.
Cause I can not see how removing the card while the program is running in a loop repeatedly and its happy as clam.

DataFile = SD.open(“datalog.csv”, FILE_WRITE);

// if the file is available, write to it:
if (DataFile) {
DataFile.println(dataString);
DataFile.close();
// print to the serial port too:
Serial.println(dataString);
}
// if the file isn’t open, pop up an error:
else {
Serial.println(“error opening datalog.csv”);
}