Main Content

Troubleshooting GPIB Interface

GPIB is a standardized interface that allows you to connect and control multiple devices from various vendors. GPIB is also referred to by its original name HP-IB, or by its IEEE® designation IEEE-488. GPIB support in MATLAB® is provided through the VISA-GPIB interface.

Issue

If you are having trouble connecting to or communicating with your GPIB device, follow these troubleshooting steps.

Possible Solutions

Supported Platforms and Minimum Driver Requirements

The VISA-GPIB interface is supported only on Microsoft® Windows® 10 (64-bit) and is not available for macOS or Linux.

The following table shows the minimum GPIB and VISA driver versions you must have. You must have one of the following GPIB drivers and its corresponding VISA driver both installed.

Minimum GPIB driverMinimum VISA driver
Keysight® IO Libraries version 18.1.24715.0 (Keysight Connection Expert 2019)Keysight IO Libraries version 18.1.24715.0 (Keysight Connection Expert 2019)
ICS 488.2v4 Adaptor version 4.0
ADLINK ADL-GPIB version 20.01.0
NI-488.2 Adaptor v2.8

National Instruments™ NI-VISA version 19.5

MCC GPIB 488.2 Library v2.3

None of the supported GPIB drivers (Keysight, ICS, ADLINK, NI, and MCC) support asynchronous read and write operations.

The Keysight GPIB driver also has the following limitations:

  • The End Or Identify (EOI) line is not asserted when the End-Of-String (EOS) character is written to the hardware.

  • All eight bits are used for the EOS comparison.

  • A board index value of 0 is not supported.

  • An error is not reported for an invalid primary address. Instead, the read and write operations time out.

Configuration and Connection

  1. Make sure that your adaptor is powered on. Make sure your device is also powered on.

  2. Make sure that you have the correct GPIB and VISA drivers installed for your device. Refer to your device documentation and the vendor website.

  3. Make sure your device is supported in Instrument Control Toolbox™. See Is My Hardware Supported? and Instrument Control Toolbox Supported Hardware.

  4. Make sure that Instrument Control Toolbox recognizes your device, by using the visadevlist function.

    resourceList = visadevlist
    resourceList =
    
      6×6 table
    
                            ResourceName                         Alias                  Vendor               Model       SerialNumber     Type 
             __________________________________________    _________________    ______________________    ___________    ____________    ______
    
        1    "USB0::0x0699::0x036A::CU010105::0::INSTR"    "NI_SCOPE_4CH"       "TEKTRONIX"               "TDS 2024B"    "CU010105"      usb   
        2    "TCPIP0::169.254.2.20::inst0::INSTR"          "Keysight_33210A"    "Agilent Technologies"    "33210A"       "MY57003523"    tcpip 
        3    "ASRL1::INSTR"                                "COM1"               ""                        ""             ""              serial
        4    "ASRL3::INSTR"                                "COM3"               ""                        ""             ""              serial
        5    "GPIB0::5::INSTR"                             "FGEN_2CH"           "Agilent Technologies"    "33522B"       "MY52800145"    gpib  
        6    "GPIB0::11::INSTR"                            "OSCOPE_2CH"         "TEKTRONIX"               "TDS 1002"     "0"             gpib  
    

    If the instrument is not listed, it might not be configured properly in your vendor’s VISA configuration utility software.

  5. Make sure you can create the VISA-GPIB object using visadev. Each VISA-GPIB object is associated with one controller and one instrument. visadev requires the resource name or alias as an input. For example, create a VISA-GPIB object connected to a National Instruments controller with board index 0 and a Tektronix® TDS1002 digital oscilloscope with primary address 1 and secondary address 0.

    visagpib = visadev("GPIB0::1::0::INSTR")

    If you do not get an error, the object was created successfully. If the resource name or alias does not exist, you get an error. Check that the resource name or alias is correct in the vendor configuration utility software.

    You can have only one visadev object for a given resource at a time.

  6. When you have connected, you can communicate with your device. If you have problems sending or receiving, you might need to configure communication settings. Make sure you are using the correct instrument command. Look in the instrument’s documentation to see what commands it recognizes. Verify that communication works by testing the connection using the vendor's configuration utility.

VISA Driver Configuration

If you are still having connection or communication issues with your GPIB resource using VISA, you can troubleshoot using your VISA vendor's software and utilities, as described in the following table.

VendorConfiguration UtilityTesting ConnectionDebug Utility
Keysight VISAKeysight Connection Expert (KCE)Interactive IO button on KCEIO Monitor button on KCE
National Instruments VISAMeasurement and Automation Explorer (MAX)Tools > NI VISA > VISA Interactive ControlTools > NI I/O Trace
  1. If you have multiple VISA installations, make sure that you have a preferred VISA set and that it is enabled. Check if all the VISA interfaces are using the expected VISA.

  2. Use your vendor's configuration utility to make sure that your device hardware is being detected. Check that the hardware and interface properties are assigned as expected. You can also check that your device responds to a *IDN? query.

  3. If you use SCPI commands, check if your device responds to them as expected when issued from the configuration utility.

  4. Use your vendor's debug utility to check the Instrument I/O traffic for errors other than timeout errors.

Communication

  1. Make sure the correct data type is being used with read, readbinblock, write, and writebinblock. Use the same data type that your instrument is configured to return.

  2. If reading and writing data types other than uint8 or int8, make sure the ByteOrder property is correct. You can configure it to be little-endian or big-endian. For GPIB, ByteOrder refers to the order in which the bytes in a multi-byte data type values are transmitted on the communication bus. You can use the swapbytes function to troubleshoot issues with ByteOrder. Configure ByteOrder to the appropriate value for your instrument before performing a read or write operation. Refer to your instrument documentation for information about the order in which it stores bytes.

  3. EOIMode is the default and should be left on most of the time. However, some instruments might require EOIMode to be turned off.

Adaptor Requirements

Bus and connector.  You need a bus and connector to communicate with GPIB instruments. The GPIB bus is a cable with two 24-pin connectors that allow you to connect multiple devices to each other. For more information, see Bus and Connector.

GPIB devices.  Each GPIB device must be some combination of a Talker, a Listener, or a Controller. A Controller is typically a board that you install in your computer. Talkers and Listeners are typically instruments such as oscilloscopes, function generators, multimeters, and so on. Most modern instruments are both Talkers and Listeners. Each Controller is identified by a unique board index number. Each Talker/Listener is identified by a unique primary address ranging from 0 to 30, and by an optional secondary address, which can be 0 or can range from 96 to 126. For more information, see GPIB Devices.

GPIB data.  Two types of data can be transferred over GPIB, instrument data and interface messages:

  • Instrument data — Instrument data consists of vendor-specific commands that configure your instrument, return measurement results, and so on. For a complete list of commands supported by your instrument, refer to its documentation.

  • Interface messages — Interface messages are defined by the GPIB standard and consist of commands that clear the GPIB bus, address devices, return self-test results, and so on.

    Data transfer consists of one byte (8 bits) sent in parallel. The data transfer rate across the interface is limited to 1 megabyte per second. However, this data rate is usually not achieved in practice, and is limited by the slowest device on the bus.

GPIB lines.  GPIB consists of 24 lines, which are shared by all instruments connected to the bus. 16 lines are used for signals, while eight lines are for ground. The signal lines are divided into these groups:

  • Eight data lines

  • Five interface management lines

  • Three handshake lines

For information on the types of lines and GPIB pin and signal assignments, see GPIB Lines.

See Also

|

Related Topics