Instrument Control (GPIB, Serial, VISA, IVI)

cancel
Showing results for 
Search instead for 
Did you mean: 

usb communication

I'm trying to use USB communication in VISA for the first time.

I'm using a device for which I already have device drivers and a DLL.  This works fine.  I am also able to interrogate the USB communication using SnoopyPro.

I have implemented the VISA driver using the VISA device driver wizard, and it seems to be up and running.  I can also access the USB attributes programatically.

My problem is getting even the simple exchange in the picture to run in VISA.  I have never programmed USB before, so I may be a bit lost.....



Can someone tell me how to implement this simple exchange in VISA.  I know it requires using the "VISA USB Control out" and "VISA USB Control in" VIs, but I've no idea what to wire where.....

Thanks for every piece of helpful information, no matter how small.

Shane.

Message Edited by shoneill on 10-18-2007 12:40 PM

Using LV 6.1 and 8.2.1 on W2k (SP4) and WXP (SP2)
0 Kudos
Message 1 of 7
(4,885 Views)

Hi shoneill,

If you have the driver dll for your device, why would you create a new one?

I would just call the functions in the dll to communicate with the instrument.

Creating your own usb driver requires deep knowledge about usb specs and standards.

Below a link to another discussion about creating your own usb driver.

What kind of device would you like to communicate with?

Evrem

0 Kudos
Message 2 of 7
(4,850 Views)
0 Kudos
Message 3 of 7
(4,851 Views)
I know the route over the DLL works.  I've been using this for a few years now.

It's not about the ability to use the device, it's about learning how to interface over USB......  I want to solve the problems because I want to learn how to use USB RAW communications.

As you have seen, I am able to capture the appropriate information when using the DLL driver.  I want to be able to re-create this in LabVIEW to do away with the DLL.

I have since found trhe USB 2.0 specification and have printed what I think are the most applicable parts.  I was unaware as to how complex USB communication can be, but I really want to be able to get this up and running.

If anyone has any clues (The values associated with certain standard commands would have been a good starting point - I've found these in the USB Spec eventually) I^m more than glad to hear them....

Shane.
Using LV 6.1 and 8.2.1 on W2k (SP4) and WXP (SP2)
0 Kudos
Message 4 of 7
(4,847 Views)
I'm getting a bit further in my quest (whether it's crazy or not). I've read a bit of the USB 2.0 spec, and have found out the following. In order to perform a GET_DESCRIPTOR_FROM_DEVICE command (Used during USB initialisation AFAIK) I need: bmRequestType = 10000000 (binary display) whereby bit 1 denotes data transfer direction "device-to-host", bit 2&3 represents Type "Standard" and bits 4 to 0 represent "Device". bRequest = 6 (GET_DESCRIPTOR) wValue = high byte = 1 "DEVICE", low Byte = 0 (Descriptor index) wIndex = 0 ? wlength = ? I don't see a wlength input.... Is this derived from the size of the "Write Buffer" wired? I've played a bit with various possibilities (wiring "Write buffer with varying lengths of U8 arrays from 0 to 72 bytes long....) I keep getting the error message shown in the picture (VISA:  (Hex 0xBFFF003D) Invalid buffer mask  specified.)..... What am I doing wrong? (The open VISA returns no error).



The USB sniffer program I have used does not give me the exact binary representation of the GET_DESCRIPTOR_FROM_DEVICE command, otherwise I could reverse-engineer the correct values quite easily...... Anyone help?

Message Edited by shoneill on 10-19-200704:06 PM

Message Edited by shoneill on 10-19-200704:06 PM

Message Edited by shoneill on 10-19-2007 04:07 PM

Using LV 6.1 and 8.2.1 on W2k (SP4) and WXP (SP2)
0 Kudos
Message 5 of 7
(4,841 Views)
I'm getting a bit closer to the problem (which means I have new problems),

If I use the code posted previously, I see using my USB sniffer that a GET_DEVICE_DESCRIPTOR request is carried out (as intended), and responded to.  The byte sequence (as much as the USB sniffer shows anyway) is identical to "normal" operation.

I also see that the DEVICE_DESCRIPTOR is only 4 bytes long (the third query since a USB reset).  The returned values are also equal to those returned during "normal" operation, so I'm retrieving the right values.

Problem is, I still get the "Hex 0xBFFF003D) Invalid buffer mask  specified" error at the "VISA USB Control Out".  I can connect any length buffer to the Control out, or connect nothing at all, I still get the same error. Anyone have ANY idea what's going on here?

Shane.
Using LV 6.1 and 8.2.1 on W2k (SP4) and WXP (SP2)
0 Kudos
Message 6 of 7
(4,766 Views)

Hi,

I do have the same problem. My Company needs to read every USB device independant to the operating system. Following that we need all the USB descriptors to start the connection and conversation with the different UUTs at the Teststation. If we do have all the descriptor data, connecting the UUTs isn't a problem. But we can't get our program to work to get the descriptors because of the same reasons.

Is there already a solution? Can sameone help?

 

Florian

0 Kudos
Message 7 of 7
(2,759 Views)