0

Micro-SD Module not Initializing
Moderators: adafruit_support_bill, adafruit

Please be positive and constructive with your questions and comments.

Micro-SD Module not Initializing

by Joey4JC on Thu May 20, 2021 12:04 am

Hello, I have a new Adafruit micro-SD Breakout Board module which simply will not initialize using my Mega2560. I've read the tutorial/data sheets and reviewed and tried the CardInfo and Read/Write examples. Wiring is directly per the instructions for the Mega:
5V to 5V
CLK to pin 52
DO to pin 50
DI to pin 51
CS to pin 53

At powerup and upload, the SD board red LED comes on briefly and goes back off so it seems to have power and be alive. But the SD.begin(53) command does not return true. I've read much about the CS pin and have both pins 10 and 53 configured as outputs. I've tried playing with a number of things with no luck (but not yet tried any manual SPI writes). I'm pretty much to the end of my rope here and would very much appreciate any help. I've copied code below for one of the simple sketches that is not working.

Thanks much !

--------------------------------------------------------------------------------------------------------------

#include <SPI.h>
#include <SD.h>
File myFile;

void setup() {
Serial.begin(9600);
Serial.print("Initializing SD card ...");
pinMode(10, OUTPUT);
pinMode(53, OUTPUT);

if(!SD.begin(53)) {
Serial.println("initialization failed !");
return;
}
Serial.println("initialization done.");

myFile=SD.open("test.txt",FILE_WRITE);
if(myFile){
Serial.print("Writing to test.txt ...");
myFile.println("testing 1, 2, 3.");
myFile.close();
Serial.println("done.");
} else {
Serial.println("error opening test.txt");
}

}

void loop() {

}

Joey4JC
 
Posts: 4
Joined: Sat Apr 24, 2021 5:01 pm

Re: Micro-SD Module not Initializing

by dastels on Thu May 20, 2021 9:28 am

Let's start with a clear photo of the wiring, specifically the connections to the breakout.

Dave

dastels
 
Posts: 6912
Joined: Tue Oct 20, 2015 3:22 pm

Re: Micro-SD Module not Initializing

by Joey4JC on Thu May 20, 2021 7:18 pm

Hi Dave, thanks for the reply. Pics are attached below:

SDwiring_1.jpg
SDwiring_1.jpg (111.71 KiB) Viewed 248 times


SDwiring_2.jpg
SDwiring_2.jpg (106.07 KiB) Viewed 248 times


SDwiring_3.jpg
SDwiring_3.jpg (89.92 KiB) Viewed 248 times

Joey4JC
 
Posts: 4
Joined: Sat Apr 24, 2021 5:01 pm

Re: Micro-SD Module not Initializing

by dastels on Thu May 20, 2021 7:42 pm

What do you have soldered into the breakout? It doesn't look like there's a header pin sticking up through the 5v hole, but I see solder. When somethign doesn't work as expected, I'll usually retouch the soldering as a first step. That'll fix it surprisingly often.

Another thing to remove and reinsert everything on the breadboard, or try is a different place on the breadboard. Try different wires. I've seen all those fix problems.

Your connections and code look correct so I'm still thinking it's a connection issue.

Hmm.. the example doesn't include SPI.h, have you tried removing that. There's a chance it's confusing the SD library.

Dave

dastels
 
Posts: 6912
Joined: Tue Oct 20, 2015 3:22 pm

Re: Micro-SD Module not Initializing

by Joey4JC on Thu May 20, 2021 9:48 pm

Yep, thanks Dave, connection problem. There was a header in there, just a crappy job of installing it. Luckily was able to remove the old header and replace without wrecking the board from too much heat.


"Once you have eliminated the impossible, whatever remains, however improbable, must be the truth." - Commander & Chief Science Officer Spock

Joey4JC
 
Posts: 4
Joined: Sat Apr 24, 2021 5:01 pm

Re: Micro-SD Module not Initializing

by dastels on Thu May 20, 2021 10:37 pm

It's almost always a connection problem.

Wasn't it Sherlock Holmes that said that first?

Dave

dastels
 
Posts: 6912
Joined: Tue Oct 20, 2015 3:22 pm

Please be positive and constructive with your questions and comments.