LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

USB trigger no device

Solved!
Go to solution

Hi, I'm trying to output a trigger for synchronising an oscilloscope with some labview motion control.

Can I control a USB port (simply turn on/off the voltage in one the pins) with labview?

 

0 Kudos
Message 1 of 18
(3,081 Views)

Do you want to do anything else with the USB connection?

 

If not, the simple solution is to break out the data wire and connect it to a digital (or analog) output pin on a DAQ device and toggle it using e.g. DAQmx, an Arduino and serial commands, whatever.

 

If you do need working USB communication to the device, then I'd look for commands you can send to trigger the behaviour. It might be you could use the same messaging protocol as in your (in this case) hypothesized connection to activate triggers. It's also reasonably likely that you can use the USB-RAW behaviour and write a message, even if it will be ignored, knowing that it will flip the data line repeatedly (but you'd have to know the behaviour of the receiver in that condition).

 

 


GCentral
0 Kudos
Message 2 of 18
(3,044 Views)
Solution
Accepted by topic author mlars

No.

 

USB is not like a serial port. The actual hardware pins are not exposed.

 

The USB controller chip has a defined interface and then controls the pins itself. I know of no USB controller which gives any kind of user access to the hardware pins themselves.

0 Kudos
Message 3 of 18
(3,032 Views)

Can you recommend a different way to do it? (if you have an example with a different port?)

0 Kudos
Message 4 of 18
(3,010 Views)

I do not need to connect anything else to that usb port. So there is no device to initialise the port. On the outside I would simply cut the usb cable and 2 of the wires to a bnc.

0 Kudos
Message 5 of 18
(3,008 Views)

It will depend on your trigger speed and how tightly synchronized it has to be with your other hardware. One of these little multifunction devices might work.

 

https://www.ni.com/en-us/shop/select/multifunction-io-device?modelId=124894

0 Kudos
Message 6 of 18
(3,007 Views)

@mlars wrote:

 

Can I control a USB port (simply turn on/off the voltage in one the pins) with labview?

 


Not in a way that would allow such an operation! The USB port (we leave away USB-C for now as that has several extra lines for super extra high speed data and high current power supply lines) is a complex interface with a Ground, +5V, and two data lines. But these data lines are not your standard bit bang DIO lines and neither standard serial port data lines. There is an entire signaling protocol running on these lines that is specified by the USB standard. To get this protocol right there needs to be a pretty complex protocol engine that handles all the correct signaling. Except with some low level bit bang implementations on low cost 8 bit CPUs you have simply no direct access to the USB pins as the protocol engine that is implemented in the USB controller is an independent dedicated controller engine that sits between the host and the USB pins and isolates the pins fully from the host interface. Theoretically there is a possibility to maybe switch off the 5V power supply line but that are controller specific functions that the actual driver may or may not expose but Windows definitely doesn’t let you control that through one of its standard APIs.

 

If you know which side of a solder iron you should not touch you may get somewhere with a small DIY FTDI based GPIO board that you can connect to the USB port. With the help of the FTDI2DX driver you can then set the DIO pins in bit bang mode and start controlling them. Geek factor on the scale of 1 to 10 is at least 8, it needs some understanding of low level programming and hardware components and definitely a persistent tinkerer to get anywhere.

If you want it quicker and with less tinkering, you’ll have to dig deeper in your wallet and buy an NI or similar DIO or multifunction USB device.

Rolf Kalbermatter
My Blog
Message 7 of 18
(3,004 Views)
0 Kudos
Message 8 of 18
(2,991 Views)

That is basically the opposite of what the OP wants...

 

Seems like cutting the wire is the simplest solution. 


GCentral
0 Kudos
Message 9 of 18
(2,966 Views)

Thanks for all your suggestions. We ended putting an arduino in between. If somebody works out a solution (make an example script), that works with cut usb cable, that could be useful in the future.

0 Kudos
Message 10 of 18
(2,954 Views)