LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

How can I use LabVIEW to communicate with TI DLP using USB RAW?

I need help using LabVIEW to communicate with a TI DLP Lightcrafter 4500 unit using USB.I am not very familiar with USB protocol, however, after reading the DLPC350 Programmer's Guide, I know USB control of the DLP unit is possible using USB. In the past I was successfully able to use I2C protocol to communicate with the DLP using LabVIEW and Arundio. However, now I would like to learn how to use USB instead of I2C.

 

I used the USB Instrument Control Tutorial guide to setup the USB RAW drivers so it can be recognized by NI-VISA. I was able to successfully setup the drivers and get the devices to be recognized as a VISA Resource. Now I am using the example VI, "USB RAW - Control.vi" to communicate with the DLP unit (screenshot below). However, I am really confused on what I have to do with this example VI.

usb-control-example-vi.png

 

I read page 9-10 of the DLPC350 Programmer's Guide which explains the USB read/write transaction sequence. However, I am still not understanding exact what values I have to configure in the USB RAW - Control.vi to successfully control the DLP unit. Below is a screenshot of an exaple command reference to read the current power state of the DLP unit or to write (change) the current power state of the DLP unit. Using this example USB command reference, how can I use LabVIEW to control the DLP using USB?

 

dlpc350-command-ref-power-control.png

0 Kudos
Message 1 of 9
(3,521 Views)

Well the USB raw communication you want to use is at the lowest USB protocol level possible. Your device however uses USB HID, which is a higher level protocol to transfwer byte streams between the device and host controller. Basically what you are missing is the specification of the USB HID protocol that defines over which endpoints the actual communication has to occur and in which operation mode.

 

Endpoints are internal ports on the lowest USB protocol level. A device can have one or more endpoints and each endpoint can be associated with control transfers or data transfers and data transfers use either bulk, interrupt or isochronous transfer mode and are unidirectional. A control transfer endpoint is mandatory for any device and the rest is optional and the different USB classes like USB HID, USB COMM, USB Mass Storage etc. define more specifically what type of endpoints are supposed to be supported and in what way.

 

So you would need to get somewhere the specification of how USB HID is specified to use one or more endpoints to transfer the actual data to and from the device. Alternatively you could try to use a HID DLL interface and skip the VISA USB Raw business.

Rolf Kalbermatter
My Blog
0 Kudos
Message 2 of 9
(3,474 Views)

According to this link HID uses a control endpoint to control certain basic settings in the device and interrupt endpoints for data transfer. This document basically describes the missing information between what is described in the TI document and what is needed for the VISA USB Raw device access.

 

But I'm not sure how VISA USB Raw allows to access Interrupt endpoints (or isochronous ones). It may be that it doesn't!

Rolf Kalbermatter
My Blog
0 Kudos
Message 3 of 9
(3,471 Views)

Given that @roflk mentioned that HID uses control endpoint, then how can I use the example USB RAW - Control.vi to communicate with the DLP? I am unsure if this helps, but I found that DLPC900Programmer's Guide has better elaboration and example of how one can use HID to communicate with the DLP. Even if I use USB HID, where can I find LabVIEW examples to do this? It seems other have also requested examples using HID.

 

Honestly I don't have a strong understanding of USB protocol or a background in computer engineering or programming in C. I tried to read about USB protocol on multiple websites, however, I am not understanding how can I translate that into implementation of the communication in LabVIEW with the command reference table provided in the DLPC350 Programmer's Guide .

 

Currently I am using I2C to communicate with the DLP. However, I was able to successfully do this because LINX had great examples, LINX - PmodTMP3.vi, on how to implement I2C. I cam not finding any good examples for USB.

0 Kudos
Message 4 of 9
(3,438 Views)

VISA USB RAW has no support for Isochronous transfers.

0 Kudos
Message 5 of 9
(3,422 Views)

@Intaris wrote:

VISA USB RAW has no support for Isochronous transfers.


 

That's not really a problem since HID devices do not use isochronous endpoints. They do however have a mandatory interrupt in endpoint and an optional interrupt out endpoint for data transfer. While interrupt in is specifically supported in VISA with the USB Raw Interrupt Event, interrupt out needs to be kind of tricked by assigning the according endpoint identifier to the USB Bulk out VISA attribute and doing a normal VISA Write. That's at least what I saw in some USB examples. That of course doesn't really answer the ops question what values to assign to the different parameters of the USB Control Out function and I wouldn't know it myself as I haven't done that yet. The problem most people have is that they think that USB is similar to I2C or RS-232 for instance. The reality however is that it is a lot more complicated. I2C for instance has two speeds and a pretty well defined single protocol. USB defines in itself only the physical interface and a very low level and complicated infrastructure to transport different kind of data packets over that interface. It's the specific definition of the different device profiles on top of that which define in more detail how the data is transfered, and a virtual serial port interface has a very different device profile than a mass storage device, or a webcam, just to name a few. USB Raw supports this lowest level specification and not fully as it doesn't allow for isochronous data transfers just to name one thing.
Rolf Kalbermatter
My Blog
0 Kudos
Message 6 of 9
(3,417 Views)

I know, but you raised the question in a previous post. Just clarifying.

 

Should have referenced your text, sorry.

 

I've done USB Nuggets in the past. I'm mildly familiar with the ins & outs of the USB protocol and standards.

0 Kudos
Message 7 of 9
(3,406 Views)

@Intaris wrote:

 

I've done USB Nuggets in the past. I'm mildly familiar with the ins & outs of the USB protocol and standards.


Yes I'm aware of that, and my comments were not directed at you at all. Smiley Very Happy

But I have read comments in linked threads about how it is "hard to understand" that there are no ready made examples how to use USB raw communication when it is so "simple" to create working I2C communication.

Rolf Kalbermatter
My Blog
Message 8 of 9
(3,396 Views)

No worries.

 

There are days I regret ever writing about USB communications in LabVIEW. I mean, I think it's cool and all, but it's very far removed from GPIB..... Smiley Very Happy

0 Kudos
Message 9 of 9
(3,389 Views)