10-18-2023 04:02 PM
Hello,
Any help is greatly appreciated! I have looked into other NI solutions, but I believe my situation is different due to using the Prologix GPIB-USB with the PyVISA wrapper not working where as the serial library does work. My current setup involves python code in PyCharm IDE(I will paste the code snippet below), a Prologix GPIB-USB adapter connected to my laptop and the Keithley2400 SourceMeter. Connecting to the Keithley2400 via serial library in python works. The keithley can be written commands no problem with this library. There is a pymeasure wrapper I would like to use though and it uses pyvisa which uses NI-VISA, hence I am posting here because I think it is NI-VISA I need help with. I want to note that I only started having issues last Friday, which leads me to believe there may be a bug in the newest NI-VISA version which was released last Wednesday (I have NI-VISA 2023 Q4). I have used the Pymeasure wrapper multiple times over the past year with no issues like this.
Things I have noted:
pyvisa-info:
UserWarning: GPIB library not found. Please manually load it using _load_lib(f
ilename). All GPIB functions will raise OSError until the library is manually loaded.
warnings.warn(message)
Machine Details:
Platform ID:
Processor: Intel64 Family 6 Model 154 Stepping 4, GenuineIntel
Python:
Implementation: CPython
Executable: C:\Users\xx\Anaconda3\python.exe
Version: 3.9.13
Compiler: MSC v.1916 64 bit (AMD64)
Bits: 64bit
Build: Aug 25 2022 23:51:50 (#main)
Unicode: UCS4
PyVISA Version: 1.13.0
Backends:
ivi:
Version: 1.13.0 (bundled with PyVISA)
#1: C:\WINDOWS\system32\visa32.dll:
found by: auto
bitness: 64
Vendor: National Instruments
Impl. Version: 24119296
Spec. Version: 7340032
#2: C:\WINDOWS\system32\visa64.dll:
found by: auto
bitness: 64
Vendor: National Instruments
Impl. Version: 24119296
Spec. Version: 7340032
py:
Version: 0.7.0
ASRL INSTR: Available via PySerial (3.5)
TCPIP INSTR: Available
Resource discovery:
- VXI-11: ok
- hislip: ok
TCPIP SOCKET: Available
USB INSTR:
PyUSB does not seem to be properly installed.
Please refer to PyUSB documentation and
install a suitable backend like
libusb 0.1, libusb 1.0, libusbx,
libusb-win32 or OpenUSB.
No backend available
USB RAW:
PyUSB does not seem to be properly installed.
Please refer to PyUSB documentation and
install a suitable backend like
libusb 0.1, libusb 1.0, libusbx,
libusb-win32 or OpenUSB.
No backend available
VICP INSTR:
Please install PyVICP to use this resource type.
GPIB INSTR:
gpib_ctypes is installed but could not locate the gpib library.
Please manually load it using:
gpib_ctypes.gpib.gpib._load_lib(filename)
before importing pyvisa.
GPIB INTFC:
gpib_ctypes is installed but could not locate the gpib library.
Please manually load it using:
gpib_ctypes.gpib.gpib._load_lib(filename)
before importing pyvisa.
Code:
import pyvisa as visa
from pymeasure.instruments.keithley import Keithley2400
import pymeasure.adapters
adapter = pymeasure.adapters.PrologixAdapter('ASRL3::INSTR')
vpmeter = Keithley2400(adapter.gpib(25))
print(pymeasure.instruments.list_resources())
vpmeter.use_front_terminals() #code fails here
10-19-2023 12:29 PM
This question is better fit to ask Prologix as this topic is in no way related to NI
10-19-2023 01:33 PM
Thank you for replying back! I do believe it is an NI-VISA problem because that is the backend PyVisa is using. The Prologix cable has always worked before in this setup and still currently works when using serial.write. The NI-VISA library is having issues and it does appear I have no gpib-32.dll file
10-19-2023 03:04 PM
Looks like there is a open topic in PyVISA about supporting Prologix GPIB-USB
https://github.com/pyvisa/pyvisa/issues/112
10-19-2023 03:16 PM
Thanks again for getting back! I appreciate your help on this stubborn issue.
Prologix actually does already have pyvisa connection in the library Pymeasure, which is what I use. Pymeasure uses PyVisa for communication. PyVisa can use any (most) VISA backend libraries and the one recommended is NI-VISA which is what I use. This is not unique to only Python as NI-MAX also cannot communicate to the instrument. Using python and the Prologix cable, I am completely able to communicate using the serial.write library, but the goal is to use Pymeasure/PyVisa. I had been using this cable and pymeasure for a while now and it was working perfectly until a week ago. The issue lies in NI-VISA because that is the backend pyVisa is using. You can see in the pyvisa-info log that there is no gpib library. I suspect these issues will resolve if I can figure out how and why it was deleted.
10-19-2023 07:08 PM
Prologix GPIB (GPIB-USB Controller) is a product loaded with an FTDI serial chip, and Prologix GPIB itself appears to be a serial I/F from VISA.
Therefore, NI's GPIB-related libraries (such as ni4882.dll and gpib-32.dll) are not used at all when using Prologix products. (Also, these dlls will not be installed on your computer unless you install NI-488.2.)
Controlling Prologix GPIB itself requires sending commands to Prologix itself via serial.
https://prologix.biz/downloads/PrologixGpibUsbManual-6.0.pdf
From this, I think that PyMeasure does not support communication using Prologix, so you will need to create the code to control Prologix and the instrument from PyVISA on your own.
10-19-2023 07:11 PM
After looking into it, it seems that there is a dedicated command for using Prologix I/F with PyMeasure.
See here.
https://pymeasure.readthedocs.io/en/latest/api/adapters.html#prologix-adapter
10-19-2023 07:17 PM
Yes, these are the commands and library I am using! I actually use it for the Keithley and Prologix as there is a pymeasure.adapters and a pymeasure.instruments. Your suggestion then would be to install the latest version of NI-488.2? I have NI-VISA and I do not have any gpib library whatsoever (that I could find) in either System32 or SysWOW64. Wouldn't NI-VISA place nigpib.dll during download? Either way I will see if I can get the latest NI-488.2 and will report back.
Thanks everyone for the input!
10-19-2023 07:26 PM
Since Prologix is serial communication and not GPIB (and it's not an NI product either) installing NI-488.2 won't change the situation.(It's just a signal-level conversion between serial and GPIB in the Prologix hardware.)
Installing NI-488.2 is worthwhile when using NI's GPIB I/F.
10-19-2023 07:42 PM
Hmmm..... I think I see what you're saying. Even with it being serial based, it seems based on the output of my pyvisa-info, I need a gpib library to feed to NI-VISA backend for pyvisa to work properly. It doesn't look like I have one. I was thinking if I could get the one from NI-488.2 perhaps I can use this to appease pyvisa. Is this not the right way to think about it? Fixing the issue from the pyvisa-info regarding the gpib dll is the only fix I can think of to get pymeasure working again.