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