Instrument Control (GPIB, Serial, VISA, IVI)

cancel
Showing results for 
Search instead for 
Did you mean: 

Timeout errors with Mac NI VISA drivers

I am attempting to talk to an Agilent 34972A connected to a MacBook Pro (OS 10.6.6) over USB with VISA using SCPI. I have NI VISA 5.0 drivers installed, and I am using pyVISA (Python) to access the driver. I have been having a bugger of a time even getting the *IDN? command to work. I have been using Spy to see what is going on, but it hasn't been too much help. Using Spy, I can tell that the driver seems to be getting the correct viWrite or viRead command. Sometimes the write command timesout, and sometimes it returns nothing. viRead always timesout.

 

Do you have any suggestions for a starting place for troubleshooting this issue? Is there any NI utility that lets me issue SCPI commands directly so I can see if the driver is indeed communicating properly? At this point it seems like my software (pyVISA) is communicating with the driver, but the driver isn't communicating with the hardware. I can't really verify that, however. (And yes, I have made sure that the termination character (LF for this instrument) is being used and sent.)

 

Thanks,

Matt

 

 

0 Kudos
Message 1 of 7
(4,044 Views)

I resolved this issue. This post is incase anyone else has the same issue.

 

I decided to try to communicate with the Agilent 34972A from a Win7 machine with Agilent's drivers and software. I got the exact same behavior. I contacted Agilent, and found out that there is a bug in the firmware which requires BOTH the LAN and USB interfaces to be enabled when communicating over USB (I had disabled the LAN interface since I wasn't planning on using it).

 

Everything works just fine now, both on Mac in Win7.

 

-Matt

0 Kudos
Message 2 of 7
(4,026 Views)

Matt,

    If you don't mind, what library file are you using in pyVisa?  I have a very similar setup, but I cannot get the visa.Instrument command to work.  It is stating that it cannot find the associated library.  I realize that install path might be different, but just the raw file name might help me tremendously.

 

Thanks!

Adam

0 Kudos
Message 3 of 7
(3,974 Views)

Hey Adam,

 

The library should be found here:

 

/Library/Frameworks/Visa.framework/VISA

 

...so VISA is the name of the actual library. (Note that this is actually an alias to the real file, which is in /Library/Frameworks/VISA.framework/Versions/A).

 

There isn't any extension on the file like there is for Linux or Windows.

 

Post if this works for you, or if you need some more info.

 

Cheers,

Matt

Message 4 of 7
(3,971 Views)

Ugh.  That's what I was afraid of.  That is the file that I am pointing to (as it's the only one that did not throw an error when trying to load).  Any idea as to why it would say the library is not found if I point that that file?

 

Note: I have this same question on post http://forums.ni.com/t5/Instrument-Control-GPIB-Serial/VI-ERROR-LIBRARY-NFOUND-Mac-OS-X-10-6-6/td-p/...

 

Code Snippet: 

 

from pyvisa.vpp43 import visa_library

visa_library.load_library("/Library/Frameworks/VISA.framework/VISA")
import visa
ps = visa.Instrument("GPIB::17")

 

Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "/Users/aclewis/.envs/TIDE29/lib/python2.7/site-packages/PyVISA-1.3-py2.7.egg/pyvisa/visa.py", line 358, in __init__
    "lock")))
  File "/Users/aclewis/.envs/TIDE29/lib/python2.7/site-packages/PyVISA-1.3-py2.7.egg/pyvisa/visa.py", line 132, in __init__
    keyw.get("lock", VI_NO_LOCK))
  File "/Users/aclewis/.envs/TIDE29/lib/python2.7/site-packages/PyVISA-1.3-py2.7.egg/pyvisa/vpp43.py", line 753, in open
    byref(vi))
  File "/Users/aclewis/.envs/TIDE29/lib/python2.7/site-packages/PyVISA-1.3-py2.7.egg/pyvisa/vpp43.py", line 398, in check_status
    raise visa_exceptions.VisaIOError, status
pyvisa.visa_exceptions.VisaIOError: VI_ERROR_LIBRARY_NFOUND: A code library required by VISA could not be located or loaded.

 

0 Kudos
Message 5 of 7
(3,969 Views)

Matt,

 

Thanks for posting your solution!. Most of the time people just ask but never say how they solved their problems.

 

This was very helpful!! 

 

Regards,

Pablo

0 Kudos
Message 6 of 7
(3,916 Views)

Hi,
I am using VISA lib as wrapper over USB to communicate with Agilent34972a and using SCPI commands to read channels 101:116 as follows:
1. Reset device
*RST
2.
SYST:REM
3.
*CLS
4. Set channel numbers for scan
ROUT: SCAN (@101,102,103,104,105,106,107,108,109,110,111,112,113,114,115,116)
5. Set auto ranging on
SENSE: VOLT: DC: RANG: AUTO ON,(@101,102,103,104,105,106,107,108,109,110,111,112,113,114,115,116)
6. Set sampling time to 100ms
SENSE: VOLT: DC: APER 0.00001,(@101,102,103,104,105,106,107,108,109,110,111,112,113,114,115,116)
7.Trigger scan
TRIG:COUNT INF
8.Start read
READ?

I am observing that when I read USB port using viRead function at a interval of 100ms,
I do not get data each time for all channels. I get zeros. I have set timeout of 80ms for viRead so that I call poll it for every 100ms.

What is wrong in above approach?
Am I missing anything in configuring meter before starting readings?
Is there any better approach so that I can get all the data meter is collecting with very high sampling rate?

Please help me.
Thanks in advance.

0 Kudos
Message 7 of 7
(3,497 Views)