I've only had time this morning to quickly compile & try bobemoe's Print_Data example, but I can see that it's EXACTLY what I was after. I should be able to incorporate this code to 'format' the data stream in the most user-friendly way possible, which will make life so much easier for my workmates (and me!).
I'll be away from my computer today so I won't be putting much time into this, but in the next couple of days I'll let you know exactly how things have gone.
Charlie & bobemoe - you're work here will be extremely valuable to many others like myself I'm sure; we can't thank you guys enough.
Oh, one last thing - Charlie, did you have any thoughts on why my RTC data is being 'corrupted'?
I've looked at the code and there are a couple of things that I'd like to go over with you - as they're application specific maybe you should PM me and we'll take it offline via email. We can post final findings but the interim comms might be a little noisy for this topic.
Kind-of, and no. The library is intended for tight memory situations where you are willing to accept limitations in usage. uFat allows you to find the starting sector and length of a file on a fat12 or fat16 formatted device.
You can then read data from and write data to those sectors. It doesn't understand the filing system more than it needs to, which in this case is only reading the boot sector, partition table and directory.
A few posts ago bobemoe posted code to use the Arduino library print routines to output strings to an mmc card. I've spoken with him and used his code as a basis for DevicePrint. It has been modified to fit my usual criteria - small & tight with few (if any) dependencies.
Get it herehttp://arduinonut.blogspot.com/2009/02/libraries.html along with some of my usual written drivel about whatever and stuff.
Commentary and questioning welcomed as usual. Enjoy.
After numerous emails, pulling of hair & re-writes, sirmorris has helped to get my SD card logging dreams up & running. You can get the 'final' sketch here: http://docs.google.com/Doc?id=dqhc6fg_0gmk96kdd. It's certainly not the prettiest sketch, and I can't claim much of it at all as my own work, but it does what I hoped it would (although real-world testing hasn't happened yet).
Hi Sirmorris.. unfortunately i dont have much luck compiling your code - i am using 011 of the IDE with a 328 Chip..
Errors are:
In file included from C:\Documents and Settings\Administrator\Desktop\arduino-m328-win_current\arduino-0011-m328\hardware\cores\arduino/WProgram.h:6,
from DevicePrint.cpp:1:
c:/documents and settings/administrator/desktop/arduino-m328-win_current/arduino-0011-m328/hardware/tools/avr/lib/gcc/../../avr/include/avr/signal.h:36:2: warning: #warning "This header file is obsolete. Use <avr/interrupt.h>."
In file included from DevicePrint.cpp:3:
/DevicePrint.h:20: error: expected class-name before '{' token
23: error: microfat2.h: No such file or directory In function 'uint8_t proxyWriter(const uint8_t*, long unsigned int, uint8_t)':
In function 'void setup()':
It also looks from this error that the mmc, microfat and deviceprint folders haven't been copied to the folder
arduino-00XY\hardware\libraries
which is where they should live.
I hope the upgrade won't cause you too many problems, but there are issues with some sketches - the libraries changed significantly during the 11-12 transition. You can keep both versions side-by-side though, so if you have a problem sketch just compile it under 0011. For all new work, start out in the 0013 IDE.
If you do need to port code then the rule seems to be - if it's an .h file then add
well... i thought it had to do with 0011.. alright.. so i upgraded.. lets see if it works now ;0)
So far it compiles and runs - did i miss something or do you use the same wiring as on the first post shown? Either that has changed or my Card reader is not soldered properly ><
Hey guys, I've been following this very helpful thread but haven't made much progress. I've figured out it's not detecting the card is in since I get STA_NOINIT and STA_NODISK from the MMC init function. I'm using the 012 arduino software.
I've measured the pins with a multimeter and I suspect one of the ground pins isn't connected quite right. So I was wondering how you guys have it hooked up? I bought just the SD card holder and stuck a breakaway thing with the side with the long pins going in to the holder and wires soldered to the short pin side as shown below. I'm using a seeduino which has a 3v3 switch and it's hooked according to the diagram in the OP.
edit>oh right and the question: how do you guys have your card holder hooked up? Is there a better way of doing it? I could have gotten the card holder with a pcb soldered on from sparkfun but it was $15 but I want to use it in a final pcb design too. If nothing works I guess I'll have to suck it up and buy that sd holder board.
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.
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.
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 ><
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 ><
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!