Skip site navigation (1)Skip section navigation (2)
Date:      Tue, 4 Jun 2013 17:59:18 -0700
From:      Jeremy Chadwick <jdc@koitsu.org>
To:        Alban Hertroys <haramrae@gmail.com>
Cc:        "freebsd-stable@freebsd.org" <freebsd-stable@freebsd.org>
Subject:   Re: Serial terminal issues
Message-ID:  <20130605005918.GA5709@icarus.home.lan>
In-Reply-To: <383C78B1-4F16-408F-8144-63B470D0C129@gmail.com>
References:  <383C78B1-4F16-408F-8144-63B470D0C129@gmail.com>

next in thread | previous in thread | raw e-mail | index | archive | help
On Tue, Jun 04, 2013 at 11:32:48PM +0200, Alban Hertroys wrote:
> I can't seem to get my serial terminal to work with my new system.
> 
> I had a serial terminal connected to my old system that worked great
> and copied /boot.config, /boot/loader.conf and /etc/ttys settings over
> from it.
> 
> The new system has a Gigabyte GA970A-UD3 board with just a serial
> header on the board. I bought a serial connector backplate in an
> electronics store and connected it to the board. Could the pinout be
> different or something?

It is very possible.  You should have asked Gigabyte what exact product
(specifically part number) to purchase that provided a
header-to-backplane DB9 port, or if they could send you one (many will
for free).  Always use what the mainboard vendor tells you.  Always.

