3

I know this question has be asked before on this site. However it was never really answered. I have an Arduino Uno. I am trying to get it to read a 2 GB SDHC Micro SD card. The problem is, the SD card never intializes. I am not sure if there is something wrong with the wiring (which I think is NOT the issue) or the SD card/shield. I have formatted the SD card, but perhaps I did use the wrong settings to do so. Additionally, this SD card is quite old, probably several years. It can still be managed on my PC however.

I bought the following Micro SD shield off Amazon. It has the pins VCC, GND, MISO, CS, MOSI, and SCK, for which I figured the following:

MISO = D0
CS = D1
MOSI = CLK
SCK = D3

I have the circuit wired in the following way:

SCK to Pin 10 on Arduino
CS to Pin 11 on Arduino
MISO to Pin 12 on Arduino
MOSI to Pin 13 on Arduino
VCC to 3.3V source on Arduino
GND to Arduino Ground

The image below is a compilation of the closeup of the shield and my wiring. Not that I am also using Pin 9 in the picture. However this is used for a different portion of the circuit.

enter image description here

The code that I am trying to run comes from the SdFat library. Though the Amazon page says the device can be used without this library, I prefer to have it. I am running the SdInfo.ino example located in SdFat/SdFat/examples/SdInfo/. I have changed the coding so that:

const uint8_t SD_CHIP_SELECT = 10;

I have also tried running the Basic.ino example in the TMRpcm library, located at: TMRpcm/examples/basic, but this doesn't work either. Below is the code:

#include <SD.h>                      // need to include the SD library
//#define SD_ChipSelectPin 53  //example uses hardware SS pin 53 on Mega2560
#define SD_ChipSelectPin 10  //using digital pin 4 on arduino nano 328, can use other pins
#include <TMRpcm.h>           //  also need to include this library...
#include <SPI.h>

TMRpcm tmrpcm;   // create an object for use in this sketch

void setup(){
  tmrpcm.speakerPin = 9; //5,6,11 or 46 on Mega, 9 on Uno, Nano, etc
  Serial.begin(9600);
  if (!SD.begin(SD_ChipSelectPin)) {  // see if the card is present and can be initialized:
    Serial.println("SD fail");  
    return;   // don't do anything more if not
  }
  tmrpcm.play("music"); //the sound file "music" will play each time the arduino powers up, or is reset
}

void loop(){  
  if(Serial.available()){    
    if(Serial.read() == 'p'){ //send the letter p over the serial monitor to start playback
      tmrpcm.play("music");
    }
  }
}

In short. My SD card does not initialize, and I cannot seem to figure out why.

5

The first thing to try is to use the 'proper' pins for the SPI:

SCK to Pin 10 on Arduino ---> Pin 13
CS to Pin 11 on Arduino ---> Pin 10
MISO to Pin 12 on Arduino ---> Pin 12
MOSI to Pin 13 on Arduino ---> Pin 11
VCC to 3.3V source on Arduino
GND to Arduino Ground

Try that first and see how you get on.


By the way, just thought I'd mention, probably worth just following the Adafruit example word for word as I'm guessing your board is pretty much a good fit for this tutorial:

https://learn.adafruit.com/adafruit-micro-sd-breakout-board-card-tutorial

good luck getting it rockin' ;)

1

That breakout board includes a 3.3V regulator and level shifter. It should be powered from 5V for proper operation.

Also, as @Andology mentions: use the correct SPI pins.

  • Thanks, I'm at work right now. I'll give it a try later today! – Alex Weber Oct 21 '15 at 17:42
0

I could not get this to work, tried everything , then I took a chance and powered the SD card reader from the 5V pin instead of the 3.3 then suddenly it worked. I have the exact same SD card reader as shown in this post.

  • 1
    This solution was already posted by Majenko. – gre_gor Dec 21 '17 at 16:00
0

If you have checked everything (wiring, coding your correct pin etc), AND you have already formatted the new card with the correct sd formatter and/or fat32 formatter, and it still does not work; I have found the following worked on some cards: Simply create an empty (0 bytes) file on the new card. Cards that were returning all kinds of funny errors (like they are too small - or simply won't initialize) magically start working !

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.