LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

USB with LABVIEW / VISA

Hi all,
 
I am a beginner in Labview. I had to develop a small prototype to read data from RS232. With VISA's functions and labview examples, everything worked fine.
 
Now I would like to interface some USB devices by using similar VISA's components. In order to acquire skills in USB programming, I would like to build a simple program which for instance would get information on a simple USB device (as a USB KEY, or a USB mouse...).
 
I already succesfully created specific visa drivers with the drivers wizard, installed them, see them with MAX.
 
I studied the LV examples USBRawControl.VI and USBRawBulkMain.VI. But I do not succeed in getting any results. I guess I enter the wrong parameters in the example. Can anyone explain me a bit more how it works ? Or give me a set of parameters to test the LV example and get any results ?
 
Thanks a lot.
 
Jérémy
 
 
0 Kudos
Message 1 of 4
(3,088 Views)

There is, imho, no such thing as a simple USB device. For example, the USB mouse will automatically install itself using the windows HID driver so that it can be used as a mouse and creating a VISA driver for it will be be fairly futile unless you get rid of the windows driver and that would not be a good thing. I don't know what you mean by a USB Key.

When a USB device is used that does not use one of the existing classes, you could create a VISA driver and use that instead of the driver that the vendor provides. You would however, need to get from the vendor a lot of details on the USB RAW communication protocol that they are using. This is difficult at times and every vendor is free to choose a slightly different protocol. The only time I've used USB RAW is when the USB device was something developed in house and I had all of the info I needed.

To get really experienced, you might want to see about getting a USB development kit where you have full control of the firmware at the USB side.

0 Kudos
Message 2 of 4
(3,081 Views)

Thanks for your quick answer.

1. When I write "usb key", I mean a USB storage device (sorry for my english !).

2. Could you give me some examples of informations I have to get from vendor (I can ask him) :

Protocol ? Packets (block, interrupt, control...) ?

Is there any international standard to ask and get data from usb device ?

In other words, what does look like a request to a vendor to develop an application with his USB device ?

3. Once again, my application is quite complex and I will have to get a detailled document on the device (it is a sensor) I want to integrate in Labview. But for the time being, I was looking for a quite simple example where I could plug a device and ask him for serial number, vendor ID, and so on... Just to have a practical view of the USB coding. Looking at the forum and internet, I am afraid it is utopic !

Thanks a lot anyway.

Regards.

Jérémy

0 Kudos
Message 3 of 4
(3,074 Views)

No, there is no international standard in order to get/receive data from a USB device. That's exactly the problem. How the vendor implements a USB serial adapter could be completely different than implementing a USB storage device.

You would need to ask the vendor about the data transfer mechanism - i.e. bulk or control pipe. Bulk is probably the simplest since you can just use a VISA Write or VISA Read so you would need a list of the commands to send and how the received data is formatted. This is what I used and since we wrote the firmware for the USB device, it was fairly simple. Look at the shipping example called USB - RAW Control to see how much information you need to read/write with this mechanism. If you got this to work, you would still need information on how to translate the control buffer data. I've never had to formally request this but you misght want to search the forum for posts regarding USB RAW to see if you can find more information.

If you are getting a commercial sensor, then it is very likely that they have a dll available that can be integrated into multiple programming environments. In most cases, this is a much better solution than trying to develop your own VISA driver.

0 Kudos
Message 4 of 4
(3,061 Views)