SD card initialization failed

Hello,

I am using a SD card module with my arduino mini.
I put a 2GB SD card inside the module.

Wiring :

  • GND -> GND
  • VCC -> 5V
  • MISO -> Pin 11
  • MOSI -> Pin 12
  • SCK -> Pin 13
  • CS -> Pin 10

Nevertheless, when I am running this code, it does not work :

#include <SD.h>
#include <SPI.h>


int pinCS = 10;

void setup() {
    
  Serial.begin(9600);
  
  pinMode(pinCS, OUTPUT);
  digitalWrite(pinCS, HIGH);

  // SD Card Initialization
  if (SD.begin())
  {
    Serial.println("SD card is ready to use.");
  } else
  {
    Serial.println("SD card initialization failed");
    return;
  }
  
}
void loop() {
  // empty
}

I found a lot of topics on the internet about this subject and no one solved my issue :confused:

I tried to change SD library version, no change.
I tried to change Ardunio IDE version, no change.
I tried to set pinCS to 14 (because on the arduino mini pinout it is physical pin 14), no change.

Anyone know what's the problem ?

Have you managed the level shift required between a 5V arduino and a 3.3V SD Card?

There is a level shifter on the module and it works well (I check with a voltmeter).

Which module are you using? Where did you get the module?

How did you go about formatting the SD? What method and program did you use to format the SD card?

Here is he link of the module : https://www.amazon.co.uk/VKLSVAN-Reader-Storage-modules-Arduino/dp/B01LCXDT2E

I did not format my SD card (In fact, I've done it with my Android smartphone cause I don't have any microSD adaptater for my computer but I couldn't choose the format...). It should be in FAT32 no ?

From all accounts, it should be formatted with the official SD Card formatter from SD Memory Card Formatter for Windows/Mac | SD Association

I can vouch for any other method, but know that using this formatter worked to solve my initialization issues in the past. Even if the card had been formatted from the box and readable in the computer, didn't guarantee the Arduino can read it.

Ok, thank you, I will buy an adaptater and tell you if that was the issue.

Well, so I downloaded the sdcard software and formatted my SD card but the initialization still failed ...

I did the "Overwrite format" and here is it what happened :

Other ideas ?

Guys, I found the solution !

In fact I referred to this Arduino Mini pinout : Arduino MINI Pinout Diagram - Project Guidance - Arduino Forum and it seems that MISO and MOSI are inverted on this pinout.

I think it is like Arduino Uno :

Pin 13 : SCK
Pin 12 : MISO (and not MOSI)
Pin 11 : MOSO (and not MISO)
Pin 10 : SS

If it is not that, maybe what is wrote on my SD card module is false.

If anyone has a mini and can confim the MISO/MOSI Pin because it is strange :slight_smile:

1 Like