(several...) SD just, simply, not working! [SOLVED, tnx fat16lib]

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 :slight_smile: 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:
http://forum.arduino.cc/index.php?PHPSESSID=cb2ocm9h166jhq2fi366rgfdf7&topic=218098.0
http://forum.arduino.cc/index.php?topic=144813.0

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? :slight_smile:

[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! :slight_smile:

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.
http://code.google.com/p/sdfatlib/

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.

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..
    :stuck_out_tongue:

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... :cold_sweat:

Thank you!

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

LC studio Sdcard shield.jpg

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 Data-Logger Shield for Arduino. The 74AHC125N is a nice cheap part but a little more complex.

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.

SDcard dividers.jpg

pito,

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.. :slight_smile:

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 1.8 Color TFT LCD display with MicroSD Card Breakout [ST7735R] : ID 358 : $19.95 : Adafruit Industries, Unique & fun DIY electronics and kits. $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.

@fat16lib:
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.. :slight_smile:

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

My remark is related to "4050" - the old cmos one. The 74HCT and friends are an another story.
Thanks for clarification..
:wink:

Found the 4050 "fix" prototype. This is with the a 1k resistor to the 50 ohm terminator. Remember my scope is old and has a 2-3 ns rise time. I set the scope at 20 X

TEK0005.JPG

Wow. Thank you guys for the overnight support!

Pito, apparently the current schematic is pretty much what you've posted. I found this very picture too, but my limited knowledge doesn't let me to confirm to be the carbon copy of my current board. Seems real close, though. :sweat_smile:
I've also got the idea of buffering, but it's probably beyond my current project, time and capabilities.
Thank you fat16lib for information, too.

Having seen the schematics and components you both recommended, though, while I agree that it's everyone's responsibility to decide what one's need to fit his/her purpose as a newbie I still hold a very straightforward unanswered question (definitively unasked :)) that I believe others might be advantaged as well:

"Which cheap and easy to be handled by software SD module would you guys recommend to start with an Arduino UNO board? Does truly the Adafruit Assembled Data Logging Shield worth those $5 more of the Arduino board itself?"

I might sound cheap, but the Raspberry PI, although a different device, seems to me a better bargain with included SD and pin in/out. Now, shoot on me :slight_smile:

[for the records: the SD module has been trashed]

Here is a cheap card that seems to work. It has level shifters. I worry about sharing with other SPI devices since I think it buffers MISO and may not release MISO when chip select goes high.

http://www.ebay.com/itm/Micro-SD-Storage-Board-Mciro-SD-TF-Card-Memory-Shield-Module-SPI-For-Arduino-D9-/370990470595?pt=LH_DefaultDomain_2&hash=item5660c155c3

If you are using only the SD on SPI is works. Some of these cards have a newer version /date so may be different.

On my way 8)

Thank you, I'll try once it gets here...