comp.lang.labview
[Top] [All Lists]

Re: USB Raw Bulk communication

Subject: Re: USB Raw Bulk communication
From: pille3256
Date: Fri, 14 Dec 2007 05:40:07 -0600 CST
Newsgroups: comp.lang.labview

Hi!
 
First of all I want to underline that I am not an USB neither a NI-VISA 
expert. Despite of that I have worked on both issues and therfore have 
some experiences about it.
 
 
Assumed that you have  created an *.inf file with the help of the VISA 
Driver Development Wizard and your device was successfully detected by the 
Measurement&Automation Explorer,
then you can open a ViSession in your program using the functions 
viOpenDefaultSession/viOpenSession. (I think you've done that)
 
Okay, if you want to access an USB Mass Storage device using the USB RAW MODUS, 
you have first of all to read the USB Interface Descriptor. Related to USB 2.0 
specification a Mass-Sotrage-Device itself and it's protocols (how to access 
the storage-sectors) are defined in this Interface Descriptor. For all new 
devices of that class it is recommended to use the Bulk-Only-Transport (BOT) 
protocol and the SCSI-transparent command set (that is actually how the sectors 
are read/written). In order to get the Interface Descriptor you have to send an 
USB standard request (GET_DESCRIPTOR) via the viUsbControlIn function. How 
to fill the setup-packet for that request you can find out in the USB 2.0 
specification inside Chapter 9.
 
Assumed that bInterfaceSubClass = 06h (SCSI command set) and bInterfaceProtocol 
= 50h (Bulk-Only-protocol) you can now use the SCSI-commands to access the 
device. Due to the BOT the SCSI-commands must be specified inside a 
Command-Block-Wrapper (CBW, defined in BOT). These CBWs are sent to the device 
by using viWrite. Receiving the requested data (e.g. after sending the 
SCSI READ10 command) and the Command-Status-Wrapper (CSW) is done by the 
viRead-function.
 
In order to get things working it is most probably that you have to read some 
chapters of the USB specifications. It is not as complex as it seems to be, I 
promise;-) Using the NI-VISA-library you will save a lot of time, because it 
will do much of the protocol stuff for you (e.g. TOKEN Packets, error 
cheking and handling, enumeration process is done by Windows, etc.) If you had 
to write an embedded host for your pen-drive it would be much more work to 
do......
 
Of course that is only a short and not completed description how to access 
a mass-storage-device e.g. a pen-drive using NI-VISA, but may be it will give 
you a short impression how to do it.
Hope it helped a little!
 
 
@  Rob : I think too, that RAW has nothing to do with the FAT-filesystem, 
it is just the level (low level usb communication) on which to communicate 
with the device. You should be able to communicate with device no matter what 
the format of the file-system is.
 
Regards,
pille
 
 Message Edited by pille3256 on 12-14-2007  05:20 AMMessage Edited by 
pille3256 on 12-14-2007  05:23 AM

<Prev in Thread] Current Thread [Next in Thread>
  • Re: USB Raw Bulk communication, pille3256 <=