05-17-2022 01:48 PM
I am attempting to automate the control of a USB CDC ACM device. We have been manually controlling the device using Termite Terminal Emulator 3.3 and have had zero issues. When attempting to communicate with the device through NI-VISA (either in MAX or LabVIEW) we encounter the 0xBFFF0000 miscellaneous error or an indicator that the device is not connected. The settings from Termite are as follows: 115200 Baud, 8 data bits, 1 stop bit, no partity, no flow control, 100 ms polling.
We also attempted to use PuTTY and could not connect. Another group had success using Tera Term.
We were provided an unsigned driver for the custom device, but it is unsigned so we have had problems installing it. We attempted to create a USB RAW driver using the NI-VISA Driver Manager, but again it was unsigned and did not appear to work correctly. Windows is recognizing the device name and associating it with a port in Device Manager without issue.
If we make sure that no device drivers are installed then we get a yellow exclamation in MAX. If we mess with the settings it will become a red x.
Any ideas on things to check? I have already done a bunch of searching on the forums for CDC devices, but it appears our problem is different.
05-17-2022 03:45 PM
Find the place in device manager with the yellow exclamation and right-click it and choose Properties, then in the window that comes up go to the "Details" section and choose "Hardware IDs" from the "Property" dropdown.
This should give you one or more strings that look something like:
USB\VID_1395&PID_0026&MI_03
The number after VID is the vendor ID and after PID is the product ID.
You can usually use those strings to do searches for compatible drivers. Since it's a virtual serial device on a USB connection, there's a pretty good chance that a generic driver might exist for that device and it could come up in a web search. If you can find one and install it, it might start working.
05-17-2022 04:05 PM
Unfortunately the Hardware ID (USB\VID_A0A0&PID_0004&MI_00) does not provide anything besides a somewhat suspicious looking site with a general USB\VID_A0A0 driver. The device was custom built and it is my impression from searching around the internet that something was left out of the firmware. Since I do not know what is in the firmware, I am not sure what would be missing or where to start. I think I can get a copy of the firmware though.
05-17-2022 05:39 PM - edited 05-17-2022 05:42 PM
USB\VID_A0A0 is not an officially registered USB vendor ID, so someone has been indeed hacking.
Do NOT try to use NI-VISA USB Raw. Aside from the problem that you encountered that Windows 10 requires you to have signed drivers and a NI VISA INF file is only signed if you can sign it yourself, which requires you to have a valid signing certificate, you also do NOT want to communicate on USB Raw level even if that device is fully and completely implementing an official USB class such as the USB CDC ACM. That is simply insane. Such a device does not work like a normal serial port where you can simply write a command to and read the response, but you have yourself also to bother about setting up the correct USB endpoints first and handling possible interrupt bus transfers as well.
On the other hand does Windows not just blindly install a device driver for a device only because it claims in its USB identification descriptor to be a certain device class but it also wants to understand what sort of device that is and uses for that the VID and PID. But your device has not an officially recognized VID and PID. What you would need is a Windows INF style file for your device that tells Windows that this VID and PID is indeed a device that the standard usbser.sys driver can handle if it can, or provides its own custom kernel device driver that can do that.
05-20-2022 03:40 PM
We were able to obtain a trace of the USB communications when using both Termite and PuTTY. As usual Termite worked and PuTTY failed. The first section is initializing Termite followed by commands 0, 2, 5, and 0 through Termite. After the second "START OF LOG" is PuTTY failing. I also attached a file with a LabVIEW Continuous Serial Read Write example test that failed with a misc error.
The main differences that I see that there are far fewer calls to EP 0 for PuTTY and LabVIEW and the IRP does not stay the same like the Termite setup.
I do not have much experience looking at log files, so I might be missing something.
05-21-2022 04:57 AM
I'm not familiar with Termite but it looks to me as if it is doing some low level access of serial ports or something. Hard to tell however. Fact is that VISA and Putty simply access the Windows COMM API and do not deal with serial ports themselves beyond what that API allows.
It means that these applications only can access serial ports that are installed under windows as such and that it can't do anything beyond what the Windows API exposes, which is not the full capability of many underlying device driver. There is an option to do some IO passthrough to access driver specific extensions but that is only an option if you do exactly know the driver in question. NI uses that for instance for their own serial port drivers for their hardware which support additional things such as software selectable IO direction (for RS-485 operation or electrical isolation state). And the only software that supports that is NI VISA as the according IO Control codes aren't really documented.
So there is a lot of if's and when's here and the fact that one application seems to work with your device tells very little as we have no idea about what exact API it uses and from a quick look at the Termite website, they do give some information and even allow some plugin development for their tool, but nothing that I would see about the low level interface to the serial ports.
My guess is that your device is a non-standard device that does a few things not quite as it should despite you claiming that it is a full USB CDC class device (but why would someone going through the trouble of writing a full specification class CDC driver not take the little extra effort to apply for an official USB Vendor ID?) and Termite somehow either actively works around such misbehaviour or maybe simply ignores certain errors and happily churns on even after them. The application was developed by someone to use in the field with their own hardware so it could very well be that it simply ignores certain errors categorically or specifically and doesn't abort communication on them.
06-22-2022 05:29 PM
Since the LabVIEW communication was not working, we instead implemented a process where system executive opens Termite and LabVIEW keyboard inputs simulate a user. I know that this is prone to problems (especially with the user interrupting the inputs), but outside of rewriting the driver I was not sure of other options.
06-23-2022 01:04 AM - edited 06-23-2022 01:05 AM
@Happyfrank wrote:
Since the LabVIEW communication was not working, we instead implemented a process where system executive opens Termite and LabVIEW keyboard inputs simulate a user. I know that this is prone to problems (especially with the user interrupting the inputs), but outside of rewriting the driver I was not sure of other options.
Maybe you would like to give System.IO.Ports.SerialPort a try: https://forums.ni.com/t5/LabVIEW/Trouble-with-receiving-data-from-a-Zebra-Miniscanner-in-LabVIEW/m-p...
If it works for you, you can add .NET nodes to LabVIEW to avoid the detour through simulating user input. If you swap out the VISA configure/VISA Open with the appropriate .NET constructor node, it should be pretty simple to replace VISA.
06-23-2022 10:10 AM
We did attempt to use Powershell as another way to access the device, but is also generated an error. It has been a while, but it was something about not being able to access the device/port. From what we have been able to find, there is something that the Windows tool for serial communication (used by LabVIEW, PuTTY, Powershell, etc) requires that we do not have or do not provide. Termite and Tera Term apparently use another tool and can ignore the issue.