# Cant get serial port to connect.

## dE_logics

Although it's a dying technology, but cause I got that null modem cable, I'm gonna try it.

So I've got an old Desktop PC with Gentoo on one end and a Debian KDE installation on the other.

I'm trying to get a terminal session with the Gentoo PC.

Both recognize their respective serial ports by the kernel - 

```

[    0.000000] console [tty0] enabled

[    1.054086] serial8250: ttyS0 at I/O 0x3f8 (irq = 4) is a 16550A

[    1.104909] 00:09: ttyS0 at I/O 0x3f8 (irq = 4) is a 16550A
```

and

```

[    0.000000] console [tty0] enabled

[    3.013307] serial8250: ttyS0 at I/O 0x3f8 (irq = 4) is a 16550A

[    3.037560] 00:09: ttyS0 at I/O 0x3f8 (irq = 4) is a 16550A
```

I've the following in /etc/inittab on the Gentoo install - 

s0:12345:respawn:/sbin/agetty -L 9600 ttyS0 vt100

And I got the agetty instance running (confirming via ps).

On the Gentoo system, output of stty -a -F /dev/ttyS0 - 

```
speed 9600 baud; rows 24; columns 80; line = 0;

intr = ^C; quit = ^\; erase = ^?; kill = ^U; eof = ^D; eol = <undef>;

eol2 = <undef>; swtch = <undef>; start = ^Q; stop = ^S; susp = ^Z; rprnt = ^R;

werase = ^W; lnext = ^V; flush = ^O; min = 1; time = 0;

-parenb -parodd cs8 hupcl -cstopb cread clocal -crtscts

-ignbrk -brkint -ignpar -parmrk -inpck -istrip -inlcr -igncr -icrnl -ixon -ixoff

-iuclc -ixany -imaxbel -iutf8

-opost -olcuc -ocrnl -onlcr -onocr -onlret -ofill -ofdel nl0 cr0 tab0 bs0 vt0 ff0

-isig -icanon -iexten -echo -echoe -echok -echonl -noflsh -xcase -tostop -echoprt

-echoctl -echoke
```

Thing look fine, but on the Debian system - 

```
speed 9600 baud; rows 0; columns 0; line = 0;

intr = ^C; quit = ^\; erase = ^?; kill = ^U; eof = ^D; eol = <undef>;

eol2 = <undef>; swtch = <undef>; start = ^Q; stop = ^S; susp = ^Z; rprnt = ^R;

werase = ^W; lnext = ^V; flush = ^O; min = 1; time = 0;

-parenb -parodd cs8 hupcl -cstopb cread clocal -crtscts

-ignbrk -brkint -ignpar -parmrk -inpck -istrip -inlcr -igncr icrnl ixon -ixoff

-iuclc -ixany -imaxbel -iutf8

opost -olcuc -ocrnl onlcr -onocr -onlret -ofill -ofdel nl0 cr0 tab0 bs0 vt0 ff0

isig icanon iexten echo echoe echok -echonl -noflsh -xcase -tostop -echoprt

echoctl echoke
```

So obviously there's no response from any serial communication program like cutecom, gtkterm or putty.    :Sad: 

----------

## NeddySeagoon

dE_logics,

The wonderful thing about the RS232 standard for serial ports is that there are so many versions to choose from and some cominations will destroy others.

The original was 20mA current loop, which needed 15v. As far as I know, that predates the PC.

Later versions havs allowed lower and lower voltages.

First step is to put minicom on both boxes, then on each box in turn, link the Tx and Rx pins (pins 2 and 3), so whatever goes out is sent back.

This is a loopback test.  In mnicom, turn off flow control altogether, so you don't need any other wires looped back and check that what you type onthe keyboard you get back.  Hint: local echo is both a help and a hinderance.

This will work regardless of baud rate, parity and stop bit settings.  The PC hardware design is brain dead in the serial comms department as it does not support different settings for transmit and receive at the same time on the same serial port.

When that works on both systems, you can play with minicom and your null modem cable.

Set both ends to 9600,n,1 which is the tradition in the PC world. Anything faster then 9600 will cause dropped characters with some setups.

Set flow control off for this test. Using minicome on both ends, what you type on one end should appear at both ends. If local echo is on turn it off or you will get both local and remote echo. SSoo eevveerryytthhiinngg wwiill aappeeaarr ttwwiiccee.  :)

Once that works, play with a serial console for real.

----------

## dE_logics

The test works on both the boxes.

I followed - 

http://support.attachmate.com/techdocs/1368.html

----------

## NeddySeagoon

dE_logics,

The next step is to use your null modem cable to send from one PC to the other.

There are several test cases but you cannot type fast enough to need flow control, so we can ignore test cases with hardware flow control or software flow control.

In minicom on both systems set up the serial links for 9600,n,1 and all flow control off.

Its essential that the settings are *idential* at both ends.

What you type in minicom at one end should appear in minicome at the other end.

Your loop back testing has shown that the serial port works on each PC independently. If the settings are *identical* at each end and the null modem test fails, then either the null modem cable isn't a null modem or the serial ports use two different incompatable versions of the RS232 standard.

To check your null modem, you neet to test that pin 2 at one end is connected to pin 3 at the other. That is, that pins 2 and 3 are crossed over in the cable.

----------

## dE_logics

Nothing happened.

I checked connection between pin 2 at one end and pin 3 on the other, but there's no connection between them.

pin 2 on one end is connected to pin 2 at the other and pin 3 on one end is connected to pin 3 at the other.

----------

## NeddySeagoon

dE_logics,

Thats not a null modem cable.

You have the two Tx pins connected together and the two Rx pins connected together.

If you have the bits to make a cable, you only need three wires. Wired as follows:-

Pin 2 to pin 3

Pin 3 to pin 2

Pin 7 to Pin 7

This leaves out all the hardware handshake wires but thats OK up to 9600 baud.

----------

## dE_logics

So that listing in ebay was false!

Thanks for the info Neddy!... I'll surely see to this.

----------

## dE_logics

I'm tempted to try serial over RJ45, but cant find the resources.

----------

## NeddySeagoon

dE_logics,

If you don't mind butchering your "not a null modem cable" chop it in half, identify the wires going to pins 2,3 and 7 in each half and connect them correctly for a null modem.

Leave the rest of the wires unconnected - you may want to cross them over later so you can have hardware flow control

----------

## dE_logics

 *NeddySeagoon wrote:*   

> dE_logics,
> 
> If you don't mind butchering your "not a null modem cable" chop it in half, identify the wires going to pins 2,3 and 7 in each half and connect them correctly for a null modem.
> 
> Leave the rest of the wires unconnected - you may want to cross them over later so you can have hardware flow control

 

Yeah, that sounds a good idea, but it appears those wires are too find for the purpose, but still I'll try.

----------

