Re: Serial (RS232) communication - failing to detect stop bit



On Sat, 25 Aug 2007, in the Usenet newsgroup comp.os.linux.hardware, in article
<1188067467.381246.119690@xxxxxxxxxxxxxxxxxxxxxxxxxxxx>, arka.n.roy wrote:

NOTE: Posting from groups.google.com (or some web-forums) dramatically
reduces the chance of your post being seen. Find a real news server.

I need to use my Gentoo machine to obtain data from an external
instrument via a 9-pin serial port. Very old stuff.

41557 Aug 28 2001 Serial-Programming-HOWTO

So is that HOWTO, and it should be on your system.

I bought a cable that is called a "cross cable" in Japan (where I am
located), I think this corresponds to what is called a "null-modem
cable" in America. Both ends are female, and it is used to directly
connect 2 PCs.

The "sex" of the connector is only one part of the problem. You also
need to check the wiring of the pins. The "normal" cable is wired pin
to pin like this:

1-1 2-2 3-3 4-4 5-5 6-6 7-7 8-8 9-9

though not all of those wires may be included (minimum is pins 2, 3, and
5, though the full cable is 8 wires with the shield acting as the ninth).

The fun comes in when this is not a "normal" cable. There are several
wiring schemes used - a _minimal_ cable has only three wires, 2-3 3-2
and 5-5. A more complete cable adds hand-shaking (7-8 8-7). See the
Serial-HOWTO for more details.

274227 Jan 17 2007 Serial-HOWTO

PC-1: Gentoo OS
PC-2: Has partitions for both Windows XP and Xandros Linux.

OK - I'd start by using minicom (or equal) on both systems to see
that the serial ports are alive and well.

I have narrowed things down to where I realize I am getting the
following.

If I run the following command on the Gentoo machine (PC-1):
cat /proc/tty/driver/serial
I get, along with the number of bytes transfered by rx and tx, I also
get fe:2, which I assume means two frame errors.

I'm not exactly sure I'd be trying to read bits directly from the
device.

The rx figure is correct in that it jives with the number of bytes I
sent from PC-2... this indicates that the Gentoo machine IS receiving
data. However maybe the fe:2 means that it is not detecting the stop
bits, and this is preventing it from displaying output text in
minicom.

For this, I'd probably be using a utility called modem-lights - I have
NO idea where you'll find a copy - or using 'seyon' rather than minicom.
Both display the status of the serial bits. Depending on the cable you
are using, you probably are having handshaking problems. You may also
have a program called 'statserial'

[compton ~]$ whatis statserial
statserial (1) - display serial port modem status lines
[compton ~]$

I have checked and rechecked that all the settings (bit rate, parity
etc) all match on both machines. I am wondering if there is some
factor in the kernel that is making it not recognize the stop bit. I
have had other indications as well that a stop bit or a terminator is
not being detected (long story).

What are you using to monitor the serial port. The kernel itself doesn't
do so - you need some application to listen to the bits/IRQs. The
serial driver (part of the kernel) only knows about certain speeds,
and the maximum speed is a function of the age of the computer. I'd
initially be playing at 9600 (the default), 19200, 38400, 57600 and
maybe 115200 bits/second.

What are some possible causes? (e.g. the OS is doing too much
interrupting or not enough?)

Looking at /proc/interrupts might tell you, but as noted this only shows
stuff for which there is some application listening to the IRQs. By this
I mean that if I look at /proc/interrupts now, I see

[compton ~]$ column /proc/interrupts
0: 285150536 timer 10: 132871 3c900
1: 1613100 keyboard 13: 1 math error
2: 0 cascade 14: 2144565 + ide0
3: 4701535 + serial 15: 0 + ide1
8: 16 + rtc
[compton ~]$

Now you can see IRQ 3, but that's the mouse on this system. The modem is
using IRQ 4 - but it doesn't show because nothing is listening to the
modem. If I fire up minicom:

[compton ~]$ column /proc/interrupts
0: 285162106 timer 8: 16 + rtc
1: 1613544 keyboard 10: 132883 3c900
2: 0 cascade 13: 1 math error
3: 4702651 + serial 14: 2144655 + ide0
4: 80151 + serial 15: 0 + ide1
[compton ~]$

there's the modem.

Old guy
.



Relevant Pages

  • Re: ppp problem with isp
    ... 1-byte buffer and no flow control. ... speed modem connections at the usual serial device's 115200 bps default ... to chat modem initialization. ... These comments are derived from the setserial man pages, the Serial-HOWTO, ...
    (comp.os.linux.networking)
  • Re: Ubuntu 5.10 + How to connect to Internet
    ... If this command does not show a modem, ... read the Serial-HOWTO and Modem-HOWTO ... is phone number, user names, password, and the IP addresses of the DNS servers. ...
    (comp.os.linux.setup)
  • Re: ppp problem with isp
    ... For once the native COM port is working so any problems can't ... be with the old card but I'm still using the same modem ... >> to me this is because of the card itself (I'm using a serial ... >These comments are derived from the setserial man pages, the Serial-HOWTO, ...
    (comp.os.linux.networking)