Pages: 1 ... 4 5 [6] 7 8 ... 13   Go Down
Author Topic: SD card read/write with Arduino  (Read 105517 times)
0 Members and 1 Guest are viewing this topic.
0
Offline Offline
Jr. Member
**
Karma: 1
Posts: 79
Combat, please!
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

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
Logged

Bonn, Germany
Offline Offline
God Member
*****
Karma: 2
Posts: 903
View Profile
WWW
 Bigger Bigger  Smaller Smaller  Reset Reset

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 ><
Logged

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

Bonn, Germany
Offline Offline
God Member
*****
Karma: 2
Posts: 903
View Profile
WWW
 Bigger Bigger  Smaller Smaller  Reset Reset

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 ><

« Last Edit: February 15, 2009, 03:20:29 pm by Nachtwind » Logged

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

Millicent, South Australia
Offline Offline
Newbie
*
Karma: 0
Posts: 40
Arduino rocks
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

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! smiley)

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.
Logged

JB

Bonn, Germany
Offline Offline
God Member
*****
Karma: 2
Posts: 903
View Profile
WWW
 Bigger Bigger  Smaller Smaller  Reset Reset

wow, thats been exactly it smiley-mad)

Finally i can save stuff smiley-mad)))
Logged

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

Millicent, South Australia
Offline Offline
Newbie
*
Karma: 0
Posts: 40
Arduino rocks
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

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
Logged

JB

Raleigh, NC
Offline Offline
Jr. Member
**
Karma: 0
Posts: 75
View Profile
WWW
 Bigger Bigger  Smaller Smaller  Reset Reset

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/
Logged

Bonn, Germany
Offline Offline
God Member
*****
Karma: 2
Posts: 903
View Profile
WWW
 Bigger Bigger  Smaller Smaller  Reset Reset

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.
Logged

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

Raleigh, NC
Offline Offline
Jr. Member
**
Karma: 0
Posts: 75
View Profile
WWW
 Bigger Bigger  Smaller Smaller  Reset Reset

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

0
Offline Offline
Jr. Member
**
Karma: 1
Posts: 79
Combat, please!
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

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 smiley-wink 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 smiley 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  smiley-razz



Logged

0
Offline Offline
Jr. Member
**
Karma: 1
Posts: 79
Combat, please!
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

@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' smiley

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  smiley-grin
Logged

Bonn, Germany
Offline Offline
God Member
*****
Karma: 2
Posts: 903
View Profile
WWW
 Bigger Bigger  Smaller Smaller  Reset Reset

hehe, nice idea ^^

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

Logged

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

0
Offline Offline
God Member
*****
Karma: 0
Posts: 572
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

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!
Logged

Bonn, Germany
Offline Offline
God Member
*****
Karma: 2
Posts: 903
View Profile
WWW
 Bigger Bigger  Smaller Smaller  Reset Reset

... or simply pushing the most needed infos to the playground?
Logged

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

Raleigh, NC
Offline Offline
Jr. Member
**
Karma: 0
Posts: 75
View Profile
WWW
 Bigger Bigger  Smaller Smaller  Reset Reset

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

Pages: 1 ... 4 5 [6] 7 8 ... 13   Go Up
Jump to: