TS5500 Single Board Computer

With linux and lots of serial ports


Photo of the TS-5500 embedded PC

Some useful links

TS5500 Single Board Computer (SBC) with linux and lots of serial ports.
TS home page
TS page on linux kernel building, ssh ...
Stephen Wood's page - TS-5300 w/ 10 serial ports

Introduction

This was my first foray into the world of SBC's and embedded Linux.   I wanted a computer that would run off a solar powered battery system, ran linux, and had lots of serial ports.  The plan is to place these devices in remote locations to control systems used for atmospheric monitoring at the HiRes and Pierre Auger   astroparticle physics observatories.

I looked at a number of SBC vendors.  Technologic Systems offered good linux support and nice choice of products.  Although they did not know of anyone who had used one of there SBC's with 8 serial ports under linux, I did find a very nice page by Stephen Wood at Thomas Jefferson Labs showing such a system.  The PC-104 archetecture seemed a good choice because many vendors offer PC-104 products.  The SBC I'm using does not support a mouse, keyboard, or VGA monitor.  In the world of linux and networking this seems like a good thing.  Not only does it save the $, space and power budget, it also keeps the system simple.


Hardware

I ordered the following from Technologic Systems

Component Description
TS-5500 Single Board Computer
OP-RAM-64MB 64 MB Ram Option
OP-ADC Analog to Digital Converter
OP-CF-64MB 64 MB Compact Flash Card
OP-LINUX Have TS configure the CF card with linux
SD-DR-31 SanDisk Imagemage USB Compact Flash Card Reader
MISC Enclosure with power supply (11-40 VDC input - 5VDC output for SBC)
OP-24VDC 24V DC Power Supply (120VAC -> 24VDC for Enclosure power supply)
TS-SER4 Four serial port daughter board (ordered two of these)
OP-16BITUSB 16 Bit PC/104 Stack-Through Bus - allows use of IRQ10-15 for TS-SER4's
OP-DDB9HDR-4 Four 10 pin header to DB9 male adapters for TS-SER4 (ordered two sets)

I then obtained the following from CompUSA:
DB9 null modem cable female/female (belkin F3B207-10)
Scandisk PC card adapter for Compact Flash SFCF-38
CAT5 crossover network cable A3X126-10cm
64mb CompactFlash PNY Technologies (P-CF064-RF)


Communicating with your SBC - ssh and CF cards

The TS-5500 does not support a mouse, keyboard, or VGA monitor.   There are a number of ways to communicate between this SBC and a host system.   In my case the host system was my sony vaio laptop running redhat 7.1.  It has ethernet and one serial port.   The communications options include:

  1. The com2 port acts like a consol.  You can connect a null modem cable another computer and run your favorite terminal emulator, ie seyon, minicom, kermit..
  2. Network via the ethernet port - either using telnet, ssh, on NFS cross-mounted disks
  3. Swap the CF card between the SBC and the host computer.
  4. Get an optional daughter board that has mouse, keyboard, and a monitor connection.

I first used option 1 to watch the SBC boot.  I watched the SBC boot up linux, logged in and looked around at the various directories.  Looked like a linux system.

Getting ssh to work

I then decided I wanted to be able to log on the the SBC using ssh.   As of 5/2003,  the linux on the CF card supplied by TS does not include ssh.  TS does provide a web page  that has a tar file and instructions for installing ssh.  But I needed a way to transfer the ssh tar file to the file system on the SBC.   The CF card looked like a good way to do this.

I tried to get the CF USB card reader to work on my laptop.  No luck.  Apparently the windoze part of my laptop does something to the IRQ needed by the usb port.  Found a work-around, but it looked complicated.  Nor would the CF usb card reader work on my desktop machine, also running RH7.1  To mount the CF card on the laptop, I got a $13 pcmcia adapter card (Scandisk SFCF-38).  The CF card shows up as /dev/hde.

I did find that the CF reader would work on the TS-5500 usb port.  It shows up on /dev/sda  -- In effect it acts like a second disk drive.

On laptop

Used /usr/sbin/netconfig to set static IP address of 192.168.0.51
(the SBC has a default address of 192.168.0.50)
Put new CF card in pcmcia adapter

   fdisk /dev/hde

created 1 linux partition

   mkfs /dev/hde1 (to make ext2 type partition)
   mkdir /cf
   mount -t ext2 /dev/hde1 /cf

Copied the ssh tar file downloaded from TS to /cf/.
remove compact flash card

On TS-5500

Put in reader and plugged reader into usb port on TS computer

   mount -t ext2 /dev/sda1 /mnt

Follow instructions on mikes page on embedded86x for ssh
had to start sshd, (/etc/rc.d/init.d/network restart) but could probably have rebooted and it would have started

On laptop

