Re: serial, basic stuff

From: Jon Clausen <freebsd-questions_at_ymmv.dk>
Date: Sun, 21 Apr 2024 12:32:37 UTC
On 2024-04-21 12:06:39 (+0200), Jon Clausen wrote:
> On 2024-04-21 11:32:00 (+0200), Dag-Erling Smørgrav wrote:

> > disable the serial console on either or both (add `console="vidconsole"`
> > to /etc/loader.conf, make sure you don't have `-D`, `-P`, or `-h` in
> > /boot.config or /boot/config) and make sure getty is running on port 1
> > instead (change `onifconsole` to `on` on the ttyu1 line in /etc/ttys).

> I think I'd rather leave the port0 setup as is, and just use port1 (on both
> systems) for now.
> 
> This means I'll need to get getty set up on one side, and make the
> connection from the other side. Once I have a working setup like that, I can
> then start working towards the port1(client) to port0(server) setup

Right.

Once I had the wires connected correctly, changed 'onifconsole' to 'on' in 
/etc/ttys, and issued `kill -HUP 1`, things started working.

So after I had a successful connection jh05:cuau1 <-> jh06:ttyu1 using the
default settings, I then went on to increase the speed from 9600 to 115200.

This worked as well, so I now have a working "high speed" setup.


So at this point, I should be ready to move on to attempting the setup that
I actually want:

jh05:cuau1 <-> jh06:ttyu0


This does not work out of the box.
Assuming that the RS232/TTL adapter works, and that I have made the
connections correct this time, I suppose the difference in settings between
the devices might need aligning.


This is what I have currently:

root@jh05:~ # stty -a -f /dev/cuau1.init
speed 115200 baud; 0 rows; 0 columns;
lflags: icanon isig iexten echo echoe -echok echoke -echonl echoctl
	-echoprt -altwerase -noflsh -tostop -flusho -pendin -nokerninfo
	-extproc
iflags: -istrip icrnl -inlcr -igncr ixon -ixoff ixany imaxbel -ignbrk
	brkint -inpck -ignpar -parmrk
oflags: opost onlcr -ocrnl tab0 -onocr -onlret
cflags: cread cs8 -parenb -parodd hupcl -clocal -cstopb -crtscts -dsrflow
	-dtrflow -mdmbuf rtsdtr
cchars: discard = ^O; dsusp = ^Y; eof = ^D; eol = <undef>;
	eol2 = <undef>; erase = ^?; erase2 = ^H; intr = ^C; kill = ^U;
	lnext = ^V; min = 1; quit = ^\; reprint = ^R; start = ^Q;
	status = ^T; stop = ^S; susp = ^Z; time = 0; werase = ^W;
root@jh05:~ #

root@jh06:~ # stty -a -f /dev/ttyu0.init
speed 115200 baud; 0 rows; 0 columns;
lflags: icanon isig iexten echo echoe -echok echoke -echonl echoctl
	-echoprt -altwerase -noflsh -tostop -flusho -pendin -nokerninfo
	-extproc
iflags: -istrip icrnl -inlcr -igncr ixon -ixoff ixany imaxbel -ignbrk
	brkint -inpck -ignpar -parmrk
oflags: opost onlcr -ocrnl tab0 -onocr -onlret
cflags: cread cs8 -parenb -parodd hupcl clocal -cstopb -crtscts -dsrflow
	-dtrflow -mdmbuf rtsdtr
cchars: discard = ^O; dsusp = ^Y; eof = ^D; eol = <undef>;
	eol2 = <undef>; erase = ^?; erase2 = ^H; intr = ^C; kill = ^U;
	lnext = ^V; min = 1; quit = ^\; reprint = ^R; start = ^Q;
	status = ^T; stop = ^S; susp = ^Z; time = 0; werase = ^W;
root@jh06:~ #


And this is where I could use some (more) guidance.

I'd like to keep ttyu0 more or less as-is, so that I can connect to them as
usual (with a USB-to-serial adapter) when I'm physically near the machines.

But I guess the cuau1 settings, which - except for the speed - are
unmodified since OS install,  sort of reflect the fact that these ports do not
have the full "RS232" set of wires.

So just copy/pasting the settings from ttyu0 onto cuau1 might not be the
proper thing to do.

There are a lot of permutations here... :P

Any recommendations?

br
/jon
-- 
YMMV