serial, basic stuff

From: Jon Clausen <freebsd-questions_at_ymmv.dk>
Date: Sat, 20 Apr 2024 09:41:49 UTC
Hi

I need some help getting this figured out, apparently :/

I have two PCengines APU boards ("jh05" and "jh06") - small form factor,
headless, with two serial ports each:

0: front mounted DB9 (regular "RS232")
1: header on the board (TTL)

Ultimately, I would like to "cross connect" the machines, so:

jh05:port0 <-> jh06:port1
jh05:port1 <-> jh06:port0

This way I will have "console" access to either machine, from the other one,
which would allow me to make "network interrupting" changes to either system
by using the other one for access.

Both systems are "identical", and both currently run 13.2-RELEASE


Now, I've been using linux for ~25 years, FreeBSD for ~10 - sprinkled with
various other unix-like systems on the side during that time - so I'm not a
complete newbie.
But I have never actually had to work with serial communications very much.
Particularly, I have never needed to connect two FreeBSD systems using *actual*
serial devices before.

Since the ports are different levels (one is TTL, the other is "5V") I
thought I'd start out just connecting the DB9 front connectors using a
regular null-modem cable.

This should minimise the number of things that can go wrong, and once I have
this setup working, I can move on to using the RS232<->TTL adapters I have.
So, initially, the setup is:

jh05:port0<->jh06:port0

I'm using `screen` for the connections, mostly because the keystrokes to
kill a `screen` session are not the same as what kills the ssh-connection
into the boards.


First of all, I'd like some clarification about the tty* devices, versus the
cua* devices.

Does one use the "cua" device on the "connecting" system?
So to connect to jh06, should I expect this to work:
jh05:~ # screen /dev/cuau0


Since I have had little success using the serial connections directly, I
have used one of my USB<->serial converters. And with this, things seem to
be fine.

But it does not appear to matter much, whether I use ttyU0 or cuaU0. Both
work. If I make a connection like this:

jh05:~ # screen /dev/cuaU0

I get the login prompt of jh06. I can then login, break the connection and
make a new connection using:

jh05:~ # screen /dev/ttyU0

-which then lands me back at the same session on jh06.


In practical terms, for my use case, as described above, should I be using
the tty* or the cua* device to initiate the connection?


Once that's out the way, I'll probably need some guidance for the various
flags/settings on each of the devices too - but that's for later


br
/jon

-- 
YMMV