Go Down

Topic: SPI SD card reader & other SPI device not working together (Read 3654 times) previous topic - next topic

Ray_Beebe

Spent sevral hours trying to figure out the odd behavior of an micro SD card reader with an SPI camera module. Both worked fine on their own, but when used together either SPI camera or Card failure occurred almost all the time.

Turns out the SD card readers improper design was the problem.  A quick look at the card reader shows an LVC125A Tri-state buffer is used for CS, MOSI, MISO and SCK. Looked good, but after checking all connections it turns out all the OE's for the LVC125 are active all the time. The CS pin went into the buffer and out to the SD card only. The Tri-sate capability of the chip was not being use! That would work for CS, MOSI and SCK but not for  MISO - an output. The MISO buffer output was always driving the SPI bus high or low even when other SPI devices were active. Totally unbelievable a tri-state buffer is used in a design and its tri-state capability not used at all!

The solution was to unsolder buffer pin 13 from the board then solder a wire between pin 13 and the CS input. Then use some hot glue to protect the hair thin wire and solder work. Now when the SD cards CS is high or low the MISO output is high impedance or active.

I've been writing and reading images to the micro SD card with no issues at all now.

issraar

Hello @Ray_Beebe,

could you please let me know which one is CS Input , pin 8 or 9 ??

vdt0812

Dear @Ray_Beebe and @issaar,
I connected Pin 13 and pin CS (pin 8 ), but it had no effect. Could you please give me some advice to solve this problem?

ShermanP

He said he desoldered pin 13 from the module board.  That's needed because pin 13 is probably connected to ground under the 125 chip.  You have to break that connection.  Also, you need to make sure that your 125 pinout is the same as his.

There are two other ways to solve this problem:

1.  If you can find the trace that connects the 125's MISO output to the MISO header pin, you can cut that, then connect the header pin directly to the MISO pin of the SD holder, bypassing the 125.  The SD card itself should behave properly and release MISO when its CS isn't selected.  And since MISO is an output of the SD card at 3.3V, you don't need to translate it to 3.3V in the 125 anyway.

2.  It is reported that you can fix this by inserting a resistor in series somewhere in the connection from the MISO ouput of the 125 and the MISO input of the Arduino.  I don't specifically remember the value of the resistor, but it might be 3.3K.  When the SD card is selected, the resistor isn't enough to interfere with the transmission, particularly since the other SPI device has released its MISO.  And when the other SPI device is selected, the resistor just behaves as a pullup or pulldown resistor which does not prevent the other device from taking MISO to whatever state it wants.  You would need to experiment with the resistor value.  Too high a value would limit your speed.

I'll attach a drawing showing fix #1.

By the way, I've never seen a microSD module that does not have this problem.  Maybe the module makers of the Far East will do it right at some point.


Go Up