LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Converting VISA Alias to COM Port breaks the COM port's ability to function after device power cycle

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)

 

ijustlovemath_0-1613489225333.png

 

 

0 Kudos
Message 1 of 13
(1,618 Views)

I don't use the Type Cast.  I will just wire the string straight up to a VISA input.


GCentral
There are only two ways to tell somebody thanks: Kudos and Marked Solutions
Unofficial Forum Rules and Guidelines
"Not that we are sufficient in ourselves to claim anything as coming from us, but our sufficiency is from God" - 2 Corinthians 3:5
Message 2 of 13
(1,608 Views)

Sadly there's no change on my end! Here's what the probe looks like:

 

ijustlovemath_0-1613491175415.png

and the COM port did not change when I powered it back on:

 

ijustlovemath_1-1613491227648.png

 

 

0 Kudos
Message 3 of 13
(1,599 Views)

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

0 Kudos
Message 4 of 13
(1,576 Views)

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.

0 Kudos
Message 5 of 13
(1,568 Views)

This is what I see in the example

Snap44.pngSnap43.png

 

This is what I meant, but it seems you already tried it?

 

Snap45.png

mcduff

0 Kudos
Message 6 of 13
(1,557 Views)

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.

0 Kudos
Message 7 of 13
(1,553 Views)

No change with that, I still think it has everything to do with the Alias -> COM port conversion

0 Kudos
Message 8 of 13
(1,549 Views)

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.

 

Snap46.png

mcduff

0 Kudos
Message 9 of 13
(1,542 Views)

@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.

 

Snap46.png


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.


GCentral
There are only two ways to tell somebody thanks: Kudos and Marked Solutions
Unofficial Forum Rules and Guidelines
"Not that we are sufficient in ourselves to claim anything as coming from us, but our sufficiency is from God" - 2 Corinthians 3:5
0 Kudos
Message 10 of 13
(1,534 Views)