Go Down

Topic: SD card read/write with Arduino (Read 115332 times) previous topic - next topic

sirmorris

Hi

I always reach for this diagram:
http://www.interfacebus.com/Multi_Media_Card_Pinout_MMC.html

SI on the diagram  =  arduino MOSI
SO on the diagram  =  arduino MISO

I always ground pin6 even though it says NoConnect.

So wire it like so:

sdCARD    ARDuino
1         10
2         11
3         gnd
4         +3v3
5         13
6         gnd
7         12


It looks like a great harness you've got there but I suspect that the little legs aren't making a good contact with the socket. Try making a plug-in board - you'll use it over and over.

When it comes time to attach it to protoboard I usually bend the little pins down a bit and use them to locate to the card solidly. I tack them, then solder the tabs at the sides to lock the holder in place. As you might expect really.

Check out some of the photos on a few of the posts on my blog, especially http://arduinonut.blogspot.com/2008/09/lash-up.html and http://arduinonut.blogspot.com/2008/09/programmer-redux.html

Test your wiring by writing a sketch to make all of the signal lines high, measure them (without a card in place!!) and then make them low, measure again. Test for shorts.  

I hope there's something here that helps.

Charlie

Nachtwind

Thank you, that sure was helpful, but my first thought that it might be really damn simple to connect a card to the arduino is more or less destroyed. If i look at your pics, especially those close-ups of your shield makes me realise that i need more than a few pins and cables to connect the card to the arduino.. do you have a schemata of what is connected what way to what else? I ask becuase this looks much different to what i have seen in the first post of this thread... and i am quite confused now ><
Believe me, Mike, I calculated the odds of this succeeding against the odds I was doing something incredibly stupid[ch8230] and I went ahead

Nachtwind

#77
Feb 15, 2009, 09:13 pm Last Edit: Feb 15, 2009, 09:20 pm by Nachtwind Reason: 1
Alright, after builidng it like done on the first post but using the same pins as in your post i was finally able to get to the point that the Serial window says: Done!

Unfortunately 'Done' is not exactly anything.. although it finds the file (or not) nothing is written into it ><

SDCard is formatted in FAT with 2GB Space - everything that is on it is just the 0byte data.txt

*edit* sectorsavailable() return 0
*edit2* you may chose to ignore the whole post.. somehow it seems my SD card is done with the world ;0) - it cant be written with anything ><

Believe me, Mike, I calculated the odds of this succeeding against the odds I was doing something incredibly stupid[ch8230] and I went ahead

JB

I had to 'fill up' my data.csv file with junk data so that it was bigger than 512 bytes before it would write anything. One of the sketches which was presented in this post recommended at least 15kb file size; having a data.txt file of 0 bytes would lead to sectorsavailable() returning 0 & there being not enough space in the file to write any data. As I understand it, you will only be able to write data to the file up until the original file size; more data will NOT increase the file size as required, it will just fail to write to the file.  (I think - sirmorris will correct me if this is wrong! :))

Try making your file larger... fill it with anything you like as it will be overwritten anyway. You could even take any other old .txt file & rename it if you wanted, saves the hassle of making stuff up!

Hope this helps,

JB.
JB

Nachtwind

wow, thats been exactly it :0)

Finally i can save stuff :0)))
Believe me, Mike, I calculated the odds of this succeeding against the odds I was doing something incredibly stupid[ch8230] and I went ahead

JB

Hooray - I've been able to give something BACK to the forums instead of just using everyone else's knowledge!!

Glad it's working for you!!

JB
JB

JustinHoMi

Quote
if you just want to log data (and not necessarily read it) i have an sdlogging library that saves to fat16 formatted SD cards.  i use it to log GPS & sensor data: http://www.ladyada.net/make/gpsshield/download.html


Is anybody using this library? It overcomes some of the limitations of the libraries everyone is discussing here.

I came across this one too, which supports fat32 and sdhc: http://code.google.com/p/wavehc/

Nachtwind

I have played arround with LadyAdas code for a while, but as i was not able to set up the wiring right for it i could not really test it.. but what i noticed was quite a big overhead.. if i remember right it took quite a bunch of space on the arduino.. yet it seemed really good from its limitation/options.
Believe me, Mike, I calculated the odds of this succeeding against the odds I was doing something incredibly stupid[ch8230] and I went ahead

JustinHoMi

Is the wiring not the same as the others? I haven't taken time to examine the schematic yet.

sirmorris

Hi all.

I'm back from a short break - I'm glad to see things happening.

The wiring should be the same for the ladyada code - the arduino's hardware SPI support works on a certain set of pins only. I tried my code out on a ladyada GPS board at dorkbot London a few weekends ago and it worked without modification.

As for using the ladyada code 'to get around the limitations of uFat' - well we're going full circle ;) uFat is my way of getting around the limitations of having very little RAM and flash left after using the full FAT library..!

If your sketch is quite small and you can use the more fully featured library then I would suggest doing so as it makes your life really easy! uFat was designed for situations when this isn't quite the case :) I've traded simplicity for RAM. A full sketch of uFat, MMC & deviceprint will use under 5k. You have to make compromises - this is a classic trade-off!

The DevicePrint code will work with anyone's library. You do need the arduino IDE version 0012/0013 though.

@JB - you're spot on. The file needs to be stuffed beforehand. And contiguous! Else strange results are going to happen  :P




sirmorris

@NachtWind -

Quote
If i look at your pics, especially those close-ups of your shield makes me realise that i need more than a few pins and cables to connect the card to the arduino..


The board there 'has a lot more than the requisite 6 resistors and a regulator' :)

It also has a monostable multivibrator to drive an LED which flashes when there's a positive transition on the clock line.  That accounts for about 6/7 components  :D

Nachtwind

hehe, nice idea ^^

Well, i got mine to work at last and thats more than i had ever expected ;0)

Believe me, Mike, I calculated the odds of this succeeding against the odds I was doing something incredibly stupid[ch8230] and I went ahead

trialex

Awesome!

Can I make a request?

It would be awesome to have a single post that has a schematic, a link to the library, and a small example sketch.

That way everyone could be confident they are on the same page.

Thanks again for everyone's efforts!

Nachtwind

... or simply pushing the most needed infos to the playground?
Believe me, Mike, I calculated the odds of this succeeding against the odds I was doing something incredibly stupid[ch8230] and I went ahead

JustinHoMi

Has anybody experimented with higher/lower resistor values in the voltage divider?

Go Up