| |
TCP/IP Lean on the LogicFlex single board PC
Introduction
Although a PC is a very useful test platform for the networking software in the 'TCP/IP Lean'
book (ISBN 1-929629-11-7), most PCs are highly unsuitable for full-time embedded operation, on
the grounds of size, cost and reliability. Rotating disks, flimsy edge-connectors, and inadequate
board support may be acceptable in a domestic or office environment, but can cause major problems
in the field. In response to this, various manufacturers produce rugged PCs for industrial
operation; in some cases this involves existing PC components encased in a more robust chassis,
alternatively the whole PC may be shrunk down to a single small circuit board. In this document,
I'll be looking at one such single-board PC, and how remarkably easy it is to run the TCP/IP
Lean software on it.
Single-board PC
JK Microsystems (www.jkmicro.com) has crammed a lot of PC functionality into their
LogicFlex
single-board computer. At first sight, this 4.2" x 3.6" card bears little resemblance to a PC,
yet it has an Intel 386Ex processor running at 25MHz, ½ megabyte of RAM and ½ megabyte
non-volatile Flash memory, two serial ports, real-time clock, NE2000-compatible Ethernet
interface, and 46 digital I/O lines.
Inevitably, some sacrifices have to be made in the interests of compactness, though these
aren't as restricting as you might think.
- Disk drives. There are no floppy or hard disk interfaces, but the on-board
Flash memory does emulate a disk drive, and additional solid-state disk space
can be provided by plugging in another device. File transfer is via the serial
link or network.
- Video display and keyboard. There is no support for a standard VGA display,
and no PC keyboard interface. All console communications is achieved via a
serial link. For many 'headless' embedded applications, a serial link is
preferable to the conventional keyboard plus video display; it is far easier
for a service engineer to connect a serial link to a laptop for diagnostic tests,
rather than lug around a VGA monitor and keyboard.
- Speed and memory size. Compared with a modern desk-top PC, the CPU speed and
memory size seem ridiculously small, but they are more than adequate for the
programs in the TCP/IP Lean book. The lower PC specification results in lower
costs, smaller size, and lower heat dissipation. The board consumes around 0.4
Amps at 5 Volts, so no heatsinks or fans are required, which is a major benefit
for embedded operation.
Operating system
A miniature version of DOS is installed on-board as standard, so on power-up, a DOS prompt is displayed
immediately on the serial console interface (no lengthy boot-up sequence). Commands such as COPY, DIR
and TYPE do exactly what one would expect. Files can be uploaded to the board using the serial link;
a convenient UP command has been provided for the purpose. Many programs (including the TCP/IP Lean
EXE files) will run without modification, though any program that attempts to direct-access non-existing
hardware (such as a VGA display) will fail.
The NE2000-compatible Ethernet interface is supported by a Packet Driver which is automatically loaded
on start-up, and is compatible with the TCP/IP Lean ETHERP.CFG configuration file.
Development kit
JK microsystems sells a development kit (part #99-0051), that has the LogicFlex board, interface cables, and power supply
(though sadly this is 100V only, so unusable by us Europeans). A CDROM is supplied with very comprehensive
software, and a complete licensed copy of Borland C v4.52, which is ideal for embedded TCP/IP Lean development.
Debugging TCP/IP Lean software
The inclusion of Borland C with the kit makes it remarkably easy to download and debug TCP/IP Lean executables on
the board. The following description shows how a program can be downloaded and debugged with a minimum of effort.
I've assumed that the development PC has two spare serial ports is available, since this does allow one to be
used for the LogicFlex console, and another for the debug link. If only one port is available, then a second
system can be used for the console port (any old PC with terminal emulator will do).
The following steps give a quick guide how to set up a LogicFlex system for use with TCP/IP Lean. Consult the
JK microsystems manual before making any connections to the board, since it could be damaged by stray voltages
or static discharge.
- Install the TCP/IP Lean software from the book CDROM, using a root directory of C:\TCPLEAN
- Install Borland C from the JK Microsystems CDROM, making sure to include all the DOS support.
- Connect the LogicFlex COM2 console port to PC COM2, by plugging the supplied cable into the back
of the PC. Run a terminal emulator at 9600 baud, and check communication by executing the DIR command.
- Connect the LogicFlex COM1 port to PC COM1, using a new cable (10-way IDC and 9-way male D connectors
crimped onto 10-way ribbon, and a crossover 'null-modem' cable to connect to the PC).
- As a test of COM1, execute the LogicFlex CON2COM1 command to transfer control to the COM1 port,
run the PC terminal emulator at 9600 baud on COM1, and use the DIR command to check that communication
is established.
- Re-power the LogicFlex, and reset the terminal emulator back to COM2. Use the LogicFlex UP command
and XMODEM on the terminal emulator to upload TDREMOTE.EXE from the 'Borland TD Remote' directory on the
JK microsystems CD.
- Use the UP command to transfer C:\TCPLEAN\ETHERP.CFG to the board, and rename to TCPLEAN.CFG.
- Create a batch file on the LogicFlex by typing echo tdemote.exe -rp1 -rs4 > tdr.bat
- Run the batch file to start TDREMOTE on the board; it will use COM1 at 115Kbaud.
- On the development system, open a DOS box, and change directory to C:\TCPLEAN\BC45. To debug the
'ping' utility, run Turbo Debug using the command line: td - rp1 -rs4 ping.exe
- Turbo Debug should interrogate the remote board through the serial link, report that the file
wasn't found, and ask whether you want it to be downloaded. Responding 'yes' will start the download;
when it is complete the debugger will display a source-code window, with the cursor at the start of 'main'.
Use function key F7 to single-step the program, or F9 to run it; see the Borland Help files for full details
of the command set.
Copyright © Jeremy Bentham 2001
Copyright © 1998-2003 JKmicrosystems, Inc.
|