Sensorsoft

SCOM Application Note

March 10, 2016



 
 

INTRODUCTION

The SCOM Serial Communications Tool saves time and money by providing solutions to common serial communication problems. Many applications utilize serial port communication to deploy various peripherals. The problem with these applications is that they become difficult to debug when the attached serial peripheral fails to interact correctly. Since the serial communication is usually buried within the application code, you cannot easily separate application problems from the actual serial device problems. SCOM cuts through the layers of application code and allows you to speak directly to the device.

Here are a few of the applications where it's being used, listed by type of serial peripheral.
 

MODEMS

Many satellite installations utilize modems as back-up to their regular service. When the satellite link goes down, these modems re-establish a dial-up link to temporarily supply communications until the satellite connection can be restored. To insure that the modems are properly configured, an initialization string is automatically transmitted to the modems. Existing UNIX shell commands cannot provide this type of automated capability.

The following scom command line issues a command string (contained in a file) to insure modems are set to the desired parameters:

# scom -f /usr/modems/telebit.init ttyb
 

This example shows how modem parameters (Hayes) can be saved to a file for later viewing or comparison:

# scom -t 13 ttyb "at&v" > /usr/modems/hayes.sav
 

It is important to note that all command strings sent to the modem must be terminated with a -t 13 for the modem to execute them. If the command string is contained in a file, then a carriage return (i.e. CR) must be appended to the end of string in the file (i.e. echo -n "\r" >> telebit.init ).

In the following command line, scom dials up a another modem to check for a login prompt;

# scom -D -s 19200 -d 30 -t 13 ttya "ATDT4163632815"

CONNECT 14400 (output to screen)

User Access Verification (output to screen)

Username: (output to screen)
 

In the Solaris and HP-UX version of scom you can use the -D option, do not drop DTR, to keep the modem link up between shell script lines. The only way to do this with other UNIX versions of scom is to set the modem to ignore the DTR line ( &D0 setting on most modems). An application script /scom/scripts/dialup.sh provides an automated procedure for checking the integrity of dial-up modem lines for those who maintain modem pools and internet modem terminal servers.
 

SERIAL LINKS (PPP/SLIP/UUCP)

Monitor and probe mode capabilities of scom allow it to be used as an inexpensive replacement for a protocol analyzer. Using a breakout box and a special cable connected to a spare serial port, scom is often used to monitor receive and transmit communications over various serial links.
Many transmissions contain control characters or binary data that cannot be properly displayed on terminals in native form. The monitor and probe mode of scom, converts non-printable bytes into hex or mnemonic representation for easy viewing (i.e. <00h> <FFh>). Using this mode you can locate problem areas in the link that previously went unnoticed.

In the following example, scom is used to continuously monitor RX or TX data on a PPP link:
 

# scom -s 38400 -d 0 -m ttya
 
 

ALPHA/NUMERIC PAGING FOR EARLY WARNING

scom has built-in support for sending messages to alphanumeric and numeric paging services using an off-the-shelf modem. It can be used in applications where it is necessary for a computer to generate the pages, informing the administrator when the system needs maintenance. Here are some examples;

scom makes it easy to send alphanumeric or numeric pages from a shell script or the command line as shown in this example;
 

scom -P SMS-TAP_page.ini "Server1: Disk space low - / filesystem" ttya
 

By using a shell variable for the message string, unique warnings can be issued from shell scripts to signal administrators of impending problems before they become more serious.
 

PLOTTERS

If your plotter does not come with UNIX software, scom makes it easy to use it from your own shell scripts or batch files. In this example scom sends a set-up string to a Houston Instruments plotter to initialize it, then sends a drawing file for plotting:

# scom -s 2400 -e -z 2 -f /plots/080D0008.plt ttya ";:Z"
 

TERMINALS

Troubleshooting terminal problems is easier using scom. A common exercise of dumping a file to a terminal for testing is now more flexible - you can select the baud rate you want instead of using the default. SCOM will also let you view the control characters from the terminal keyboard or allow you to send control strings to test screen control.

In this example scom monitor mode prints control characters being received from a VT100 terminal keyboard:
 

# scom -s 19200 -m -d 0 ttya

