2

I have this SD-card module. I have formatted the SD with this tool. My problem is that the Arduino Uno can't initialize the SD. I tried with this script:

// include the SD library:
#include <SPI.h>
#include <SD.h>

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

const int chipSelect = 7;

void setup() {
  // Open serial communications and wait for port to open:
  Serial.begin(9600);
}

void loop(void) {
  if (!card.init(SPI_HALF_SPEED, chipSelect)) {
    Serial.println("Doesn't work properly");
  } else{
    Serial.println("works properly");
  }
  delay(2000);
}

And the result:

Doesn't work properly
Doesn't work properly
Doesn't work properly
Doesn't work properly
Doesn't work properly
Doesn't work properly
Doesn't work properly
Doesn't work properly
Doesn't work properly
Doesn't work properly
works properly
works properly
works properly
works properly
works properly
works properly
Doesn't work properly
Doesn't work properly
Doesn't work properly
works properly
works properly
works properly
Doesn't work properly

The "works properly" happens, usually, when I move the module slightly. Is there a way to repair the module?

OS: Windows 10

  • It sounds like maybe you have unreliable wiring connections. Your module won't directly plug into an Arduino Uno, so how have you physically made the electrical connections? – Chris Stratton Mar 31 '18 at 20:05
  • I use: MISO -> Pin 12, MOSI -> Pin 11, SCK -> Pin 13, SDCS ->Pin 10, 5V -> 5V, GND -> GND – user45309 Mar 31 '18 at 20:13
  • Yes, but how are these connections physically made? – Chris Stratton Mar 31 '18 at 20:14
  • With Jumper Wires like this: exploringarduino.com/parts/jumper-wires – user45309 Mar 31 '18 at 20:16
  • 1
    Show us a photopgraph of your actual setup. – Majenko Mar 31 '18 at 20:34

Your Answer

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