Issues connecting to VISA device

74 views (last 30 days)
Jonathan
Jonathan on 12 Feb 2020
Answered: Jonathan on 9 Mar 2020
Hello,
I'm having issues connecting to an instrument (a Thor Labs PM100A optical power meter) over a VISA connection via USB. The confusing thing is that I have some basic code that works perfectly happily on a couple of machines, but not on other machines. The simple code to open the connection to the instrument is:
PM100A = visa('ni','USB0::0x1313::0x8079::P1002477::INSTR');
fopen(PM100A);
As I said, on a couple of machines it works perfectly. On the other machines I get the error:
"Error using icinterface/fopen (line 83)
Unsuccessful open: Could not open VISA object. Use INSTRHWINFO for a list of available configurations."
All machines are running Matlab 2019a or 2019b, and all have the Instrument Control Toolbox, all run on Windows 10. In all cases Windows seems to have installed the power meter drivers successfully, and on all machines I can communicate to the instrument using the separate software supplied by Thor Labs.
One thing I have noticed is that in the Test & Measurement Tool (tmtool), on the machines that do work the instrument is recognised in the Instrument Control Toolboox/Hardware/VISA/USB tree. On the machines that don't work, the instrument is not recognised even if I manually scan for USB devices. I assume this means that although the instrument seems set up in Windows, some instances of Matlab can't "see" the instrument is there.
Also, on the machines where I can't communicate to the Thor Labs meter, I am able to establish a VISA connection with a totally different instrument (a power supply from a totally different manufacturer).
I have no idea where to go from here, so if anyone has any suggestions that would be very much appreciated. Thanks in advance!
  1 Comment
Jonathan
Jonathan on 12 Feb 2020
Just to add as a follow up, as I've been continuing hitting my head against this problem...
I tried connecting the power meter on a different PC, via tmtool, and it worked successfully. Copying the line that tmtool generated to make the connection, I noticed that it was using a different vendor name than my own code:
PM100A = visa('KEYSIGHT','USB0::0x1313::0x8079::P1002477::INSTR');
I tried executing that line of code on one of the non-working PCs and get the error:
Error using visa (line 224)
Unable to create VISA object. The required drivers may not be installed properly.
So, then I tried uninstalling and re-installing the meter's drivers in Windows Device Manager, doing likewise for the Instrument Control Toolbox in Matlab and...same error.
That's me totally out of ideas now. It's not obvious at all why it works on some PCs and not on others. They all seem to have similar/same Matlab versions (2019a or 2019b), and the same toolboxes installed. All have the same drivers installed from the same vendor, all work fine with the Thor Labs software. It's a total mystery to me!

Sign in to comment.

Accepted Answer

Jonathan
Jonathan on 9 Mar 2020
Well, eventually I managed to fix the issue.
I noticed that other software like Python and NI-MAX didn't recognise the instrument either, indicating an underlying problem that wasn't only affecting Matlab.
The issue seems to have been that Windows had assigned the "wrong" driver to the instrument. For whatever reason, this meant that the Thor Labs software could communicate with the instrument, but nothing else. I found some instructions on how to fix this issue from the National Instruments website...following the "try reassociating the USB device" section, steps 1-3 & 5, fixed my specific problem.
I hope that helps someone in future!

More Answers (0)

Categories

Find more on Instrument Connection and Communication in Help Center and File Exchange

Products

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!