*** Inconsistent "Read" of SD cards *** using CardInfo

I have been experiencing fundamental challenges in getting any SD Reader/writer hardware (I have more than one SD Reader/Writer from AliExpress and I have one SD Reader/Writer from Adafruit) and have tried 3 separate SD cards to initialize them using the standard Arduino "CardInfo" program. I have tried 3 SD cards so far: (1)8GB from Adafruit, (2) 32GB cards from Amazon. NOTE - all have been formatted successfully with SD Card Formatter.

What happens:

Most times, "CardInfo" Serial output tells me that it cannot read a card. I keep resetting my Nano and repeating the execution of the code over and over again. Every now and again, (1 out of 10?) I get a partial read, at other times, completely PERFECT reads!! (1 out of 20?) All SD cards have been formatted with SD Card Formatter and successfully formatted. Also, in all cases, each of the SDs works fine on my PC and can be used for reading and writing.

I have checked all wiring, which at this point, has to be correct, since some of the messages are that everything is wired fine, and the SD can be read. I have tried more than one SD card, more than one Nano and more than one SD reader (one from Adafruit and others from AliExpress) and results are identical - inconsistent reading when running, "CardInfo" program from Arduino IDE.

Anybody experience this on their systems? Any guidance will be much appreciated. :slight_smile:

Tell us how you are powering the SD readers. Have you measured the voltage while using the reader?

Paul, thanks so much for the quick response! :slight_smile:
I have measured the voltage at the reader, it is 5 Volts. I am currently just powering a desktop configuration through the 5V pin using the USB connection. Maybe I should power it with a 9VDC supply to VIN (which I can do, no problem). The light on the reader goes on and to the casual eye, it seems to be "working ok". I haven't monitored the +5VDC pin relative to ground when it is being used. Do you believe that the current demand is too high for the Nano's 5V output? It is the ONLY device wired to the Nano at this point, nothing else at all is connected.

Paul, I just plugged in a 9VDC power source to VIN and ran again, same results. I just wanted to report bACK. :slight_smile:

I have been under the impression that all SD card readers require 3.3 volts. Is your device different?

Do you have the required 5V to 3.3V logic level shifters for the SD module, or are they built into it?

Paul,

Many devices have both 3.3V and 5VDC input pins. Adafruit's, as well as the ones I got from Ali are fine with either voltage coming in. Both internally operate at 3.3VDC but both have hardware onboard to do the conversion.

Gordon

I know for sure that the Adafruit unit does. And from watching sever YouTube videos on the subject, the units I have from Ali also have internal logic level shifters as well....

I am doing all of my most recent tests specifically on the Adafruit unit with both an 8GB SD card and also a 32GB card. Both SD cards at some point do get read successfully....I captured much of the output and copied and pasted it in Excel so I could see it clearly.

Adafruit engineers support their products, so the very best place to post this question is on the Adafruit forum.

1 Like

I did, lol, waiting for a response....thanks for taking the time to answer :slight_smile: Much appreciated.

Could we have links to the two SD modules you have?

What exactly is the error message you get from CardInfo? Does it fail to find the card, or fail to find the partition, or what?

If it works sometimes, but usually doesn't, there really aren't too many possible causes. Power issues would be at the top of my list, but also breadboard problems, or even flaky jumpers.

Sherman, I tend to agree with your summary statement! I have double and triple checked my wiring to make sure that I have continuity for all connections. I will however likely make a new harness and make sure everything is "perfect". As far as the card reader devices go, one of them is an Adafruit MicroSD card breakout board (Part number 254). I know that this particular item does have a dedicated chip for level shifting - it is why I am focused on this device first and then will worry about the other ones that I have. The ones I got from AliExpress are less expansive, HOWEVER I know that they do not have a dedicated chip for doing level shifting. It is for this reason I am mainly limiting my troubleshooting to the Adafruit SD reader. As far as error messages, CardInfo generates the following one most of the time:

Initializing SD card...initialization failed. Things to check:
* is a card inserted?
* is your wiring correct?
* did you change the chipSelect pin to match your shield or module?

Once in a while, I get a partial read which is this message:

Initializing SD card...Wiring is correct and a card is present.
Card type: SD1
Could not find FAT16/FAT32 partition.
Make sure you've formatted the card

And once in a while (1 out of 20?) I get a correct read which is:

Initializing SD card...Wiring is correct and a card is present.
Card type: SDHC
Clusters: 242304
Blocks x Cluster: 64
Total Blocks: 15507456
Volume type is: FAT32
Volume size (Kb): 7753728
Volume size (Mb): 7572
Volume size (Gb): 7.39
Files found on the card (name, date and size in bytes):
SYSTEM~1/ 2023-09-11 12:15:34
WPSETT~1.DAT 2023-09-11 12:15:34 12
INDEXE~1 2023-09-11 12:15:36 76

I don't have much more to offer. You should definitely check the connections, including any jumpers you are using.

SD cards do require time to boot up after power is applied. You might add a one-second delay at the beginning of CardInfo to see if that makes a difference. Or you could just hit the Nano's reset button after it has tried the first time. But CardInfo usually works without bothering with all that.

Is your CS line on D4 or D10?

My CS (Chip Select) is set for Pin-8 and I matched that value in CardInfo source file and downloaded. Working on the new wiring harness now, lol :slight_smile:

Thanks for taking your time to assist me!!

Gordon

Well, it's a long shot, but you might try using D10 for CS if possible.

Just wanted to thank you for all your efforts!! Problem now solved. It was a bad harness and/or Nano screw terminal connection. I made a brand new harness between the Nano and the Adafruit SD reader. I also switched over to SDFat.h from Adafruit (a little larger library but more complete). Now the Adafruit is reading 100% of the time, all good. Thanks again! :slight_smile:

1 Like

That's great. But let's address the Aliexpress SD modules while we're at it. Can you post a link, or a picture?

Sure. I have pictures, how and where do I post them? I do not see a way to add an attachment or insert a pic? Maybe I am missing on how to do it...

In the editor box, it's the UPLOAD up arrow.