Shop OBEX P1 Docs P2 Docs Learn Events
FSRW buffer size — Parallax Forums

FSRW buffer size

William50William50 Posts: 22
edited 2015-04-13 21:51 in Propeller 1
I am writing files that are typically 17k - 30k in size. Currently I am writing blocks of 512 to the sd card at a time and have adjusted the FSRW buffer size accordingly.

Is there a more efficient way to do this? Such as writing larger chunks at a time?

Comments

  • Mike GreenMike Green Posts: 23,101
    edited 2015-04-13 08:43
    FSRW and other SD card drivers write blocks of 512 bytes at a time to the SD card. Even if you write larger amounts of data, this gets broken down into 512 byte blocks. There are other ways to transfer data to and from the SD card, but you'd have to write your own driver for this and pre-allocate file space so you're not really using the DOS file system which is based on 512 byte blocks.

    Consider switching to this (http://obex.parallax.com/object/16) SD card driver which is a little faster than FSRW, particularly if you're writing 512 byte blocks aligned on a 512 byte file boundary. It's a little bigger than FSRW, but you can leave out the pieces that you don't need for your application.
  • RaymanRayman Posts: 14,665
    edited 2015-04-13 09:44
    Faster than FSRW, really? Last I heard that driver had a lot more features than FSRW, but was slower...
  • William50William50 Posts: 22
    edited 2015-04-13 17:17
    Thanks for the replies.

    I do have one other issue with FSRW.

    I can not consistently get a return value whenever I invoke a command such as: error=sdpwrite(@buffer,n)

    Shouldn't the variable "error" have a return value indicating whether the operation was successful?
  • Tracy AllenTracy Allen Posts: 6,664
    edited 2015-04-13 21:51
    PUB Pwrite(ubuf, count) : r | t
    {{
    ' Write count bytes from the buffer ubuf. Returns the number of bytes
    ' successfully written, or a negative number if there is an error.
    ' The buffer may be as large as you want.
    }}
Sign In or Register to comment.