The LXI protocol offers a multitude of interfaces for
communications with test equipment, including LAN Web pages, VISA
sockets, and VISA VXI-11 interfaces. Converting an existing serial
instrument to an LXI Class C device can be done quickly and economically
using an off-the-shelf Ethernet-to-serial converter.
Choosing the Converter
Since many vendors offer off-the-shelf Ethernet-to-serial
converters, make sure that the converter you choose meets the minimum
requirements for buffer space, supports dynamic host configuration
protocol (DHCP) and static IP addressing, and has in-the-field upgrade
capability.
Although most available converters share the same space for code
and data buffers, some do have separate areas for those two items. An
evaluation of the requirements showed that an LXI Class C device needs a
minimum of 24 kB of buffer space to support the required ports.
Kepco designed LXI devices by modifying off-the-shelf converters
manufactured by Lantronix and Netburner. Our development cycle time was
less than one man-year, and we used a subcontractor for the IVI driver.
Our LXI devices have at least 256 kB of space allocated for the program
code. With both the Lantronix and Netburner converters, we used 130 kB
for the application with almost 70 kB of the space allocated to Web
pages.
Ethernet Basics
An Ethernet device uses specific ports to send and receive
commands. FIGURE 1 shows the ports required by an LXI device. Only the
SCPI RAW port and VXI-11 port communicate with the Class C device
because they receive messages for the device and send responses back to
the host computer. The SCPI RAW port is a socket interface and provided
on all converters. It usually has the capability to make one or two
connections.
An instrumentation engineer usually has worked with GPIB and is
accustomed to having unlimited connections to a device. However, the
connections to an LXI device are limited because each one requires
dedicated memory for its send and receive buffers.
If an LXI device has insufficient connections, program debug
becomes complicated. At least four connections are needed to improve the
first-time experience designing and debugging an LXI product.
Another feature helpful during user integration is the Telnet port.
While not required by the specification, it provides a way to send
commands to a device and get responses, like the features found in the
National Instruments Measurement & Automation Explorer and the
Agilent Technologies Connection Expert.
[FIGURE 1 OMITTED]
Converter Modifications
Although an off-the-shelf converter has many of the functions
required to meet Class C compliance, it will not have support for
several functions needed in LXI instruments, including a LAN LED display
and LAN Reset, which ensure that all LXI devices start up in the same
manner; discovery, which encompasses both VXI-11 support and Remote
Procedure Calls (RPC) Get Port functionality; and an IVI driver for the
device. In addition, many off-the-shelf converters do not support AutoIP
and duplicate IP.
Let's take a look at implementation details of each of these
requirements.
LAN LED
The simplest LAN-activity display can be a one-color LED with three
states:
* Off to indicate the LAN detected an error.
* On to indicate the IP address is valid and the unit is able to
communicate.
* Blinking when an operator activates the identify function via the
Web interface.
If the converter supports AutoIP, then it accommodates duplicate IP
detection as well. When an LXI device detects a duplicate IP, it must
stop using that IP address. However, if the address in use was selected
using AutoIP, device operation over the LAN can continue using a
different IP address. Otherwise the LAN LED must be turned off and
remain off until either the power is cycled or the LAN Reset is
activated.
LAN RESET
In an LXI device, LAN Reset consists of two steps. First, enable
DHCP and AutoIP; second, restart the converter to determine its IP
address. A designer also can choose to implement many optional features
that provide enable and disable capability through the Web interface
such as ping, VXI-11 discovery, and multicast DNS (mDNS) support. If
these capabilities are configurable, then they must be enabled after a
LAN Reset.
DUPLICATE IP DETECTION
Duplicate IP detection is accomplished using the Address Resolution
Protocol (ARP) over the network. ARP is the method for finding a
host's hardware address when only its IP address is known.
ARP packets have a content that Wikipedia defines as, "On
Ethernet networks, these packets use an EtherType of 0x0806 and are sent
to the broadcast MAC address of FF:FF:FF:FF:FF:FF. Note that the packet
structure shown in TABLE 1 has SHA, SPA, THA, and TPA as 32-bit words
but this is just for convenience--their actual lengths are determined by
the hardware and protocol length fields."
AUTOIP SUPPORT
The converter's ARP module will need modification if AutoIP is
not supported. The modification must process each received ARP packet by
comparing the IP address against the device's IP address. If the
comparison is true, it is a duplicate IP address. The LXI device turns
its LAN LED off and stops using the IP address.
An LXI device can use the ARP logic to ask another device to send
its IP address. This is done using a special ARP packet called a Null
Probe.
The Null Probe is used to ensure that either a static IP address,
an address provided by the DHCP server in the system, or an AutoIP
address is not already in use on the network. The Null Probe contains
the sender's media access control (MAC) address, a 0 for the
sender's protocol address, the target's hardware address, and
the IP address being verified as the target protocol address.
ARP packets are broadcast to all devices on the network. If the
target protocol address matches the device's IP address, the target
responds with an ARP packet to the sender.
Broadcast messages sometimes are lost in large networks, but this
can be overcome by sending the Null Probe packet multiple times. This
code snippet shows the Null Probe packet is sent three times with
different delays and the duplicate address flag is tested:
EthernetIP=ip_addr; // so duplicate address will be detected
Null_Probe(ip_addr); // send a probe
OSTimeDly(7);
if (Duplicate_address == 0){
Null_Probe(ip_addr); // send a probe--second required
OSTimeDly(5);
if(Duplicate_address==0)
{
Null_Probe(ip_addr); // send a probe--third required
OSTimeDly(8);
}
}
The transmission of three packets is a standard method as defined
in RFC 3927. This time-delayed multiple transmission process provides
adequate assurance that the packet will be received by all devices in
the network. There are multiple attempts to detect the duplicate
address, but if the address is duplicated, the routine exits to reduce
network traffic.
AUTOIP
AutoIP automatically selects an IP address without using a DHCP
server. It uses pseudorandom IP addresses to create an IP address and
then the duplicate IP address logic to verify that another device on the
network is not using the created IP address. If the address is in use,
the LXI device probes for a new address.
Not all converters support AutoIP, but you can implement it by
trying an address, detecting if it's in use, and if so, looping
until a free IP address is found. AutoIP uses a specific address range
from 169.254.000.000 through 169.254.254.254.
We recommend that AutoIP be done using a pseudorandom number
generator and that the numbers be seeded using a MAC address. In this
way, each device has a unique series of addresses that will be probed.
This method has been proven in networks of 1,800 devices; the
number of attempts any device incurs is three to find a valid address.
This yields a 30-s time period for all 1,800 units if they powered up at
the same time.
Implementing the VXI-11 Protocol
The LXI device must support the VXI-11 protocol to provide a
discovery method. The discovery method requires at least two port
connections on the device: Port 110 to receive a Get Port command and
another connection on a different port, normally 1024, to perform the
VXI-11 commands.
The VXI-11 protocol mimics the IEEE 488.2 interface using Ethernet
to make the connection between the host and the device. It has some
advantages over a socket interface because it provides the capability to
support an interrupt request such as the SRQ line of the GPIB interface
and single-byte commands like Selected Device Clear.
The VXI-11 protocol is based on the standard for RPCs developed in
the 1970s. The RPC relies on a tool called RPCGEN that creates all the
code needed to implement this functionality in an LXI device. When
working with a small embedded-processor instrument, this tool generates
more code than is required to meet the LXI requirements.
Implementing VXI-11 LXI Discovery
There are two parts to the LXI discovery process: first, the RPC
Portmap command, which is the port number of the VXI-11 protocol, is
published, and second, the actual VXI-11 commands are sent. A documents
archive found in the LXI Consortium's LAN and Web groups contains
two Zip files that provide code for the two parts of the process.
COPYRIGHT 2008 Nelson
Publishing Reproduced with permission of the copyright holder. Further reproduction or distribution is prohibited without permission.
Copyright 2008 Gale, Cengage Learning. All rights
reserved. Gale Group is a Thomson Corporation Company.
NOTE: All illustrations and photos have been removed from this article.