![]() |
![]() |
|
![]() |
![]() |
|
| September 20, 2001 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" 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 alpha_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 SENSORSOFT DEVICES SCOM has special support for Sensorsoft Devices. In the example below, the temperature of a remote location is measured using a ST6105J Thermometer. The CRC error detection, re-transmission and plug and go acrobatics are handled by scom. An ASCII 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 is a sample script called splogdata.sh that takes repeated readings from a soft probe and stores them in a log file. It checks alarm limits and pages 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) 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 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 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 alpha_page.ini "Fred,call head office in CA" ca.acme.com@6005 Using SCOMd provides an number of features and benefits over terminal servers;
DIGITAL CAMERAS SCOM has special support for Olympus digital cameras. Digital cameras can be used in a number of applications easily and without much setup;
SCOM provides a quick way to snap a picture and downloaded it to disk. The following simple command line uses a setupfile that contains all keywords necessary to shoot and download an image directly from a camera connected to your serial port; # scom -C D200L.ini tty3a The next command line shows how scomd server can be used to share a digital camera over a TCP/IP network with a number of workstations; # scomd -s 19200 -b -f /usr/adm/cam.log tty3a cam On the client side, the following command line controls the remotely located camera to shoot a picture, then download the image file to the client workstation's disk; # scom -C D200L.ini Sparc@6004 Located in the /scom/scripts directory is a shell script called getall_pictures.sh or getall_thumbnails.sh to download all pictures from an Olympus digital camera. 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. 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 sent back from the camera is stored in a file that can later be viewed by an image tool or delivered to clients who share 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
INTERNAL HELP LISTING As shown here, both SCOM and SCOMd have an 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 5.1 Usage: scom [-options] serialport | host@port [transmit string] SCOM TCP/IP Serial Port Server Ver 5.1
com(HTML) scomd(HTML) Copyright (C) 1997-2001 Sensorsoft Corporation, All rights reserved. |
|||