Shop OBEX P1 Docs P2 Docs Learn Events
Help! FSRW: How to INTERFACE with it? — Parallax Forums

Help! FSRW: How to INTERFACE with it?

HarleyHarley Posts: 997
edited 2010-10-01 11:47 in Propeller 1
Who is making use of it? The source listing of fsrw does not make it clear HOW TO USE.

For instance, what are the VARs to use fsrw to connect one's code to it?

I think the documentation implies that one can use A0 for the basepin, and the following three then complete the electrical interface. Who has used fsrw? And how did you know how to make use of this object?

Does one have to provide a buffer RAM area? That is, what marks off the beginning and end of what is to be written to SD card? Is there assumed some sort of 'OS' which provides this info?

I feel like I have the main page missing from 'my documentation! The Spin files of fsrw don't make its use very clear. I don't seem to see the 'hooks' to interface with fsrw. This is totally new stuff for me.

Comments

  • lonesocklonesock Posts: 917
    edited 2010-09-29 16:48
    Hi. Sorry I did not reply to the earlier post.

    I have used FSRW. I am assuming you downloaded version 2.6 from the OBEX? Inside the zip there are 2 files you will want to look at: test.spin and serial_terminal.spin. Basically, you could use the object like this:
    obj
       sdfat: "fsrw"
       term : "FullDuplexSerial"
    
    CON
       _clkmode = xtal1 + pll16x
       _xinfreq = 5_000_000
       sd_DO = 0
       sd_CLK = 1
       sd_DI = 2
       sd_CS = 3
       
    pub demo  | retval
    
      ' start my serial engine
      term.start( 31, 30, 0, 115200 )
    
      ' start my SD engine
      retval := \sdfat.mount_explicit(sd_DO, sd_CLK, sd_DI, sd_CS)
      if retval < 0
        term.str( string( 13, "Failed to mount", 13 ) )
    
      ' open a file for writing, and write out the same string 100 times
      sdfat.popen(string("speed.tst"),"w")
      repeat 100
        sdfat.pputs( string( "Hi, there, write out this string.", 13 ) )
    
      ' close the file and unmount the SD card
      sdfat.pclose     
      sdfat.unmount    
    

    You _can_ have an external buffer, if you want. You can write or read one character at a time.

    hope this helps,
    Jonathan
  • Mike GreenMike Green Posts: 23,101
    edited 2010-09-29 16:55
    You're making it much harder than necessary. The buffers and other necessary variables are internal to the object as is true of almost any object. You don't have to mess with them.

    As is true of any object, the interface (to your program) is defined by the public (PUB) methods. Look at the comments associated with each PUB function. These are:

    release
    unmount *
    mount_explicit
    mount *
    pflush
    pclose *
    setdate
    popen *
    get_filesize
    pread *
    pgetc
    pwrite *
    pputs
    pputc
    seek
    tell
    opendir
    nextfile
    getclustersize
    getclustercount

    At a minimum, you need the starred methods to mount the SD card, open a file, read or write the file, close the file, and unmount the card. The comments in the FSRW source file are pretty straightforward.
  • HarleyHarley Posts: 997
    edited 2010-09-29 17:34
    Thanks to lonesock and Mike,

    I now see I failed to mention I wish to display results on a 4.3" LCD. So somehow I need to change the FDS input/output to my LCD display driver and from my on-screen 'keyboard'.

    Mike, I will study the * starred methods to get things working. Hopefully I'm not expecting too much from fsrw to run with this LCD approach. I was looking for a hand held configuration. So far there seems to be no problem with RAM usage; that is when I compile. Not sure what all actual usage requires. I'm too 'green' with SD card use. So not sure how I'll be getting files ONTO the SD card in the form needed.
  • Cluso99Cluso99 Posts: 18,069
    edited 2010-09-29 22:11
    Take a look at PropDos and PropCmd as they use a version of FSRW to do some basics.

    Probably KyeDos could also help.
  • HarleyHarley Posts: 997
    edited 2010-10-01 11:47
    Cluso99, thank you for that info. I did download PropCmd to see what that was providing. Unfortunately it used FDS. I was hoping someone had interfaced with a LCD. I'm aware there might be much more displayed on a monitor than a smaller LCD. But PropCmd might be quite useful if I can i/f the LCD and on-screen keyboard to it.

    The 4.3" LCD is 480 x 272 pixels, thus 30 x 17 tiles and Parallax font uses two rows, thus only 7 lines of text, and 30 char/line is limiting. But I still want to go with the LCD just to learn 'stuff'. Like how painful is it really to go so limited. Probably depends on the application.

    I just got the SD card pcb wired up today. So now I can begin to debug that h/w too.
    Take a look at PropDos and PropCmd as they use a version of FSRW to do some basics.

    Probably KyeDos could also help.
Sign In or Register to comment.