Sigrok Protocol Decoder GPIB

For GPIB (General Purpose Interface Bus, or HPIB, or IEEE488; 16 bits parallel) protocol analysis with a Saleae Logic16 clone, I need a Sigrok decoder. It is planned, but I like to use it now. So, I tried to program it myself.

Not so easy, after the first look. The decoder HowTo describes it on a high level, but misses a lot of details. So, I am trying to understand the logic at the example ir_nec.

After some reading I found decoder parallel most suited as a guide.

On the right is a picture (click on the picture will expand it) of the GPIB connection. In order to make it easy, I used a 24 wire flat cable with a GPIB-DB24 plug on one end, and a 26 pin flat cable connector on the other side. A 26 pin pin-plug with wire-wrap pins is used to have an easy connection to the Saleae-Logic16 clone.

/!\ This project is also hosted on github - sigrok-gpib


Sigrok Decoder GPIB

I made a sample session file with an ID poll of a HP logic analyzer HP1631D. Please see at State Analysis for a GPIB decoding print.

When you load the decoder GPIB in Pulseview the channel ATN must be set to pin 14, in order to decode the GPIB commands. Channel EOI is alread set to pin 8.

It will easier the handling, to connect the Logic Analyzer input bits with the same channel numbers (0..15), as shown in the protcol decoder.

The source code is named and and can be viewed via mouse click, and downloaded.

The 2 files must be copied in, either:

# Ubuntu, user local
$ mkdir ~/.local/share/libsigrokdecode/decoders/gpib
# Ubuntu, in sigrok installation
$ sudo mkdir /usr/local/share/libsigrokdecode/decoders/gpib

/!\ Take care about the 2 underscores of the init file. It can happen, that the operating system will modify them, as it happened to me on Mac OS X. Then the decoder gpib will not load, and you get no error message.

For an easier installation (user local) you can also install via github.

The files must be placed in a new folder named gpib:

# path libsigrokdecode/decoders/gpib/

# a quick test for a good installation, and showing the parameters is:
$  sigrok-cli --protocol-decoders gpib --show
ID: gpib
Name: GPIB
Long name: General Purpose Interface Bus
Description: IEEE-488 GPIB / HPIB protocol.
License: gplv2+
Annotation classes:
- items: Items
- gpib: DAT/CMD
- eoi: EOI
Annotation rows:
- bytes (Bytes): items
- gpib (DAT/CMD): gpib
- eoi (EOI): eoi
Required channels:
- d0 (D0): Data I/O bit 1, ch 0
- d1 (D1): Data I/O bit 2, ch 1
- d2 (D2): Data I/O bit 3, ch 2
- d3 (D3): Data I/O bit 4, ch 3
- d4 (D4): Data I/O bit 5, ch 4
- d5 (D5): Data I/O bit 6, ch 5
- d6 (D6): Data I/O bit 7, ch 6
- d7 (D7): Data I/O bit 8, ch 7
- eoi (EOI8): End or identify, ch 8
- dav (DAV9): Data valid (clock), ch 9
- nrfd (NRFD10): Not ready for data, ch 10
- ndac (NDAC11): Not data accepted, ch 11
- ifc (IFC12): Interface clear, ch 12
- srq (SRQ13): Service request, ch 13
- atn (ATN14): Attention, ch 14
- ren (REN15): Remote enable, ch 15
Optional channels:
- sample_total: Total number of samples (default 0)
- state: state analysis ('False', 'True', default 'False')
This protocol decoder can decode the GPIB (IEEE-488) protocol.

If the clock channel DAV is set, GPIB decoding is shown.

If the total sample number is given, the last byte is shown.

If option "state" is set "True", a GPIB "State Analysis" is printed
in the terminal.

Below is a decoder sample print of the before mentioned ID poll. It is made with the command:

$ pulseview -i 

The first picture shows in detail the GPIB handshake.


The second picture shows in detail the last 4 bytes, notice the EOI signal at the last data byte.


The third picture shows the whole GPIB session: command ID, answer HP1631D.


The GPIB rows contain the following data:


When you collect a data stream with sigrok (command line), or pulseview (sigrok with GUI), you have the possibility to save the data to a session file with the extension In order to test decoder software, you can replay the collected data with the command line option -i file-name.

GPIB attributes

On the right you see a picture of the gpib decoder attributes, seen when you click on the flag gpib on the left in the picture above.

The following is important:

The total number of bytes 20000 was from the capture session:

A short explanation for the GPIB command decoding, when line ATN was active:

GPIB State Analysis

If you set in attributes window the state analysis flag to True, you will get in the terminal the following print, like a State Analysis:

GPIB State Analysis
     0; 3F;  63; UNL ;
     9; 5F;  95; UNT ;
    18; 24;  36; L4  ;
    25; 49;  73; I   ;
  4031; 44;  68; D   ;
  5843; 0A;  10; LF  ; EOI
  5852; 3F;  63; UNL ;
  5860; 5F;  95; UNT ;
  5869; 44;  68; T4  ;
 14830; 48;  72; H   ;
 15417; 50;  80; P   ;
 15536; 31;  49; 1   ;
 15656; 36;  54; 6   ;
 15775; 33;  51; 3   ;
 15895; 31;  49; 1   ;
 16106; 44;  68; D   ; EOI
 16123; 3F;  63; UNL ;
 16130; 5F;  95; UNT ;

The data colums are:

The logic of the GPIB session is:

  1. Convert Rigol DS1102E I2C CSV for Sigrok

  2. Pulseview on windows 32/64 Bit with 8 Bit Logic Analyzer

  3. USBee AX with Pulseview and decoder UART explained

  4. Pulseview with UART decoder and SPI and stacking nRF24L01

  5. Sigrok Saleae Logic16 support

  6. Sigrok RSS feed, news

List of pages in this category:

-- RudolfReuter 2016-09-09 16:19:32

Go back to CategoryLogicAnalyzer or FrontPage ; KontaktEmail (ContactEmail)

SigrokDecoderGPIB (last edited 2016-10-19 08:06:11 by RudolfReuter)