Go Down

Topic: Trying to get SD to initialize. (Read 465 times) previous topic - next topic


I am just trying to make contact with my SD card. It is a 16GB that was formatted with SD Card Formatter and then inserted into an Ethernet2 w/ W5500 shield. The Serial Window just shows "SD card initialization failed" every time.

I use the following sketch....

Code: [Select]
     *  Arduino SD Card Tutorial Example
     *  by Dejan Nedelkovski, www.HowToMechatronics.com
    #include <SD.h>
    #include <SPI.h>
    File myFile;
    int pinCS = 4; // Pin 10 on Arduino Uno
    void setup() {
      pinMode(pinCS, OUTPUT);
      // SD Card Initialization
      if (SD.begin())
        Serial.println("SD card is ready to use.");
      } else
        Serial.println("SD card initialization failed");
      // Create/Open file
      myFile = SD.open("test.txt", FILE_WRITE);
      // if the file opened okay, write to it:
      if (myFile) {
        Serial.println("Writing to file...");
        // Write to file
        myFile.println("Testing text 1, 2 ,3...");
        myFile.close(); // close the file
      // if the file didn't open, print an error:
      else {
        Serial.println("error opening test.txt");
      // Reading the file
      myFile = SD.open("test.txt");
      if (myFile) {
        // Reading the whole file
        while (myFile.available()) {
      else {
        Serial.println("error opening test.txt");
    void loop() {
      // empty


I have the same problem. I changed my memory card from SDHC 16GB into a 2GB card and it works well

Go Up