Author Topic: Problems using pyvisa, gpib-usb-hs and HP3458A  (Read 553 times)

0 Members and 1 Guest are viewing this topic.

Offline SphyrnaTopic starter

  • Contributor
  • Posts: 10
  • Country: de
Problems using pyvisa, gpib-usb-hs and HP3458A
« on: September 13, 2023, 02:13:29 pm »
Hello,

inspired by xdevs page I would like to script some measurements on a DMM. But I have some problems to get the basic drivers or software running. First I did a step by step installation from https://www.cl.cam.ac.uk/~osc22/tutorials/gpib_usb_linux.html. I installed pyvisa as front end and pyvisa-py and NI-VISA as backends. pyvisa-info gives:
Code: [Select]
pyvisa-info
Machine Details:
   Platform ID:    Linux-6.2.0-32-generic-x86_64-with-glibc2.35
   Processor:      x86_64

Python:
   Implementation: CPython
   Executable:     /usr/bin/python3
   Version:        3.10.12
   Compiler:       GCC 11.4.0
   Bits:           64bit
   Build:          Jun 11 2023 05:26:28 (#main)
   Unicode:        UCS4

PyVISA Version: 1.13.0

Backends:
   ivi:
      Version: 1.13.0 (bundled with PyVISA)
      #1: /usr/lib/x86_64-linux-gnu/libvisa.so.23.5.0:
         found by: auto
         bitness: 64
         Vendor: National Instruments
         Impl. Version: 24118528
         Spec. Version: 7340032
   py:
      Version: 0.7.0
      ASRL INSTR: Available via PySerial (3.5)
      USB INSTR: Available via PyUSB (1.2.1-1). Backend: libusb1
      USB RAW: Available via PyUSB (1.2.1-1). Backend: libusb1
      TCPIP INSTR: Available
         Resource discovery:
         - VXI-11: ok
         - hislip: ok
      TCPIP SOCKET: Available
      GPIB INSTR: Available via Linux GPIB (b'4.3.6')
      GPIB INTFC: Available via Linux GPIB (b'4.3.6')
      VICP INSTR:
         Please install PyVICP to use this resource type.
When I tried it with the pyvisa-py backend and it throws:
Code: [Select]
python3
Python 3.10.12 (main, Jun 11 2023, 05:26:28) [GCC 11.4.0] on linux
Type "help", "copyright", "credits" or "license" for more information.
>>> import pyvisa
>>> rm = pyvisa.ResourceManager('@py')
>>> rm.list_resources()
libgpib: ibBoardOpen failed to open device file /dev/gpib0
libgpib: No such file or directory
libgpib: invalid descriptor
libgpib: invalid descriptor
libgpib: invalid descriptor
libgpib: invalid descriptor
libgpib: invalid descriptor
libgpib: invalid descriptor
libgpib: invalid descriptor
libgpib: invalid descriptor
libgpib: invalid descriptor
libgpib: invalid descriptor
libgpib: invalid descriptor
libgpib: invalid descriptor
libgpib: invalid descriptor
libgpib: invalid descriptor
libgpib: invalid descriptor
libgpib: invalid descriptor
libgpib: invalid descriptor
libgpib: invalid descriptor
libgpib: invalid descriptor
libgpib: invalid descriptor
libgpib: invalid descriptor
libgpib: invalid descriptor
libgpib: invalid descriptor
libgpib: invalid descriptor
libgpib: invalid descriptor
libgpib: invalid descriptor
libgpib: invalid descriptor
libgpib: invalid descriptor
libgpib: invalid descriptor
libgpib: invalid descriptor
libgpib: ibBoardOpen failed to open device file /dev/gpib0
libgpib: No such file or directory
libgpib: invalid descriptor
libgpib: invalid descriptor
libgpib: invalid descriptor
libgpib: invalid descriptor
libgpib: invalid descriptor
libgpib: invalid descriptor
libgpib: invalid descriptor
libgpib: invalid descriptor
libgpib: invalid descriptor
libgpib: invalid descriptor
libgpib: invalid descriptor
libgpib: invalid descriptor
libgpib: invalid descriptor
libgpib: invalid descriptor
libgpib: invalid descriptor
libgpib: invalid descriptor
libgpib: invalid descriptor
libgpib: invalid descriptor
libgpib: invalid descriptor
libgpib: invalid descriptor
libgpib: invalid descriptor
libgpib: invalid descriptor
libgpib: invalid descriptor
libgpib: invalid descriptor
libgpib: invalid descriptor
libgpib: invalid descriptor
libgpib: invalid descriptor
libgpib: invalid descriptor
libgpib: invalid descriptor
libgpib: invalid descriptor
('ASRL/dev/ttyS4::INSTR', 'ASRL/dev/ttyS0::INSTR')
With the NI-VISA backend it throws:
Code: [Select]
python3
Python 3.10.12 (main, Jun 11 2023, 05:26:28) [GCC 11.4.0] on linux
Type "help", "copyright", "credits" or "license" for more information.
>>> import pyvisa
>>> rm = pyvisa.ResourceManager('@ivi')
>>> rm.list_resources()
('ASRL1::INSTR', 'ASRL5::INSTR')
>>>
If I connect the GPIB adapter the udevadm monitor --environment says:
Code: [Select]
UDEV  [30086.657642] add      /devices/pci0000:00/0000:00:14.0/usb1/1-5/1-5.4/1-5.4.2/1-5.4.2:1.0 (usb)
ACTION=add
DEVPATH=/devices/pci0000:00/0000:00:14.0/usb1/1-5/1-5.4/1-5.4.2/1-5.4.2:1.0
SUBSYSTEM=usb
DEVTYPE=usb_interface
PRODUCT=3923/709b/101
TYPE=0/0/0
INTERFACE=255/0/0
MODALIAS=usb:v3923p709Bd0101dc00dsc00dp00icFFisc00ip00in00
SEQNUM=4209
USEC_INITIALIZED=30086650903
ID_VENDOR_FROM_DATABASE=National Instruments Corp.
ID_MODEL_FROM_DATABASE=GPIB-USB-HS
ID_PATH=pci-0000:00:14.0-usb-0:5.4.2:1.0
ID_PATH_TAG=pci-0000_00_14_0-usb-0_5_4_2_1_0
TAGS=:snap_cups_cupsd:snap_cups_ippeveprinter:
CURRENT_TAGS=:snap_cups_cupsd:snap_cups_ippeveprinter:

UDEV  [30086.669265] bind     /devices/pci0000:00/0000:00:14.0/usb1/1-5/1-5.4/1-5.4.2 (usb)
ACTION=bind
DEVPATH=/devices/pci0000:00/0000:00:14.0/usb1/1-5/1-5.4/1-5.4.2
SUBSYSTEM=usb
DEVNAME=/dev/bus/usb/001/011
DEVTYPE=usb_device
DRIVER=usb
PRODUCT=3923/709b/101
TYPE=0/0/0
BUSNUM=001
DEVNUM=011
SEQNUM=4210
USEC_INITIALIZED=30086620303
ID_VENDOR=National_Instruments
ID_VENDOR_ENC=National\x20Instruments
ID_VENDOR_ID=3923
ID_MODEL=GPIB-USB-HS
ID_MODEL_ENC=GPIB-USB-HS
ID_MODEL_ID=709b
ID_REVISION=0101
ID_SERIAL=National_Instruments_GPIB-USB-HS_01268E03
ID_SERIAL_SHORT=01268E03
ID_BUS=usb
ID_USB_INTERFACES=:ff0000:
ID_VENDOR_FROM_DATABASE=National Instruments Corp.
ID_MODEL_FROM_DATABASE=GPIB-USB-HS
ID_PATH=pci-0000:00:14.0-usb-0:5.4.2
ID_PATH_TAG=pci-0000_00_14_0-usb-0_5_4_2
ID_FOR_SEAT=usb-pci-0000_00_14_0-usb-0_5_4_2
MAJOR=189
MINOR=10
TAGS=:snap_cups_cupsd:seat:snap_cups_ippeveprinter:
CURRENT_TAGS=:seat:snap_cups_cupsd:snap_cups_ippeveprinter:
In /etc/udev/rules.d/ I applied the following rules:
Code: [Select]
SUBSYSTEM=="usb", ACTION=="add", ENV{DEVTYPE}=="usb_device", ATTR{idVendor}=="3923", ATTR{idProduct}=="709[ab]", MODE="660", GROUP="plugdev", SYMLINK+="usb_gpib"
SUBSYSTEM=="usb", ACTION=="add", ENV{DEVTYPE}=="usb_device", ATTR{idVendor}=="3923", ATTR{idProduct}=="709[ab]", RUN+="/lib/udev/ni_usb_gpib"
KERNEL=="gpib[0-9]*", ACTION=="add", MODE="660", GROUP="plugdev"

Someone has a hint how to fix this problem :scared:?
 

Online ch_scr

  • Frequent Contributor
  • **
  • Posts: 813
  • Country: de
Re: Problems using pyvisa, gpib-usb-hs and HP3458A
« Reply #1 on: September 13, 2023, 02:47:46 pm »
Looking at the "udevadm monitor" output, there are the lines:
Code: [Select]
TAGS=:snap_cups_cupsd:seat:snap_cups_ippeveprinter:
CURRENT_TAGS=:seat:snap_cups_cupsd:snap_cups_ippeveprinter:
Not sure if that is normal or if the printer driver snatched it up blocking it somehow?
Don't have one to test and compare, but it seems strange at least?
 

Offline alm

  • Super Contributor
  • ***
  • Posts: 2881
  • Country: 00
Re: Problems using pyvisa, gpib-usb-hs and HP3458A
« Reply #2 on: September 13, 2023, 02:56:56 pm »
Not sure if it's related, but I wouldn't install both NI-VISA and PyVISA-py. Last time I checked, NI-VISA for Linux only supports GPIB USB devices on ancient kernel versions. So I'd skip NI-VISA lest it breaks something, and focus on getting linux-gpib to work.

Online tszaboo

  • Super Contributor
  • ***
  • Posts: 7392
  • Country: nl
  • Current job: ATEX product design
Re: Problems using pyvisa, gpib-usb-hs and HP3458A
« Reply #3 on: September 13, 2023, 03:40:47 pm »
Not sure if it's related, but I wouldn't install both NI-VISA and PyVISA-py. Last time I checked, NI-VISA for Linux only supports GPIB USB devices on ancient kernel versions. So I'd skip NI-VISA lest it breaks something, and focus on getting linux-gpib to work.
I think it's absolutely related. Having the right package is paramount, and I think in this case you indeed need to have pyvisa-py installed. Though this was a while ago, but I think I had the same issue on an unrelated python script.
 

Offline alm

  • Super Contributor
  • ***
  • Posts: 2881
  • Country: 00
Re: Problems using pyvisa, gpib-usb-hs and HP3458A
« Reply #4 on: September 13, 2023, 03:44:50 pm »
First /dev/gpib0 needs to exist. Until that time, there's a problem with linux-gpib drivers that aren't being loaded, not with PyVISA-py.

That guide is for Ubuntu versions from 2010. If you have a somewhat recent Ubuntu version, check if the link in my signature has packages that work on your system. The kernel package should contain the necessary udev scripts.
« Last Edit: September 13, 2023, 04:25:17 pm by alm »
 

Offline SphyrnaTopic starter

  • Contributor
  • Posts: 10
  • Country: de
Re: Problems using pyvisa, gpib-usb-hs and HP3458A
« Reply #5 on: September 14, 2023, 06:28:06 am »
Not sure if it's related, but I wouldn't install both NI-VISA and PyVISA-py. Last time I checked, NI-VISA for Linux only supports GPIB USB devices on ancient kernel versions. So I'd skip NI-VISA lest it breaks something, and focus on getting linux-gpib to work.
The NI-VISA version I installed supportes jummy and focal (https://www.ni.com/pdf/manuals/ni-visa-linux-2023-q3.html). But I will try to install the packages from alm on a clean debian system. Maybe you are right and isn't possible to have two backends installed. I will try to have a look into that cups driver tags.
 

Offline alm

  • Super Contributor
  • ***
  • Posts: 2881
  • Country: 00
Re: Problems using pyvisa, gpib-usb-hs and HP3458A
« Reply #6 on: September 14, 2023, 07:59:02 am »
The NI-VISA version I installed supportes jummy and focal (https://www.ni.com/pdf/manuals/ni-visa-linux-2023-q3.html).
Yes, but it doesn't support the GPIB-USB-HS on Linux. Select GPIB-USB-HS here and see what it says for Linux. It used to be limited to kernels <= 2.6.24 (released in 2008), but I guess now they completely dropped support.
 
The following users thanked this post: ch_scr

Offline SphyrnaTopic starter

  • Contributor
  • Posts: 10
  • Country: de
Re: Problems using pyvisa, gpib-usb-hs and HP3458A
« Reply #7 on: September 14, 2023, 11:12:41 am »
Thank you for the infos alm. I wasn't able to get it running on debian, too. But I have to admit that I am not a Linux pro user. I got it running on windows now. I just installed the NI drivers and adapted the PATH variables and pyvisa lists the intruments. Now I will start with some scripting yippiiiih  :phew:.
 


Share me

Digg  Facebook  SlashDot  Delicious  Technorati  Twitter  Google  Yahoo
Smf