Go Down

Topic: (several...) SD just, simply, not working! [SOLVED, tnx fat16lib] (Read 14362 times) previous topic - next topic


Feb 28, 2014, 05:57 pm Last Edit: Apr 25, 2014, 04:38 pm by greenestmike Reason: 1
Hello everyone, hope you might forgive me while taking up a well discussed issue - "using SD cards on Arduino is sometimes less than straightforward".
I have probably read every single post on the web, and while taking several actions in the meantime, I ended up spending almost two months uselessly. Long introduction to beg you being easy on me, please...
I'll reward with full gratitude from the Verona, the city of Romeo & Juliet :) for those who heard of it..

For the records, I found these two post quite interesting and close to the topic, nevertheless not applicable to my case:

MY REAL SIMPLE SETUP: a bare Arduino UNO, no frills, no further shields except  SD card module (this --> http://www.lctech-inc.com/Hardware/Detail.aspx?id=0c3b6f7a-d101-4a60-8b56-3abfb7fd818d).
CS pin is 4.

REAL SIMPLE MATTER: it never works, not even the example code.

Cards on the bench are two SanDisk (capacity of 128MB used, formatted and fully working and another 2GB absolutely new and intact) and one Maxell 2GB (used and commonly used in my digital camera. i.e. "working").

Code is "anything" in the example that does some sort of *writing*. Reading is generally fine.
Example SdInfo is working fine. ReadWriteSdFat is not.
My own code used to work for a while until it decided, spontaneously, to quit. Absolutely no chance to attempt a StressTest (as the example provided) neither with the brand new card.
SdFormatter works, but creates an unformatted disk (as reported by ReadWriteSdFat), thus unusable.
Sometimes ReadWriteSdFat makes some written 0Bytes file while returning:

error: opening test.txt for write failed
SD errorCode: 0X13,0X0

Question about pins. Every example reports different pins according to which shield one's using. Not using any shield whatsoever I wonder whether an arbitrary PIN can be chosen. Again, my preferred number is "4" but I tried with other numbers with no luck.

I thought hooking a card to Arduino was way more straightforward but apparently is seems out of my reach.
Any recommendation before throwing everything off the window? :)

[I swear: my next project is to plant a tree...]


Show us the schematics of the sdcard module.. (or datasheet)


Thank you Pito for quick answer... I think trying to find schematics could be a little more harder than I might expect having been the purchase done over eBay and... you know...

Nevertheless I'll try (tomorrow, now I have to take classes). Will keep you informed on my discoveries! :)

Have a good day/night, depends on where you are!


Have you tried the SDfat library that forum member fat16lib maintains?
I think you will have better luck.

Your SD card needs a solid 3.3V supply, they can draw 200-250mA.
The SCK, MOSI, and SS signals should be buffered thru an active device and not just thru resistor dividers.
Designing & building electrical circuits for over 25 years.  Screw Shield for Mega/Due/Uno,  Bobuino with ATMega1284P, & other '328P & '1284P creations & offerings at  my website.


Feb 28, 2014, 08:18 pm Last Edit: Feb 28, 2014, 08:34 pm by pito Reason: 1
Let us wait on the schematics. From the picture it seems there are just 4x10k pullups at the signals to 3V3. So it seems a tough decisions waiting on Romeo:
1. trash the module and go with planting the trees
2. go with properly designed dividers
3. go with a buffer
4. trash the module and ask Juliet to help with searching for a better module..


Thank you Pito and CrossRoads, slight bad news here.

Schematics are unavailable, the best I could do is to take closer picture to the soon-to-be trashed item (4).
As for the tree (1), I'm way ahead and done excavation already. Truck on the way home will get the tree here; on the way back the garbage. You could guess the content. Juliet is driving.
2. Unaware of what properly designed dividers are (not that I haven't any clue of, but hardware electronic is still sort of magic for me) there's an AMS1117 3.3 HT315E component, quite likely THE voltage regulator you mention (the only component on board - you know, smart guys comes from northern Italy :)).

Sdfatlib in use is already the latest one, the Christmas' one (20131225).

Hope to find a way out.
Apparently hooking up a wireless card and broadcast bit-after-bit seems a more viable solution...  :smiley-roll-sweat:

