SD card lib not working

Hi all,

I am trying to make use of the SD card lib provided with the standard installation. I have an Arduino UNO and a SD card breakout board that has the pins (5V, 3.3V, MOSI, MISO,SCK, CS, GND).

I have connected the SD breakout using pins 13,12,11 as ordered in the SD card examples and then CS as pin number 4. This however has not worked as I always get the initialisation failed error. I am using both the ReadWrite and CardInfo examples.

I have now tried numerous fixes such as lowering the SPI speed in the SD.cpp file. I have added the line digitalWrite(X, output). I have changed the CS pin to 10 and 4 but still not working. I have even tested four different SD cards and with all of them I get the same error?

Thinking that it might be the breakout I used the CardInfo example, it was able to check the wiring as well as determine the SD card type, but as soon as it tries to find the volume it tells me there are no FAT16,32 partitions on the SD card.

This is really getting frustrating and I don't know what else to try? Please help.

Thank you in advance

This is really getting frustrating and I don't know what else to try?

So you decided to blame the library, rather than your hardware? Well, you are wrong. It is your hardware that is failing.

Nowhere in my message did I blame the library.

I have tried the software fixes that I have found searching these forums as well as check the hardware by using two different Arduino Uno boards, three SD breakouts, and five SD cards. After doing this I tried the forum for help.

But great help hey! People like you make this forum worse than LOL players and they are satan spawn.

So,

to anyone having similar problems. Here how I fixed it.

Firstly, ensure that your wires are short, SPI prefers low levels of noise. Do not use a breadboard! (Preferably)

Then, a mixture of the following online help (note nothing in this forum since people are soooo eager to help):

  1. Ensure that you fix the SD examples by adding the line digitalWrite(X,HIGH); after choosing port as output where X refers to the CS pin.

  2. When using SD cards over 32Gb in size, ensure that you use a tool capable of formatting it to the FAT32 format. Note, not the tool given in this format. CNET has a good download but there are many.

  3. In the SD.cpp change the SPI speed and lower it, the higher SPI speeds are known to cause problems. Currently I am using QUARTER speed.

By performing all three fixes I was able to get my SD card working. It now works with all three my SD breakouts (one built, two bought) and five SD cards.

Hope this helps someone out there!

am03bam4n:
So,

to anyone having similar problems. Here how I fixed it.

Firstly, ensure that your wires are short, SPI prefers low levels of noise. Do not use a breadboard! (Preferably)

Then, a mixture of the following online help (note nothing in this forum since people are soooo eager to help):

  1. Ensure that you fix the SD examples by adding the line digitalWrite(X,HIGH); after choosing port as output where X refers to the CS pin.

  2. When using SD cards over 32Gb in size, ensure that you use a tool capable of formatting it to the FAT32 format. Note, not the tool given in this format. CNET has a good download but there are many.

  3. In the SD.cpp change the SPI speed and lower it, the higher SPI speeds are known to cause problems. Currently I am using QUARTER speed.

By performing all three fixes I was able to get my SD card working. It now works with all three my SD breakouts (one built, two bought) and five SD cards.

Hope this helps someone out there!

Got to wonder about hardware that requires this much manipulation to make it work.

You do realize that the SD card breakouts are made in China by goodness-who using goodness-knows-what and without much quality control.

.

ieee488:
Got to wonder about hardware that requires this much manipulation to make it work.

You do realize that the SD card breakouts are made in China by goodness-who using goodness-knows-what and without much quality control.

.

Exactly why I built my own. Since it is quite a simple breakout, all that was required then was a logic level converter for 3.3V to 5v. But yeah, for the amount of effort to fix, much easier to build your own.

am03bam4n:
Exactly why I built my own. Since it is quite a simple breakout, all that was required then was a logic level converter for 3.3V to 5v. But yeah, for the amount of effort to fix, much easier to build your own.

And so therefore, PaulS was right.

Your original hardware was faulty which you failed to acknowledge.

ieee488:
And so therefore, PaulS was right.

Your original hardware was faulty which you failed to acknowledge.

Please go read both of my replies. It was not the hardware, since both the built and the two bought breakouts work. My first assumption was the hardware which is why I built the third breakout myself. I had to both reduce the speed of SPI in the the SD lib and change the partition of the SD card to get it working.