It's also very possible the cable you're using to connect from the
Gigabyte board to something (you didn't disclose what) is wired wrong.

> > cat /boot.config 
> -D -S19200

Please try using "-S19200 -Dh" (please read carefully).  The order of
the arguments may matter as well (there has been some speculation on the
lists about this, and I do not care to do the analysis; just passing
information on blindly).

> > cat /boot/loader.conf 
> boot_multicons="YES"
> boot_serial="YES"
> comconsole_speed="19200"
> console="comconsole,vidconsole"

You do not need any of this given what /boot.config contains.  Please
remove it all.

> > cat /etc/ttys
> ...
> ttyu0   "/usr/libexec/getty std.19200"  vt320   on  secure

This is completely correct.

> >From /var/log/messages:
> Jun  4 21:28:50 solfertje kernel: uart0: <16550 or compatible> port 0x3f8-0x3ff irq 
> 4 flags 0x10 on acpi0
> Jun  4 21:28:50 solfertje kernel: uart0: console (19200,n,8,1)
> Jun  4 21:28:50 solfertje kernel: orm0: <ISA Option ROMs> at iomem 0xd5000-0xd67ff,0xd7000-0xd7fff on isa0
> Jun  4 21:28:50 solfertje kernel: sc0: <System console> at flags 0x100 on isa0
> Jun  4 21:28:50 solfertje kernel: sc0: VGA <16 virtual consoles, flags=0x300>
> Jun  4 21:28:50 solfertje kernel: vga0: <Generic ISA VGA> at port 0x3c0-0x3df iomem 0xa0000-0xbffff on isa0
> Jun  4 21:28:50 solfertje kernel: atkbdc0: <Keyboard controller (i8042)> at port 0x60,0x64 on isa0
> Jun  4 21:28:50 solfertje kernel: atkbd0: <AT Keyboard> irq 1 on atkbdc0
> Jun  4 21:28:50 solfertje kernel: kbd0 at atkbd0
> Jun  4 21:28:50 solfertje kernel: atkbd0: [GIANT-LOCKED]

Okay, so what's the problem?  You're not seeing any I/O on the serial
port?

How do you have your serial device connected to something on the
other end?  Meaning: solfertje has a serial port, and it's connected to
what exactly?

Are you sure the device its connected to is working?

Is the cable a null modem cable (if it's attached to another PC), etc.
etc. etc...

Does your serial cable have **correct** hardware flow control (CTS/RTS)
wiring, along with proper DCD tie-in?  Many "adapters" or cables do not
do this correct.  The official handbook says this:

http://www.freebsd.org/doc/en/articles/console-server/cabling.html

Which appears to have been updated in some manner of speaking, making
things "extra complicated".  Below is a document I wrote when using
FreeBSD x86 systems (those with DB9 serial ports), using a DB9-to-RJ45
adapter with *proper* wiring, to connect to MRV or Xyplex units -- the
important part is what the RJ45 ends are signal-wise.  Again, these use
PROPER CTS/RTS flow control with proper DCD tie-in, and work with the
"std.xxxxx" ttys(5) entries.

=========
The LX-4016S-001 sports sixteen (16) RJ45 connectors.

The cabling for the console port (Diag/Mgmt Port, also known as Port 0)
comes with the unit.  The cable to use for this port appears to be some
sort of rollover cable (Cisco?); it's silver and flat, not round like
CAT5.  It's 8-pin though.  A DB9 adapter also comes with this cable,
which allows you to hook it up to a standard PC and access it.

Ports labelled 1-16 require RJ45-to-DB9 adapters for hooking the MRV
up to actual servers in the rack.  The adapters that work best are the
Xyplex XFDCE91 adapters, which support hardware flow control (RTS/CTS)
and come pre-assembled.  You can find the product here:

   Xyplex adapter XFDCE91
   RJ45-to-DB9
   APACN p/n 24490-15 -- http://www.apacn.com/

Pinout/wiring diagram:

         RJ45          DB9
       Female          Female
  ===========          =======
      (CTS) 1  <---->  7 (RTS)
      (DTR) 2  <---->  6 (DSR)
      (TxD) 3  <---->  2 (RxD)
  (TxD GND) 4  <---->  5 (GND)
  (RxD GND) 5  <---->  5 (GND)
      (RxD) 6  <---->  3 (TxD)
  (DSR/DCD) 7  <---->  4 (DTR)
      (RTS) 8  <---->  8 (CTS)

Pins 1 (DCD) and 9 (RI) on the DB9 are unconnected/unused.

With these adapters, use standard (not crossover!) CAT5/6 cables.
=========


This diagram should allow you to build your own cable if need be,
including a null-modem cable if you plan on doing a PC<-->PC (i.e. DB9
to DB9) connection.  I just happened to use RJ45 stuff; for DB9-to-DB9;
just follow the chart (signal/pin names) and go from there.

If you already have a cable and you aren't sure of its wiring (which is
very common -- sigh, stupid companies...), you will need to figure out
the wiring using a multimetre (continuity test is all that's needed).

> I didn't see any options in the BIOS to set the console speed (just
> address and IRQ, those are in the above). ISTR that my old mobo did
> allow to set that information, but then again, that board (Tyan Tiger)
> gave me access to the BIOS through the serial console.

This has absolutely no relevancy.

Serial port speed settings in a BIOS pertain to BIOS-level console
redirection -- that redirection is lost the instant anything (boot
loader, kernel, etc.) touches SMI and/or interrupts and starts
"fiddling" with the serial port.

What you're adjusting in FreeBSD is 1) the FreeBSD boot loader touching
the serial port, and 2) the FreeBSD kernel outputting to a serial port
(it also initialises/sets the serial port), and 3) getty et al spawning
a login prompt on the serial port.

I would point you to my "FreeBSD via serial console and PXE" document,
except there are one-offs specific to the PXE portions that are not
relevant to your situation.  The important part is that I've used
FreeBSD serial console for almost 16 years and have a very good
understanding of what works (including vs. what some developers say
"should" work; i.e. reality vs. pragmatism).

-- 
| Jeremy Chadwick                                   jdc@koitsu.org |
| UNIX Systems Administrator                http://jdc.koitsu.org/ |
| Making life hard for others since 1977.             PGP 4BD6C0CB |




Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?20130605005918.GA5709>