Serial to Ethernet Converter


Table of Contents

  1. Overview
  2. Downloads
  3. Installation and Running
  4. Building the project
  5. Usage Examples
  6. Configuration Options
  7. Future Development


Overview

TcpComm is a serial-to-ethernet converter that allows applications to access TINI's serial ports through TCP. Applications written using the Java Comm API can use one of TINI's network-enabled serial ports without altering any Java code. If you do not have the Java Comm API installed, you will need to in order to use the usage examples listed on this page.

TcpComm is a client-server application. The TcpComm client works by installing itself as another driver specified by the file javax.comm.properties. When the Comm API enumerates ports, it will query the TcpComm driver for ports it knows about. The server works by running on a TINI attached to the serial device the application needs to communicate with. The following image illustrates this relationship:

The PC runs the client, connecting to the TINI board through the ethernet. By invoking methods on javax.comm.CommPort objects, the client sends network messages to TINI, telling it what serial operations to perform.


Downloads


Installation and Running

In order to run the sample applications described later, download and unpack the file listed above. To use TcpComm, we will need to change our javax.comm.properties file and place the file tcpcomm.jar (included in the download) in our classpath.


Building the Project

A number of source files are included in this distribution. They can be separated into files for the client and files for the host. One file is shared between both.

Building the Host
To build the host application, the following files must be compiled for TINI and built using TINIConvertor:

When building with TINIConvertor, make sure to use the '-m' switch to specify the class TiniCommPortServer as the main class for the application. See documentation in the TINI software distribution for more on compiling for TINI and using TINIConvertor.

Building the Client
The client is not an application, but rather a set of drivers that will reside in a jar file. The following files must be compiled and jar'ed together in a file called tcpcomm.jar:


Usage Examples

Configuration Options

The TcpComm server application (CommPortServer.tini) works by opening and listening on TCP port 10101. To run it on a different port, use the command line:

		java CommPortServer.tini serial0 10102 &

This would run the server on port 10102. To make the client programs connect to this port, change your command line to the following:

		java -Dtcpcomm.serial=180.0.16.133:10102 FindiButtonsConsole

Note the ':10102' specifies the port for the client to connect.

Though this software was written with TINI in mind, the server can also run on a PC with a properly installed Comm API. To run on the PC, execute the class com/dalsemi/tcpcomm/server/CommPortServer, using the same arguments as for the TINI application.

		java com/dalsemi/tcpcomm/server/CommPortServer COM2 10102

Classpath issues may need to be resolved to run the application on the PC. Remember that on TINI, the main class to execute is TiniCommPortServer. This is because it may need to enable a serial port before it begins running.

Some applications may require handshaking to be enabled on TINI. For these applications, add an '-hs' argument to the command line of the server:

		java CommPortServer.tini -hs serial0 10102 &

Future Development

Currently, the client software can only run on a PC. With future modifications to TcpComm, the client software will be able to run on TINI as well.