Go Down

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

bobemoe

#60
Feb 03, 2009, 05:44 pm Last Edit: Feb 03, 2009, 05:45 pm by bobemoe Reason: 1
Good point. I guess it is the little things that count when you only have a little processor and memory ;)

The library is updated with that change.

Thanks again.

JB

You guys are AMAZING!!  :D

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

Thanks again everyone!!

JB
JB

sirmorris

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.


acquisition

Is there any hope on getting the read from SD to work?

sirmorris

Hi

Reading from SD is a solved problem. The discussion happening here was to do with a specific problem sketch.

Charlie


acquisition

#65
Feb 09, 2009, 06:46 pm Last Edit: Feb 09, 2009, 06:50 pm by acquisition Reason: 1
But does it read/write FAT? Will it be added to the official Arduino library page?

sirmorris

Hi

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.

In most cases this has been quite enough for me!

Charlie


sirmorris

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.

C

Nachtwind

wow,that looks very interestering, gonna have to finish soldering my sd card thingy ;0)

Anyway - is there a chance you could also write a function for reading stuff from an uFat File?
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

Hi again everyone!

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

Here's a photo of my current test setup...

Needs a LOT of work before it's ready for final implementation!!  ;D

Please feel free to suggest code improvements/rip my sketch to shreds - I'm no programmer, I've got thick skin, and any help is greatly appreciated!!

One last thanks to sirmorris & bobemoe for their work here - it's amazing how generous you've been with your help & knowledge.

I'll pop a note in here when I get something up in the exhibition area.

JB.

JB

Nachtwind

Hi Sirmorris.. unfortunately i dont have much luck compiling your code - i am using 011 of the IDE with a 328 Chip..

Errors are:
Code: [Select]

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()':
Believe me, Mike, I calculated the odds of this succeeding against the odds I was doing something incredibly stupid[ch8230] and I went ahead

sirmorris

#71
Feb 13, 2009, 03:49 pm Last Edit: Feb 13, 2009, 03:51 pm by sirmorris Reason: 1
As it stands the libraries don't compile under 11 - the Print functionality hasn't been abstracted from the serial library in this version.

You'll need to upgrade to version 0013. http://arduino.cc/en/Main/Software.

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

#include <WConstants.h>

and if it's a cpp file, add

#include <WProgram.h>

Good luck. If you need any help just yell.

C


Nachtwind

#72
Feb 13, 2009, 04:08 pm Last Edit: Feb 13, 2009, 04:42 pm by Nachtwind Reason: 1
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 ><
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

Just for the record - everything is working fine with 0012. Will upgrade to 0013 soon to keep up with the community!
JB

omikun

#74
Feb 15, 2009, 02:23 am Last Edit: Feb 15, 2009, 03:48 am by omikun Reason: 1
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.



Any help would be great!
Thanks!

Go Up