Variations on fsrw
oodes
Posts: 131
Hello All,
Is there any variations on fsrw out there that can talk to multiple files on an SD card. I'm currently running 3 fsrw's talking to 3 different files on an SD card which is using 3 cogs. I'm now in need of another cog and another fsrw to talk to another file but I have no spare cogs. Is there any object that can talk to multiple files or an object that will rename a file that is on the SD card. I am emailing a logfile that is on the sdcard . While Im emailing I write to a temporary logfile and transfer the contents of the temporary logfile into the original after the email has taken place. If I could rename the temporary logfile instead of transferring it I might be able to get away with not using another cog .
Thanks
Des
Is there any variations on fsrw out there that can talk to multiple files on an SD card. I'm currently running 3 fsrw's talking to 3 different files on an SD card which is using 3 cogs. I'm now in need of another cog and another fsrw to talk to another file but I have no spare cogs. Is there any object that can talk to multiple files or an object that will rename a file that is on the SD card. I am emailing a logfile that is on the sdcard . While Im emailing I write to a temporary logfile and transfer the contents of the temporary logfile into the original after the email has taken place. If I could rename the temporary logfile instead of transferring it I might be able to get away with not using another cog .
Thanks
Des
Comments
I think FSRW 2.6 can handle multiple open files. You need to include a separate instances of the object, for every file you want have open at the same time.
FSRW does not reserve another cog for every instance, it always uses only one cog (in addition to the Spin-cog) for the low level SPI driver. All instances access the same SPI driver
Even the Spin code exists only one time in memory if you have several instances of the driver. All what is allocated multiple times is the VAR section. The variables are unique for every instance (including a 512 byte sector buffer).
Why do you need to rename the files? What you describe can be done with 2 files, If you record to file 1 you can send file 2, if sent you close file 1 and file 2, and then open file 1 for sending and file 2 for recording. Next time you record again to file 1 and send file 2, and so on..
Andy
Cheers for that, Thats exactly what I was after. Was unsure if the separate instances used multiple cogs. The idea of renaming the file was just a back up plan to having 2 files open at the same time. Thats pretty much what i'm doing at the minute, Im using the Cinterion Mc55i to email the file but for some reason the email cog hangs up at a certain (same)instance and the moment I power down the email cog releases and im assuming its due to the fact that other cogs have been released.
Thanks for clearing that up for me, I can investigate some other areas
Take it Handy Andy
Des
Jonathan
Thats interesting you should say that. Now that you mention it , 3 of the instances I call the FRSW are in the same cog but the 4th one (which is causing me some problems ) I'm calling is from another cog causing some random errors but I think you hit the jackpot there. Pardon my ignorance but where is the block driver located?
Yours Gratefully
Des
Jonathan
Alright sound yeah that's the driver I'm using, authored by your good self I see.
Thanks for your help , looking forward to sorting this project out!
Regards
DEs
Cheers
DEs
http://www.parallaxsemiconductor.com/an006
Also in the OBEX at:
http://obex.parallax.com/object/16
Thanks
Des
Went at that today Jonathan , putting the locks on seems to have done the trick , eradicated some big problems I was having. Still a couple of small bugs to sort out but working well all the same I must say. Cheers for the help Lads , been driving me nuts for a while that
Des