[SOLVED] SD card initialization failed ...

Sorry to post about this, but I’ve read literally dozens of web pages about this issue and am stuck.

My configuration:

  • Arduino Uno
  • Keyes Data Logging Shield with RTC and SD card slot
  • Three different SD cards, all formatted with the SD Card Formatter app v. 5.0.1-b6e25b8 on OS X.
  • Arduino and shield are powered by the USB port from a Mac

I’m just trying the CardInfo test in the SD library.

I’ve set const int chipSelect = 10; — which sort of works for one test

Symptoms:

With a brand-new Toshiba 16 GB SD Card (SD-K16G), I get “SD2” followed by “Could not find FAT16/FAT32 partition.”

With a brand-new Toshiba 8 GB (SD-KO8G), I get “initialization failed. Things to check… etc.”

With an older Toshiba 64 MB (SD-M64), I get “initialization failed. Things to check… etc.”

All the cards are readable and I can create files on them using OS X.

I’ve tried:

  • Many different versions of SD.h
  • Adding pinMode(10, OUTPUT); in setup()
  • Adding 9V power, in addition to the USB power
  • Trying chipSelect = 4 and chipSelect = 8
  • Writing an empty file to the SD card using OS X, to “get things started”
  • Writing a non-empty file to the SD card using OS X
  • Tried QuickStart and SdInfo in the SDFAT library (neither sketch works at all, though maybe I have them configured wrong)

Question: Is there a troubleshooting guide for this problem?

EDIT: I have tried SdFat and can’t get it to work at all. Nothing appears on the console. It seems like the Arduino just crashes. Am I supposed to modify int chipSelect; to be int chipSelect = 10; or something? I tried, but no joy. If this is necessary, it is not at all clear to me from the (otherwise comprehensive) documentation.

EDIT #2: I got SDFat sort of working by choosing Version 1.1.0.

However, it still can't access the card. Error message is below.

It prompts for the chip select pin number. I input "10".

Result:

SD initialization failed.
Do not reformat the card!
Is the card correctly inserted?
Is chipSelect set to the correct value?
Does another SPI device need to be disabled?
Is there a wiring/soldering problem?

errorCode: 0x43, errorData: 0xff

Restarting

I'm stuck. Any suggestions?

Problem solved. Apparently, the issue was a defective SD card shield. I swapped in a new shield board and everything started working.