LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Send a class specific request using VISA on a USB device

Hi all,
 
I had some posts previously but I guess it is better to start a new one. I am not a USB expert thus please excuse some of the words I use to describe my problem ! 🙂
 
Context :
 
I would like to develop my own acquisition software with a usb device. I guess this device is USBTMC compliant because when I look at the device manager, it is recognized as a HID.
 
I do not know exactly all the protocol but it looks quite simple (even if USB nevers seems to be simple...)
 
What I have done :
 
I got vendor ID and Model ID, I built the VISA drivers and my device is now recognized as a NI VISA usb device. When I execute Labview Examples (raw usb communication), I am able to open it, see it in the rolling list, thus I guess I built my drivers correctly.
 
In order to understand how does the device work, I have used a "USB data transfer spy software" and I have run the official device acquisition software. Then I observed a sequence of measurement transfer commands :
1. a class specific request (Host -> Client) :
     Destination : Interface, Index 0
     Request : 0X9
     Value : 0X200
     Send 0X40 bytes to the device
  => I guess this is the way the host asks to the client to send a measure
 
       I also have the exact values of the bytes sent to the device.
 
2. a control transfer (Client -> Host) with a setup packet = 21 09 00 02 00 00 40 00 (which is ALWAYS the same)
  => I guess this is the way the client explains to the Host how it will send the data
 
3. A Bulk or Interrupt transfer : Looking at the bytes received, I can see the measurement value ! This is coded in hexa format but I easily found out where was my interest.
=> I guess this is the data packet
 
4. A Bulk or interupt transfer (Host -> Client)
=> I guess it is the way Host says it received well the data and asks for the device to stop sending data.
 
What I would like to do :
 
Assuming I have well understood usb protocol, I would like to build my application. Using the examples, I have build an application which works as following :
1. Open a VISA session with USB VISA device
2. Send a Control request
     - Request Type : 0
     - Request : 9
     - V alue : 200
     - Index : 0
3. Read a Bulk Transfer using a VISA READ
 
Obviously it does not work and I do not understand why !
 
Here is a list of my questions :
1. I assume that my device is USBTMC compliant because it is detected by windows as a HID device when I use the acquisition software. Correct ?
 
2. Is there a simple way to test my NI VISA drivers are OK using LABVIEW and not MAX. I mean a simple program to send an ID request, then receive the request and display the id number ? Or something more simple as a connection test ?
 
3. Looking at specific class request in USB protocol, I found that these requests were control request. As a consequence, I consider that the "class specific request" is a control transfer. Correct ? Moreover, it really looks like a "GET_REPORT" or similar request...
 
4. Is it correct to follow the steps I described for my Labview Application ? Do I need to set times to wait for the device answer ?
 
5. The USB spy software also gives me the information "pipe handle" as an adress. I do not understandd what is the purpose of this.
 
That's it ! Sorry for the long long post but it looks like a tricky problem, at least for me ! Thanks for any help you can provide.
 
Regards.
 
Jérémy
 
 
 
    
0 Kudos
Message 1 of 4
(3,679 Views)
Hi,

1. I assume that my device is USBTMC compliant because it is detected by windows as a HID device when I use the acquisition software. Correct ?
It seems to be according to your reasoning but to be sure you should check hardware and protocol specifications.

2. Is there a simple way to test my NI VISA drivers are OK using LABVIEW and not MAX. I mean a simple program to send an ID request, then receive the request and display the id number ? Or something more simple as a connection test ?
I advice you to check the built-in examples included in LabVIEW. You will find them in the menu help --> Find examples.
 
3. Looking at specific class request in USB protocol, I found that these requests were control request. As a consequence, I consider that the "class specific request" is a control transfer. Correct ? Moreover, it really looks like a "GET_REPORT" or similar request... 
4. Is it correct to follow the steps I described for my Labview Application ? Do I need to set times to wait for the device answer ? 
5. The USB spy software also gives me the information "pipe handle" as an adress. I do not understandd what is the purpose of this.
Well I am not an expert in USB protocol and the fact is this protocol is not pretty easy to understand and the technical specifications take entire books... What I suggest is that you gather a maximum information about all of this and then go back to the forum and DevZone to find the answers to more specific points. Concerning your LabVIEW application architecture you shall find basics and helpful examples in the location I told you.

Good luck!


Regards,
Matthieu B.
NI France

Cordialement / Regards, Matthieu B. @ NI France.
0 Kudos
Message 2 of 4
(3,653 Views)
HID does not equal TMC. They are two completely different classes.
0 Kudos
Message 3 of 4
(3,650 Views)

Hi,

First, I agree that HID is not TMC. My device is HID compliant. Sorry Dennis.

On my problem, I had a wider look in the forum and I found some posts of people who writes they communicate with an HID device using HID.dll functions. It seems by this way, you can get some basic information as attributes, feature report, and so on...

Thus my question is : What do you think of this way to communicate with a usb device ? Do you think HID.dll contains enough functions to perform a basic read/write data on a usb device ?

Obviously, it is an open question. What appends in my mind is to get a report as rich as i can of the feature and try to find the information i need in the output report. Moreover, if this technique is successfull, no need to communicate in a "raw mode" with usb. Stupid way of considering the problem ? 🙂

Thanks anyway for your previous answers, this forum is really helpful.

Jérémy 

 

 

 

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