When choosing a piece of hardware, you will likely be confronted with many options from different vendors for what interface (PCI, PXI, USB, Serial/GPIB, LXI) that device will use to communicate with your software controller, so how do you choose?
USB devices are often significantly cheaper than their PCI or PXI counterparts, but this reduced cost comes with a trade-off in the overall stability and robustness of the communications interface. Windows background operations in PC based systems, highly electrically noisy environments, and connecting outside devices to the USB bus (inserting a flash drive) can potentially cause a USB device to stop responding to commands. Such issues are of particular concern in long term testing applications such as environmental or fatigue/creep testing.
In applications where the volume of systems being produced makes hardware costs very important, or whenever budgets are tight in general, USB devices can provide a cost effective solution. When strict HW cost restrictions exist but long term stability is a requirement, we've found that taking out some additional "insurance" in your code to prevent communications disruptions with your USB devices will pay big dividends.
Devcon is a command line utility that allows you to programmatically perform functions such as detecting enabling, disabling, removing, restarting, and querying devices attached to your computer (any devices, not just USB devices). You can find out what devices are currently recognized as being connected to your computer, and you can target specific devices (by vendor or product IDs) to send commands to. Installing the utility is a snap, and creating a some basic LabVIEW subVIs to handle the desired functions was a straightforward process.
In a recent project, we were able to use this utility to create a "rescue" strategy for any of our USB devices that stopped responding during a long term test. One approach used was to "disable" and then "re-enable" the particular device. Another option is to "remove" the device and then allow windows to "rescan" for connected devices to re-detect and reinitialize that device. Additionally, you can "remove" a USB hub with multiple devices attached to it, and then "rescan" to reset all those devices.
In essence, this utility provides a programmatic method for unplugging and reconnecting the USB cable for a given device. It also includes many other useful functions such as querying devices to determine their state. As mentioned before, it can operate on any devices you could normally access through windows Device Manager (not just USB ones), and since it's command line based, it can easily be integrated into a variety of software languages. See the links below for more information, example code, and to download the Devcon utility and try it out for yourself!
NI Discussion of USB device eject/rescan: http://digital.ni.com/public.nsf/allkb/1D120A90884C25AF862573A700602459
Microsoft Devcon utility information and download: http://support.microsoft.com/kb/311272
Disclaimer: This article refers to Devcon the useful command line utility, not Devcon the Transformers Autobot.
Learn more about DMC's LabVIEW programming services.