Used /usr/sbin/netconfig to set static IP address of 192.168.0.51
(the SBC has a default address of 192.168.0.50)
connected crossover cable between ethernet port on laptop and SBC
Restarted network /etc/rc.d/init.d/network restart)

Could ssh into and out of TS-5500
In retrospect, I might have saved some time by following the instructions that TS provides for using NFS and transfered the ssh file that way.


Hello world!

My next step was to see if I could compile a program on my laptop, copy the executable file to the SBC on the second CF card and run it there.

   wiencke@localhost:~/temp> more hello.c
   int main(){
     printf("hello world!\n");
     return(0);
   }
   wiencke@localhost:~/temp> gcc -c hello.c
   wiencke@localhost:~/temp> gcc -o hello.run hello.o
   wiencke@localhost:~/temp> ./hello.run
   hello world!
   wiencke@localhost:~/temp> scp hello.run root@192.168.0.50:/mnt/.
   root@192.168.0.50's password:
   hello.run  100% |*********************************| 13712  00:00
   [root@miniepc root]#/mnt/hello.run
   hello world!

You are supposed to compile code on the host machine with the flags

   -march=i386  -mcpu=8386

However on the suggestion of Stephen Wood I found that many executables, for example setserial would simple work when copied to the SBC.


CF Backups

This is a real strength of the CF devices.  The CF cards are way easier to back up and to replace than conventional hard disks.

Plugged CF into laptop via pcmcia adapter

   [root@localhost emb]# dd if=/dev/hde of=y2003m03d18.TS5500.dd
   125440+0 records in
   125440+0 records out
   [root@localhost emb]#
   [root@localhost emb]# ls -l *.dd
   -rw-r--r-- 1 root root  64225280 May 19 08:27 y2003m03d18.TS5500.dd

then swap with new CF card

   [root@localhost emb]# dd if=y2003m03d18.TS5500.dd of=/dev/hde
   125440+0 records in
   125440+0 records out
   [root@localhost emb]#

with new disk as sda

   [root@miniepc root]#fdisk /dev/sda
   Command (m for help): p
   Disk /dev/sda: 8 heads, 32 sectors, 496 cylinders
   Units = cylinders of 256 * 512 bytes
      Device Boot      Start         End     Blocks     Id  System
   /dev/sda1   *           1          16       2032      1  FAT12
   /dev/sda2              17         490      60672     83  Linux

Then shutdown, put new disk as primary, ie where original CF card was.
system boots.
So now I have two identical disks for booting the system

I would recommend becoming familiar with dealing with the CF cards and readers before attempting more complicated things.  Also make an image copy of your working CF.  Since the 64mB cards I was using are much smaller than the 30gB drive on my laptop I can keep as many copies of different versions as I need.

To mount a CF card to look at the files I used

   mkdir /mnt/flash
   mkdir /mnt/cflinux
   mount -t ext2 /dev/hde2 /mnt/cflinux
   mount -t vfat /dev/hde1 /mnt/flash

I have noticed that occasionally the system does not fully boot on the new card but goes as far as the BIOS.  After another power cycle, the system boots.  Will need to investigate further.

Kernel, patches

The next step was to get the two TS-SER4 cards to work. This required building a new kernel for the SBC I had never made or patched a kernel before.  I was confused for while by the way the word "kernel" gets used.

kernel packages

from www.kernel.org you can download a kernel package.  A kernel package contains a considerable amount of source code organized in many subdirectories.  You can download one of many kernel packages (TS uses 2.4.18, my host machine uses 2.4.7-10), follow a procedure to compile them to make something called a kernel file.  The kernel packages contain a lot of code to support a variety of hardware and features.   Since your computer does not have all the hardware that the kernel package supports, you do not want or need a kernel that has all these features.   This is especially true for a SBC that uses a small amount of memory and a small amount of CF disk space. So you need a way to select what gets compiled and what doesn't.  This is specified in a configuration file, /usr/src/linux/.config  You can use something called make xconfig to select the options graphically.

kernel files

