ITEM: AN2109L

Cleo SYNCable + async to sync converter



ENV:
        AIX 3.2.5
        128-port adapter
        Black Box Cleo sync to async converter
        Motorola UDS sync modem

DESC:
        Keep getting tty buffer overrun errors from a tty which
        has a sync-to-async coverter on it.  The tty is disabled
        nad is running Cleo software.
ACT:
        Customer's setup is as follows:

        8port_adapter_tty---------cleo--------MotorolaUDS
                            
        Between the tty and cleo RS-232 is used.  RTS/CTS, no XON/XOFF
        The cleo is an async to sync converter which goes to a 
        Motorola UDS sync modem and then does sync over a dial-up
        line.  You are getting receiver overrun on inputs and tty
        hog errors for this tty.

        Suggested the following tips:

        1) Be sure that the cleo box (and modem?) are set to use
           RTS/CTS as well.

        2) Increase ihog value

        3) Decrease the read trigger of the tty to give reading from
           this tty higher priority.

        4) Perhaps these devices aren't capable of RTS/CTS.  Try
           turning XON/XOFF on as well.

        5) Lower baud rate to see if the problem clears up at lower
           speeds.

ACT:
        Examined customer's error report and determined that these
        errors are only occuring exactly every 4 minutes.  The 
        errors only occur when the tty is not in use.  Normally,
        there is 3780 software from Cleo running on the port 
        instead of a getty.  When this process is NOT running, the
        errors are logged.

        cu -ml tty2

        There is continuously a stream of data coming across the
        line - a heartbeat type of signal.  If no process is
        reading this data and it continues to flow in, when the
        buffer is filled then it will be flushed and this error
        will be logged.

        To prove this theory, we increased the size of the ihog
        input buffer:

        stty ihog 1024 \< /dev/tty2
        echo tty tty2|crash|more

        The ihog is now at 1024 and the time between these errors
        being logged should approximately double.

        Customer will leave the Cleo daemon running to read the
        signal.  Also, will device a C program that the customer
        can run to read what is coming on the port and discard it
        or log it for testing.

\#include \
\#include \
\#include \
\#include \
\#include \
 FILE   *fdr, *fdw, *fdl;
int    fd;
struct termio term_save, stdin_save;
 void Exit(int sig)
{        if (fdr) fclose(fdr);
        if (fdw) fclose(fdw);
        if (fdl) fclose(fdl);
        ioctl(fd, TCSETA, &term_save);
        close(fd);
        ioctl(fileno(stdin), TCSETA, &stdin_save);
        exit(sig);
}main(int argc, char *argv[])
{        char   *b, buffer[80];
        int    baud = 0, num;
        struct termio term, tstdin;
           if (argc \< 2 || !strcmp(argv[1], "-?")) {
                  fprintf(stderr, "USAGE:  motalk /dev/tty? [speed]\\n");
                  exit(1);
          }
           if ((fd = open(argv[1], O_RDWR|O_NDELAY)) \< 0 ) {
                  perror(argv[1]);
                  exit(errno);
          }
           if (argc > 2) {
                switch(atoi(argv[2])) {
                        case 300:
                                baud = B300;
                                break;
                        case 1200:
                                baud = B1200;
                                break;
                        case 2400:
                                baud = B2400;
                                break;
                        case 4800:
                                baud = B4800;
                                break;
                        case 9600:
                                baud = B9600;
                                break;
                        case 19200:
                                baud = B19200;
                                break;
                        case 38400:
                                baud = B38400;
                                break;
                        default:
                                baud = 0;
                                fprintf(stderr,
                                        "%s: %s is an unsupported baud\\n",
                                        argv[0], argv[2]);
                                exit(1);
                }
        }
/*      SAVE STDIN AND TTY STATE. ALSO TRAP SIGNALS   */
        ioctl(fd, TCGETA, &term_save);
        ioctl(fileno(stdin), TCGETA, &stdin_save);
        signal(SIGHUP,  Exit);
        signal(SIGINT,  Exit);
        signal(SIGQUIT, Exit);
        signal(SIGTERM, Exit);
 /*      SET STDOM TP RAW MODE, NO ECHO    */
        ioctl(fileno(stdin), TCGETA, &tstdin);
        tstdin.c_iflag = 0;
        tstdin.c_lflag &=  ~(ICANON | ECHO);
        tstdin.c_cc[VMIN] = 0;
        tstdin.c_cc[VTIME] = 0;
        ioctl(fileno(stdin), TCSETA, &tstdin);
 /*      SET TTY STATE   */
        ioctl(fd, TCGETA, &term);
        term.c_cflag |= CLOCAL|HUPCL;
        term.c_iflag &= ~ICRNL;   /*  TO AVOID UN-NEEDED BLANK LINES  */
          if (baud > 0) {
                  term.c_cflag &= ~CBAUD;
                  term.c_cflag |= baud;
          }
        term.c_lflag &= ~(ICANON | ECHO);   /*  TO FORCE RAW MODE     */
        term.c_cc[VMIN] = 0;
        term.c_cc[VTIME] = 10;
        ioctl(fd, TCSETA, &term);
        fcntl(fd, F_SETFL, fcntl(fd, F_GETFL, 0) & ~O_NDELAY);
 /*      OPEN TTY FOR READ AND WRITE  */
          if ((fdr = fopen(argv[1], "r")) == NULL ) {
                  perror(argv[1]);
                  exit(errno);
          }
          if ((fdw = fopen(argv[1], "w")) == NULL ) {
                  perror(argv[1]);
                  exit(errno);
          }
 /*      ALL I/O IS UNBUFFERED */
        setbuf(stdin, 0);
        setbuf(stdout, 0);
        setbuf(fdr, 0);
        setbuf(fdw, 0);

/*      WRITE ALL DATA READ FROM THE TTY TO A LOG */
        fdl = fopen("/tmp/ttylog", "w"); 
 /*      TALK TO THE MODEM  */
        puts("Ready... \^C to exit");
        while (1) {
                if ((num = read(fileno(stdin), buffer, 80)) > 0)
                        write(fileno(fdw), buffer, num);
                if ((num = read(fileno(fdr), buffer, 80)) > 0) {
                        printf("Read %d bytes\\n", num);
                        write(fileno(stdout), buffer, num);
                        write(fileno(fdl), buffer, num);
                }
        }
        Exit(0);
}       /*       E N D    O F    P R O G R A M        */

ACT:
        Customer did above tests and found that the Cleo box 
        was sending back a beacon signal.  It sent back a "U" 
        if the link was up and it sends back a "D" if the link
        is down.  These eventually fill the input buffer.  You
        get around the problem by:

        1) Set AIX tty up for no handshaking.  No XON/XOFF, no
           RTS/CTS

        2) Increase ihog value to 4096 - the input buffer must be
           large enough to accomodate the largest packet size used.

        3) Turn off RTS/CTS pacing and XON/XOFF on the modem itself.
           The modem should be doing no flow control on its own.

        Now all is working fine.


Support Line: Cleo SYNCable + async to sync converter ITEM: AN2109L
Dated: October 1995 Category: N/A
This HTML file was generated 99/06/24~13:30:26
Comments or suggestions? Contact us