02-16-2021 09:27 AM - edited 02-16-2021 09:34 AM
Here's the situation:
- VISA Aliases can be swapped at runtime through NI MAX. This is not ideal for our application, so we are moving to a registry-based approach for ensuring that the device we're talking to is actually the device we want. We're implementing this in addition to restricting access to NI MAX to admins only (program runs on unprivileged user).
- To do this, we implemented a caching mechanism, which involves converting the alias to its COM port equivalent (through the Interface Number property)
- The device is connected directly to our PC via USB cable, not through a hub, and the USB Selective Suspend is disabled, per: https://forums.ni.com/t5/LabVIEW/Unknown-System-Error-in-VISA-VISA-close-questions/td-p/3227916?prof...
- Before converting the alias to the COM Port equivalent, we're able to power cycle the device, and the alias we use errors briefly, but recovers and functions normally (with no real intervention other than polling VISA open/close)
- After converting the alias to the COM Port, this no longer works.
I've attached a minimal example, for which you'll need to download the KD Scientific 2XX lvlib from the "Find Instrument Drivers" dialogue under Tools > Instruments
I want to say, the issue is NOT with the driver itself (I know this will be brought up), as it's merely VISA Open -> VISA read/writes -> VISA close
The issue is in converting a VISA Alias to a COM Port (see the diagram disable structure in the "Init" state)
02-16-2021 09:53 AM - edited 02-16-2021 09:54 AM
I don't use the Type Cast. I will just wire the string straight up to a VISA input.
02-16-2021 10:00 AM
Sadly there's no change on my end! Here's what the probe looks like:
and the COM port did not change when I powered it back on:
02-16-2021 10:40 AM
Can you try the following?
If you get an error with your VISA Alias, Use the Close VISA Function to Close the ALIAS, then try to query it again.
mcduff
02-16-2021 11:18 AM
Check the provided minimal example, there's a VISA close on error, eg there's not "sad green busy computer" symbol in the VISA alias.
02-16-2021 11:39 AM
This is what I see in the example
This is what I meant, but it seems you already tried it?
mcduff
02-16-2021 11:45 AM
Ah, I see! That's just a polling mechanism. The code works as expected (eg device power cycle is recoverable) when not using the COM port (the "Disable" case), even with the polling mechanism in place. I can try that though.
02-16-2021 11:53 AM
No change with that, I still think it has everything to do with the Alias -> COM port conversion
02-16-2021 12:04 PM
Why don't you try a different tact?
You could modify something like below. Keep listing/finding the ports, until you have the one you are looking for.
mcduff
02-16-2021 12:13 PM - edited 02-16-2021 12:16 PM
@mcduff wrote:
Why don't you try a different tact?
You could modify something like below. Keep listing/finding the ports, until you have the one you are looking for.
No real need to open up the sessions...
And, yes, I will just wire the desired string straight to the VISA Configure Serial Port.
NOTE: I made this VI specifically for discovering a serial port from connecting a USB-Serial device. That is why I am doing the filter.