SD Card Error

I am trying to get the following code to write a simple text file to an SD card, but I keep getting card.init failed (1,FF). I have tried 2 SD cards one being a SD2/2GB SanDisk and the other being a SD6/16GB ADATA. My computer can use both cards so I know the cards are fine. I am using the SD/MMC breakout board found on Sparkfun and resistors to lower the 5V logic down to 3.3V logic. The DO pin on the breakout board is connected directly to the Arduino though. Anybody know what is going on? I heard the Arduino is picky with what SD cards you use.

#include <SdFat.h>
#include <SdFatUtil.h>

Sd2Card card;
SdVolume volume;
SdFile root;
SdFile file;

#define error(s) error_P(PSTR(s))

void error_P(const char* str)
{
PgmPrint("error: ");
SerialPrintln_P(str);
if(card.errorCode())
{
PgmPrint("SD error: ");
Serial.print(card.errorCode(),HEX);
Serial.print(",");
Serial.println(card.errorData(),HEX);
}
while(1);
}

void writeCRLF(SdFile& f)
{
f.write((uint8_t*)"\r\n", 2);
}

void writeNumber(SdFile& f, uint32_t n)
{
uint8_t buf[10];
uint8_t i = 0;
do{
i++;
buf[sizeof(buf) - i] = n%10 + '0';
n /= 10;
}while(n);
f.write(&buf[sizeof(buf) - i], i);
}

void writeString(SdFile& f, char *str)
{
uint8_t n;
for(n = 0; str[n];n++);
f.write((uint8_t *)str, n);
}

void setup()
{
Serial.begin(9600);
Serial.println();
Serial.println("Type any character to start");
while(!Serial.available());
if(!card.init(SPI_HALF_SPEED))
{
error("card.init failed");
}

if(!volume.init(&card))
{
error("volume.init failed");
}

if(!root.openRoot(&volume))
{
error("openRoot failed");
}

char name[] = "TESTFILE.TXT";

file.open(&root,name,O_CREAT | O_EXCL | O_WRITE);

file.timestamp(2,2010,12,25,12,34,56);

for(uint8_t i = 0; i <10; i++)
{
writeString(file, "Line: ");
writeNumber(file, i);
writeString(file, " Write test.");
writeCRLF(file);
}

file.close();
Serial.println("File Created");

if(file.open(&root, name, O_READ))
{
Serial.println(name);
}
else
{
error("file.open failed");
}

Serial.println();

int16_t character;
while((character = file.read()) > 0)
{
Serial.print((char)character);
}

Serial.println("\ndone");
}

void loop()
{
}

This one?

and you have voltage divider resistors for the MOSI and SCK lines?
How are you providing the 3.3V power to the breakout board?

Take a look at how adafruit connects to an SD card:
http://www.ladyada.net/make/logshield/design.html
The parts of interest are the 3.3V source and the logic buffer.

The problem is not that the arduino is picky. The problem is signal integrity - proper buffers are needed for the high speed clock & control lines and ensuring sufficient supply current.

Are you setting this parameter correctly?

  if(!card.init(SPI_HALF_SPEED))   <<<< Not sure where this gets set.
  {
    error("card.init failed");  <<< causes this error message tho
  }

Another thing you might try is the fat16lib library,

There a bunch of known working sketches to try, can use to confirm your hardware setup is actually good.
http://code.google.com/p/beta-lib/downloads/list

Need to end up in ...\arduino\libraries\sdfatlib folder
Then under sdfatlib\extra\examples you can find things like SdFatBench.pde for running a speed write/read test for your card.

That is the breakout board I'm using. There are voltage dividers on the SCLK, CS, and MOSI line. I'm providing the 3.3V off the power lines on the Arduino Uno. I ran the program called ReadWriteSDFat in the SdFat library and I got

"Can't access SD card. Do not reformat.
No card, wrong chip select pin, or SPI problem?
SD errorCode: 0X1"

I found the error thanks to your link. Thank you.

Note that many SDcards require more than 50mA worst case to power them, the Arduino 3V3 output may be insufficient for your card. microSD cards are less likely to be power hungry.