05-27-2021 09:35 AM - edited 05-27-2021 09:35 AM
Hi,
I am trying to communicate with a device connected to my PC via USB. But in VISA it is not showing USB, it is only showing com1 and LPT1. How can I detect my USB port in VISA open in LabVIEW. Thank You.
Solved! Go to Solution.
05-27-2021 03:52 PM - edited 05-27-2021 03:56 PM
USB is only the electrical and mechanical specification and some low level bit stream mechanisme. As such it is not an interface that could be directly accessed through VISA without some extra work.
If the USB interface provides an USB-COMM class device (or also often called a virtual COMM port since it pretends to the operating system to be a RS-232 port) then this is captured by the Windows COMM driver and available to VISA as a serial port. When it is a so called USB-TMC device, it looks to the system like a GPIB device and VISA has a driver for that to present it as USB instrument resource. Any other USB protocol is not recognized by VISA out of the box.
You could create a USB RAW device driver for NI-VISA but that is generally not what anyone wants to do. For one thing, since Windows 7 you can't just install unsigned drivers like that, so you would really need to purchase a signing certificate from a Certificate Authority.
The next problem is that a USB Raw device does not have a simple interface to use. You have to deal yourself with endpoints, pipes and what else and know what endpoint numbers etc your specific protocol uses, how the protocol frames need to be laid out in memory for sending and how to decode the received data frames, and if the data transfer is bulk, isochronous or interrupt controlled. All that information is binary so you do a lot boolean logic and other kind of low level arithmetic to get every bit and byte correctly into the data frames.
If it is using an official USB class protocol, you have to buy the according USB standard(s) and read through 100ds and 1000ds of pages of very hard to understand documentation. But to make things even more interesting, manufacturers can choose to do their own proprietary USB protocol and then you are lost without the exact protocol specification, which almost no manufacturer ever will give you.
So unless you have an USB-COMM or USB-TMC class device, you can simply not interface to that USB device through NI-VISA anymore (in theory you could before Windows 7, in practice even that was pretty much impossible because of the undocumented proprietary protocols often used for many devices).
05-28-2021 02:48 AM
So how do I communicate with that device. Its a Picoscope. So I am assuming it comes under test and measurement because I am using it for test and measurement. So it should be USBTMC. It can only be connected to the device via USB. What is the right thing to do. Thank you.
05-28-2021 03:16 AM - edited 05-28-2021 03:16 AM
Well you could of course say that your Picoscope is a Test & Measurement device. But it doesn't talk USB-TMC on the USB bus. Instead Picoscope chose to implement their own USB protocol that is only compatible to itself.
Just because something quacks and waddles like a duck doesn't always make it be a duck!
Picoscope delivers their device with an application that makes use of a DLL to communicate with the device. They also document the DLL interface. This DLL interface can be called from LabVIEW through the Call Library Node. Picoscope also provides LabVIEW libraries for their devices that make use of those DLLs.
There are many posts about using Picoscopes on this LabVIEW forum. The Picoscope LabVIEW drivers used to be in the past a bit "non-standard", meaning they used techniques that go against LabVIEW's data flow paradigm in an effort to save performance, but that type of thing only works in the most simple examples without errors. Possibly they improved on this in the meantime. I'm not using Picoscopes, so never had any inclination to look into their drivers more deeply than what was necessary to answer some questions on this forum.
05-28-2021 03:22 AM
Thank you. I have actually downloaded the dll and their LabVIEW libraries but it is not working as expected. Also I dont know how to work will Call Library Node. So I thought about communicating with it using VISA. So instead I will try to learn Call Library Node and find out why it is not working. Also so there are Picoscope questions in the LabVIEW forum, which means I can ask here doubts on Picoscope. Ok thank you.
05-28-2021 03:29 AM
Well the official Picoscope support forum is here. This should be your first contact point. While you can post LabVIEW related questions here, you need to take into consideration that only very few people here have a Picoscope that they could use to test, (and most who do are probably not very active on this forum besides asking questions themselves).
What you can do of course is searching for Picoscope on this forum (there is a search option on this site, that while working usually abysmal for more complex search criteria, works quite well if you only have one single search word). There you will get some insights into the DLL problems with this driver already. But solving Call Library Node issues without a good understanding of C programming details is a very thorny, painful and frustrating exercise!
05-28-2021 04:25 PM
Picoscope supplies LabVIEW drivers, if that's all you are after - https://www.picotech.com/downloads