pyvisa/pyvisa-py

Communication issue with Siglent SDS2352XE using pyvisa-py

Opened this issue · 1 comments

Instrument details

Output of pyvisa-info

Machine Details:
   Platform ID:    Linux-6.5.0-35-generic-x86_64-with-glibc2.35
   Processor:      x86_64

Python:
   Implementation: CPython
   Executable:     /home/jamin/miniforge3/envs/spcs_infra/bin/python
   Version:        3.12.3
   Compiler:       GCC 12.3.0
   Architecture:   ('x86', 64)
   Build:          Apr 15 2024 18:38:13 (#main)
   Unicode:        UCS4

PyVISA Version: 1.14.1

Backends:
   ivi:
      Version: 1.14.1 (bundled with PyVISA)
      #1: /usr/lib/x86_64-linux-gnu/libvisa.so.24.0.0:
         found by: auto
         architecture:
            ('x86', 64)
         Vendor: National Instruments
         Impl. Version: 25165824
         Spec. Version: 7340032
   py:
      Version: 0.7.2
      ASRL INSTR: Available via PySerial (3.5)
      USB INSTR: Available via PyUSB (1.2.1). Backend: libusb1
      USB RAW: Available via PyUSB (1.2.1). Backend: libusb1
      TCPIP INSTR: Available 
         Resource discovery:
         - VXI-11: partial (psutil not installed)
         - hislip: disabled (zeroconf not installed)
      TCPIP SOCKET: Available 
      VICP INSTR:
         Please install PyVICP to use this resource type.
      GPIB INSTR:
         Please install linux-gpib (Linux) or gpib-ctypes (Windows, Linux) to use this resource type. Note that installing gpib-ctypes will give you access to a broader range of functionalities.
         No module named 'gpib'
      GPIB INTFC:
         Please install linux-gpib (Linux) or gpib-ctypes (Windows, Linux) to use this resource type. Note that installing gpib-ctypes will give you access to a broader range of functionalities.
         No module named 'gpib'

Hello, I am having communication issues with an oscilloscope only using the pyvisa-py back-end. The issue seems to be similar to the issues presented here

This is a minimal configuration:

import pyvisa

rm = pyvisa.ResourceManager()

resources = rm.list_resources()
print(resources)
for i in range(len(resources)):
try:
my_instrument = rm.open_resource(resources[i])
query = my_instrument.query('*IDN?').strip()
print(query)
if query == 'Siglent Technologies,SDS2352X-E,SDS2EDDQ6R0793,2.1.1.1.20 R3':
print("hazah!")
my_instrument.close()
except Exception as e:
print("Error:", e)
continue

this system has a bunch of 'ASRL1::INSTR' and there are not privileges to connect to them hence the try, except block.

When using ni-visa as the backend I get the result

Siglent Technologies,SDS2352X-E,SDS2EDDQ6R0793,2.1.1.1.20 R3
hazah!

when changing the visa backend to "@py" I get this output:

/home/jamin/miniforge3/envs/spcs_infra/lib/python3.12/site-packages/pyvisa_py/tcpip.py:409: UserWarning: TCPIP:instr resource discovery is limited to the default interface.Install psutil: pip install psutil if you want to scan all interfaces.
  warnings.warn(
/home/jamin/miniforge3/envs/spcs_infra/lib/python3.12/site-packages/pyvisa_py/tcpip.py:122: UserWarning: TCPIP::hislip resource discovery requires the zeroconf package to be installed... try 'pip install zeroconf'
  warnings.warn(
('ASRL/dev/ttyS4::INSTR', 'USB0::62700::4112::SDS2EDDQ6R0793::0::INSTR')
Error: [Errno 13] could not open port /dev/ttyS4: [Errno 13] Permission denied: '/dev/ttyS4'
Error: unpack_from requires a buffer of at least 4 bytes for unpacking 4 bytes at offset 0 (actual buffer size is 0)

Most of these warnings dont matter in this context, however the last error is the crux of the issue.

Error: unpack_from requires a buffer of at least 4 bytes for unpacking 4 bytes at offset 0 (actual buffer size is 0)

which has been seen on other oscilloscopes.

Any ideas of things to try to get around this issue would be greatly appreciated!

here is some additional system info!

Screenshot from 2024-06-12 09-02-58
Screenshot from 2024-06-12 09-01-36

@MatthieuDartiailh It is also worth noting that on subsequent runs of the above script, occasionally it returns ".1.20 R3
" which is the trailing end of "Siglent Technologies,SDS2352X-E,SDS2EDDQ6R0793,2.1.1.1.20 R3", that the ni-visa back-end successfully returns.

('ASRL/dev/ttyS4::INSTR', 'USB0::62700::4112::SDS2EDDQ6R0793::0::INSTR')
Error: [Errno 13] could not open port /dev/ttyS4: [Errno 13] Permission denied: '/dev/ttyS4'
.1.20 R3