I am trying to test CardInfo with an arduino mega and a 1GB mircoSD card. I am using a mac and can only format the SD card with FAT, which gives FAT16. When I run the program I get:
Initializing SD card...Wiring is correct and a card is present.
Card type: SD2
Could not find FAT16/FAT32 partition.
Make sure you've formatted the card
I formated it once on a PC with FAT32 and it worked once, however I would like to stick with my mac.
If anyone could tell me what I am doing wrong that would be greatly appreciated,
I am using a 2 Gb Sandisk MicroSD card both on my Mac and on a MicroSD reader. I'm not sure where I formatted it. I think I read that the best way to format for the Arduino use was to format on the board (run a formatting sketch).
Sadly the Mac is a poor choice for formatting SD cards. Macs do not conform to the SD standard format.
It is likely you have formatted the card with a GUID Partition Table (GPT). The SD standard specifies SD cards must be formatted with a MBR partition table. Most cameras and phones accept this non-standard GPT format but Arduino has so little memory so GPT is not accepted.
Once a card is formatted GPT Windows often preserves this format.
The best way to reformat your card is to use SD Formatter from the SD association https://www.sdcard.org/downloads/formatter_3/ (https://www.sdcard.org/downloads/formatter_3/).
You can also use the SdFormatter example sketch from the SdFat library to format you card on the Arduino http://code.google.com/p/sdfatlib/ (http://code.google.com/p/sdfatlib/)
Card less than 4 GB should be formatted FAT16 for best performance and cards 4 GB and larger must be formatted FAT32. Also the SD standard requires this formatting.
In addition to the GPT/MBR problem, Mac, Linux, and Windows utilities do not align file structures on the correct boundaries to optimize access to the SD card's flash chips.
Most operating systems are learning about solid state drives (SSD) but OS utilities don't understand SD cards yet.
SD card manufactures produce cards that perform best when formatted according to the SD formatting standard.
Thank you for all your responses, however, I still can not get it to work. I have tried formatting it with both
I can't seem to get the library to work so the SDFormatter keeps giving me errors including:
ArduinoOutStream does not have a name.
I keep getting the same error telling me that the card is not formatted .
Thanks again for your help.
I changed the SPI speed to a quarter and now I am getting:
All data set to 0x00
error: write MBR
SD error: 13,1
when using SdFormatter
Which library are you using on the Arduino, exactly?
Error 13 means a write command failed. This is a basic hardware failure. What SD adapter are you using?
This error often happens when resistor level shifters are used or long wires connect the adapter to the Arduino.
I am using the SdFormat library, specifically the SdFormatter. I am also using this breakout board,
This breakout has no level shifters or 3.3V regulator.
Did you connect VCC to 3.3V on the Mega?
What are you doing to translate the Mega 5V SPI SCK and MOSI signals to 3.3V for the SD card?
I did connect the VCC to 3.3V. I didn't do anything to 5V SPI SCK and MOSI signals, what would you recommend? The write/read test programs has worked once with the CS, DI, SCK and DO connected directly to the mega.
Don't try any other micros SD cards. They may be damaged by the high voltage signals.
As Sparkfun says about their shield:
All new microSD shields have a voltage converter chip on-board that converts the Arduino 5V signals to 3.3V signals in accordance with SD specifications. No more 'blown up' SD cards!
The best approach is to use a level shifter like these adapters/shields
You could try resistor level shifters but these don't work well with many cards. If you try this, slow down the SPI clock.
Would something like the link below work?
It might work but this is a poor solution. Resistor based level shifters fail with many newer SD cards since new cards have edge detectors for the signals and resistors round signal edges.
This is the reason that almost all commercial products now use semiconductor buffers/level shifters.
Good luck if you try it. You might want to download the new SdFat beta and enable CRC to detect any data errors and slow down the SPI clock.
The SdFat beta with CRC is SdFatBeta20120327.zip http://code.google.com/p/beta-lib/downloads/list (http://code.google.com/p/beta-lib/downloads/list)