The kernel file is the program your PC runs that makes it a linux machine.  Other programs including many utilities, for example ssh, and programs that you write interact with the kernel.   (The kernel runs in part of memory that is isolated from the memory used by other programs.  This is one reason that linux machines don't normally crash.)

On my host machine the kernel file is /boot/vmlinuz which points to something called /boot/vmlinuz-2.4.7-10.  On the TS-5500 the kernel is on the first partition of the CF card and is called bzImage.

kernel patches

You can also apply something called a patch to your kernel package that swaps in newer source code, and does other things.  TS provides a patch that is applied to the 2.4.18 kernel package.  In my limited experience the kernel patches I have encountered are applied to the kernel package.  You then recompile the the patched kernel package to make a new kernel file.

modules

To keep the kernel file, and the memory it uses small, some parts of the kernel are kept as modules that can be loaded as needed.  I suspect this also helps with the organization of the kernel development process.  more /proc/modules will show what modules are installed on your system.

In my case, I needed to rebuild a kernel that had options for multiple serial ports turned on.

To build a new kernel, I followed the instructions for applying the ts-2.1patch to the linux-2.4.18 kernel package.  I did this as root from /usr/src on my laptop.  Being a newbie I found a few gotcha's.

I used the ts-2.1.patch.  The first time I downloaded it, I used explorer on a windoze machine and this converted the file to html format replacing all the < and > in the source code in ts-2.1.patch with something else.  For a newbie to kernel compiling this caused confusion. Also the instructions for the patch command did not work as written as of 5/24/2003.

Compiling a new kernel as root from /usr/src has potential for damage to the host machine.   For example, if your /usr/src directory already have a linux-2.4.18 directory you will overwrite it.  I did not have a /usr/src/linux directory when I started.   If one exists, it might be a good idea so make a copy of it, delete it, and then have it created again when you untar the 2.4.18 kernel package.

The actual commands that worked for me are listed below.   It assumes you have downloaded the following onto /usr/src:
2.4.18 kernel package from www.kernel.org
ts-2.1.patch from www.embededx86.com/downloads/patches
linux_binary.5_1_4.tgz from www.embeddedx86.com/downloads/patches
pcmcia-cs-3.2.4.tar.gz from www.embeddedx86.com/downloads/patches

As root:

   cd /usr/src
   tar xvf linux-2.4.18.tar
   cp ts-2.1.patch linux
   cd linux
   patch -p0 <ts-2.1.patch
   cp TSConfigFile.5500 .config
   tar -xzvf linux_binary.5_1_4.tgz
   cp linux_binary.5_1_4/doc-linux-5_1_4_19/driver/doc/* \
      /usr/src/linux/drivers/block/doc/.

(that step was to fix a problem with the ts.2.1.patch,  alternatively one can disable DiskOnChip support according to Liberty Young of TS)

   cd /usr/src/linux
   make xconfig

when the gui came up, under character device, I clicked on y for support special multiport boards.  (I'm not sure this is required) then save and exit.

I then edited the .config file and changed CONFIG_NET_RADIO=y as I might sometime use this device with a wireless lan.

For reference, the SERIAL section of the config file looks like

  # Character devices
  #
  CONFIG_VT=y
  CONFIG_VT_CONSOLE=y
  CONFIG_SERIAL=y
  CONFIG_SERIAL_CONSOLE=y
  CONFIG_SERIAL_EXTENDED=y
  CONFIG_SERIAL_MANY_PORTS=y
  CONFIG_SERIAL_SHARE_IRQ=y
  # CONFIG_SERIAL_DETECT_IRQ is not set
  CONFIG_SERIAL_MULTIPORT=y

then

   make dep
   make bzImage
   make modules
   make modules_install

On my 850 MHz laptop, each of these steps tookseveral minutes. It will also create a directory on your host machine in /lib/modules called 2.4.18-2.1-TS

To make the pcmcia package for the 5500:

   cd /usr/src
   tar -xvf pcmcia-cs-3.2.4.tar
   cd /usr/src/pcmcia-cs-3.2.4
   make config
   make all
   make install

Update module dependencies

   cd /usr/src/linux
   /sbin/depmod -a 2.4.18-2.1-TS -e -F System.map

I then mounted the CF card on my laptop and copied the kernel to it.

   mount -t vfat /dev/hde1 /mnt/flash
   mount -t ext2 /dev/hde2 /mnt/cfllinux
   cp /usr/src/linux/arch/i386/boot/bzImage /mnt/flash/.

You may want to move the original bzImage to bzmgold, for example.

I also copied the PCMCIA support applications

   cp /sbin/cardctl /mnt/cflinux/sbin/
   cp /sbin/cardmgr /mnt/cflinux/sbin/

I also copied the modules file from the host machine

   cp -r /lib/modules/2.4.18-2.1-TS /mnt/cflinux/lib/modules/

I also made an image backup of the CF card to my host machine.   Then unmounted the CF card, moved it to the TS-5500 and booted it.   Watched the boot process from the host machine over the com2 port.


Serial ports and jumpers

The TS-SER4 cards have three sets of blocks for jumpers and many great options.  If you are trying to get these cards to work for the first time, I'd suggest starting with a simple configuration.  The one below worked for me.  (ed comment -Jumpers are much easier to handle than messing with a plug 'n pray card under linux.)

I set up the cards for RS-232 on all ports.
For the two near the ports labeled COM C and COM D:

   .. RS-422
   .. RS-485
   __ RS-232
   .. TX Term
   .. RX Term
   
   (.. means no jumper, __ means jumper installed)

For the larger block for jumpers, I did the following:
The ports on the top card share IRQ 7. Ports on the bottom card share IRQ 5.
Bottom card ioports are assigned as 0x3a8, 2a8,3a0, 2a0
Top card ioports are assigned as     0x398, 298, 390, 290
You will later use setserial to associate these ioports with /dev files.

 Bottom  Top
  Card   Card
   ..     ..   JP1
   ..     ..   JP2
   ..     ..   JP3
   ..     ..
   ..     ..   2xBaud
   ..     ..   IRQ8
   __     __   IRQ4
   ..     __   IRQ2
   __     __   IRQ1
   __     ..   COM4
   ..     ..   COM2
   __     ..   COM1

To set up the serial ports I used a script adapted from one written by Stephen Wood. You will need to copy /bin/setserial from your host machine to /bin on the SBC

   [root@miniepc root]#more rc.serial.txt
   #!/bin/bash
   PATH=$PATH:/usr/local/bin

   cd /dev

   for i in 5 6 7 8 9 10 11 12 ; do
     let minor=$i+64
     mknod -m 666 /dev/tts/$i c 4 $minor
   done

   # Bottom Card (bottom in my case. Stack them however you want.)
   setserial -v /dev/tts/5 port 0x3a8 uart 16550A irq 5 ^fourport
   setserial -v /dev/tts/6 port 0x2a8 uart 16550A irq 5 ^fourport
   setserial -v /dev/tts/7 port 0x3a0 uart 16550A irq 5 ^fourport
   setserial -v /dev/tts/8 port 0x2a0 uart 16550A irq 5 ^fourport
   #setserial -v /dev/tts/5 set_multiport port1 0x3a0 mask1 0xf match1 0xf

   # Top Card
   setserial -v /dev/tts/9 port 0x398 uart 16550A irq 7 ^fourport
   setserial -v /dev/tts/10 port 0x298 uart 16550A irq 7 ^fourport
   setserial -v /dev/tts/11 port 0x390 uart 16550A irq 7 ^fourport
   setserial -v /dev/tts/12 port 0x290 uart 16550A irq 7 ^fourport
   #setserial -v /dev/tts/9 set_multiport port1 0x390 mask1 0xf match1 0xf

To do a simple test on a serial port connect the null modem cable between a serial port on the SBC and the serial port on the host system.  In this example, I used the port labled COM A on the top card, ie /dev/tts/9

Start a terminal emulator on the host computer, for example:

   seyon -modems /dev/cua0

Then on the SBC, as root:

   echo "Hello Serial World" >tts/9

and you should see the characters show up on the terminal emulator window on the host machine.
I also made an example program that sets up a serial port to a particular baud rate and write out a string  (source)


Photos

TS-5500 without cover
The TS-5500 with enclosure (cover removed) and two PC-104 TS-SER4 cards.

TS-55500 front view
Front view of the enclosure panel.  The port labeled COM2 works as a consol port.
 

TS-5500 taken apart

The system taken apart.  The PC-104 serial cards are on the left.   The SBC on the right.  The SBC is mounted in an enclosure (top removed).   This enclosure includes a built in power supply.  The ribbon cables on the SBC connect pins on the DIO and ADC to a header on the power supply.


News and commentary

Update:  12/21/2005.  L. Wiencke

This computer has been running for several years controlling   the Central Laser Facility of the Pierre Auger High Energy Cosmic Ray Observatory in the remote Pampas region of Argentina.  It works well.  The entire system is powerd by solar panels.  Computer up-times are limited only by how often the system is powered down for maintenance.  We plan to change the flash card every year or so, although this is probably overkill.  The record uptime, so far, is 250 days.  As of 12/21/2005 we are still running everything off  a 64MB size card.

Based on our experience, I highly recommend Technologic Systems and their TS5500 single board computer.

Embedded linux is an active field.  In the few hours I trolled the web I noticed questions from a number of interested people about how to get started.  Cost seemed a major issue.  At first it looked like $1000 was the cost to "join the club" as that seemed to be the price of the few starter kits I found.   However the total cost of the TS-5500 with the extra memory, serial ports, cables, enclosure and so on was about $900. (For reference an ethernet to 8 port serial adapter costs about this much)  Technologic Systems offerers a couple starter kits for less than $400.   With some scrounging, it should be possible to gather the parts to get started for less than $300.

Based on my experience the minimum needed would include
SBC with ethernet  and CF or a different removable medium,  no video, mouse, keyboard support
Power supply for the SBC
CF card - 16 Mb would be enough, but I'd recommend a larger size
Null modem cable
Crossover ethernet cable
CF reader that works on your host system