Go Down

Topic: SD Initialization Failure (Read 778 times) previous topic - next topic


So I have an Arduino Uno, and I purchased the Adafruit MicroSD card breakout board and a 2GB Micro SD card from Adafruit as well.

I have all of the pins correctly inserted as detailed by the Adafruit website, and I put the MicroSD card in the Breakout Board, and everything should be working, but I keep getting Initialization Failure when I try to run the CardInfo program under File - Examples - SD - CardInfo.  I changed the chipSelect from 4 to 10 because I'm using Pin 10 for CS (again, as Adafruit's website said I should do).

Also, I formatted my MicroSD card with the formatter here: https://www.sdcard.org/downloads/formatter_4/

I'm really not sure what to do.  I literally just received the SD card and breakout board in the mail, so I doubt they're not working.


Apr 22, 2018, 06:56 pm Last Edit: May 08, 2018, 03:18 am by GolamMostafa
This is the tutorial that I have followed to make my first SD Card Related Program to work.

Code: [Select]

#include<SPI.h>   //sd cARD USES spi bUS
#include<SD.h>    //contains library functions

#define CSPIN 10   //slecting DPin-10 requires to set direction as output
File myFile;      //file pointer variavle declaration

void setup()
  SD.begin(CSPIN);        //SD Card is initialized
  SD.remove("Test1.txt"); //remove any existing file with this name
  myFile = SD.open("Test1.txt", FILE_WRITE);  //file created and opened for writing

  if(myFile)        //file has really been opened
    myFile.println("Arduino!");  //Arduino is written into SD Card
   myFile = SD.open("Test1.txt", FILE_READ);  //file created and opened for writing

  if(myFile)        //file has really been opened
      Serial.print((char)myFile.read()); //Arduino read back from SD Card and is shown on Monitor  

void loop()

Go Up