Have you made any upgrades lately?
If you have upgraded the Kernel you have to repeat the Linux-Gpib installation procedure.
Any new version available?
The linux-gpib 4.3.4 version has been released from a while, essential if you have updated to raspberrypi-kernel 1.20210303-1.
I just installed it too. Looking at it so I can log some usb devices. Trying to figure out how it works.
Hi, new guy here.
I'm trying to get measurements from my instruments (Keithley 196 and 199) via GPIO based GPIB interface using linux-gpib on a RPi3.
So far I've been able to successfully compile linux-gpib software on the Pi and can send valid commands to instruments using the ibtest program.
Reading measurements from instruments is where I get stuck.
If I try to read using the ibtest program I get timeout error:
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]:
trying to read 1024 bytes from device...
received string: ''
Number of bytes read: 0
gpib status is:
ibsta = 0xc100 < ERR TIMO CMPL >
iberr= 6
EABO 6: Operation aborted
ibcntl = 0
Or if I try to send command bytes, interface clear command, asserting ATN,... I get Bad argument errors
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)
: i
gpib status is:
ibsta = 0x8100 < ERR CMPL >
iberr= 4
EARG 4: Bad argument
ibcntl = 0
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)
: k
Enter '1' to assert ATN synchronously, or '0' for asynchronously [1]: 1
Taking control synchronously...
gpib status is:
ibsta = 0x8100 < ERR CMPL >
iberr= 4
EARG 4: Bad argument
ibcntl = 0
I also tried using Python commands, but with similar results.
The interface circuit I use seems to be working fine as I can send commands to instruments just fine and can read measurements from keithleys using an Arduino running AR488 connected to said circuit.
I think what I need is just a kick in the right direction to get me rolling forward, so if anyone has any good suggestions, please let me know
does Keithley's work well with AR488?
Hi, new guy here.
I'm trying to get measurements from my instruments (Keithley 196 and 199) via GPIO based GPIB interface using linux-gpib on a RPi3.
So far I've been able to successfully compile linux-gpib software on the Pi and can send valid commands to instruments using the ibtest program.
Reading measurements from instruments is where I get stuck.
If I try to read using the ibtest program I get timeout error:
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]:
trying to read 1024 bytes from device...
received string: ''
Number of bytes read: 0
gpib status is:
ibsta = 0xc100 < ERR TIMO CMPL >
iberr= 6
EABO 6: Operation aborted
ibcntl = 0
Or if I try to send command bytes, interface clear command, asserting ATN,... I get Bad argument errors
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)
: i
gpib status is:
ibsta = 0x8100 < ERR CMPL >
iberr= 4
EARG 4: Bad argument
ibcntl = 0
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)
: k
Enter '1' to assert ATN synchronously, or '0' for asynchronously [1]: 1
Taking control synchronously...
gpib status is:
ibsta = 0x8100 < ERR CMPL >
iberr= 4
EARG 4: Bad argument
ibcntl = 0
I also tried using Python commands, but with similar results.
The interface circuit I use seems to be working fine as I can send commands to instruments just fine and can read measurements from keithleys using an Arduino running AR488 connected to said circuit.
I think what I need is just a kick in the right direction to get me rolling forward, so if anyone has any good suggestions, please let me know
Perhaps I misunderstand, but above looks like the problem is with the communication between linux-gpib <-> GPIO based GPIB adaptor and unrelated to the instrument, doesn't it? Is that a self-made adaptor? Perhaps worth testing with a more common interface (if a PC is available, then an old ISA or PCI based adaptor would be best; on the Pi that's not an option -- there a pricey Agilent or NI USB adaptor might be best) might help locate the problem.
Basically I'm able to transmit commands, but not receive data back.
I'm using a self made GPIB adapter with SN7516x bus drivers wired according to pin definitions in "gpib_bitbang.c" file of the kernel module source (
https://sourceforge.net/p/linux-gpib/code/HEAD/tree/trunk/linux-gpib-kernel/drivers/gpib/gpio/gpib_bitbang.c).
As a next step I'm going to try bypassing the SN7516x drivers and wiring the GPIB bus directly to RPi's GPIO pins, but haven't found time yet to do so.
The same circuit seems to work just fine when connected to an Arduino Micro running AR488 firmware, I'm able to transmit commands and receive data just fine.
That rules out problems with instruments, wires and adapter circuit I guess.
AR488 firmware seems to work just fine with my Keithley 196 and 199 and the adapter board I made fro the Raspi.
At the moment I don't have access to any other working GPIB adapters, but I'm starting to think I should get my self an old PIC adapter from fleabay. Any reliable suggestions?
[..]
As a next step I'm going to try bypassing the SN7516x drivers and wiring the GPIB bus directly to RPi's GPIO pins, but haven't found time yet to do so.
Perhaps I'm interpreting the 'directly' too literally, but keep in mind that the RPi's bus, unlike AVR based Arduinos, is not 5V tolerant.
According to "Tutorial Description of the Hewlett-Packard Interface Bus", this implementation
https://github.com/elektronomikon/raspizero_gpib_shield, and poking at the GPIB port with a DMM, I should (??) be safe to wire the RPi directly to the bus.
So any way, I deleted the driver ICs wired the GPIB bus to RPi via some 100ohm resistors, and hid behind a brick wall.
The good news: RPi is still alive and is able to read data from instruments.
The bad news: My circuit sucks for some reason and it's already the 1st revision of the PCB I had made
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]:
trying to read 1024 bytes from device...
received string: 'NDCV+03.38573E+0
'
Number of bytes read: 18
gpib status is:
ibsta = 0x2100 < END CMPL >
iberr= 0
ibcntl = 18
I'm attaching the GPIB part of my circuit. The left side connects directly to the RPi GPIO
Right, back to debugging my circuit...
Linux-gpib is only compatible with
this supported hardware.
If your hardware isn't on the list it most likely won't work.
For an own GPIB Apdapter I would recommend building something with an Vxi11 interface. Implementing read and write is sufficient for almost everything and you can then even use pyvisa on top of that.
Linux-gpib is only compatible with this supported hardware.
If your hardware isn't on the list it most likely won't work.
I think nitromethane is shooting for compatibility to the "GPIO bitbang adapter". Seems to be new-ish (started in 2016, most recent modifications spring 2021). I think that's very interesting and would like to see it work
IMHO, for a cheap adapter at the tail of a USB cable and directly connecting to a GPBI interface of a single instrument (like e.g. AR488), leaving the bus driver out as a cost-reduction measure seems sensible. When connecting multiple, even old, devices via potentially quite long cables, this seems much more questionable.
Just to be clear, yes I'm trying to get the Linux-gpib GPIO bitbang driver working with a self made interface circuit with a few extra bits along side the GPIB bus drives.
I found the problem with my circuit. DAV, NRFD and NDAC lines on the raspberry side need pull-up resistors.
When testing with an Arduino this wasn't an issue since the pull-ups seem to be taken care of inside the MCU, but I was naive in thinking that pull-ups were also taken care inside of the SoC.
Now with 10k resistors pulling to 3,3V, my interface circuit finally seems work properly.
I'll do a new revision of the circuit (hopefully the last one) and if I'm happy with it, I was thinking of open sourcing the design.
Just to be clear, yes I'm trying to get the Linux-gpib GPIO bitbang driver working with a self made interface circuit with a few extra bits along side the GPIB bus drives.
Why not writing an own userlevel "driver"? Linux-GPIB is really a pain and in your case it would be simple to avoid it.
I was already considering writing my own GPIB bitbang library in python until I got the thing working, which considering this is my first time doing anything GPIB or computer controlled measuring equipment in general would be a big project to say the least.
Now I'm almost afraid to ask, but why is linux-gpib a pain?
Aside from needing recompiling every time the kernel gets updated the linux-gpib GPIO driver seems to work fine, if the interface circuit is correctly implemented.
[..]
Why not writing an own userlevel "driver"? Linux-GPIB is really a pain and in your case it would be simple to avoid it.
Seems to compile and install still (even though it's old) just fine. Where's the pain?
And there's some value in partly reusing already tested code instead of inventing the wheel once again and not quite round.
Will this do the drift measurement for a 3458A as per service note 18A?
How do I connect it to GPIB bus? I have NI USB-GPIB-HS/HS+ adapters
Thanks
David
Hi everyone,
This thread and the install script were very helpful. However, out of the clipboard it didn't quite work for me. I'm using a Raspberry pi CM4 on the reference I/O expander board. Running Raspbian Bullseye in late May of 2023.
Here are the changes / extra steps I did to get it working for my Agilent 82357A GPIB to USB adapter:
Add "arm_64bit=0" to ./boot/config.txt
Added "/home/pi/.local/bin" to my path variable to resolve some warnings. The command is:
export PATH=$PATH:/home/pi/.local/bin
added make clean between the make and make install steps
in step 2 ran the risky kernel upgrade: "sudo apt-get install --reinstall raspberrypi-bootloader raspberrypi-kernel"
measat_releaseX1.8.hex doesn't work, put 82357a_fw.hex where measat was going in step 4.2, in my case"/usr/local/share/usb/agilent_82357a"
ignored system.map errors when installing the kernel driver
reboot between steps - if something doesn't work reboot and try again, then if still not working run "sudo apt-get update && sudo apt-get upgrade && sudo apt-get dist-upgrade" and reboot again and try again.
step 6.1 was needed
In 4.2 the gpib.conf file, board type = agilent_82357a
Also in step 4 if people copy and paste the wget command with the HTML url tags then it will fail to download.
I also manually edited the file gpib.conf in step 4 since I wasn't sure if the script would work as intended. Replacing: board_type = "NI HS whatever" with board_type = "agilent_82357a"
Also keep in mind 6.2 is still using the measat firmware so it needs to be adjusted before attempting to use it with a Agilent 82357A.
Install GPIB on Linux with Agilent USB-GPIB adapter (tested with Raspberry Pi OS Lite 32bit 2022-04-04 Bullseye (5.15.32-v7+) and linux gpib 4.3.4 (r2025) on pi3):
Joe Meta's tweaks:
Add "arm_64bit=0" to ./boot/config.txt
//my path = /home/pi/.local/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/local/games:/usr/games
export PATH=$PATH:/home/pi/.local/bin
echo $PATH
added make clean between the make and make install steps
in step 2 ran the risky kernel upgrade: "sudo apt-get install --reinstall raspberrypi-bootloader raspberrypi-kernel"
measat_releaseX1.8.hex doesn't work, put 82357a_fw.hex where measat was going in step 4.2, in my case"/usr/local/share/usb/agilent_82357a"
ignore system.map errors
reboot between steps - if something doesn't work reboot and try again, then if still not working run "sudo apt-get update && sudo apt-get upgrade && sudo apt-get dist-upgrade" and reboot again and try again.
step 6.1 was needed
Sources:
[url]https://xdevs.com/guide/agilent_gpib_rpi/[/url]
[url]https://www.eevblog.com/forum/metrology/raspberry-pi23-logging-platform-for-voltnuts/msg1301773/#msg1301773[/url]
[url]https://www.eevblog.com/forum/reviews/using-a-raspberry-pi-with-linux-gpib-and-a-beiming-or-agilent-usb-gpib-adapter/?all[/url]
[url]https://sourceforge.net/p/linux-gpib/code/HEAD/tree/trunk/[/url] -> History
1. Preparation
sudo apt-get update && sudo apt-get upgrade && sudo apt-get dist-upgrade && echo 'Rebooting...' && sudo reboot
2. Install Kernel-Headers
sudo apt-get install raspberrypi-kernel-headers && [ -d /usr/src/linux-headers-$(uname -r) ] && echo 'kernel-headers installed' || echo 'ERROR: wrong or no kernel-headers installed: '$(ls /usr/src/)', should be '$(uname -r | cut -d+ -f1)
//If newer headers are installed, updating kernel could be an option (at your own risk)
sudo apt-get update && sudo apt-get install --reinstall raspberrypi-bootloader raspberrypi-kernel
//If older headers are installed, we are stuck and have to wait until the newer headers are released
3. Install GPIB
3.1 Install build-tools
sudo apt-get install build-essential texinfo texi2html libcwidget-dev tcl8.6-dev tk8.6-dev libncurses5-dev libx11-dev binutils-dev bison flex libusb-1.0-0 libusb-dev libmpfr-dev libexpat1-dev tofrodos subversion autoconf automake libtool libpython3-dev
3.2 Build & install GPIB kernel module //was getting stuck here
sudo svn checkout svn://svn.code.sf.net/p/linux-gpib/code/trunk /usr/local/src/linux-gpib-code
cd /usr/local/src/linux-gpib-code/linux-gpib-kernel/ && sudo make
sudo make clean
sudo make install
3.3 Build & install GPIB user module
cd /usr/local/src/linux-gpib-code/linux-gpib-user/
sudo ./bootstrap
sudo ./configure
sudo make
sudo make clean
sudo make install
4. Install Agilent 82357a
4.1 Get Firmware
cd /usr/local/src/linux-gpib-code/ && sudo apt-get install fxload
&&
sudo wget [url]https://linux-gpib.sourceforge.io/firmware/gpib_firmware-2008-08-10.tar.gz[/url]
&&
sudo tar xvzf gpib_firmware-2008-08-10.tar.gz
&&
cd /usr/local/src/linux-gpib-code/gpib_firmware-2008-08-10/agilent_82357a/
4.2 Config
//adapter
sudo nano $(sudo find / -name 'gpib.conf' | grep etc) //new location since r1757 (changed from /etc/gpib.conf to $(sysconfdir)/gpib.conf)
-> board_type = "agilent_82357a"
//auto download firmware - wrong file, correct location - should use 82357a_fw.hex
//sudo cp /usr/local/src/linux-gpib-code/gpib_firmware-2008-08-10/agilent_82357a/measat_releaseX1.8.hex $(sudo find / -type d -name 'agilent_82357a' | grep usb | grep -v gpib)
//corrected version:
sudo cp /usr/local/src/linux-gpib-code/gpib_firmware-2008-08-10/agilent_82357a/82357a_fw.hex $(sudo find / -type d -name 'agilent_82357a' | grep usb | grep -v gpib)
//udev rules
sudo cp /usr/local/etc/udev/rules.d/* /etc/udev/rules.d/ //seems that the udev rules are copied to incorrect location - bug in gpib or raspbian? In r1730 everything is fine, in which release does it break?
// Grant user permission
// Since r1748, group gpib has to be created manually
sudo groupadd gpib
// Add user to group - for other user replace 'pi' with name of other user
sudo adduser pi gpib
5. Finish
5.1 Reboot
sudo reboot
//after reboot, all leds should be lit on the adapter (2x green, red) and finally only one green, if not there is a problem (see 6)
//after plug-in the adapter all leds should be lit (2x green, red) and finally only one green, if not there is a problem (see 6)
5.2 Test with connected equipment (optional)
ibtest
d
//device id
w
//after here is device specific, given are examples for HP/Agilent/Keysight devices (tested with 3457A/3458A)
END ALWAYS
w
ID?
r
[enter]
//prints: HP345xA
q //quit
6 Trouble-shooting
6.1 Test gpib module
lsmod | grep gpib_common
//Should give a line back with gpib_common, if not try next step
sudo modprobe gpib_common
lsmod | grep gpib_common
//should finish without error & print gpib_common, else gpib is not installed -> try 3. and watch out for errors
6.2 Test Adapter (only needed if not all leds are lit)
//Load Firmware for testing (latest point to plugin Adapter)
cd /usr/local/src/linux-gpib-code/gpib_firmware-2008-08-10/agilent_82357a/
lsusb -d 0957:0518 //output: Bus xxx Device yyy: ID 0957:0518 Agilent Technologies, Inc. 82357B GPIB Interface
sudo fxload -t fx2 -D /dev/bus/usb/xxx/yyy -I ./measat_releaseX1.8.hex //1st FW load
lsusb -d 0957:0518 //output: Bus xxx Device zzz: ID 0957:0518 Agilent Technologies, Inc. 82357B GPIB Interface
sudo fxload -t fx2 -D /dev/bus/usb/xxx/zzz -I ./measat_releaseX1.8.hex //2nd FW load
lsusb -d 0957:0718 //output (ID changed to 0957:0718 and all leds 2x green & red on adapter are lit) : Bus xxx Device xyz: ID 0957:0718 Agilent Technologies, Inc.
lsmod | grep agilent //output (2 lines): agilent_82357a & gpib_common
6.3 Test userspace
sudo ldconfig && sudo gpib_config
//finish without error, else the configuration is not correct -> 4.2
Hi, thanks for your experience, but let me add a few notes:
It would be good to maybe tell which issues you had, and why each 'hack' worked out.
Add "arm_64bit=0" to ./boot/config.txt
that seems to be related with some issues with upgrading to 64-bit kernel version instead of 32-bit if I googled it right, so that's a note for the users of this board, not necessary step for everybody, and likely not for this board either unless they are going to upgrade.added make clean between the make and make install steps
quite illogical step I would say, we build everything and then broke everything with a big hummer. I suppose you had built artifacts from previous attempt that's why it didn't 'make' again, so if doing it right it should be "make clean && make && sudo make install"ignored system.map errors when installing the kernel driver
it looks like you tried to insert driver for wrong kernel or just haven't rebooted to get it match your kernel, or there might be some hidden issue with driver itself, but that's definitely not the recommended behavior
Regarding upgrade - the issue is that by just doing "apt-get install something" you won't install kernel headers for the kernel you are running right now, it will install the latest ones (that your cached pat database knows about), that's why upgrade to newest kernel first before trying all other steps makes sense.
Regarding wget argument you are right, it's just a copy-paste, and not a script that is supposed to run copy-pasted. That could be updated.
Thanks to mendip-defender I was also able to update the github repo. It was tested last week with a Raspberry Pi 4
Hi!
I hope this is the right place to ask for some help …
I’m trying to get the setup from MiDi running on a Raspberry Pi Zero with a Beiming S82357 adapter.
I read in the forum that the adapter should be well supported, linux-gpib also lists support, albeit only from firmware version 1.20. Is there a way to check the firmware version of the adapter?
The installation works fine, but when I try to run ibtest and connect to a device, it fails:
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]: 1
trying to open pad = 1 on /dev/gpib0 ...
libgpib: IBOPENDEV ioctl failed
libgpib: error in is_cic()!
ibdev error
ibsta = 0x8000 < ERR >
iberr= 0
EDVR 0: OS error
ibcntl = 22
Aborted
I then followed the trouble-shooting guide, where
sudo ldconfig && sudo gpib_config
failed, too:
failed to bring board online
failed to configure board
main: Input/output error
I tried uploading the Agilent 82357A driver, despite this being noted not necessary on the linux-gpib supported hardware site, as it seemed to have helped in
this case.
Afterwards, gpib_config indeed ran without errors but when I tried to communicate with any device (via ibtest) I always got another error:
enter a string to send to your device: *IDN?
sending string: *IDN?
gpib status is:
ibsta = 0xc100 < ERR TIMO CMPL >
iberr= 14
EBUS 14: Bus error
ibcntl = 0
My devices run on addresses 1, 2 and 3. I tested the whole setup successfully with the Agilent IO suite on windows.
I'm also using a gpib_conf that user bingo600 has noted to work on this adapter:
interface {
minor = 0 /* board index, minor = 0 uses /dev/gpib0, minor = 1 uses /dev/gpib1, etc. */
board_type = "agilent_82357a" /* type of interface board being used */
name = "usb_gpib" /* optional name, allows you to get a board descriptor using ibfind() */
pad = 0 /* primary address of interface */
sad = 0 /* secondary address of interface */
timeout = T3s /* timeout for commands */
eos = 0xa /* EOS Byte, 0xa is newline and 0xd is carriage return */
set-reos = yes /* Terminate read if EOS */
set-bin = yes /* Compare EOS 8-bit */
set-xeos = no /* Assert EOI whenever EOS byte is sent */
set-eot = yes /* Assert EOI with last byte on writes */
/* settings for boards that lack plug-n-play capability */
/* base = 0 */ /* Base io ADDRESS */
/* irq = 0 */ /* Interrupt request level */
/* dma = 0 */ /* DMA channel (zero disables) */
master = yes /* interface board is system controller */
}
I tried to get this running the whole day yesterday
and would be really grateful for some help.