LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Connecting to USB devices with libusb-win32, is it possible?

That tutorial is a good jumping off point, life is good when it's an instrument like that but there has to be a more robust way to handle the odd situations.  For instance mine was a USB data transfer cable that I needed to send data out on the UUT and read it on the test system.  Windows has a signed driver for it and finding a way to bypass that is essentially impossible. 

When the device is linked to VISA it shows up in the device manager as a VISA device but when you get the properties is gives you the device cannot start error.  When you have this error the device is not even visible in VISA interactive control let alone MAX.  If it doesn't show up in MAX your up the creek! My biggest mission was to get it to show up in MAX as I've had other USB devices that once they're visible there presented no problem to control using VISA. 

As for the USB sniffers I Googled and tried to use them thinking I may be able to get some command line access to the program to catch my data within my test application.  After trying a few of them they are pretty buggy.  In fact several of the ones I encountered were last revised in 2001 or 2002 with notes saying that although untested they should work in Windows XP.  I had no luck.
0 Kudos
Message 11 of 29
(5,877 Views)
Shane: I look forward to your nugget.

Whenever someone wants to know about ports, I believe the classic source for engineers has been Jan Axelson's books (http://www.lvr.com).  She covers the hardware and software side of things.  Her books include coding examples, etc.  I have her "Serial Port Complete" 1st edition, but need to get the 2nd edition which includes USB, etc.  Maybe she could be of some help in pointing us in the right direction for getting this USB mess sorted out.  I imagine she would point us toward one of her books, but if that's what it takes...

- Brad

0 Kudos
Message 12 of 29
(5,855 Views)

Do any one have the solution to communicate to the libusb device from NI-VISA.

 In the Device Manager i am able to detect the device but it is not listed in the MAX devices.

  

0 Kudos
Message 13 of 29
(5,672 Views)
My final solution ended up being an executable (in C) that I called using LabVIEW.  Unfortunately there was no way I could find to get low enough to have LabVIEW get a crack at the device before windows hijacked it.  Using the system exec in LV I called my executable and was able to read my data back reliably.  You may want to look into that option, I spent almost a week trying to get it to work in LV with no luck, but don't let that deter your efforts.
0 Kudos
Message 14 of 29
(5,659 Views)

Vlnaran--

 

If you are looking to communicate/detect USB device, you'll need to start with a driver.  What you'll need to determine is if the device you have is a USB INSTR Class (USBTMC) device, otherwise you'll need to use USB RAW.  You can create your own driver using the VISA Driver Development Wizard.  Before the device will show in Measurement & Automation Explorer, the USB device will need to be associated with the NI-VISA developed driver.  I have linked the following DevZone and KnowledgeBase for your resource:

 

Developer Zone Tutorial: USB Instrument Control Tutorial

KnowledgeBase 1VCFFL3Y: What Is the VISA Driver Development Wizard?

 

Depending on the class of the device, the following KnowledgeBases will also serve as good information:

 

KnowledgeBase 321A2A2Y: What is USBTMC and How Can I Communicate to my USB Instrument Using NI-VISA?...

KnowledgeBase 325APJ2Y: How Can I Communicate With a Device Using NI-VISA USB Raw Mode?

 

 

Cheers!

--
Tyler C

0 Kudos
Message 15 of 29
(5,647 Views)

HERE is a link to my nugget on USB comunication with pure G.

 

Please note that USB communication is easier on MAc or Liunux because there's no need for the special "VISA RAW driver" step.  Makes getting up and running much easier for anyone who might have the choice.

 

Shane.

0 Kudos
Message 16 of 29
(5,637 Views)

NIDave, 

First i tried with calling a Executable from Labview and moved on to CIN [Compiling C cource code for Labview] and now i am trying to implement the C program in Labview since that would give me more flexibility to change the things.

 

Since in both implmentation the Executable and CIN i have some constraints.....

 

I am expecting to call a USB from VISA so that i can call the subfunctions from Labview and to make changes i can make changes in labview instead of changing the c code and then the labview code accordingly each time.

 

My USB device is listed in the Device manager but not in the MAX devices.....That is the problem i am facing.

If this is not resolved ..i have to use the dll of the usb library ..have you tried that.

 

0 Kudos
Message 17 of 29
(5,626 Views)

Tyler C,

Thanks for the Links....

    My PC [Win 2000] is able to detect the device in the Device Mangaer.

So i expected it to be USBTMC Device but it is not listed in the MAX devices.

 

Can you help me to fix what could be the problem ...if a device is detected in the PC and not able to detect in the Labview devices.

 

 

 

0 Kudos
Message 18 of 29
(5,623 Views)

Hey Vlnaran,

 I'm curious to know if the device can be seen in a VISA Interactive Control, which is located under Start>>All Programs>>National Instruments>>NI-VISA>>VISA Interactive Control.  If the device can't be seen there, then it won't show up in MAX.  This can occur if a VISA session cannot be opened for the device.  Thanks and have a great day!

David Pratt
Group Manager for Application Engineering Specialists | Automated Test
NIC
0 Kudos
Message 19 of 29
(5,571 Views)
One thing to note, I was able to get my device to show up in VISA interactive control and in MAX but Windows had hijacked it and I was unable to have access to control it.  For what it's worth I was using a USB to USB data transfer cable to monitor a "heartbeat" on my UUT.  Maybe that why Windows grabbed it, since it was designed as a XP to Vista transfer cable.  Maybe it recognized the PID and VID and wouldn't relinquish it.  I also contacted the vendor about being able to alter the PID and VID so that Windows wouldn't automatically grab it but that wasn't possible.  This may be an option on your device if you encounter the same hurdle. 
0 Kudos
Message 20 of 29
(5,562 Views)