Go Down

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


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


If you want fat support, couldn't you theoretically throw it on the first portion of the SD card itself and then access it that way? I'm not intelligent enough to implement such a thing, but I thought I'd throw it out there. Would you have to modify the Arduino bootloader in order to get it to read a sketch from a foreign memory source? Is it even possible?


Hi Charlie - your uFAT library looks interesting, but I haven't been successful with it so far.

Has anyone else gotten it working?

I have an SD setup just as described at the top of this thread. I am able to demonstrate 'raw' SD I/O successfully using the SD raw library and the demonstration sampling app with two different SD cards.

I have downloaded and built mmc1.rar and it compiles and upload successfully. You don't directly state the pinouts, but they appear the same as the schematic above from the code. It correctly detects the presence of the SD card (or its removal), but it never gets past mmc::initialize.

I'd love to get this working - any ideas for me to try?

Thanks, harry


Mr. Orange-

I had no trouble getting your code up and running in 15 minutes - happily logging, saving, and reading the input to analog1.

However, after hitting the arduino reset button, I found that the read function returns junk(from the SD card).

Shouldn't the SD card retain data after a power cycle? or, is it a function of the code that you so nicely supplied to get me started - and I just don't understand it, yet?


Hi - I wanted you to know that I got the mmc1.rar code for uFAT working, just as advertised. My problem was that a makeshift 3.3v supply from a voltage divider seemed to work for the raw SD write, but not for the full uFAT mmc code.  

I cobbled together a 'real' variable power supply capable of producing 3.3v from http://www.ladyada.net/library/equipt/diypsupp.html, which worked flawlessly and the uFAT code worked correctly.

A few 'tricks':

Your card must be formatted FAT16, not FAT32. Under windows, if you see FAT32 and FAT, the 'FAT' is FAT16 and the partition must be less than 2G.

It hasn't been explicitly mentioned but the wiring for uFAT is indeed the same as the raw SD write above.

The demonstration file that uFAT writes to is fred.txt . If you just create fred.txt in windows be sure you really get fred.txt and not fred.txt.txt!  If necessary, enter the command shell and mv fred.txt.txt to fred.txt.

To answer ducttapepro6, I verified that the newly written files are 'static' on the SD card using uFAT as one would expect.

Go Up