Hello guys,I'm having a strange problem with my SD card writing/reading and I don't know how to fix it.I have 2GB SD card installed in my module and I'm running the SD library sample files.If I run the "CardInfo" sample it correctly displays the data about my card, so the wiring must be correct. Further more if I run the "DumpFile" sample it displays my "Lorem Ipsum" .txt file in the serial monitor successfully and without a problem. But strange thing start to happen when I run the "ReadWrite" sample or "Datalogger" sample. The console gets flooded with strange characters and and file becomes corrupted and gigantic in size. Like about 1,6GB in a matter of seconds. Or the write to the card fails (says it passed with success) but there is nothing in the file.

void setup(){ // Open serial communications and wait for port to open: Serial.begin(9600); while (!Serial) { ; // wait for serial port to connect. Needed for Leonardo only }

Serial.print("Initializing SD card..."); // On the Ethernet Shield, CS is pin 4. It's set as an output by default. // Note that even if it's not used as the CS pin, the hardware SS pin // (10 on most Arduino boards, 53 on the Mega) must be left as an output // or the SD library functions will not work. pinMode(10, OUTPUT);

So I would assume that the software would be ok, given it is a standard example.Couple of things to try:1. If you have set up the SD card reader on a breadboard circuit, are all the electrical connections ok?2. Can you try a different SD card? 3. Can you reformat the SD card you are using?4. Can you try a different SD card library?

I use SDFat as the bugs in SD get in my way, but they should have no effect in your case. SDFat is faster as well.

There is another strange behavior I noticed just now using the SDFat library. If I run the benchmark sample it failes to write on the SDCard but it still creates the file. Corrupted of course. While the sample that displays the information about the card work without an error.

There is a possibility that this is a card issue, but I have 16MB and 128MB cards that arent working at all.

I formatted the card several times using the offical software drom SD website.

Can you post a sample of code using the SDFat that works for you? So I can try to run it and see the results.

One more thing I read something about the length of the cables between sdCard module and arduino. Mine are quite long about 10cm, could that be the problem maybe?