Writing and Reading SD/MMC cards
El Paisa
Posts: 375
Is there a program to perform operations such as write, read, create directories, open files, etc for the Spark Fun breakout SD/MMC cards?
Comments
Just received mine in the mail today...
fred2
At present it does not support subdirectories.
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
Paul Baker
Propeller Applications Engineer
Parallax, Inc.
Post Edited (Paul Baker (Parallax)) : 2/26/2007 9:24:40 PM GMT
Note that it does not support MMC at this point.
I have a new project where I need to have two or more, but probably just two, files open for reading simultaneously but repeatedly at random times. This is for an exhibit where pushbuttons will play WAV sounds.
Do you think it would be hard to modify your code for this?
I've group the variables that are per-file, so it should not be *too* hard to make it work with multiple files. I am
undecided on exactly how to approach this though. Let me think about it just a little bit.
Note that the SD support is slower than what you might be used to on a PC; playing a WAV should be possible,
but playing two WAVs simultaneously (assuming 44.1KHz 16-bit stereo samples, so that's 176KB/sec with
enough buffering to overcome jitter, *each*) might be pushing it. I mean, I am sure it is possible, but
you will have to be careful.
If you are willing to prepare the card carefully, by formatting it fresh, then writing each file in order (to
guarantee each file is fully sequential), you can eliminate all the file system overhead and just go straight to
the lowest level block reading code; that would probably be the easiest way of doing what you want, but
again, it would only work if you prepared the card in that way. If you did this, you would start by opening
each file in turn, and then get (with a new routine) the block offset of the first block, and the total file
size, of each file into an array. Then you would just read blocks off the low level card.
This would also be a very simple modification to what exists.
But let me know in more detail what your requirements are and I'm sure we can get it to work. In
particular, I can make the block read code faster than it currently is if you are willing to give up a bit
more code space.
If you use one of the compression codecs people have posted on this forum, you might be able to do it
more easily, but certainly I'd just start with WAVs and see what happens.
SDRW.spin·works perfectly with my setup, BTW femtobasic (any version) does not, shows a error message "can't mount the SD".
·
I would like a program to open/close files, create directories, create files, open and close files, etc.
For the Demo board the SD Card uses pins 0..3, ProtoBoard uses pins 8..11, and Hydra uses pins 16..19
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
Mike
SPI mode is a bit slower than the alternative "multi-bit" mode, and somewhat less flexible, but the advantage is that only four I/O lines are needed, mult-bit modes need a lot more I/O pins.
Mahjongg
I tried your objects for reading/writing SD cards. I is a really great work !
It add a great value for the Propeller.
Congratulation and thank-you.
dro.
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
in medio virtus
prewritten pieces all ready to go.
Any chance to add a "append" to the "read, write" file operations?
The version I have does not , may be I have an outdated file.
I just downloaded the latest object file and works...