Need help writing to SD card
bulkhead
Posts: 405
I couldn't find a single good source of info on how to do it (I tried the Object Exchange, forum search, search.parallax.com). If there is such a source, could someone point me to it?
So far, I have unsuccessfully used the pinout shown on the Propeller Cookbook (image attached) and the "fsrw.spin" object (attached) with the pin connections shown in "sdspiqasm.spin" (with the exception that I used 1kR instead of 20kR). I then attempted to run it with the code from this post: http://forums.parallax.com/showthread.php?p=746399
The result was the program hung up on the line
and my PC no longer "sees" the SD card when I plug it in. I had just formatted the SD card and verified that it worked with the PC before I attempted the write, so the propeller definitely did something. Is it a software/hardware problem?
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
I'm new to the propeller!
So far, I have unsuccessfully used the pinout shown on the Propeller Cookbook (image attached) and the "fsrw.spin" object (attached) with the pin connections shown in "sdspiqasm.spin" (with the exception that I used 1kR instead of 20kR). I then attempted to run it with the code from this post: http://forums.parallax.com/showthread.php?p=746399
The result was the program hung up on the line
sdfat.mount(0)
and my PC no longer "sees" the SD card when I plug it in. I had just formatted the SD card and verified that it worked with the PC before I attempted the write, so the propeller definitely did something. Is it a software/hardware problem?
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
I'm new to the propeller!
Comments
you might check out the following link for some basic code that gives an example of how to set up an SD program from SPIN. One of the examples (Simonl's) simply calls some of the software available on the Object Exchange, "fsrw and friends." It's very basic but gives you an idea of where to start. His particular example writes files in CSV format.
http://forums.parallax.com/forums/default.aspx?f=25&m=288797
{Edit note: I just noticed that this is the part of the forum you already tried. Hmmm.... and you did verify that the card was okay before using it on the Prop. Well, in that case you might be in the same boat I am with a mystery of how my software, which calls up fsrw, etc. is completely trashing my SD cards. In that case, I should like to invite you to join in on an on-going discussion on the forum at
http://forums.parallax.com/forums/default.aspx?f=25&m=294690 }
Make sure all of the objects that are called by fsrw, etc are in your Propeller folder or on your Propeller IDE when you download it so they, too, will get downloaded into the Prop.
As for your PC no longer seeing the SD card, it's possible that because the files on the SD card weren't closed out properly when you ran the Propeller, the PC doesn't see the card. I had the same problem when I started out with SD cards and my program wasn't yet operating properly. Your bad software writes garbage to the SD card and the garbage smells bad to the PC. I had to try plugging the card into my SD adapter and then plugging the adapter into the computer. Sometimes I had to do that several times before it showed up. You might have to use something like Norton's Disk Doctor, etc. before you can see it, too, if things got really bad. After unsuccessfully running a card on your Propeller - even if only once - you will probably have to reformat the SD card so your Propeller can work with it. It's a bummer when having to do that after every debugging operation, but after a while you will develop a technique that you can do in your sleep. Sooner or later, you will get your software to close out the files properly and it won't be a problem, hopefully.
Hope that helps,
Mark
Post Edited (ElectricAye) : 9/20/2008 2:17:06 AM GMT
Actually I just realized I haven't been using the latest version of fsrw. Apparently it didn't come up when I searched the Object Exchange for "SD card" since it is listed in full as "secure digital card". I will give it a try. For future reference fsrw can be found here: obex.parallax.com/objects/92/
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
I'm new to the propeller!
Use something that is a "known" working software solution like FemtoBASIC to do
your hardware testing, then move forward once you know thats working..
Otherwise, you'll be removing handfuls of hair.. [noparse]:)[/noparse]
OBC
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
New to the Propeller?
Getting started with a Propeller Protoboard?
Check out: Introduction to the Proboard & Propeller Cookbook 1.4
Updates to the Cookbook are now posted to: Propeller.warrantyvoid.us
Got an SD card connected? - PropDOS
I've been using an SD socket "breakout board" I bought from Sparkfun.com. It has solder holes for the various lines DO, DI, CLK, etc. See....
http://www.sparkfun.com/commerce/product_info.php?products_id=204
As far as schematics go, I used the same schematic and resistors as shown in the wiring diagram at the top of the sdspi object which I think came with "fsrw and friends." I have attached a scan of it for your convenience.
hope that helps,
Mark