Basic SD Card Reader Circuit

I would like a sanity check on my circuit as I have not gotten this SD card reader (SparkFun SD/MMC Card Breakout - BOB-12941 - SparkFun Electronics) to work. I am using a sandisk microsd 8GB card put into an sd card adapter. I have wired it as such:

using pull down resistors to bring I/O and power down to 3.3V and am using the following sample code with the pin changed to pin 10 http://arduino.cc/en/Tutorial/CardInfo , yet I still get SD library initialization failed.

/*
  SD card test
   
 This example shows how use the utility libraries on which the'
 SD library is based in order to get info about your SD card.
 Very useful for testing a card when you're not sure whether its working or not.
   
 The circuit:
  * SD card attached to SPI bus as follows:
 ** MOSI - pin 11 on Arduino Uno/Duemilanove/Diecimila
 ** MISO - pin 12 on Arduino Uno/Duemilanove/Diecimila
 ** CLK - pin 13 on Arduino Uno/Duemilanove/Diecimila
 ** CS - depends on your SD card shield or module.
        Pin 4 used here for consistency with other Arduino examples

 
 created  28 Mar 2011
 by Limor Fried
 modified 9 Apr 2012
 by Tom Igoe
 */
 // include the SD library:
#include <SD.h>

// set up variables using the SD utility library functions:
Sd2Card card;
SdVolume volume;
SdFile root;

// change this to match your SD shield or module;
// Arduino Ethernet shield: pin 4
// Adafruit SD shields and modules: pin 10
// Sparkfun SD shield: pin 8
const int chipSelect = 10;    

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("\nInitializing 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(chipSelect, OUTPUT);     // change this to 53 on a mega


  // we'll use the initialization code from the utility libraries
  // since we're just testing if the card is working!
  if (!card.init(SPI_HALF_SPEED, chipSelect)) {
    Serial.println("initialization failed. Things to check:");
    Serial.println("* is a card is inserted?");
    Serial.println("* Is your wiring correct?");
    Serial.println("* did you change the chipSelect pin to match your shield or module?");
    return;
  } else {
   Serial.println("Wiring is correct and a card is present.");
  }

  // print the type of card
  Serial.print("\nCard type: ");
  switch(card.type()) {
    case SD_CARD_TYPE_SD1:
      Serial.println("SD1");
      break;
    case SD_CARD_TYPE_SD2:
      Serial.println("SD2");
      break;
    case SD_CARD_TYPE_SDHC:
      Serial.println("SDHC");
      break;
    default:
      Serial.println("Unknown");
  }

  // Now we will try to open the 'volume'/'partition' - it should be FAT16 or FAT32
  if (!volume.init(card)) {
    Serial.println("Could not find FAT16/FAT32 partition.\nMake sure you've formatted the card");
    return;
  }


  // print the type and size of the first FAT-type volume
  uint32_t volumesize;
  Serial.print("\nVolume type is FAT");
  Serial.println(volume.fatType(), DEC);
  Serial.println();
 
  volumesize = volume.blocksPerCluster();    // clusters are collections of blocks
  volumesize *= volume.clusterCount();       // we'll have a lot of clusters
  volumesize *= 512;                            // SD card blocks are always 512 bytes
  Serial.print("Volume size (bytes): ");
  Serial.println(volumesize);
  Serial.print("Volume size (Kbytes): ");
  volumesize /= 1024;
  Serial.println(volumesize);
  Serial.print("Volume size (Mbytes): ");
  volumesize /= 1024;
  Serial.println(volumesize);

 
  Serial.println("\nFiles found on the card (name, date and size in bytes): ");
  root.openRoot(volume);
 
  // list all files in the card with date and size
  root.ls(LS_R | LS_DATE | LS_SIZE);
}


void loop(void) {
 
}

I tried formatting the SD card with SD Formatter.
I tried using D3/CD as CS.
I triple checked my wiring.
I checked that my SD card supports SPI.
The arduino works fine with the accelerometer.

Anyone have any suggestions what else I can debug?

Voltage dividers like that are not really level converters.

I can't really make out from your "circuit" what wires go where. A proper schematic would be more helpful, even if you do it in pencil or using Paint or something.

It is currently mapped as:

Arduino SD Card Reader D10: SS pull down resistor D3 - blue wire D11: MOSI pull down resistor CMD - purple wire D12: MISO D0 - yellow wire D13: SCK pull down resistor CLK - green wire 5V pull down resistor 3.3V - white wire GND GND - black wire

The comments on the product page (https://www.sparkfun.com/products/12941#comment-54cb02adce395f97688b4567) suggested this mapping:


BREAKOUT - ARDUINO


D3 - chipSelect CMD - MOSI CLK - SCK D0 - MISO VDD - 3.3v GND - GND

This blog post (http://opengears.blogspot.com/2012/01/cheap-diy-sd-card-breakout-board-for.html), also linked in the comments, suggested using the pull down resistors to lower the logic level to 3.3v

The voltage divider for the SD 3V idea will not work.

If that's a Nano you've depicted there then perhaps its 3V pin (17)? I'm not sure what the current requirements of an SD are. I could suggest a circuit or two for alternate 3V.

SD cards needd 150-200mA at startup. You need a real voltage converter from 5V to make 3.3V.

Then the Nano's 3V is not an option.

SD cards needd 150-200mA at startup. You need a real voltage converter from 5V to make 3.3V.

I bet there aren't many other people that knew that. Good to know.

Ok, so I updated my circuit to use a 3.3v voltage regulator (https://www.sparkfun.com/products/526) LD33V variant and a bi directional logic level converter (https://www.sparkfun.com/products/12009)

The voltage regulator feeds the power to the sd card reader and the reference voltage for the logic converter. Despite the fritz data sheet the product page says that all 4 channels are bi directional on the logic level converter. The LD33V voltage regulator wires Ground Output Input relative to the pins.

Despite this change it still does not initialize the sd card.

Is there a way to check if the sd card reader is fried? My initial setup before I realized it was not meant for 5V did not convert down 5V to 3.3V and I am not sure if this fried it or not.

The card reader is just a board isn't it? Take the SD card out and try to read it on a computer.

Yes, the sd card works on a pc. I was more wondering if there was anything I could do with the self test pin. I got a fresh sd card reader board to test for fried circuit, it still did not work.

I don't understand what you are saying. According to the schematic there is nothing on the board that could be fried.

The voltage regulator looks like it is wired up wrong. The center pin is the ground. Also you need capacitors to grounds either side of the regulator.

[quote author=Nick Gammon date=1422921443 link=msg=2072913] I don't understand what you are saying. According to the schematic there is nothing on the board that could be fried.

[/quote]

My mistake then.

Grumpy_Mike: The voltage regulator looks like it is wired up wrong. The center pin is the ground. Also you need capacitors to grounds either side of the regulator.

The data schema on the product page is for the other version of the regulator, the LD33V variant is wired Ground Output Input, and I have confirmed it is regulating to 3.3v properly with this wiring. I will make sure to add capacitors when I switch from usb to battery powered.

The thing I did not see was the 200 mA power spike to the card on startup that CrossRoads mentioned.

Hey,I hope you can help me out a bit if possible…
I am trying myself right now to read straight from a sq8 camera flash memory slot…is it possible ?
Or do I have to connect some kind of middle adapter or perhaps a flash card ?
Really need help thanks !

I dont think "FLASH MEMORY" (CF) is the same as an SD card..

Is it possible?

Is what possible? What are you trying to connect to? Using what?

Give us some details if you want a response.

How about pics of your set-up? wiring? Schematic of device trying to 'read from'...