LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

USB Raw Bulk communication

You do need to be very knowledgeable regarding the USB device itself if you are communicating to it via RAW, and also just to check with you - be sure that the device itself is in RAW format and not FAT16/32 or NTFS. Also does the device show up in MAX correctly?

Regards,

 

Rob W

National Instruments

Application Engineer

 

Applications Engineer
0 Kudos
Message 11 of 19
(3,498 Views)
"You do need to be very knowledgeable regarding the USB device itself if you are communicating to it via RAW"

Please expand on this.  I thought RAW (outside the Test and Measurement class) was very much dependent on the USB Device itself........

What does RAW have to do with NTFS or FAT?  They're file systems.  USB is a data sommunications protocol.  I don't see the connection.

Shane.
Using LV 6.1 and 8.2.1 on W2k (SP4) and WXP (SP2)
0 Kudos
Message 12 of 19
(3,489 Views)

Well the device being used in a pen drive, in order to get this recognized with the program he is wishing to use the format of the drive must be RAW, and the drivers for it built as per the knowledge base, and will therefore show up in MAX as well.

Rob W

National Instruments

Application Engineer

Applications Engineer
0 Kudos
Message 13 of 19
(3,484 Views)
I'm sorry, I don't mean to be rude, but what does the file system formatting of a pen drive have to do with low-level USB communication..... ("format of the drive must be RAW").

Is there something else I need to know about USB communications that I've missed in my search?

"
and the drivers for it built as per the knowledge base".  Can you elaborate on exactly which knowledgebase you're referring to?

I'm confused.

Shane.
Using LV 6.1 and 8.2.1 on W2k (SP4) and WXP (SP2)
0 Kudos
Message 14 of 19
(3,471 Views)

Hi All

Can any one briefly explain what is the exact difference between USB Raw Bulk commnucation and USB Raw Control commnucation? when to go for which?( I know it is application specific but some more clearly with any example or situation.).

My application is to send and receive commands to and from a USB Raw device(just like serial communication). Can u suggest for which communicaton i had to go for?

Thanks

Kiran

0 Kudos
Message 15 of 19
(3,450 Views)
Hi,
 
Apologies for the late reply. USB RAW bulk communication basically sends a bulk of data to the device without creating any connection orientated mechanism inside the kernel, it does however allow greater access to the lower level functions. Control mode will create what's called an URB inside the kernel to setup some connection orientated system between you and the device. If you want to read/write similar to serial communication then I would suggest keeping with RAW.
 
It was posted earlier in the forum by another member,
 
Regards,
 
Rob W
National Instruments
Application Engineer
Applications Engineer
0 Kudos
Message 16 of 19
(3,443 Views)
I think if the device is responding to RAW communication (VISA Read or Write) then this is the easiest way to do it.

If the device does not respond this way, or the communication is not working, then Control in and Control out may be neccessary.  This will then require quite detailed knowledge of the inner workings of the device.

Shane.
Using LV 6.1 and 8.2.1 on W2k (SP4) and WXP (SP2)
Message 17 of 19
(3,440 Views)
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 AM

Message Edited by pille3256 on 12-14-2007 05:23 AM
0 Kudos
Message 18 of 19
(3,334 Views)

Sorry,

I forgot to mention.

A great book on how to programm and access USB mass-storage-devices in general is given by "USB Mass Storage, designing and programming devices and embbeded hosts" from Jan Axelson, who seems to be the ultimative USB-guru. The book helped me a lot!! 

0 Kudos
Message 19 of 19
(3,329 Views)