<ESC>[A<ESC>[B<ESC>[C<ESC>[D
 

SENSORSOFT DEVICES

scom has special support for Sensorsoft Devices. In the example below, the temperature of a remote location is measured using a ST6105 Sensorsoft Thermometer. The CRC error detection, re-transmission and plug and go acrobatics are handled by scom. A text setup file (ST6105.ini) controls parameters such as number of retires on error, temperature scale and type of command.

# scom -Q /scom/setupfiles/ST6105.ini ttya

-24.0 C (output)
 

Also located in the /scom/scripts directory are sample scripts called monitordX.sh that take readings from a Sensorsoft device and store them in a log file. They check alarm limits and page and email the administrator when an alarm condition exists.
 

MICROCOMPUTER DEVELOPMENT

Design engineers need not be concerned whether exotic development equipment is supported under UNIX. SCOM supplies everything needed to talk to such devices.
 

Download hex dump files to microcontrollers (i.e. Dallas DS5000)
Program EEPROM's/PLD's from serial device programmer (i.e. DATA I/O 2900)

Here a microcontroller is downloaded with new operating software from a file:

# scom -s 19200 -t 13 ttyb scom -s 19200 -t 13 -f /dallas/ds5000/uOSv2.80.hex ttyb "L"
 

The first instance of scom gets the microcontroller's attention by sending it a <CR> and setting its auto-baud circuits to the correct baud rate. The second instance of scom - first sends the load command (L) and terminating <CR> (-t13), then sends the hex dump file.
 

DATA ACQUISITION SYSTEMS

SCOM has the flexibility to interface to a large variety of RS232 data acquisition units and instruments for data collection and logging.

The following crontab example shows how temperature can be monitored and logged to a file every hour using scom, an RS232 data acquisition unit and a temperature probe. Here scom issues a command to read a temperature probe, the device returns a measurement that is then appended to a file:
 

10 * * * * /etc/scom -t13 -r13 -n1 ttya p1read >> /temperature.dat
 

Note that -n1 and -r13 options are used because the data acquisition system only returns one line for the measurement, terminated by <CR>. The option -t13 is required by the device to indicate the end of the "p1read" command.
 

SHARE PERIPHERALS ON TCP/IP NETWORKS WITHOUT A TERMINAL SERVER

scomd provides a way for SCOM users to share expensive or widely used serial peripherals on your TCP/IP network without the expense of purchasing a terminal server. With a spare serial port on your UNIX/LINUX system, scomd can put serial peripherals on your network for use by any client. The following example shows how one scomd command line can share a paging modem;

# scomd -s1200 -e -d30 -f/usr/adm/pagelog tty2a pager

scom also provides the client side too, using the command line;

# scom -P SMS-TAP_page.ini "Sam, please call 276-5556" scobox@6005

Notice that the client uses a TCP socket connection (scobox@6005) to perform the page, instead of a serial port device name. If the above scomd server is available on an Intranet, then the paging modem can be accessed from other area codes or countries to page without long distance charges as shown here;

#scom -P SMS-TAP_page.ini "Fred,call head office in CA" ca.acme.com@6005

Using scomd provides an number of features and benefits over terminal servers;


NETWORK CAMERAS

SCOM has special support for Axis Network cameras. Network cameras can be used in a number of applications easily and without much setup;

SCOM provides a quick way to download an image to disk. The following simple command line uses a setupfile that contains all settings necessary to shoot and download an image directly from a camera connected to your network to a file on disk;

# scom -C camera.ini image.jpg axis:80
 
 

SHARING PERIPHERALS WITH A TERMINAL SERVER AND SCOM CLIENT

Many customers already use terminal servers to connect serial peripherals to their TCP/IP network. The problem often is, the necessity to write a custom client program utilizing socket programming. SCOM delivers the client side without writing any C or Java code. This next command line sends a <CR> command to a weight scale, connected to a terminal server, and receives the measurement response;

# scom -t 0x0D -S 0x0D ts_3@6002

30.5 LBS. (response)

The following example allows a Digi Port Server II to share a Soft Thermometer across a network. SCOM in this case would be the client;

Digi Port Server II SETUP

set line baud=1200 csize=8 parity=N stopb=1 break=ignore error=null range=XX(all other settings are off)

set ports dev=prn sess=1 edelay=1 termtype=none auto=on dport=21XX dest=IPaddress range=XX

set flow ixon=off ixoff=off range=XX

CLIENT COMMAND LINE

# scom -QST6100.ini dgii@21XX

XX is the port number where the Soft Thermometer is connected.
IPaddress can typically be the same IP address you choose for the Digi Port Server itself.
 
 

SUPPORTING SERIAL DEVICES THAT USE BINARY AND NON-PRINTING CHARACTERS

Some of the easiest devices to support using scom are those that use printable ASCII characters or commands. However using devices that communicate with binary or ASCII control characters requires a more detailed approach as we will describe here.

The best way to send and receive binary command strings are using files. The following example using a digital camera shows how a binary command string is sent using scom's -f option and the response stored in a file;
 

# scom -s 115200 -f /camera/get_picture.cmd ttya > image01.jpg
 

The file get_picture.cmd contains a binary command stream that requests that the camera download a picture. The resulting JPEG image send back from the camera is stored in a file that can later be viewed by with an image tool or delivered to clients who share use of the camera. To build the command stream file, one simply echoes the desired binary bytes to a file as such;
 

echo -n "\001\006\034\005\000\067" > get_picture.cmd
 

If analysis of the response is required, then commands like "od", "hd" and "grep" can be used to determine nature of the response stored in the file. In this example if the file is found to have few bytes in it and one of those bytes is a NAK, this indicates that the camera rejected the command due to a checksum error;

# if file is less than 5 bytes, we have an error
if test `wc -c` -lt  5
then
        # does the response contain a NAK (0x15)
        hd x image001.jpg | grep 15
        # was previous grep successful 
        if test echo $? -eq 0
        then
                # checksum error, re-send command
                scom -s115200 -f/camera/get_picture ttya > image001.jpg
        fi
fi


INTERNAL HELP LISTING

As shown here, both scom and scomd has internal help output (when you type "scom" or "scomd") so that you need not always refer to the manual page:
 

SCOM Serial Communications Tool (Client)   Ver 9.25

Copyright (C) 1995-2019  Sensorsoft Corporation, All rights reserved

Usage: scom [-options]  serialport | host:port  [transmit string]
  -d Read delay timeout in seconds, default is 1 second
  -f Send file to port, requires path-filename argument
  -n Number of lines to read, default is ALL
  -r Receive terminator to expect, default <LF>, range 0-255 decimal
  -t Transmit terminator, default none, range 0-255 decimal
  -c Flow control, default is XON, use XON,RTS,NONE
  -s Bit rate, default is 9600 bps, range 50-460800
  -o Set odd parity and 7 data bits, default (8N1)
  -e Set even parity and 7 data bits, default (8N1)
  -z Set number of stop bits, default is 1, use 1 or 2
  -m Monitor mode, displays control characters with mnemonic labels
  -p Probe mode, displays all characters in hexadecimal
  -v Display version, target CPU and OS
  -S Exit on Special received character, range 0-255 decimal
  -L Specify a custom lock file name
  -N Do not check for or produce a lock file
  -Q Sensorsoft Device mode, requires setupfile
  -P SMS-TAP/DTMF Paging mode, requires setupfile and message
  -E Email (SMTP) client mode, requires setupfile, subject and message
  -A Specify path/filename for email attachment. Must precede -E option
  -R Specify email recipients on command line. Must precede -E option
  -C Network Camera mode, requires setupfile imagefilename
  -X Plug-in Reader Mode, requires pluginfile setupfile
 

SCOM TCP/IP Serial Port Server   Ver 9.25

Copyright (C) 1997-2019  Sensorsoft Corporation, All rights reserved

Usage: scomd [-options]  serialport  service
  -d Idle timeout before socket close, default is 10 seconds
  -b Debug messages are generated
  -f Output ALL messages to a log file, requires path-filename
  -c Flow control, default is NONE, use XON,RTS,NONE
  -s Bit rate, default is 9600 bps, range 50-460800
  -o Set odd parity and 7 data bits, default (8N1)
  -e Set even parity and 7 data bits, default (8N1)
  -z Set number of stop bits, default is 1, use 1 or 2
  -v Display version, target CPU and OS
  -L Specify a custom lock file name
  -N Do not check for, or produce, a lock file
  -F Setupfile mode, requires setupfile
  -S Shutdown server, requires serialport
  -I Reinitialize server, requires serialport
 
 

REFERENCE LIST OF SERIAL PERIPHERALS USED WITH SCOM

ALSO SEE
scom(HTML) scomd(HTML)
 
 

Copyright (C) 1997-2019  Sensorsoft Corporation, All rights reserved.
Sensorsoft, Soft Thermometer and SCOM Serial Communications Tool are trademarks of Sensorsoft Corporation.