You are not logged in.

#1 2013-05-30 14:17:46

hobarrera
Member
From: The Netherlands
Registered: 2011-04-12
Posts: 356
Website

Getting serial consoles working

I'm trying to use my serial ports as serial consoles.
For my initial test to make sure I've got everything up and running (and to make sure I've understood everything correctly), I've pluged a serial cable from one serial port to another (on the same computer).

Both serial ports are identified by ttyS1 and ttyS2

[    0.881584] 00:03: ttyS0 at I/O 0x3f8 (irq = 4) is a 16550A
[    0.903016] 0000:02:00.0: ttyS1 at I/O 0xd010 (irq = 28) is a ST16650V2
[    0.924240] 0000:02:00.1: ttyS2 at I/O 0xd000 (irq = 29) is a ST16650V2

I then ran getty on ttyS2:

systemctl start getty@ttyS2.service

It seems to be running fine

$ systemctl status getty@ttyS2
getty@ttyS2.service - Getty on ttyS2
   Loaded: loaded (/usr/lib/systemd/system/getty@.service; disabled)
   Active: active (running) since Wed 2013-05-29 16:53:24 ART; 18h ago
     Docs: man:agetty(8)
           man:systemd-getty-generator(8)
           http://0pointer.de/blog/projects/serial-console.html
 Main PID: 18377 (agetty)
   CGroup: name=systemd:/system/getty@.service/getty@ttyS2.service
           └─18377 /sbin/agetty --noclear ttyS2 38400 linux

But when I try to connect with the instructions from the wiki, I just get a blank terminal and not login prompt, anything. Anything I type is not echoed either.

Of cource, when trying to connect, I'm using ttyS1. (since the other end of the cable connected to ttyS1 is connected to ttyS2).
I tried running the clients as root (since I belive that normal users don't have access to /dev/ttyS1).

Any ideas?

Offline

#2 2013-05-30 17:06:03

ewaller
Administrator
From: Pasadena, CA
Registered: 2009-07-13
Posts: 20,232

Re: Getting serial consoles working

Did you use a null-modem cable (swaps pins 2 and 3 so that 2 on one end goes to 3 on the other and 3 on the first end goes to 2 on the other)?
Any chance you are using hardware flow control ? 
What if you do not start getty and just instantiate two minicom sessions (or whatever terminal program you are using) to try to echo between them?
What if you put a terminal session on one port, and just redirect data to the other device node (  pstree > /dev/tyyS1  for example)
Do you, by chance, have an oscilloscope handy?


Nothing is too wonderful to be true, if it be consistent with the laws of nature -- Michael Faraday
Sometimes it is the people no one can imagine anything of who do the things no one can imagine. -- Alan Turing
---
How to Ask Questions the Smart Way

Offline

#3 2013-05-30 17:51:04

hobarrera
Member
From: The Netherlands
Registered: 2011-04-12
Posts: 356
Website

Re: Getting serial consoles working

ewaller wrote:

Did you use a null-modem cable (swaps pins 2 and 3 so that 2 on one end goes to 3 on the other and 3 on the first end goes to 2 on the other)?

I'm not sure. The packaging on the cable doesn't say anything, and I don't have a tester at hand (here's another reason for me to step out and buy one).
I'm pretty sure this is my problem; I'll report back once I've checked the cables.


ewaller wrote:

Any chance you are using hardware flow control ?

Uhm... not that I'm aware of; how could I tell?

ewaller wrote:

What if you do not start getty and just instantiate two minicom sessions (or whatever terminal program you are using) to try to echo between them?
What if you put a terminal session on one port, and just redirect data to the other device node (  pstree > /dev/tyyS1  for example)

Doesn't work. Nothing happens.

ewaller wrote:

Do you, by chance, have an oscilloscope handy?

Nope, I don't.

Offline

#4 2013-05-30 20:46:37

ewaller
Administrator
From: Pasadena, CA
Registered: 2009-07-13
Posts: 20,232

Re: Getting serial consoles working

Hardware flow control is one of the configuration items of your serial terminal emulator.  Flow control choices are usually none, hardware (RTS/CTS, CD, DSR/DTR), or software (Xon/Xoff, ETX/ACK).  Choose none.

As a real quick and dirty test, fire up a terminal program and, using just a short length of wire (an unfolded paper clip will work nicely) poke one end in pin 2 and the other in pin 3 on the same connector (the one associated with the tty your program is using).  Then, see if the terminal will loop back to itself.  If you cannot get this working, we will need to take a closer look at your driver configurations.


Nothing is too wonderful to be true, if it be consistent with the laws of nature -- Michael Faraday
Sometimes it is the people no one can imagine anything of who do the things no one can imagine. -- Alan Turing
---
How to Ask Questions the Smart Way

Offline

#5 2013-05-30 21:36:32

hobarrera
Member
From: The Netherlands
Registered: 2011-04-12
Posts: 356
Website

Re: Getting serial consoles working

ewaller wrote:

Hardware flow control is one of the configuration items of your serial terminal emulator.  Flow control choices are usually none, hardware (RTS/CTS, CD, DSR/DTR), or software (Xon/Xoff, ETX/ACK).  Choose none.

Merely disabling flow control didn't change anything.

ewaller wrote:

As a real quick and dirty test, fire up a terminal program and, using just a short length of wire (an unfolded paper clip will work nicely) poke one end in pin 2 and the other in pin 3 on the same connector (the one associated with the tty your program is using).  Then, see if the terminal will loop back to itself.  If you cannot get this working, we will need to take a closer look at your driver configurations.

I tried this and it works, but only if I disable flow control first.

Does that mean my cable is not a null-modem one?

Offline

#6 2013-05-30 21:41:31

ewaller
Administrator
From: Pasadena, CA
Registered: 2009-07-13
Posts: 20,232

Re: Getting serial consoles working

Probably.  The problem is both ports are sending on pin 3, and expect to see data arrive on pin 2.  A straight through cable hooks the two Tx lines together, and the two Rx lines together.  A 'null modem' does the swap in the cable.

http://en.wikipedia.org/wiki/Null_modem


Nothing is too wonderful to be true, if it be consistent with the laws of nature -- Michael Faraday
Sometimes it is the people no one can imagine anything of who do the things no one can imagine. -- Alan Turing
---
How to Ask Questions the Smart Way

Offline

Board footer

Powered by FluxBB