Thank you!


Still asleep I found this. Can you confirm somehow we talk the same?


Mar 01, 2014, 11:56 am Last Edit: Mar 01, 2014, 12:09 pm by pito Reason: 1
If you confirm we talk the same - then you may add a 5th point to your "to-be-decided-list":
5. whether to trash all those SDcards used..

An Sdcard is a 3.3V gadget, it means any signal feeding the card must be below 3.3V.
Arduino Uno itself is 5V - all the signals are 5V.
It may happen the cards survived your experiments.

The shield we discussed is intended for 3V3 powered -inos (I do prefer that since ever, no messing with translators, more time for planting the trees).

What you need to do is to build a level translator from 5V (Arduino) -> 3V3 (Sdrcard's inputs).
You can do it in several ways.


Many SD breakouts and shields use a 74HC4050N. See attached diagram. This part is available in a DIP package http://www.digikey.com/product-detail/en/74HC4050N,652/568-7814-5-ND/1230396.

The Adafruit Data logging shield and a number of other products use a 74AHC125N http://www.digikey.com/product-detail/en/SN74AHC125N/296-4531-5-ND/375724.  This also available in DIP.

Here is the circuit for the Adafruit shield http://www.ladyada.net/make/logshield/design.html.   The 74AHC125N  is a nice cheap part but a little more complex.


Mar 01, 2014, 01:46 pm Last Edit: Mar 01, 2014, 01:58 pm by pito Reason: 1
Probably with your shield and 4050...

You may try the resistive dividers as well (stick with the resistor values). The power consumption will be higher than with the buffer chips.



Great article,  I get a lot of mail about the LC Studio card.  It is one of the worst and now I have a link for replies.

Too bad the people that produce these cheap modules don't just use a buffer, in volume a 4050 SMD is $0.15.


It seems "it is the responsibility of the end user to decide on how the specific shield fits the purpose" :).
The "LC shield is ok" with 3.3V arduinos/clones. Maybe the happy users just replaced 5V regulator for 3V3 one on the arduino uno and they are happy with the LC shield now.
Frankly, I personally never had 5V system so the topics on the voltage level translators is something I do not care.. :)


Mar 01, 2014, 02:47 pm Last Edit: Mar 01, 2014, 03:03 pm by fat16lib Reason: 1
It seems "it is the responsibility of the end user to decide on how the specific shield fits the purpose" smiley.
The "LC shield is ok" with 3.3V arduinos/clones. Maybe the happy users just replaced 5V regulator for 3V3 one on the arduino uno and they are happy with the LC shield now.

This is true but the seller should not claim the module works on 5 V Arduino.  Most ebay ads have this statement:
Support 5V/3.3V input

Update:  One trend I like, is more products are combining an SD with some other function.

Here is a module I use when I need a display and SD http://www.adafruit.com/products/358.  $20 for a great 128X160 color display and SD.  This type product solves the voltage problem and sharing the SPI bus.

This class product seems to generally be well designed.


Mar 01, 2014, 03:02 pm Last Edit: Mar 01, 2014, 03:06 pm by pito Reason: 1
My personal remark to "4050" topic (maybe worth of rising it separately):
1. I would NOT recommend to use 4050
2. 3V3 Vcc is off the 4050 spec
3. 4050 is not intended for messing with SPI signals at 8MHz (50y old gadget)
4. the rising/falling times plus prop delay is not defined at 3.3V, but I would estimate (try to extrapolate from 5V numbers) it is bigger that the 8MHz clock period at 3.3V
5. it may not harm if driving something unidirectionally with it  - but you are reading the SPI with the same clock and MISO does not pass such "delay line" - so if the stuff works it is just a matter of luck
6. it originates probably from the author of 4k7/10k divider..
Worth of a measurement.. :)


None of the DIP buffers are great but the data sheets give times for 50 pf.  Transition time at 4.5 V and 50 pf is 7 ns but at 2 V it is 25 ns.  So what is the number for 3.3V and 15 pf?

They do work in the various modules that use them, probably due to less capacitance. Their key advantage is DIP.

I have never had a user contact me with problem with products that use them

Go Up