Closed tristanlorriaux closed 1 year ago
Can you share the manual of your instrument ?
Do you see any change if you specify \r\n
as termination character ? I doubt it will make a difference but I would like to be sure.
Indeed, the read termination is /r/n but with or without, it doesn't change anything ! Here is the PDF of the BK : A700000007901997.pdf Thanks a lot for your quick response 🚀
From your instrument it does not appear to support VXI-11 protocol (and I am quite surprised you got an IDN). However page 104 raw socket connection is mentioned. Can you try again using a raw socket resource ?
TCPIP::192.168.0.133::5025::SOCKET
Hi there 👋,
Seems to work, thanks a lot ! It was indeed BK instuments not supporting VXI-11 protocol. The IDN has actually misled us a bit, but raw socket connection with 5025 port works (we should have worked a little more on the manual oops).
Thanks a lot ! 🚀
Happy you got it to work
Hi there 🚀,
The error :
We encounter a major bug with pyvisa-py. Here are the different pyvisa first commands in iPython :
$ import pyvisa as visa
$ rm = visa.ResourceManager('@py')
$ bk = rm.open_resource('TCPIP0::192.168.0.133::inst0::INSTR')
Then
$ bk.query('*IDN?')
works and returns :which is our instrument. But, when we query
$ bk.query('MEAS:CURR?')
, it fails.To be more explicit, the
$ bk.write('MEAS:CURR?')
or for instance$ bk.write('OUT?')
work and return with debug mode ($visa.log_to_screen()
) :$ bk.write('MEAS:VOLT?')
But if we
read()
,raw_read()
,read_ascii_values()
,read_binary_values()
,read_bytes()
, it fails and return the EOF error :(Seems to come from decoding the response in the Vxi11 protocol.)
The context :
I use mamba with python 3.9, but it also fails on other computers with other distros but it works with an old pyvisa package (1.11, not using pyvisa-py). Current versions used :
PyVISA 1.13.0 PyVISA-py 0.6.2
Output of
pyvisa-info
Machine Details: Platform ID: Windows-10-10.0.22000-SP0 Processor: Intel64 Family 6 Model 165 Stepping 5, GenuineIntel
Python: Implementation: PyPy Executable: C:....\mambaforge-pypy3\python.exe Version: 3.9.16 Compiler: MSC v.1929 64 bit (AMD64) Bits: 64bit Build: Jan 18 2023 (#feeb267e) Unicode: UCS4
PyVISA Version: 1.13.0
Backends: ivi: Version: 1.13.0 (bundled with PyVISA) Binary library: Not found py: Version: 0.6.2 ASRL INSTR: Available via PySerial (3.5) USB INSTR: Please install PyUSB to use this resource type. No module named 'usb' USB RAW: Please install PyUSB to use this resource type. No module named 'usb' TCPIP INSTR: Available Resource discovery:
Thank in advance for your responses ! Best regards,
Tristan