VXI11 Ethernet Protocol for Linux

or: How to talk to your LXI-Compliant Agilent, LeCroy or Tektronix Scope from Linux over LAN

Steve D. Sharples

The code is now being maintained on github by a colleague: https://github.com/applied-optics/vxi11
Please follow the link above to get the code. The following is legacy, and will be left here for a while, but will eventually be deleted.

Website updated: 30 July 2015 (above note).
Related links:
Linux Drivers for Agilent Infiniium Oscilloscopes (built on this VXI-11 protocol and user library)
Linux Drivers for Tektronix Oscilloscopes and Arbitrary Function Generators (built on this VXI-11 protocol and user library)
TCP/IP Control of a LeCroy DSO with Linux (uses LeCroy's own VICP protocol)
Random links:
Hardware Linux/open source drivers | Eagle PCB -> PCBTrain Export Mini How-To | Eagle PCB -> LPKF Milling Machine Mini-How-To | strip_nl: newline (CR) stripper | Applied Optics Group at EEE, University of Nottingham (who we are)

Skip to the end...

Here's a link to a tarball of the latest source: vxi11.tar.gz. Once you've untarred it, have a gander at the README.txt file. You might also want to have a quick butchers at the CHANGELOG.txt file.

For those in a real hurry, check out the 30 second quick download and installation instructions.

NOTE: I've published a set of code for Tektronix oscilloscopes and arbitrary function generator, to complement a set of code for Agilent Infiniium oscilloscopes, consisting of a user library and a few example command line utilities. Both the Agilent code and Tek code is built on top of this (the vxi11) code, so you will need both if you want to use it.

Introduction

This is a collection of source code that will allow you to talk to ethernet- enabled instruments that use the VXI11 protocol, from Linux. This includes a wide range of instruments (including oscilloscopes, logic analysers, spectrum analysers, function generators etc) by a wide range of manufacturers (including Tektronix, Agilent, LeCroy and Anritsu to name just four). An interactive "send and receive" utility is included as an example.

You may want to build on to this libraries for your specific instruments - I've currently got libraries for talking to Agilent Infiniium scopes, Tektronix scopes, and Tektronix arbitrary function generators (AFGs) too. LeCroy scope drivers will follow shortly. Basically if you've got a Programmer's Reference for your instrument, and this code, you should be able to cobble something together.

The source code (libraries and a couple of example programs) for talking to Tektronix scopes and AFGs is available here. Similar code for talking to Agilent Infiniium scopes is available here. (You will still need the vxi11 source too.)

This collection of code has been produced because, around June 2006, I grew frustrated at how difficult it seemed to be to do a relatively simple task. None of the major manufacturers had any "out of the box" Linux solutions to talking to their instruments (although often I would talk to technical folks who would try their best to help; Randy White of Tektronix of particular note). One of the solutions offered was to use something called NI VISA; most of this is closed source, it was enormous, and I had worries about legacy issues with changing PC hardware. And on top of that you have to pay for it.

Via Guy McBride at Agilent, I obtained a copy of a vxi11.x RPC file similar to the one included here (although no-one at Agilent seemed to know or care where it came from). After lots of searching on the information superhighway I located what I believe is the original source (or something like it); see the section on vxi11.x below. This source seems to have literally been written from the published VXI11 protocol. I also received from Agilent a simple example program that showed you how to use the protocol; working from this and the (open) source that uses the vxi11.x that is included here, I wrote vxi11_cmd and the user libraries. Also helping me along the way were the VXI-11 RPC Programming Guide for the 8065 (PDF) and the VXI-11 and HP E2050A (PDF) Programmer's Guide. After I wrote the library, I found (and wish I'd found earlier) an article in Test and Measurement World called Linux controls instruments through Ethernet. From there, there was originally a link to a zip-file, including an 8-page Word document and some source code, published by Stefan Kopp of Agilent. The original link is now dead, but you can find a copy via the internet archive wayback machine (click on the blue circle around the number 28 on May). This is well worth a look if you're interested, and something I unfortunately missed completely whilst writing this code.

More online resources

Oliver Schulz pointed out that in spring 2007 Agilent published some Application Notes concerning Linux in general, and the VXI11 protocol in particular:
AN 1465-27 Using Linux in Your Test Systems: Linux Basics (PDF)
AN 1465-28 Using Linux to Control LXI Instruments Through VXI-11 (PDF)
AN 1465-29 Using Linux to Control LXI Instruments Through TCP (PDF)
The second of these may be of interest if you wish to extend the code (making use of the abort channel, or implementing service requests). As always, I would be interested in any suggestions, constructive critisism, bug fixes or patches.

Description of the lightweight Linux vxi11 code

This collection of source code consists of:

1. vxi11.x

This file, is the amalgamation of vxi11core.rpcl and vxi11intr.rpcl which are part of the asynDriver (R4-5) EPICS module. More general information about EPICS is available from: http://www.aps.anl.gov/epics/. This code is open source, and is covered under the copyright notice and software license agreement shown in the vxi11.x file itself, and also at: http://www.aps.anl.gov/epics/license/open.php.

It is intended as a lightweight base for the vxi11 rpc protocol. If you run rpcgen on this file, it will generate C files and headers, from which it is relatively simple to write C programs to communicate with a range of ethernet-enabled instruments.

