Re: Serial Port voltage drops with Linux

From: Richard B. Johnson (root@chaos.analogic.com)
Date: Mon Jan 17 2000 - 16:28:12 EST


On Mon, 17 Jan 2000, Dan Christian wrote:

> Is the device port powered (i.e. no other power input)?
>
> My guess is that you are try to get power from the port hand shake
> line. If these lines aren't set appropriately, then you are effectively
> drawing power off the transmit line (when it tries to go high). Check
> what the level of each line is under Linux and whatever is currently
> working.
>
> You can control these lines under Linux (or almost any Unix) using the
> ioctl command. I can't find the code that I usually use for this, so I
> can't give more detail right now. I know that there are open source
> packages that let you play with them.
>
> -Dan
>

Hmmm. If his hardware is trying to get power from the modem control
lines the hardware is broken by design and should be fixed. There
is no RS-232C specification for this mode of operation.

The ioctl to raise all modem control lines is:

        struct termios modem;
        fd = open("/dev/ttyS0", O_RDWR|O_NDELAY);
        flags = fcntl(fd, F_GETFL);
        flags &= ~O_NDELAY;
        fcntl(fd, F_SETFL, flags);
        memset(&modem, 0x00, sizeof(modem));
        modem.c_cflag = SPEED|CS8|CREAD|CLOCAL;
        modem.c_iflag = IGNBRK|IGNPAR;
        modem.c_cc[VMIN] = 1;
        modem.c_cc[VTIME] = 1;
        ioctl(fd, TCSETS, &modem);

Note: This is a template. No error checking is performed, and may
even contain typos.

This keeps CTS high, as well as DTR (CLOCAL does this). SPEED is
B9600, B19200, etc. This sets the modem to its dumbest (raw) mode
which is what is generally needed for control.

Cheers,
Dick Johnson

Penguin : Linux version 2.3.39 on an i686 machine (800.63 BogoMips).

-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.rutgers.edu
Please read the FAQ at http://www.tux.org/lkml/



This archive was generated by hypermail 2b29 : Sun Jan 23 2000 - 21:00:16 EST