09-10-2024 04:04 AM
Hello everyone,
I am working with a USB RAW Class device and would like to establish communication with it in order to read and write data. Could someone guide me on how to achieve it?
That are the best libraries available to it?
Thank you in advance for your help
09-10-2024 05:55 AM
Hello
Well, it's not exactly my main point, but I had a similar problem before. To connect properly, there are a few things we need to clarify:
First, what device are you working with?
Second, when you connect it to your computer, does it show up in MAX?
Also, what exactly are you trying to connect via USB, and do you have the device's manual?
09-10-2024 03:07 PM
The first answer to anyone asking about communicating to a VISA RAW device is always, "are you sure?". You should pursue VISA RAW only if there's no actual interface available to you via the more traditional Windows driver route.
If you're convinced that you're "on your own" for whatever the device is, you next need to become familiar with the VISA Driver Wizard, which is a separate application you'd find under Start->National Instruments->NI-Visa Driver Wizard.
Basically, you tell the wizard the VID and PID of the USB device, and it generates a *.inf file, which (if you can get Windows to accept it, unsigned), assigns NI-VISA as the device's driver. If you can do this, then you can use a VISA reference of USB RAW class and have access to the device's control pipe(s) (using the VISA Control In and Control Out nodes), and its bulk pipe (using the traditional VISA Read and Write nodes). (There is also support for USB interrupts, but that's an aspect with which I never dealt.)
This sounds complicated because it is. I was able to do it to access an ST Micro STM32 that was in DFU mode (factory blank-flash mode, essentially) so that I could upload blocks of code and get it to start, and it was a pretty substantial effort at the time - part of a LabVIEW-based factory test where my code functioned as a bootloader. It has become more difficult because successive releases of Windows have gotten really paranoid about loading unsigned device drivers. You may need to either 1) pursue an unsecured, "developer" mode of Windows, or 2) get your *.inf file signed using a certificate authority your Windows trusts.
Best of luck!
Dave
09-10-2024 04:33 PM - edited 09-10-2024 04:37 PM
Please explain WHY you think you have to go the USB Raw path. In most cases people think hey there is no driver for my device I go USB Raw and am done. There is a VISA Driver Wizard and I just run it and I'm done. Wrong! Once you created a VISA USB Raw device configuration file and installed it, the real work begins.
If it is a standard USB Class device you can go and head over to the USB Consortium for the according specification for that device class and get started. Each class has generally several 100 to several 1000 pages of documentation that you should kind of understand fairly well before you can even hope to get anything going. But if it is a standard USB Class device, why can't you use the standard drivers that Windows already comes with?
And if it is a proprietary device class? Well you have to bugger the device manufacturer and unless you can wave a purchase order with at least 7 digits of hard dollars on it, you should consider yourself lucky if you even get as much as a "Sorry we do not give out this documentation". Usually you could just as well yell into a black hole and hope to get any answer from it. 😁
So what device are you trying to talk with? Do you know what USB device class it is? If it is not a standard USB class, did you already get the protocol specification for it from the manufacturer? And don't even think about trying to send an *IDN? command to any of these devices. That will NOT work, nor will any other string based commands usually. Communication with USB devices is almost exclusively in binary bits and bytes!