Sd card module card

The arduino uno doesn´t read my SD module card.
The SD card is SDHC and it is formatted.
When i run the code it says "initialization failed!"
The pins are well placed.
The code workss fine, it is not the problem but here i leave just in case

#include <SPI.h>
#include <SD.h>
File myFile;
void setup() {
// Open serial communications and wait for port to open:
Serial.begin(9600);
while (!Serial) {
; // wait for serial port to connect. Needed for native USB port only
}
Serial.print("Initializing SD card...");
if (!SD.begin(10)) {
Serial.println("initialization failed!");
while (1);
}
Serial.println("initialization done.");
// open the file. note that only one file can be open at a time,
// so you have to close this one before opening another.
myFile = SD.open("test.txt", FILE_WRITE);
// if the file opened okay, write to it:
if (myFile) {
Serial.print("Writing to test.txt...");
myFile.println("This is a test file :)");
myFile.println("testing 1, 2, 3.");
for (int i = 0; i < 20; i++) {
myFile.println(i);
}
// close the file:
myFile.close();
Serial.println("done.");
} else {
// if the file didn't open, print an error:
Serial.println("error opening test.txt");
}
}
void loop() {
// nothing happens after setup
}

Which SD card module do you have?
How have you connected it to your UNO?
How did you format the card?

image
yes, it is connectede to arduino
i format it with the option that comes with the computer

How? Which pins on the SD module did you connect to the UNO, and where did you connect them?

Have a read of the sticky post at the top of this forum that discusses the correct way to format SD cards.

I don't know if it's the reason for your problem, but that SD card module is suitable for 3.3V processors, not a 5V processor like the Uno. It does not have any voltage level translation, and will subject the SD card to excessive voltage. If interested, I can post a fix that has worked for me. But we need to see how you have it wired.

it is formatted in fat32, the connection are:


we also try using the pin 10 with cs. Now this happened:
When I upload my updated sketch into Arduino, the SD Card stops working. Then I press the reset switch, and it still won't work.
I have to either power-down the Arduino and then power up again; or, I can unplug the SD Card and plug it back in again. Either way, when I press the reset button after that, the SD Card works again. But that's using "human intervention", and I want the SD Card to wake up automatically.
I don't find a procedure in the SD Library to accomplish this. And even disconnecting the 5V supply wire to the card holder (which the AVR could easily do) does not get the SD Card working again.

i already try it with 3.3V and nothing

Is the Arduino powered from USB or from an external supply? If it's USB, then the 5V pin on the Arduino should provide enough power for the SD module.

The Uno and Nano are 5V Arduinos. That means the SCK, MOSI, and CS outputs are 5V outputs. But the SD card is a 3.3V device. The voltage regulator on the SD module provides 3.3V power to the SD card, but then you are applying 5V I/O to a device that is powered at 3.3V. That may damage the SD card, or cause it to malfunction. You should have voltage translation that converts SCK, MOSI and CS to 3.3V, but there is no such translation on the module. It is present on the microSD module, but not on your full size SD module.

The following is a fix that I have used. It may or may not solve your problem. You solder in three diodes, and cut three traces on the bottom.

Hi, thank you for your response, i will try it, the 3 resistances from the picture, how much ohms are they?

No, those are diodes. 1N4148, for example.

Ah ok, and i tried with an external supply and nothing

We tested with another arduino and worked perfectly

That's good. So what have you concluded was the problem with the original Uno setup?

The SCK pin (13) was damage, we asume was something wrong with the clock pulses.

Ok. Is it the modified SD card module (my post #9) that is now working, or the original module?

the original module

Well then you still have the voltage conversion problem with the Uno outputting 5V on the SPI lines to the SD card, which is a 3.3V device. If you decide to try the modification to correct that, please let me know if it works. My copy works, but so far nobody else has said it works for them, and I'd like to know one way or the other.

This topic was automatically closed 180 days after the last reply. New replies are no longer allowed.