Linux-GPIB Info

The Linux GPIB Package is a support package for GPIB (IEEE 488) hardware, please see at Linux-GPIBInfo#Links. The package contains kernel driver modules, and a C user-space library with Guile, Perl, PHP, Python and TCL bindings. The API of the C library is intended to be compatible with National Instrument's GPIB library.

I like to have an GPIB interface with open source code and low cost. Because this can not archived with a commercial version, I build my own. I started with an interface from Elektor, lease see at GPIBtoUSB2.

Because the CPU R8C is a little bit exotic and the output drive current capacity is quite low, I ported the program to an Arduino Nano 3 module, please see at GPIBtoUSB_Nano3.

Now,

Configuration gpib.conf

The file /etc/gpib.conf is the main configuration file for the GPIB library. For my interface it looks like:

interface {
        minor = 0       /* board index, minor = 0 uses /dev/gpib0, minor = 1 uses /dev/gpib1, etc. */
        board_type = "rwan_usb_gpib"    /* type of interface board being used */
        name = "rwan"   /* name for ibfind */
        pad = 0         /* primary address of interface             */
        sad = 0         /* secondary address of interface           */
        timeout = T3s   /* timeout for commands */

        eos = 0x0a      /* EOS Byte, 0xa is newline and 0xd is carriage return */
        set-reos = yes  /* Terminate read if EOS */
        set-bin = no    /* Compare EOS 8-bit */
        set-xeos = no   /* Assert EOI whenever EOS byte is sent */
        set-eot = yes   /* Assert EOI with last byte on writes */

        master = yes    /* interface board is system controller */

The abstact interface board, mostly a GPIB Controller, will usually have the minor number of 0. Then the Linux device name is /dev/gpib0.

The name is a comfort issue, which allows to search for the board with a handy name, e.g in the test program ibtest.

Test with new interface driver

The already installed driver can now be loaded, until a udev rule is setup for USB hotplug.

$ sudo modprobe rwab_usb_gpib

$ lsmod | grep rwan
rwan_usb_gpib          18498  0 
gpib_common            33177  1 rwan_usb_gpib

# Now test it:
$ sudo ibtest
Do you wish to open a (d)evice or an interface (b)oard?
        (you probably want to open a device): b
enter name of interface board (or device) you wish to open: rwan
trying to open board named 'rwan'
libgpib: IBOPENDEV ioctl failed
libgpib: ibfind failed to get descriptor
failed to open board

From /var/log/kernel.log you can see the start:

13:52:41 usb 2-3: FTDI USB Serial Device converter now attached to ttyUSB0
17:01:00 Linux-GPIB 3.2.19 Driver
17:32:42 show_signal_msg: 39 callbacks suppressed

19:11:05 gpib: registered rwan_usb_gpib interface
19:11:05 rwan_usb_gpib:usb_gpib_init_module - done

18:10:18 rsyslogd-2039: Could not open output pipe '/dev/xconsole' [try http://www.rsyslog.com/e/2039 ]

Test of the circuit

In order to test the basic function of the program and the interface, you need a terminal program. May I suggest PUTTY for Win32 and CoolTerm for Mac OS X.

PUTTY Parameters, Session:
  Connection Type: serial
  Serial line: COMx (x = USB Serial Emulation Nummer, z.B. 6)
  Speed: 38400

Keyboard input (blind, no Echo): "I", strg"J" (upper case I, Control+J = LineFeed)

Answer:
GPIB/USB converter V1.1

or
Set local echo ON
Text from the clipboard is inserted into the terminal window via the middle mouse key.

Firmware Comands

The commands can be sent manually in a terminal to the GPIB-USB converter. All commands must be terminated with Linefeed (Ctrl + J).

Extensions to GPIB_USB.c

To be able to operate my HP Logic Analyzer HP1631D in a useful manner with this interface a few commands were added:

The extended files are here for download: GPIB_USB_nano.ino , GPIB_functions.ino and header file GPIB_nano.h.

Application Program hp1630.py for Logic Analyzer

For comfortable using the HP Logic Analyzer HP1631D, I have written a Python command line program hp1630.py. It actually runs under MAC OS X, but should be easily ported to Win32 or Linux. If you run the programm without parameter you get get a help message. The GPIB Address of the device is coded to 4. The following commands are build in, as Command Line Parameter:

If you want to run a different GPIB device so you have to adjust the program accordingly. Since Python is a multi-platform interpreter programming language, an adoption should not be so difficult.

Screen Shots

For screen shots please have a look at GPIBtoUSB2#Screen_Shots.

Troubleshooting

$ sudo service rsyslog stop

# make device descriptor
$ sudo mknod -m 640 /dev/xconsole c 1 3

# change owner
$ sudo chown syslog:adm /dev/xconsole

$ sudo service rsyslog start

# Verify it is working with reload as well
$ sudo service rsyslog reload

# edit file in util/create_gpib0.sh

#!/bin/sh
# restore gpib device descriptors
# call with: sudo ./create_gpib0.sh
# test with: ls /dev/gp*

for i in `seq 0 15`;
    do
        mknod -m u=rw,g=rw,o= /dev/gpib${i} c 160 ${i} || exit 1;
        chown root:gpib /dev/gpib${i};
    done

List of pages in this category:

-- RudolfReuter 2013-11-07 18:02:17


Go back to CategoryLogicAnalyzer or StartSeite ; KontaktEmail (ContactEmail)