Shop OBEX P1 Docs P2 Docs Learn Events
Variations on fsrw — Parallax Forums

Variations on fsrw

oodesoodes Posts: 131
edited 2013-07-01 09:51 in Propeller 1
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

Comments

  • AribaAriba Posts: 2,690
    edited 2013-06-27 09:49
    Hello Des

    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
  • oodesoodes Posts: 131
    edited 2013-06-27 10:11
    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
  • lonesocklonesock Posts: 917
    edited 2013-06-27 10:52
    Just a quick note: since all copies of the FSRW object use the same block-layer driver cog, you will need to make sure that all calls to all FSRW objects come from the same cog. If different cogs need to access FSRW (and thus the block driver) you will need to modify the block driver to use a LOCK to guard access.

    Jonathan
  • oodesoodes Posts: 131
    edited 2013-06-27 11:49
    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
  • lonesocklonesock Posts: 917
    edited 2013-06-27 13:33
    The most recent FSRW uses a block driver named "safe_spi.spin" by default. Note: if you add locks, make sure to unlock even when error conditions call abort.

    Jonathan
  • oodesoodes Posts: 131
    edited 2013-06-27 13:57
    Cheers Jonathan ,

    Alright sound yeah that's the driver I'm using, authored by your good self I see. :D
    Thanks for your help , looking forward to sorting this project out!

    Regards
    DEs
  • Cluso99Cluso99 Posts: 18,069
    edited 2013-06-27 20:29
    Kye's SD driver can handle 2 open files. There is an AppNote describing his driver.
  • oodesoodes Posts: 131
    edited 2013-06-30 00:35
    Wouldnt mind having a look at that, but cant find it on the object exchange. You have a link for it?

    Cheers

    DEs
  • PublisonPublison Posts: 12,366
    edited 2013-06-30 03:40
    oodes wrote: »
    Wouldnt mind having a look at that, but cant find it on the object exchange. You have a link for it?

    Cheers

    DEs
    The Application Note and files are over at Parallax Semiconductor

    http://www.parallaxsemiconductor.com/an006

    Also in the OBEX at:


    http://obex.parallax.com/object/16
  • oodesoodes Posts: 131
    edited 2013-06-30 04:41
    Cheers for that,

    Thanks

    Des
  • oodesoodes Posts: 131
    edited 2013-07-01 09:51
    lonesock wrote: »
    Just a quick note: since all copies of the FSRW object use the same block-layer driver cog, you will need to make sure that all calls to all FSRW objects come from the same cog. If different cogs need to access FSRW (and thus the block driver) you will need to modify the block driver to use a LOCK to guard access.

    Jonathan

    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
Sign In or Register to comment.