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.
Paul, thanks so much for the quick response!
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.
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.
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.
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):
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.
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!