python:linux:linuxgpib

Library for Linux GPIB

link https://linux-gpib.sourceforge.io/

Download the source files and extract them. First go to the kernel sources like :

cd /home/stephane/Téléchargements/linux-gpib-kernel-4.3.3/

1 - install packages to compile the kernel file :

sudo apt-get install gcc
sudo apt-get install build-essential
2 - install linux-headers-generic to compile in C:
sudo apt-get install linux-headers-generic
sudo apt-get install autoconf
sudo apt-get install automake
sudo apt-get install libcrypto++-dev
3 - compile:
make all
sudo make install

5 - check Gpib-usb support by typing:

lsmod

6 - install packages to compile the user file :

sudo apt-get install flex
sudo apt-get install bison
sudo apt-get install guile-2.2-dev

7 - modify command links to launch python under /bin

sudo rm python python3 python3M
sudo ln -s python3.X python
sudo ln -s python3.X python3
sudo ln -s python3.X python3m

8 - install python 3.X-dev, pip, pyvisa and pyvisa-py

sudo apt-get install python3.6-dev
sudo apt-get install pip3
pip3 install pyvisa
pip3 install pyvisa-py

9 - Compile the user file :

./bootstrap
./configure
make all
sudo make install
sudo ldconfig
sudo gpib_config --minor0

9bis - edit the Gpib_config file located /usr/local/etc

the existing board-type value must be replaced by Ni_usb_b for NI compatible instrument or agilent_82357a for Keysight instruments or any other compatible string for your interface.


10 - For Specific Interface Keysight 82357 follow the help @: https://gist.github.com/turingbirds/6eb05c9267a6437183a9567700e8581a

Get the firmware : https://linux-gpib.sourceforge.io/doc_html/supported-hardware.html#AGILENT-82357A

and do the following instructions:

sudo cp ./gpib_firmware-2008-08-10/agilent_82357a/measat_releaseX1.8.hex /usr/local/lib/udev/

Insert the command line to enable everyone to access to the GPIB

sudo nano /usr/local/lib/udev/udev....script

chmod 666 /dev/gpib0

Dans le fichier script/bash /usr/local/lib/udev/gpib_udev_fxloader il est spécifié comme répertoire de travail /usr/local/share puis pour le Agilent le répertoire ou doit se situer le firmware est /usr/local/share/usb/agilent_82357a/.

Il faut donc y copier le fichier firmware mesat_releasex1.8.hex

sudo cp ./gpib_firmware-2008-08-10/agilent_82357a/measat_releaseX1.8.hex /usr/local/share/usb/agilent_82357a/

Add specific rules tu udev

Vous trouverez une configuration de rules operationnelle dans le répertoire ./linux-gpib-4.3.3/linux-gpib-user-4.3.3/usb/agilent_82357a qui a le nom 99-agilent_82357a.rules

Copiez le fichier rules dans /etc/udev/rules.d puis redémarrez le service udev

cd ./linux-gpib-4.3.3/linux-gpib-user-4.3.3/usb/agilent_82357a
  sudo cp 99-agilent_82357a.rules /etc/udev/rules.d
  sudo service udev restart

Attention : il faut gérer les droits d'accès aux périphériques dans un premier temps seul le root a accès au /dev/gpib0

cedric@cedric-OptiPlex-960:~$ sudo ibtest 


Do you wish to open a (d)evice or an interface (b)oard?
	(you probably want to open a device): d
enter primary gpib address for device you wish to open [0-30]: 11
trying to open pad = 11 on /dev/gpib0 ...


: w
enter a string to send to your device: *IDN?
sending string: *IDN?

gpib status is: 
ibsta = 0x2100  < END CMPL >
iberr= 0

ibcntl = 6
You can:
	w(a)it for an event
	write (c)ommand bytes to bus (system controller only)
	send (d)evice clear (device only)
	change remote (e)nable line (system controller only)
	(g)o to standby (release ATN line, system controller only)
	send (i)nterface clear (system controller only)
	ta(k)e control (assert ATN line, system controller only)
	get bus (l)ine status (board only)
	go to local (m)ode
	change end (o)f transmission configuration
	(q)uit
	(r)ead string
	perform (s)erial poll (device only)
	change (t)imeout on io operations
	request ser(v)ice (board only)
	(w)rite data string
	send group e(x)ecute trigger (device only)
: r
enter maximum number of bytes to read [1024]: 1024
trying to read 1024 bytes from device...
received string: 'NDCV+0.0000E-1
'
Number of bytes read: 16
gpib status is: 
ibsta = 0x2100  < END CMPL >
iberr= 0

ibcntl = 16
You can:
	w(a)it for an event
	write (c)ommand bytes to bus (system controller only)
	send (d)evice clear (device only)
	change remote (e)nable line (system controller only)
	(g)o to standby (release ATN line, system controller only)
	send (i)nterface clear (system controller only)
	ta(k)e control (assert ATN line, system controller only)
	get bus (l)ine status (board only)
	go to local (m)ode
	change end (o)f transmission configuration
	(q)uit
	(r)ead string
	perform (s)erial poll (device only)
	change (t)imeout on io operations
	request ser(v)ice (board only)
	(w)rite data string
	send group e(x)ecute trigger (device only)
: q

  • python/linux/linuxgpib.txt
  • Last modified: 2020/08/05 11:13
  • by stephane