CardInfo fails? Are you using the right SD card module/breakout/shield?

I'm posting this in the hope that we can come to a conclusion about the type of SD card module/breakout/shield to use with 5V Arduinos, or whether it even matters what type is used. I see lots of posts about the CardInfo example sketch failing to find the SD card even though everything is wired up correctly. Based on the included pictures of the breakout boards being used, I suspect the problem may be that the design of the board is wrong for use with a 5V Arduino.

I just finished testing Cardinfo using a Nano, which is 5V, and the type of SD module I think is right, and it worked perfectly for both a regular microSD card , FAT16, and a micro SDHC card, FAT32. Here are the details:

The module I used:

Arduino Nano (Banggood), CH340G USB adapter, old bootloader, connected to computer via USB

Connections - module to Nano:

Vcc 5V
CS 10
SCK 13

CardInfo.ino example sketch, with CS pin changed from 4 to 10:

// change this to match your SD shield or module;
// Arduino Ethernet shield: pin 4
// Adafruit SD shields and modules: pin 10
// Sparkfun SD shield: pin 8
const int chipSelect = 10; //was 4

Notice that the microSD module I use has a voltage translator chip in addition to a 3.3V voltage regulator. SD cards are 3.3V devices. The regulator provides the correct voltage to the SD card's power pin, but the Nano pins 10, 11 and 13 output 5V when they go high, and the voltage translator is needed to convert that to 3.3V. Otherwise, you are applying voltage to an SD card pin that is well in excess of the voltage on its power pin, which is "out of spec" at the very least.

The other kind of module simply has series resistors in those three lines, which I assume are there to limit the current that flows when 5V is applied to an SD pin expecting 3.3V. I see a lot of these modules for sale, claiming to be right for 5V Arduinos. But I wonder if these modules are the reason why so many are having problems. Unfortunately, I don't have one to test.

Well, I may be completely off base on this, but I can't think of another reason why we see so many failures with SD cards and Arduinos. But perhaps there are enough people here with experience one way of the other with these modules that we can come to a conclusion. Specifically:

If you are successfully using a module with series resistors in the three lines, but no translator chip, with a 5V Arduino, please post here with details of your setup.

If you have a module with a translator chip, but it still doesn't work, please post here with more info.

And finally, if you understand how/why the series resistor design should work properly, please explain that to me.

Thanks for starting this thread.

From Tbdanny's report, it sounds like the problem in that case was that the SD card wasn't formatted as expected.

However, I have a case that meets your criteria: a SD card module with a translator chip that fails CardInfo (detailed in a forum post here).

I've been using a Keyes Data Logging shield module which has both a 3.3V voltage regulator (MCP1700) and a voltage translator (74HC125D) for the CS, MOSI, MISO, and SCK lines. I've been trying to make this work with no luck.

My guess for now is that the problem is with either the make of SD card or that the formatting isn't "correct". I've ordered different brands of SD shield and data card to try and test this out. However, I haven't gotten it working at all, so this is just a guess!

What I've noticed after reading many posts on this issue is that generally the SD card works when connected directly to a PC but then fails with an Arduino module. One significant difference between these cases is that the PC may use the SDIO protocol whereas the Arduino SD.h library uses the SPI protocol. SD cards that work with SDIO may be more finicky with SPI, so they work fine with a PC but then fail with an Arduino SD reader.

The SDFat library seems to have an option to use SDIO, but I can't figure out how to make it work.

It seems(?) that the SDFat library is newer than the SD library for Arduino, so it might be preferable anyway. Although SDFat actually has pretty elaborate documentation, it seems written for developers, not hobbyists trying to get started.

My thought about getting to the bottom of this issue would be to figure out if it's possible to use SDFat to communicate via SDIO, fix the documentation to describe this clearly and simply, and see if that helps to resolve this issue.

Thanks for the information, mrobber. So we have three examples at this point. Your Keyes module has the translator chip, but it still doesn't work. Tbdanny's module doesn't have the translator, but he got it to work anyway. And my module has the translator, and works fine. So from that it appears my explanation of the problem isn't correct.

But I've done more research on Youtube, and found this MAKE video that deals with this subject:

From about 0:27 into the video through about 3:24 he goes through the two types of modules, showing the non-translator module as a module you should NOT buy, and claims that to use it with a 5V Arduino you would have to add a translator chip. Well, I guess Tbdanny would disagree, but I wonder whether the non-translator version really works reliably with all SD cards. Some may tolerate the excess voltage on the SPI lines, but others may not. And I would still suggest that the translator chip is the proper design.

I don't think switching to SDIO is going to improve things for you. The vast majority of SD-Arduino setups use SPI, and so far as I can tell it's very reliable. What's puzzling about your case is that your setup "kinda" works. You get at least some response in CardInfo, whereas many posting here hit a brick wall at the very beginning. It seems like it might be a bad connection or something similar - maybe bad Dupont cables, or a bad card slot. But I don't have a solution for you.

Good analysis, ShermanP. I should have mentioned that I agree with you about avoiding the SD modules that don’t include a voltage translator. Evidently they can work, but personally I’d rather have a regulated supply driving the SD card.

You’re right that most Arduino setups are using SPI without issues. What I’m wondering, though, is whether some designs of SD card are failing with SPI, but would work with SDIO. I would be curious to try it, at least, if somebody could explain how to set it up.

As mentioned, I have different brands of SD card shield and SD card on order, so I’ll report back with my findings once they arrive.

Reporting back with more info...

Executive summary: apparently, the problem was a defective SD card shield. I swapped in a new shield board and everything started working.

The new board (HiLetgo Mini Logging Recorder Data Logger Module Shield) is very similar in design to the previous board.

The CardInfo sketch now works with every SD card I've tried, including a very old one formatted in FAT12. The SdInfo sketch in the SdFat library works, however QuickStart does not.

All cards were formatted using the SD Formatter app, and I tried both Windows and OS X. I noticed that OS X adds several dozen hidden files related to its search and file systems.

I'm a bit puzzled by QuickStart not working, as I got it to run before.

This is maybe slightly off topic, but I'm confused about how different versions of libraries are handled in the web version of Arduino create. In the Libraries tab, I can pick a specific version of the library from a drop-down menu in the Include button. When I do this, a comment is added to the source code, like "// SD - Version: 1.2.3", but is this comment read by the compiler to select a version of the library? How does the IDE actually know which version to use? Where is the information saved? Is it selected per sketch, or for all sketches?

Congratulations on getting it working. So that's another case of a shield with a voltage translator working properly. I think you are correct that the other type may work for some SD cards.

Can't help with QuickStart or Create.

Thanks. :smiley:

P.S. I asked a friend who is an electrical engineer and analog circuits specialist about the two different SD card designs. He said: "A translator chip is the only way to go."