Jan-2017
You need linux-gpib SVN R1654 or later , in order to get it to work on Kernel 4.x.xIf using a zip package , you will need something higher than 4.0.3See more here
https://www.eevblog.com/forum/metrology/raspberry-pi23-logging-platform-for-voltnuts//Bingo
I have succeded in getting linux-gpib to compile on a Raspberry PI.
This means i now have a 3..5-Watt linux computer that can be used with an Agilent compatible GPIB-USB adapter.
And i even get "networking for "free" , and can make a networked linux-gpib adapter with python bindings for approx. 80 (gpib) + 40 (RasPI) = 120 US$
The adapters i know that has a linux-gpib compatible firmware is :
1:
The real Agilents (I got mine from here , with a "best offer") - came brand new in a sealed box , and with DHL shipping - 4 days to EU
http://www.ebay.com/itm/Agilent-82357B-USB-GPIB-Interface-High-Speed-USB-2-0-NEW-IN-BOX-/2513707460652:
The Beimings , with their new linux-gpib compatible firmware.
S82357 the standard adapter ok for most uses - $79
http://www.ebay.com/itm/S82357-GPIB-USB-interface-compatible-with-Agilent-82357B-/181253216568F82357 the same functions as the S82357, but uses DMA for xfer , and should be faster if you transfer large binary data chunks. -$99
http://www.ebay.com/itm/F82357-GPIB-USB-interface-compatible-with-Agilent-82357B-/171155337720 I have an Agilent 82357B, and also a Beiming S82357 , and both are working excellent with linux-gpib.
I have tested Linux Mint 14 , Debian 7.0 and the raspberry.org kernel used further down.
See :
https://www.eevblog.com/forum/reviews/howto-get-the-raspian-kernel-installed-with-headers/One of the annoyances of linux-gpib is that there is no build in kernel support for the package ,
meaning that one has to rebuild the linux-gpib package every time the kernel changes (updates).
This is not a big problem , provided that the kernel maintainer delivers a working kernel header package ,but it is still annoying.
This "challenge" is still present on a RasPI , but as my RasPI's are living protected on my inside lan.
I don't have to do every kernelupdate to protect it , and i can see it as a "Black Box" just running my gpib adapter.
I have chosen to install ufw (a small firewall) : apt-get install ufw
Just to get some protection ... But make sure you know what you are doing , or ssh will be blocked also.
Or one could even omit the default gateway on the RasPI , and making it unable to communicate with anything not on the local lan.
If logging a lot of GPIB data to the SD card , one can either put the data on a tmpfs
http://raspberrypi.stackexchange.com/questions/169/how-can-i-extend-the-life-of-my-sd-cardOr use the the Ramlog package.
http://www.xappsoftware.com/wordpress/2013/06/10/two-tricks-to-make-your-raspberry-pi-more-reliable/I have chosen neither of the above , as i have a 24/7 linux mail/file server running. So i will NFS enable my RasPI and log via NFS to my fileserver.
Raspi Preparation
Edit: 14-may-2014
Note: The below kernel versions might change , look in /boot for the latest vmlinuz-x.xx.xx-rpiFor now they are
kernel=vmlinuz-3.10-3-rpi
initramfs initrd.img-3.10-3-rpi followkernel
Howto get the Raspian kernel installed with headers:
See : http://www.raspberrypi.org/phpBB3/viewtopic.php?f=66&t=57401
Entry by : by plugwash ยป Fri Nov 08, 2013 10:22 pm
I use a standard "Foundation Noobs" as the base boot ....
http://www.raspberrypi.org/downloads
Put that one on the SD Card , and activate their Raspbian.
Boot the RasPI , set it up , enable ssh via the "on-screen" config
Then apt-get the Raspian.org kernel below.
I use an unmodified sources.list (from the Noobs raspian)
$ cat /etc/apt/sources.list
deb http://mirrordirector.raspbian.org/raspbian/ wheezy main contrib non-free rpi
We get the Raspbian package "metapackage linux kernel" , that has corresponding headers.
1: sudo apt-get update
2: sudo apt-get install linux-image-rpi-rpfv
3: In boot/config.txt append this at end of file , or it will boot the default "Foundation kernel"
************* SNIP ***********************
# Set params for "raspbian debian-style kernel" boot
#kernel=vmlinuz-3.2.0-4-rpi
#initramfs initrd.img-3.2.0-4-rpi followkernel
#kernel=vmlinuz-3.6-trunk-rpi
#initramfs initrd.img-3.6-trunk-rpi followkernel
kernel=vmlinuz-3.10-3-rpi
initramfs initrd.img-3.10-3-rpi followkernel
************* SNIP ***********************
4: reboot
5: login
6: apt-get install linux-headers-rpi-rpfv
Done Kernel stuff
6a: Install the needed system packages , in order for linux gpib to build
#All packages on one line
sudo apt-get install build-essential texinfo texi2html libcwidget-dev tcl8.4-dev tk8.4-dev libncurses5-dev \
libx11-dev binutils-dev bison flex libusb-1.0-0 libusb-dev libmpfr-dev libexpat1-dev tofrodos subversion autoconf automake libtool
7: mkdir linux-gpib (we assume in your home dir)
8: cd linux-gpib
9: svn checkout svn://svn.code.sf.net/p/linux-gpib/code/trunk linux-gpib-code
10: copy raspi.diff (patchfile) to current dir (attached)
11: cd linux-gpib-code/linux-gpib/
My patch has been accepted by the linux-gpib maintainers
So from svn rev 1611 an onwards no patching is needed , the svn repos is updated now.
The patch is also in the new linux-gpib 3.2.20 tarball that you can get here
http://sourceforge.net/projects/linux-gpib/files/
Note (new): If you are also using ISA GPIB Cards , you now have to specificly enable that on the configure line , see readme
Nov-2014 - User falcongsr : Mentions that he had to do an apt-get install python-dev to getthe python bindings to compileNow we are back on track , and can build normal with ./bootstrap.
./bootstrap
./configure
make | tee gpib-make-log
sudo make install
# The make install wil complain about depmod -ae , so just run a depmod -a afterwards
sudo depmod -a
sudo ldconfig
# Load the newly build module
sudo modprobe agilent_82357a
adapt /etc/gpib.conf to match your system (once)
Attach the USB adapter to the RasPI now
Prepare the load of the usb-adapter firmware
The Agilent 82357B adapter needs the firmware loaded twice.
lsusb
It will show something like this : Bus 001 Device 007: ID 0957:0518 Agilent Technologies, Inc.
The thing to notice is the ID : 0957:0518 , this means the adapter does not have the correct firmware yet.
The adapter will show 0957:0718 when ready , and the green leds will be lit.
cd ~/linux-gpib
sudo apt-get install fxload
#Get the USB adapter firmware
wget http://linux-gpib.sourceforge.net/firmware/gpib_firmware-2008-08-10.tar.gz
tar xvzf gpib_firmware-2008-08-10.tar.gz
cd gpib_firmware-2008-08-10/agilent_82357a/
#Find the adapter
lsusb
#It will show something like this : Bus 001 Device 007: ID 0957:0518 Agilent Technologies, Inc.
#load firmware 1'st time
sudo fxload -t fx2 -D /dev/bus/usb/001/007 -I ./measat_releaseX1.8.hex
#Find the adapter (Device will usually increment by 1 , after a fw load)
lsusb
#It will show something like this : Bus 001 Device 008: ID 0957:0518 Agilent Technologies, Inc.
#load firmware 2'nd time
sudo fxload -t fx2 -D /dev/bus/usb/001/008 -I ./measat_releaseX1.8.hex
#Find the adapter
lsusb
#It will show something like this : Bus 001 Device 009: ID ID 0957:0718 Agilent Technologies, Inc. , note the change to ID 0957:0718
The green led's should be lit , and we're ready to go.
Start/init linux-gpib (every time)
sudo gpib_config
Note : Most of the sudo's can be omitted once you get your rules correctly installed in /etc/udev/rules.d
But i'll leave this as an excercise for the reader :-)
Here is some kernel log snips , and a test session using ibtest (linux-gpib test program)
#
# From kernel-log
#
Nov 11 20:22:06 raspberrypi-3 kernel: [ 184.631539] Linux-GPIB 3.2.19 Driver
Nov 11 20:22:06 raspberrypi-3 kernel: [ 184.664507] agilent_82357a_gpib driver loading
*** Agilent insert
Nov 11 20:22:06 raspberrypi-3 kernel: [ 184.664681] usbcore: registered new interface driver agilent_82357a_gpib
Nov 11 20:22:06 raspberrypi-3 kernel: [ 184.664702] gpib: registered agilent_82357a interface
Nov 11 20:22:39 raspberrypi-3 kernel: [ 218.065122] usb 1-1.3: USB disconnect, device number 4
Nov 11 20:22:41 raspberrypi-3 kernel: [ 219.837498] usb 1-1.3: new high-speed USB device number 5 using dwc_otg
Nov 11 20:22:41 raspberrypi-3 kernel: [ 219.937934] usb 1-1.3: New USB device found, idVendor=0957, idProduct=0518
Nov 11 20:22:41 raspberrypi-3 kernel: [ 219.937963] usb 1-1.3: New USB device strings: Mfr=0, Product=0, SerialNumber=0
Nov 11 20:22:55 raspberrypi-3 kernel: [ 233.427209] usb 1-1.3: USB disconnect, device number 5
Nov 11 20:22:57 raspberrypi-3 kernel: [ 235.197578] usb 1-1.3: new high-speed USB device number 6 using dwc_otg
Nov 11 20:22:57 raspberrypi-3 kernel: [ 235.299248] usb 1-1.3: New USB device found, idVendor=0957, idProduct=0718
Nov 11 20:22:57 raspberrypi-3 kernel: [ 235.299280] usb 1-1.3: New USB device strings: Mfr=1, Product=2, SerialNumber=5
Nov 11 20:22:57 raspberrypi-3 kernel: [ 235.299298] usb 1-1.3: Product: 82357B ()
Nov 11 20:22:57 raspberrypi-3 kernel: [ 235.299315] usb 1-1.3: Manufacturer: Agilent Technologies, Inc.
Nov 11 20:22:57 raspberrypi-3 kernel: [ 235.299330] usb 1-1.3: SerialNumber: MY4945xxxx
Nov 11 20:22:57 raspberrypi-3 kernel: [ 235.309402] probe succeeded for path: usb-bcm2708_usb-1.3
Nov 11 20:23:20 raspberrypi-3 kernel: [ 258.549769] attached to bus interface 0, address 0xdb5e0000
Nov 11 20:23:20 raspberrypi-3 kernel: [ 258.568586] agilent_82357a_attach: attached
Nov 11 20:27:21 raspberrypi-3 kernel: [ 499.191299] usb 1-1.3: USB disconnect, device number 6
Nov 11 20:27:21 raspberrypi-3 kernel: [ 499.191651] agilent_82357a_driver_disconnect: exit
*** Beiming insert
Nov 11 20:28:22 raspberrypi-3 kernel: [ 560.873199] usb 1-1.3: new high-speed USB device number 7 using dwc_otg
Nov 11 20:28:23 raspberrypi-3 kernel: [ 561.205274] usb 1-1.3: New USB device found, idVendor=0957, idProduct=0718
Nov 11 20:28:23 raspberrypi-3 kernel: [ 561.205304] usb 1-1.3: New USB device strings: Mfr=1, Product=2, SerialNumber=5
Nov 11 20:28:23 raspberrypi-3 kernel: [ 561.205321] usb 1-1.3: Product: S82357 ()
Nov 11 20:28:23 raspberrypi-3 kernel: [ 561.205337] usb 1-1.3: Manufacturer: BEIMING Technologies, Inc.
Nov 11 20:28:23 raspberrypi-3 kernel: [ 561.205352] usb 1-1.3: SerialNumber: CP1001xxxx
Nov 11 20:28:23 raspberrypi-3 kernel: [ 561.215169] probe succeeded for path: usb-bcm2708_usb-1.3
Nov 11 20:29:37 raspberrypi-3 kernel: [ 635.696267] gpib0: exiting autospoll thread
Nov 11 20:29:37 raspberrypi-3 kernel: [ 635.696388] agilent_82357a_detach: detached
Nov 11 20:29:37 raspberrypi-3 kernel: [ 635.696526] attached to bus interface 0, address 0xda1b7000
Nov 11 20:29:37 raspberrypi-3 kernel: [ 635.715456] agilent_82357a_attach: attached
Nov 11 20:31:32 raspberrypi-3 kernel: [ 750.316900] /home/pi/raspi/linux-gpib-code/linux-gpib/drivers/gpib/agilent_82357a/agilent_82357a.c: agilent_82357a_read: agilent_82357a_receive_bulk_msg timed out, bytes_read=0, extra_bytes_read=1
pi@raspberrypi-3 ~ $
#
# Agilent fw-load
#
root@raspberrypi-3:~# lsusb
Bus 001 Device 002: ID 0424:9512 Standard Microsystems Corp.
Bus 001 Device 001: ID 1d6b:0002 Linux Foundation 2.0 root hub
Bus 001 Device 003: ID 0424:ec00 Standard Microsystems Corp.
Bus 001 Device 004: ID 0957:0518 Agilent Technologies, Inc. 82357B GPIB Interface
root@raspberrypi-3:~# fxload -t fx2 -D /dev/bus/usb/001/004 -I /usr/share/usb/agilent_82357a/measat_releaseX1.8.hex
root@raspberrypi-3:~# lsusb
Bus 001 Device 002: ID 0424:9512 Standard Microsystems Corp.
Bus 001 Device 001: ID 1d6b:0002 Linux Foundation 2.0 root hub
Bus 001 Device 003: ID 0424:ec00 Standard Microsystems Corp.
Bus 001 Device 005: ID 0957:0518 Agilent Technologies, Inc. 82357B GPIB Interface
root@raspberrypi-3:~# fxload -t fx2 -D /dev/bus/usb/001/005 -I /usr/share/usb/agilent_82357a/measat_releaseX1.8.hex
root@raspberrypi-3:~# sudo gpib_config
root@raspberrypi-3:~# ls /dev/gpib*
/dev/gpib0 /dev/gpib10 /dev/gpib12 /dev/gpib14 /dev/gpib2 /dev/gpib4 /dev/gpib6 /dev/gpib8
/dev/gpib1 /dev/gpib11 /dev/gpib13 /dev/gpib15 /dev/gpib3 /dev/gpib5 /dev/gpib7 /dev/gpib9
root@raspberrypi-3:~# 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]: 16
trying to open pad = 16 on /dev/gpib0 ...
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
: w*idn
enter a string to send to your device: *idn?
sending string: *idn?
gpib status is:
ibsta = 0x2100 < END CMPL >
iberr= 0
ibcnt = 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
: r
enter maximum number of bytes to read [1024]:
trying to read 1024 bytes from device...
received string: 'KEITHLEY INSTRUMENTS INC.,MODEL 2015,1043877,B15 /A02
'
Number of bytes read: 57
gpib status is:
ibsta = 0x2100 < END CMPL >
iberr= 0
ibcnt = 57
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
: q
*** Python example with my Keithley @GPIB-Addr 16 ***
root@raspberrypi-3:~# python
Python 2.7.3 (default, Jan 13 2013, 11:20:46)
[GCC 4.6.3] on linux2
Type "help", "copyright", "credits" or "license" for more information.
>>>
>>>
>>> import Gpib
>>> inst = Gpib.Gpib(0,16) # address 6
>>> inst.write("*IDN?")
>>> inst.read(100) # read 100 bytes
'KEITHLEY INSTRUMENTS INC.,MODEL 2015,104xxxx,B15 /A02 \n'
>>>
When/if your gpib adapter works ok , you could add this line : agilent_82357a
to the file /etc/modules , and omit this step on new boots : sudo modprobe agilent_82357a
Edit:
I would like to thank
plugwash and the other guyz from
raspbian.org for caring enough to make the kernel and header package available.
Apparently the "foundation isn't interested in advanced users". Apparently the "foundation has other priorities".
Ohh and the linux-gpib maintainers whom ever they are now.
Happy measuring
/Bingo