Instrument Control (GPIB, Serial, VISA, IVI)

cancel
Showing results for 
Search instead for 
Did you mean: 

Why does VISA show that a non-present device is still present?

I have NI VISA 5.4 installed and I'm using LabVIEW 2012 SP1 to control a USB HID devices using USB RAW. My computer is running Windows 7 Ultimate 64-bit. Using the VISA driver wizard, I created custom INF files that I have installed on my machine and the actual control portion is working great.

 

My issue is that once in a while VISA seems to think that a disconnected device is still present. As you can imagine, this messes with my application as it tries to talk to unit that really isn't there. Using LabVIEW VISA VIs, the device can still be discovered and attempted to be communicated with (it will just error out though). When I open NI MAX, I see the device listed as present even though it is powered off and disconnected from the PC.

 

While leaving MAX open, I can reconnect the same unit and nothing appears to change in MAX. The only difference is that now the device is actually connected and powered on. If I connect another unit, I see it populate in the device list. If I disconnect both units, the device I connected last disappears from the list but the first "phantom" device remains in the device list and is listed as present.

 

The immediate workaround I've found is to reboot the computer. Things seems to work OK for some time afterwards but will usually crop up again while using more than one USB RAW device in this manner.

 

Something else I just witnessed is that I left MAX and LabVIEW open on my work machine over the weekend and I still saw the phantom device listed as present  (it was not connected). I reconnected it and disconnected it and the device properly disappeared this time.

 

Has anyone else ever experienced similar issues? Can anyone explain what is going on? Since it is critical that my application can use more than one device at the same time, how can I ensure that the devices that are reported as available for use through the VISA VIs are really there and can be used?

 

Thanks!!

0 Kudos
Message 1 of 5
(5,096 Views)

Hi amandion,

 

This sounds like you might be having an issue with the port staying open. Are you closing it properly before you power off and disconnect your device?

 

Regards,

Thomas N.
Applications Engineer
National Instruments
0 Kudos
Message 2 of 5
(5,064 Views)

MajorTom,

 

For the most part this is true. If a device is disconnected from the system before its VISA session is closed, LabVIEW will still think it is connected, which is incredibly misleading.

 

On the other hand, if the device is USB RAW and has USB Interrupts enabled, LabVIEW seems to know immediately when it is disconnected from the system and the VISA function "Find Resources" will not return that device. My reasoning behind this behavior is that LabVIEW must be servicing the interrupt polling and therefore is able to tell when a device is disconnected when the internal polling fails.

0 Kudos
Message 3 of 5
(4,522 Views)

actually, I was wrong.

 

I am controlling another device where this behavior is not observed. As soon as the device is disconnected, LabVIEW knows it is disconnected and it will not show up when you use the "Find Resources" primitive in the VISA palette. The other device I'm using will still appear in the found list even it was disconnected.

 

For each device a VISA session was opened and USB Interrupts were enabled. The only difference is that the device which "disappears" appropriately when disconnected has a serial number in its serial number descriptor whereas the device which hangs around does not have a serial number in the serial number descriptor.

 

Maybe this is a clue to someone at NI.

0 Kudos
Message 4 of 5
(4,209 Views)

Can you maybe attach a screenshot of the 'phantom' device in MAX for the scenarios described?  Also a code snippet showing how you are returning the list of present devices.

------------------------------------------------------------------------------------------

Jon F.
Technical Support Engineer
National Instruments
0 Kudos
Message 5 of 5
(4,163 Views)