Go Down

Topic: Don't Format SD cards with OS utilities! (Read 120614 times) previous topic - next topic

Flinkly

Thanks for this, and SdFat.  I'm still working on buffering (making sense of it, ME here...), but whenever I have a question about Arduino's and SDs, and ask the Google, you (in some flavor) come up and answer my question and more.

If only SDIO didn't seem so much more intimidating than SPI (which is so simple!).

Thanks!

Eimerkette

Thanks for the information about using "SDFormatter V4.0" to format SD card.

Because of having no success to get my "Arduino UNO" - "SD card" running, I searched for posts which describes the same problem. But I didn't found any solution/hint which will help. In the meantime I spend many hours/days...

Therefore I also tried to use "SDFormatter V4.0" to format my SD card, but I did not solve my problem.

My "Arduino UNO" - "SD card" is still not running. That's really frustrating and makes no fun.

The best result (using "CardInfo") was:

Code: [Select]

Initializing SD card...Wiring is correct and a card is present.

Card type: SDHC
Could not find FAT16/FAT32 partition.
Make sure you've formatted the card


but it is hard to reproduce this situation.

Any hints?

Eimerkette

#32
Mar 12, 2017, 05:15 pm Last Edit: Mar 12, 2017, 06:12 pm by Eimerkette Reason: (Added link to new topic.)
Hi _pepe_,

thanks for this hint.

I'll do it and report the corresponding error codes in a new topic.

dlchambers

Unfortunately, this utility formats the SD as FAT32, but the Arduino SD lib wants FAT16. So the tool is useless.

C1913

Quote
So the tool is useless
So are cars, if I dont know how to drive them. Or foreign languages I don't speak. They are indeed useless, but to me, not in general.
Only cause you're frustrated is no reason to be rude. People here are there to help you, not to bother you with useless crap   ;)
If google was a country, I'd move there.

fat16lib

Quote
Unfortunately, this utility formats the SD as FAT32, but the Arduino SD lib wants FAT16. So the tool is useless.
SD cards are designed to be formatted with a layout that matches the card's flash chips.  SDFormatter produces the optimal layout by inserting hidden sectors to adjust the layout to chip boundaries.  SDFormatter chooses an appropriate cluster size.  There are no options for the standard format.

SDFormatter uses FAT12 for very small cards.  FAT16 is used for cards <= 2GB, FAT32 for cards <= 32 GB, and exFAT for cards larger than 32GB.

The SD library supports FAT16/FAT32 and is optimized for the layout SDFormatter produces.

soundlord

#36
Feb 06, 2018, 03:44 pm Last Edit: Feb 07, 2018, 01:46 am by soundlord
I do use the OS utilities to format an SD card but I use a more flexible OS -> Linux. So your advice is correct for Windows users but Linux users should use the internal command as the SD card association doesn't provide a formatting tool for Linux.

So on Linux users may issue the command:

Code: [Select]
mkfs.vfat -F 32 -s 64 -S 512 /dev/sdb1

given that the card is available as /dev/sdb on the system.
This command does the same as the formatter from the SD card association (use 32kB clusters with a FAT32 file system).
Never worked for me... SD.begin(cable select slot) returns 0.

SOLUTION:

In fact you have to (using Linux):

1. have root rights  (su root)
2. in bash (shell) --> msdosfs -I /dev/sdd (assuming /dev/sdd is the sdcard device)
3. in arduino 1.8.5 --> verify you installed the SdFAT library
Use the example called SdFormatter
4. Change the cable select port to 4 for the arduino with LCD module with SD card reader
5. Load the program in the arduino and follow the instructions using the serial monitor




 

afedorov

I see strange behavior with 32G sd card. Sometimes it initializes some times it doesn't. Can it happen becauseI used MacOs to format the card?

apollinaire

Has anybody yet tried formatting the SD card in a digital camera as a workaround?
I can't test it myself (no SD.shield in my drawer), just an idea...

capitkle

Hello everyone,

I am trying to use an SD card with my UNO for the first time and I'm running into a lot of the same problems that other posters have experienced. Unfortunately, I have not had any success with the posted solutions.

Here are some of the specs for my setup:
Board: Kuman UNO
SD Breakout: velleman VMA304
Arduino IDE: 1.8.5
SD Library version 1.1.1
SdFat version 1.0.16

I first tried running the built-in ReadWrite tutorial, but the SD card initialization failed. I then formatted the SD card with the SD Card Formatter version 5.0.1, from the SD Association's website, but still the initialization failed.

After that, I downloaded the SdFat library and tried running the SdInfo example. It was able to pull some of the info from the card, but still failed to initialize. The last thing I tried was formatting the card again using the SdFormatter in the SdFat library, but the serial monitor displayed the following error after starting the formatter:

.........
Enter option: F
Card Size: 15552 MB,

Erasing
.error: erase failed
SD error: 5,4f
.........

Is there anyone who has seen or had experience with this error before, or who could possibly point me in the right direction to solve this issue?

Thank you,

ardubr

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

nilay2344

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

ShermanP

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.

MK1888

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?


Go Up