Forum Index
ZBasic O-O Example: VDrive Class

 
Author Message
dkinzer
Site Admin


Joined: 03 Sep 2005
Location: Portland, OR

Posted: 03 February 2010, 22:15 PM    Post subject: ZBasic O-O Example: VDrive Class

The attached file contains the definition of a class to manage an FTDI VDrive2 module. The class implements a familiar "file system" interface to the content of the USB memory stick, allowing you to open/create files and then read/write/seek the files. Multiple files may be open at once.

The vdrive.bas module contains a simple test driver that will display the directory listing of the drive.



vdrive.zip
 Description:

Download
 Filename:  vdrive.zip
 Filesize:  6.53 KB
 Downloaded:  97 Time(s)

Back to top
twesthoff



Joined: 17 Mar 2006
Location: Virginia, USA

Posted: 03 February 2010, 22:50 PM    Post subject: ZBasic O-O Example: VDrive Object

Have you done any tests concerning the maximum sustained write speed with one file open? Two files open?

On 2/3/2010 5:15 PM, Files wrote:
Quote:
The attached file contains the definition of a class to manage an FTDI VDrive2 module. The class implements a familiar "file system" interface to the content of the USB memory stick, allowing you to open/create files and then read/write/seek the files. Multiple files may be open at once.

The vdrive.bas module contains a simple test driver that will display the directory listing of the drive.



- Don Kinzer





Attachments:
vdrive.zip

Back to top
dkinzer
Site Admin


Joined: 03 Sep 2005
Location: Portland, OR

Posted: 03 February 2010, 23:20 PM    Post subject: Re: ZBasic O-O Example: VDrive Object

twesthoff wrote:
Have you done any tests concerning the maximum sustained write speed with one file open? Two files open?
No. It's going to be fairly slow. The serial interface essentially has to be run at 9600 baud (the VDrive's default rate). Although you can tell the device to switch to a different rate, there is no way to tell it to revert to the default rate other than by cycling its power. This deficiency causes a problem if the ZX is reset (therefore assuming the default speed) and the VDrive's speed was previously changed but it hasn't been power-cycled. I suppose that you could try sending commands at different rates until you hit upon one that returns a correct response.

The VDrive itself actually only allows one file to be open at a time. The way that the class achieves the multi-file capability is that it actually keeps the files closed, opening ta file for an operation and then closing it again. These extra commands further tax the throughput. If one only needed the capability for one file open at a time, the class could be modified to keep a file open until it is explicitly closed. The class could also be modified to operate in the "always open" mode unless multiple files were opened at one time.

The VDrive is documented to support an "SPI" interface. Although the signals of the interface are reminiscent of SPI, the timing and data interchange is nothing like any SPI device I've seen. I did try to get it to work by bit-banging the interface and had some limited success. The VDrive seemed to get into strange modes where it woudn't respond to a sequence as it had just a short time before. Unfortunately, FTDI's support department was of little help. When I asked for example code they gave me SPI interface code for a completely different device.
Back to top
twesthoff



Joined: 17 Mar 2006
Location: Virginia, USA

Posted: 03 February 2010, 23:27 PM    Post subject: ZBasic O-O Example: VDrive Class

Thanks Don,
I appreciate your work in this area...
Tom W

On 2/3/2010 6:20 PM, Files wrote:
Quote:
twesthoff wrote: Have you done any tests concerning the maximum sustained write speed with one file open? Two files open? No. It's going to be fairly slow. The serial interface essentially has to be run at 9600 baud (the VDrive's default rate). Although you can tell the device to switch to a different rate, there is no way to tell it to revert to the default rate other than by cycling its power. This deficiency causes a problem if the ZX is reset (therefore assuming the default speed) and the VDrive's speed was previously changed but it hasn't been power-cycled. I suppose that you could try sending commands at different rates until you hit upon one that returns a correct response.

The VDrive itself actually only allows one file to be open at a time. The way that the class achieves the multi-file capability is that it actually keeps the files closed, opening ta file for an operation and then closing it again. These extra commands further tax the throughput. If one only needed the capability for one file open at a time, the class could be modified to keep a file open until it is explicitly closed. The class could also be modified to operate in the "always open" mode unless multiple files were opened at one time.

The VDrive is documented to support an "SPI" interface. Although the signals of the interface are reminiscent of SPI, the timing and data interchange is nothing like any SPI device I've seen. I did try to get it to work by bit-banging the interface and had some limited success. The VDrive seemed to get into strange modes where it woudn't respond to a sequence as it had just a short time before. Unfortunately, FTDI's support department was of little help. When I asked for example code they gave me SPI interface code for a completely different device.



- Don Kinzer




Back to top
Display posts from previous:   
Page 1 of 1

 



ZBasic Microcontrollers Home
All content Copyright © 2005, 2006, 2007, 2008, 2009, 2010 Elba Corp. All Rights Reserved.
Opinions expressed in posts are those of the author and not necessarily those of Elba Corp.
Powered by phpBB © 2001, 2005 phpBB Group