Using PC to control GPIB instruments, such as oscilloscopes, multimeters, power supplies is easiest thing, as most of vendors already supply ready to use libraries and packages to interface their instruments via GPIB. But if you want use using Linux-based OS or something like Raspberry Pi, things get tricky, especially for engineers who are not quiet familiar with Linux. Simple plugging GPIB adapter into Linux box will make nothing useful, as there are some compiling and packet tossing required, to make things exciting. Let's see how hard is that..

National Instruments GPIB-USB-HS dongle

First, take a look on hardware interface which we will be using in this tutorial.

There are multiple versions of USB-GPIB interfaces from National Instruments, and in this case I used previous generation GPIB-USB-HS.

While NI site lists Linux support, it’s declared only for RedHat, Scientific Linux and SUSE. If we want use it with something like Raspberry Pi with it’s Debian-based Linux system we are alone in the wild.

Very brief datasheet just covers basic installation and specification.

Raspberry Pi setup

All information below is tested on Raspberry Pi 1 model B revision 2, using on-board USB connection. Linux version used was RASPBIAN Debian Wheezy, which we already go through basic setup doing I2C stuff before, in this article. If you need to setup system from scratch on blank SD card, suggest to reference that article first.

Below step by step tutorial for whole process of setting up GPIB-USB-HS to work with Raspberry Pi system, I'd like to give credits to “Forum thread on EEVBlog.com” and member bingo600, which was a great help

Before installing stuff, I'd highly recommend to update current packets. All commands below are issued under admin root rights, so if you don’t usually logon under root, you may need use sudo.

apt-get update

Install Linux kernel image, as linux-gpib module versions are specific for each kernel branch, and they both need match.

apt-get install linux-image-rpi-rpfv

In my case it put kernel verison 3.18.0. You can locate it in /boot directory, where two files should be present, such as initrd.img-3.18.0-trunk-rpi and vmlinuz-3.18.0-trunk-rpi

In boot/config.txt append this at end of file , or it will boot the default “Foundation kernel”

Double check filenames and presence of files in /boot, otherwise your Raspberry Pi will not boot. If such happens, fix is easy. Just remove SD card, plug it into your PC and change config.txt file, as it’s accessible from FAT filesystem under usual OS, unlike rest of linux partitions on Raspberry’s SD card.

After success with kernel change and boot, we can check kernel version and install header package:

root@tin:/home/gpib/linux-gpib-3.2.21# make
make all-recursive
make[1]: Entering directory '/home/gpib/linux-gpib-3.2.21'
Making all in include
make[2]: Entering directory '/home/gpib/linux-gpib-3.2.21/include'
make all-am
make[3]: Entering directory '/home/gpib/linux-gpib-3.2.21/include'
make[3]: Nothing to be done for 'all-am'.
...
...
root@tin:/home/gpib/linux-gpib-3.2.21# make install

Configuration for linux-gpib and interfacing

After everything successfully installed without errors, let’s connect GPIB-USB-HS adapter to Raspberry Pi and try to talk with it.

Make sure your Pi powered with good high-current USB cable and +5 VDC power supply with at least 1 Amp , as NI GPIB-USB-HS is taking some decent amount of power and with cheap USB cable connected to PC port it was causing unstable operation, LANLEDs on Pi were blinking like crazy and nothing worked, as voltage drop too much.

Checking interface connection is simple, just run lsusb to see which devices are present on USB bus:

Unlike old GPIB-USB-B, which need Cypress FX firmware upload after connection, GPIB-USB-HS does not need any firmware uploads and ready to work right from the box.Let’s load kernel module with modprobe: