Re: Serial Port voltage drops with Linux

From: Jens Benecke (jens@pinguin.conetix.de)
Date: Mon Jan 17 2000 - 17:25:08 EST


On Mon, Jan 17, 2000 at 04:28:12PM -0500, Richard B. Johnson wrote:
> 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

That's (IIRC) exactly what the hardware is supposed to do, and this works
with QBasic, strangely...

> > 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.

Thanks a lot. I will try this next time we get together.

I am CC'ing this to Guido, who did the actual port programming and testing
(ocilloscope, serial port status tester, etc). Perhaps he can comment on
it.

Come on, Guido, this is a chance to brush up your English. :)
 

-- 
_ciao, Jens_______________________________ http://www.pinguin.conetix.de
·
"[Microsoft] ... guarantees 99.8% NT uptime for certain hard-/software.
 That's exactly the 3 minutes daily that my NT server needs to reboot."
							-- ZDnet editorial

- 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