2. vxi11_user.cc (and vxi11_user.h)

These are (fairly) friendly user libraries. At the core are 4 key functions: vxi11_open(), vxi11_close(), vxi11_send() and vxi11_receive(). These allow you to talk to your device. There are also some other functions that I considered to be generally useful (send_and_receive, functions for sending and receiving fixed length data blocks etc) that are all non-instrument- specific.

3. vxi11_cmd.cc

This is a fairly simple interactive utility that allows you to send commands and queries to your vxi11-enabled instrument, which you locate by way of IP address. I recommend you start with *IDN? It shows you how the vxi11_user library works.

If you're using some kind of LAN to GPIB gateway, then you need to supply both the IP address of the gateway, AND the device name. This could be something like "gpib0,5" or similar - consult your LAN to GPIB gateway manual.

4. Makefile

Type "make" to compile the source above. Type "make clean" to remove old object files and ./vxi11_cmd. Type "make install" to copy ./vxi11_cmd to /usr/local/bin/

5. README.txt

Mostly contains the same information as this web page.

6. CHANGELOG.txt

Text file containing information about the changes between all the different versions.

6. GNU General Public License

Fairly obvious. All programs, source, readme files etc NOT covered by any other license (e.g. vxi11.x, which is covered by its own open source license) are covered by this license. In brief:

These programs are free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version.

These programs are distributed in the hope that they will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details.

You should have received a copy of the GNU General Public License along with these programs; if not, write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.

Installation on non-Linux platforms (Windows, Mac OS X, UNIX)

I'm afraid I don't have any personal experience with compiling this code on anything except Linux, but I would be very interested to hear from those who have had success.

I've recently received an email from Stefan Mahr, who says:

You might be interested that your vxi11 package can be compiled on Cygwin/Windows.

If the packages libtirpc-0.2.1-1 rpcgen-2.11.90_20100818-1 are installed and the attached patch [to the Makefile] is applied everything works fine. At the moment I don't know why dynamic linking of libtirpc (-ltirpc) doesn't work, so static linking at the moment.

Many thanks to Stefan Mahr for this information, I hope it's useful to others.

Gotchas

These are specific to certain types of hardware, rather than the code itself...

Tek Windows-based scopes

The VXI-11 server on the scope is not (by default) enabled at start-up. This will result in the vxi11 code being unable to communicate with the scope, generally resulting in confusing RPC errors.

To enable the VXI-11 server, go to the TekVISA LAN Server Control icon at the bottom right hand corner of the scope's Desktop, right click and select Server Properties, then in the small window tick the box that says 'Start server at system powerup'. This should start the server each time.

LeCroy scopes

A similar problem, although with more useful debugging information! By default, the chosen ethernet protocol used by LeCroy scopes is their own VICP protocol. You must go to the "Utilities" menu in the scope application, click the "Remote" tab, then select "LXI (VXI-11)."

The rather confusing thing about LeCroys is that even if VICP is selected, the scope still responds correctly to the VXI-11 "*IDN?" query - this, I believe, is for LXI compliance, which states that even if the manufacturer chooses to use a protocol other than VXI-11 for communications, then the device must be "discoverable" by responding correctly to a "*IDN?" query using the VXI-11 protocol. This might lead you to think that everything is working. However, all other queries result in the response, "WARNING : CURRENT REMOTE CONTROL INTERFACE IS TCPIP". If you are running a program and parsing the responses (rather than showing them) it may not be obvious that this is happening.

LAN to GPIB gateways

You need to pass an extra argument to the vxi11_cmd utility, or the vxi11_open() function. This is usually something along the lines of "gpib0,N" where "N" is the GPIB channel number of your GPIB instrument that is connected to your gateway. It is unlikely that the gateway itself will respond to the *IDN? query.

Rigol DM3068 multimeters

In vxi11_user.cc you need to change the write_parms.lock_timeout value to 0, rather than VXI11_DEFAULT_TIMEOUT, in the vxi11_send() function (currently line 466 in version 1.10). If you don't do this, the DM3068 returns 'Device Locked'. Thanks to Ian West for reporting this gotcha.

30 Second Quick Download and Installation Instructions

This is all in the readme, but then it's nice to cut and paste sometimes...:

wget http://optics.eee.nottingham.ac.uk/vxi11/source/vxi11.tar.gz
tar -xvzf vxi11.tar.gz
cd vxi11
make
Everthing ok so far? Want to see if you can talk to your scope (or any VXI11 instrument)?
./vxi11_cmd your.inst.ip.addr
(or, if using a LAN to GPIB gateway:
./vxi11_cmd your.inst.ip.addr gpib0,N
where N is the assigned GPIB channel number of the instrument you want to query)
*IDN?

Links to the source

Here's a link to a tarball of the source: vxi11.tar.gz

This produces a "vxi11" directory containing the vxi11.x RPC protocol itself; vxi11_user.cc and vxi11_user.h user library; vxi11_cmd.cc, a simple demonstration program; a Makefile, a README.txt file, and a copy of the GNU General Public License. To extract the tarball, use tar -xvzf vxi11.tar.gz .

Please read the disclaimer about warranty, etc etc.

All the files, for all released versions so far, are available for viewing or downloading here.

Instructions for compiling are included, however it should hopefully just be a case of typing make .

All trademarks and copyrights are acknowledged.