Go Down

Topic: SD Interface Problem Solved (Read 3947 times) previous topic - next topic

big_jeff

I have an Adafruit MicroSD breakout board that I was trying to connect to an Uno, but having some problems. I now have it working and thought I would share what I found if someone else has similar problems.

With the microSD breakout board connected to the Uno the CardInfo example from the SD library was failing to initialize.

I connected a 10k pull-up from the micro SD board DO pin to 3v3 pin, and now at least the CardInfo example works reliably. After stumbling upon this solution, I did a bit of research and found SD specs require pull-ups of 10k to 100k.





fat16lib

Quote
I did a bit of research and found SD specs require pull-ups of 10k to 100k.


SD cards don't require pull-ups.  The lines are push-pull driven.  When the card is selected, the card will drive the output line.

A pull-up on the card's data output can be helpful to prevent the line from floating when no card is present.  This prevent noise from confusing card initialization when no card is present.

The Adafruit microSD breakout works fine with out additional pull-ups.  Have you posted this problem and  "solution"  on the Adafruit forum?


big_jeff

Pull-ups are required as stated in SD specs:
RDAT and RCMD are pull-up resistors protecting the CMD and the DAT lines against bus floating when no
card is inserted or when all card drivers are in a high-impedance mode.
The host shall pull-up all DAT0-3 lines by RDAT, even if the host uses the SD Memory Card as 1 bit-
mode-only in SD mode. Also, the host shall pull-up all "RSV" lines in SPI mode, even though they are
not used


The SD card pads are bi-directional with tri-state drivers, and are in a high impedance state until enabled by the SD card, which may not be when the CS line is asserted as the card is not in SPI mode initially. Leaving any digital signal in a floating, unknown, state is not a good idea. It probably works without the pull-ups most of the time, but I found a case where it doesn't, and that's why pull-ups are required, so it will work all of the time.

fat16lib

A Large value pull-up on MISO won't hurt but it is not needed.   I bet you have another problem that is not really fixed.

I recently had a user make a similar claim but the real problem was chip select was floating due to bad wiring.  A pull-up on a data line quieted noise on the nearby floating chip select and it went low long enough for the SD to initialize.  The problem came back when lots of data was read from the SD.  The 50 K internal SD CS pull-up resistor doesn't control chip select on most modules because level shifters over power it.

Quote
The SD card pads are bi-directional with tri-state drivers, and are in a high impedance state until enabled by the SD card, which may not be when the CS line is asserted as the card is not in SPI mode initially. Leaving any digital signal in a floating, unknown, state is not a good idea.


SPI should not have pull-ups or pull-downs on MISO, MOSI, or SCK. There is not a default state since there are four SPI modes and the SD is not the only device on the bus. Why would you pull MISO to 3.3 V on a 5 V system?

Atmel doesn't suggest pull-anything resistors in the processor datasheet. In fact Atmel suggests not using pull-ups/downs in some configurations.

The fact that pull-ups are not required is often stated as an advantage of SPI.
Quote
Typically lower power requirements than I²C or SMBus due to less circuitry (including pull up resistors)


Quote

It probably works without the pull-ups most of the time, but I found a case where it doesn't, and that's why pull-ups are required, so it will work all of the time.

I don't believe you found a case but you may be the first.   I wrote SdFat, which is also the base for the Arduino SD.h library.  You are not the first to make this type of claim.  This type of "fix" means there is another problem that is the real cause and it will likely bite again.

I was involved with Limor Fried on design of Adafruit SD modules and I believe her design is sound and no pull-ups are needed.

Read the SD association's SD "Physical Layer Simplified Specification".  The only mention of pull-up for SPI is the 50 K card detect/CS pullup that must be driven low during initialization to select SPI mode.  This is not the DO pin in SPI mode.

There is mention of pullups for the new UHS-II pins 10-17 but these are not relevant here.


mb54mike

 I have had problems with both LC Studios and Catalex Micro Sd cards.
I used  a CD4050 level shifter without success.
I recently updated my software version to the latest version.
Some of my old sketches did not include #include<SPI.h>

Now both cards work perfectly without a level shifter and the VCC = 3.3V

Go Up