January 15, 2010

Exploring Embedded Linux with Xport Pro


These are amazing times to be in tech.

This past year I've had the good fortune to review an eeePC powered Netbook, the Fit-PC, and the Plug Computer. All were new, capable, and progressively smaller Linux machines. Readers may also recall my increasing interest in the Arduino micro-controllers. Although the Arduino doesn't run Linux, its development environment is easy to use and particularly well suited for Linux notebooks.

Now, I'm exploring the twilight zone... embedded Linux.

Lantronix's Xport ProLantronix recently released their latest Xport Pro embedded Ethernet to Serial module with a slim version of Linux. See Figure 1 for a picture of the Xport Pro module. The Xport allows mounting of file systems, the ability to run a minimalist Web server called Boa, and telnet access. The main function of this tiny machine is to push data back and forth between a LAN connection and the serial port. Lantronix also has a much more mature Xport Pro product, based on their own Revolution operating system, that has been around for a couple of years. The Linux version fills the space for hardware product developers that are familiar with Linux and want to develop their own network-enabled applications in firmware.

Why would I want to review such a thing?

Remember the Arduino micro-controller. The Xport seemed like a neatly packaged way to communicate with the Arduino (over the serial port) from a broadband network. Exploring that capability is the subject of this article.

As a gear head, turned Linux geek, now impersonating an electronics engineer, here's my take on embedded Linux Xport Pro style. The types of off-the-shelf hardware and software, commonly available now, are just phenomenal.

Just imagine what you could do.



Prep Work

The Xport Pro module is a 3/8" x 1/2" x 11/4" device with an RJ-45 connector at one end and a set of nearly microscopic connector pins on the bottom. It is designed to be mounted on a circuit board and integrated into products. Lantronix provided me with Linux and Evolution versions of the Xport Pro module, a couple of developer boards, wall worts, and a collection of connecting cables. Also, included in my care package were CDs with the entire software developer kit, documentation, and various other files.

These Linux based modules are significantly different than a Linux notebook and run a version of the uCLinux distribution. Much like the Plug Computer, there are no video chips or desktop applications. They are designed for developers who want to connect their non-networked devices to a network and construct embedded software that uses that connection. You can communicate with the device over both the serial port and the network.

Prototyping with these nano-Linux machines is best accomplished using the development board, because most of the power, communication connections, and support circuitry are provided with a host of connectors, ground, and power points.

It was a little tricky on the serial side of the Xport, for me, because it is a 3.3-volt device and the product documents say it is not 5-volt tolerant. My serial-to-USB cable and the Arduino both work with 5-volt signalling levels. The development board has a 9-pin RS-232 port. This whole situation was solved with a 3.3- to 5-volt converter connected to the serial break-out header on the development board. I bypassed the board's 3.3-volt to RS-232 converter chip and the 9-pin connector. None of my current notebooks have an old style serial port, otherwise I could have just plugged in an RS-232 cable. Information on 3.3- or 5-volt TTL-to-USB converter cables can be found at the FTDI site.

Once everything was hooked up I started minicom and connected to /dev/ttyUSB0 from my notebook. As I powered up the developer board, I saw the familiar Linux style boot messages go by on the screen. After a few seconds I had a root prompt and could type in basic commands.

ls, cp, and even vi all worked as expected. The selection is definitely bare bones.

Xport web interfaceThe Web interface uses DHCP by default. You can figure out the IP using nmap from the Linux notebook. ifconfig can be used on the command line (while connected with minicom via the serial line) to get the IP information, as well. See Figure 2 for a screenshot of the Web interface.

I typed the Xport's IP address into my notebook's Firefox browser and was immediately greeted with a basic configuration page served by the Boa Web server.

The Web page displays the status of the Xport, lets you edit the network settings, allows configuration of the serial port, lets you set the root password, and reboot the module. The pages are simple HTML text files, housed in the /var/www directory on the Xport. It is a read-only by default, so changing the file system to read-write will be required before any customizing can happen. I edited the Admin password to something I could remember, so I could log in over the LAN using telnet.

Once I was sure that the Xport was running properly, I disconnected the USB-serial cable from my notebook and hooked up the Arduino serial lines in it's place. The Arduino RX and TX jumpers connect to the high-voltage (5 volts) side of the 3.3- to 5-volt converter. The low-voltage (3.3 volt) side of the converter went to the Xport serial break-out header on the developer board.

Processing Data

Using the Xport's IP address, I was able to log in using telnet.

rreilly> telnet

prototype breadboard setupTake a look at Figure 3 to see my prototype breadboard setup. The prototype board is on the left with the Xport plugged into the top. The level converter is the tiny reddish square with the wires, on the upper right. The Arduino micro-controller board is on the lower right. I hooked up a 10K ohm potentiometer to one of the Arduino's analog-to-digital pins to read the position of the knob, giving me a digital value from 0 to 1024.

The point of the whole exercise was to feed the potentiometer data to the Xport, so I could see it from a Linux machine on the LAN. One application is to hook up a potentiometer to my garage door and then be able to tell where the door is, according to the value of the data. Zero might be closed, 1024 might be open and 252 might be open one-quarter of the way.

The Arduino supports 14 digital input/output and six analog pins, so it is possible to read a bunch of sensors (switches, temperature chips, potentiometers) and control a bank of outputs (motors, servos, relays).

While it is interesting to program the Arduino to control things in stand-alone mode, I think the real future is in connected devices, that interact over the network. The Xport Pro device caters to that network interaction.

Once logged in to the Xport over telnet, the data could be viewed very simply, by using cat.

#> cat /dev/ttyS0

This command generated a stream of data coming from the Arduino.

On the other hand, sending data to the Arduino via the Xport, perhaps to turn on a motor, was problematic for me. I suspect that the program I was running on the Arduino was not handling the serial handshaking very well. My Arduino program was supposed to light an LED, upon receipt of a certain character and turn if off with a different character. After trying a number of techniques, I decided I didn't know enough to fix my problem, within my review time frame.

I did try replacing the Linux Xport Pro module with the Evolution version and was able to exchange data in both directions without too much trouble, over telnet.

In spite of my difficulties, my basic objective of reading data from the Arduino was met. Very likely, my lack of total understanding of serial communications, influenced my success. I don't think it is a problem or deficiency on the part of the product.

Let's not forget that Linux embedded product developers and firmware engineers will have much more insight and knowledge on how to make the serial communication work.

Back To Everyday Linux

My adventure into exploring the Lantronix Xport Pro Linux embedded world was educational and interesting.

I learned about some of the differences between an embedded Linux device and the normal Linux notebook environment. Capturing data by wiring up an Xport Pro to a Arduino micro-controller was pretty straightforward, although readers should be aware of some of the design considerations.

Lantronix representatives were patient and very responsive with my product exploration. Garry, the East Coast engineer that called me was helpful and knowledgeable about the product.

If you are looking to put a non-networked product on the network, you should definitely investigate the Xport Pro Linux version for your next project.

Rob Reilly is a technology consultant, writer, and portable computing expert. Early adopter tech trends, seminars, and media projects are his stock-in-trade. His mission is to deliver exceptional value to his clients. Links to many of his articles appear on his Web site at http://home.earthlink.net/~robreilly

Click Here!