LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Commands to FTDI virtual COM port via NI VISA interfere with communication with FTDI chip using D2XX drivers

Solved!
Go to solution

Hello!  

 

I am trying to communicate with a DLP Design module DLP-USB1232H which uses an FTDI chip.  My program uses the D2XX drivers.  It works, but...

 

In another program that runs at the same time, I'm communicating with another instrument via a virtual COM port (VCP) that uses an FTDI UART.  In this program, I use the VISA Serial Port functions.  It works, too, but...

 

The first program has the capability of listing all the FTDI devices in the system prior to choosing the right one to communicate with.  When the VCP is plugged in, it lists it (FT232R USB UART) along with the DLP-USB1232H and communication with the latter device works.   But as soon as the second program sends a command through the VCP, the first program no longer "sees" any FTDI device.  It stops working.

 

I have tried 2 different FTDI VCPs; one a standalone cable and the other built in to the instrument.

 

I’m using Windows 7 32-bit.  My programs are both LabVIEW 8.5 executables. 

 

Is VISA "taking over" the channel to the DLP-USB1232H?  Does someone who understands NI's implementation of VISA have any ideas on why VISA is doing this?  Or if something else is going on?

 

I'm also interested in workaround ideas.  I've tried a "Prolific" VCP, but most drivers don't work and the one that doesn't give an error in Device Manager doesn't communicate with the instrument.  

 

Cheers


Halden

0 Kudos
Message 1 of 15
(6,309 Views)

Hi Halden

 

Does both programs start running at the same time?

 

Maybe when you list all the devices is opening and reserving the ports, but in order to really be sure could post or attached some screenshots of your code, where we cans see how are you listing your devices and handling the port.

 

Regards

Esteban R.

0 Kudos
Message 2 of 15
(6,278 Views)

I changed the D2XX drivers to include error-checking. Those drivers use the dll. The can "Open Device by Index". When more than one FTDI chip is present, you might need to use a different index. Perhaps iterate over "Number of Devices" in "Create Device Info List".

0 Kudos
Message 3 of 15
(6,264 Views)

Hi Esteban and Todd

 

Thanks for taking the time to comment on this.

 

No, both programs don't have to start at the same time.  I usually start the program with D2XX first and the one that communicates on the VCP second.  They both run fine, until the second program actually starts using the VCP.

 

I use the function FT_Get_Device_Description_by_Index.  I start with index 0 and keep incrementing the index until nothing comes back or the DLP-USB1232H comes back.  Before the other program starts using the VCP, this works, listing the FTDI UART for index 0 and the DLP-USB1232H for index 1.  But when the other program starts talking on the VCP, this function returns nothing.

 

Cheers


Halden

0 Kudos
Message 4 of 15
(6,262 Views)

How about "Open Device by Serial Number"?

0 Kudos
Message 5 of 15
(6,256 Views)

Halden,

 

It really sounds like you have a resource conflict. That occurs when two programs or parts of programs try to use the same device or port at the same time.  Your Get Device Function probably tries to open a session with each port (as you increment the index). When it hits a port which is being used by the other driver, it cannot open the session and stops working? Have you examined the errors returned by each program? The VISA drivers will return an error when the port is in use.  I do not know about your program or drivers, but I would expect some kind of error.  Automatic error handling in LabVIEW will not catch errors from a driver if it does not translate them to LV error clusters. So do not count on automatic error handling, if you use it, to display all possible errors.

 

Lynn

0 Kudos
Message 6 of 15
(6,252 Views)

I'm looking for a workaround now to communicate with this device using VCP.  In other systems, I am able to use multiple FTDI USB-Serial adapters at once and they don't interfere.  I won't be able to have the benefits of the D2XX drivers, but at least I might be able to get something to work.  The trouble is, I can't find the VCP command set for this DLP-USB1232H device.  Using D2XX drivers, I send 2-character ASCII strings to set the various bits, and this works until the other program starts talking to the other device on VCP.  But when I send these same strings to the device as a VCP, nothing happens.  I'm guessing that when using VCP, I'm in serial mode so the parallel mode bit settings aren't possible.  Is that right?

0 Kudos
Message 7 of 15
(6,251 Views)

Hi Todd

Thanks for that suggestion.  I'm trying it now.  In getting serial number by index, the first unit reports serial number DPVOBDOVA.  The next one I have reports serial number DPVOEI5QA.  So it looks like they have unique serial numbers - darn!  But now I'm going to try see if it will report serial numbers when it won't report descriptions...

Halden

0 Kudos
Message 8 of 15
(6,245 Views)

I don't know, but that sounds reasonable.

 

Lynn

0 Kudos
Message 9 of 15
(6,244 Views)

Hi Lynn

Thanks for that explanation and suggestion.  When there's a VCP UART in the system, it tends to show up in response to index 0.  So I'll next try to skip index 0 when asking for descriptions and see if index 1 reports itself when not preceded by an index 0 enquiry.  Looking at the point of ports being open from the perspective of the second program, do you suppose the NI-VISA program might be opening various ports it finds and leaving the port to the DLP-USB1232H open though not using it?

Halden

0 Kudos
Message 10 of 15
(6,243 Views)