02-20-2020 12:44 AM
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?
Solved! Go to Solution.
02-20-2020 05:20 AM
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).
02-20-2020 09:16 AM
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.
02-20-2020 05:21 PM
Can you recommend a different way to do it? (if you have an example with a different port?)
02-20-2020 05:23 PM
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.
02-20-2020
05:24 PM
- last edited on
05-15-2024
02:49 PM
by
Content Cleaner
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/category/multifunction-io.html?productId=118688
02-20-2020 05:26 PM - edited 02-20-2020 05:35 PM
@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.
02-20-2020 07:18 PM
02-20-2020 09:56 PM
02-20-2020 10:19 PM
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.