SD Card access problem
Pyrotom
Posts: 84
I have used Tom Rockiki's fsrw object quite successfully in a number of my objects to read files from an SD card. But now I'm faced with a problem which may be in my understanding of Spin objects, or may be a problem with fsrw. Or may just be me... The situation is this: I have two objects, both of which use fsrw to read files. They both work fine independently. But when I try to call both of them from a higher level object, only the first one called works. The things I would try in other languages would be to "unmount" the SD card after each use to free it up for later objects, or create the fsrw object in my high level object, mount the SD card there, and pass a reference to it down to my lower level objects to use. But I can't do the first because fsrw does not have an "unmount" method, and I don't know how to do the second, or even if it is possible.
Comments
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
Paul Baker
Propeller Applications Engineer
Parallax, Inc.
As Paul mentioned, you have to be careful when the objects involved execute on different cogs. This isn't the only way objects are used though.
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
--Steve
If someone wants me to modify fsrw so it can be called from different objects within the same cog,
that would not be too difficult (of course only one file can be open at a time right now).
The original poster appears to simply need it to work from different objects within the same cog;
is this correct?
-tom
You can get it from harrisonpham.com/embedded/PropTCP/beta/fstest4.zip. It should be a drop in replacement for fsrw (I also added an unmount method). The file fstest.spin has an example on how to open multiple files at once (the demo just copies a file byte by byte).