I run a FreeBSD 13.3-RELEASE-p3 box with a consumer mainboard and an Intel Xeon CPU. I want to access this machine on a console using a USB to TIA-232-F adapter cable which I bought together with a PCIe card for this purpose. (So I can take out the GPU again [which I only put in when I lose SSH and have real trouble with the setup] and still access the box directly). I have been fighting with this for a long time now. Occasionally trying and failing, trying to understand the nitty gritty of manually configuring the COM ports on FreeBSD and trying to troubleshoot this fiendish combination of adapter cards, adapter cables, manual configuration, versioning and as spice on top Xen...(I want to ignore [and turned off for the sake of this argument] the latter for now [I'll suffer with enabling Xen console in the future...]).
I have absolutely no issues in connecting a rollover to my firewall, firing up minicom in WSL or PuTTY on Windows or a Linux laptop and accessing a device this way, so I do have some console experience I suppose. So generally speaking I doubt that I would have to look at how to setup the "terminal" side (cable adapter drivers are installed on the Windows box I want to access from, and the chip is recognized, though I do not own other devices with serial ports to test the cable against).
PCI/PCIe (x1) Dual Port Serial Adapter (Controller Product Page)
Serial Controller: Nanjing Qinheng Microelectronics Co. Ltd. CH352/CH382 PCI/PCIe (rev 10)
Out: 2x TIA-232-F (RS232) 9 Pin DSUB Male
Bought in Germany as "SIENOC" brand, very similar models with same chip usually sold by "StarTech" in the US
USB to RS232 Adapter Cable (Controller Product Page)
Serial Controller: Prolific PL2303GC
USB 2.0 to 9 Pin DSUB Female
Bought in Germany as "DTech" brand
I have read the handbook on this topic again and again, and it's rough to say the least. I'll start with some output. It seems the card is recognized well enough, only minor detail being that the PCIe interface where the card is slotted is mentioned as "none":
To be on the safe side I boot with /boot/loader.conf:
uplcom seemingly being the correct driver module to use with the Prolific USB adapter according to uplcom(4)
I have also tried to set bitrate to 115200 in /boot/loader.conf and in /etc/ttys with no difference.
And last but not least:
/etc/ttys
I ended up setting everything to 9600 bps cause dmesg would always contain uart0: console (9600,n,8,1) no matter what, which kinda weirds me out.
I also find it weird how there's only one ttyu running, even though I have two ports? Is this to be expected? Even with boot_multicons?
Note that as mentioned, I have the driver for the adapter installed, and minicom and PuTTY set up on a Windows client that wants to access this machine but get absolutely no input/output on the connection.
Questions I have:
I have absolutely no issues in connecting a rollover to my firewall, firing up minicom in WSL or PuTTY on Windows or a Linux laptop and accessing a device this way, so I do have some console experience I suppose. So generally speaking I doubt that I would have to look at how to setup the "terminal" side (cable adapter drivers are installed on the Windows box I want to access from, and the chip is recognized, though I do not own other devices with serial ports to test the cable against).
PCI/PCIe (x1) Dual Port Serial Adapter (Controller Product Page)
Serial Controller: Nanjing Qinheng Microelectronics Co. Ltd. CH352/CH382 PCI/PCIe (rev 10)
Out: 2x TIA-232-F (RS232) 9 Pin DSUB Male
Bought in Germany as "SIENOC" brand, very similar models with same chip usually sold by "StarTech" in the US
USB to RS232 Adapter Cable (Controller Product Page)
Serial Controller: Prolific PL2303GC
USB 2.0 to 9 Pin DSUB Female
Bought in Germany as "DTech" brand
I have read the handbook on this topic again and again, and it's rough to say the least. I'll start with some output. It seems the card is recognized well enough, only minor detail being that the PCIe interface where the card is slotted is mentioned as "none":
pciconf -lBbcevV none1@pci0:3:0:0
Code:
none1@pci0:3:0:0: class=0x070005 rev=0x10 hdr=0x00 vendor=0x1c00 device=0x3253 subvendor=0x1c00 subdevice=0x3253
vendor = 'Nanjing Qinheng Microelectronics Co., Ltd.'
device = 'CH352/CH382 PCI/PCIe Dual Port Serial Adapter'
class = simple comms
subclass = UART
bar [10] = type I/O Port, range 32, base 0xd000, size 256, enabled
bar [14] = type Prefetchable Memory, range 32, base 0xf0000000, size 32768, enabled
bar [18] = type I/O Port, range 32, base 0xd100, size 4, enabled
cap 01[60] = powerspec 3 supports D0 D3 current D0
cap 05[68] = MSI supports 32 messages, 64 bit, vector masks
cap 10[80] = PCI-Express 2 legacy endpoint max data 128(256) NS
max read 512
link x1(x1) speed 2.5(2.5) ASPM disabled(L0s/L1) ClockPM disabled
ecap 0001[100] = AER 1 0 fatal 0 non-fatal 0 corrected
lspci -vvv -s 03:00.0
Code:
03:00.0 Serial controller: Nanjing Qinheng Microelectronics Co., Ltd. CH352/CH382 PCI/PCIe Dual Port Serial Adapter (rev 10) (prog-if 05 [16850])
Subsystem: Nanjing Qinheng Microelectronics Co., Ltd. CH352/CH382 PCI/PCIe Dual Port Serial Adapter
Control: I/O+ Mem+ BusMaster+ SpecCycle- MemWINV- VGASnoop- ParErr- Stepping- SERR- FastB2B- DisINTx-
Status: Cap+ 66MHz- UDF- FastB2B- ParErr- DEVSEL=fast >TAbort- <TAbort- <MAbort- >SERR- <PERR- INTx-
Latency: 0, Cache Line Size: 64 bytes
Interrupt: pin A routed to IRQ 16
Region 0: I/O ports at d000
Region 1: Memory at f0000000 (32-bit, prefetchable)
Region 2: I/O ports at d100
Expansion ROM at f7d00000 [disabled]
Capabilities: [60] Power Management version 3
Flags: PMEClk- DSI- D1- D2- AuxCurrent=375mA PME(D0+,D1-,D2-,D3hot+,D3cold+)
Status: D0 NoSoftRst- PME-Enable- DSel=0 DScale=0 PME-
Capabilities: [68] MSI: Enable- Count=1/32 Maskable+ 64bit+
Address: 0000000000000000 Data: 0000
Masking: 00000000 Pending: 00000000
Capabilities: [80] Express (v2) Legacy Endpoint, IntMsgNum 0
DevCap: MaxPayload 256 bytes, PhantFunc 0, Latency L0s <2us, L1 <32us
ExtTag- AttnBtn- AttnInd- PwrInd- RBE+ FLReset- TEE-IO-
DevCtl: CorrErr- NonFatalErr- FatalErr- UnsupReq-
RlxdOrd- ExtTag- PhantFunc- AuxPwr- NoSnoop+
MaxPayload 128 bytes, MaxReadReq 512 bytes
DevSta: CorrErr- NonFatalErr- FatalErr- UnsupReq- AuxPwr+ TransPend-
LnkCap: Port #0, Speed 2.5GT/s, Width x1, ASPM L0s L1, Exit Latency L0s unlimited, L1 unlimited
ClockPM+ Surprise- LLActRep- BwNot- ASPMOptComp-
LnkCtl: ASPM Disabled; RCB 64 bytes, LnkDisable- CommClk-
ExtSynch- ClockPM- AutWidDis- BWInt- AutBWInt-
LnkSta: Speed 2.5GT/s, Width x1
TrErr- Train- SlotClk+ DLActive- BWMgmt- ABWMgmt-
DevCap2: Completion Timeout: Not Supported, TimeoutDis+ NROPrPrP- LTR-
10BitTagComp- 10BitTagReq- OBFF Not Supported, ExtFmt- EETLPPrefix-
EmergencyPowerReduction Not Supported, EmergencyPowerReductionInit-
FRS-
AtomicOpsCap: 32bit- 64bit- 128bitCAS-
DevCtl2: Completion Timeout: 50us to 50ms, TimeoutDis-
AtomicOpsCtl: ReqEn-
IDOReq- IDOCompl- LTR- EmergencyPowerReductionReq-
10BitTagReq- OBFF Disabled, EETLPPrefixBlk-
LnkCtl2: Target Link Speed: 2.5GT/s, EnterCompliance- SpeedDis-
Transmit Margin: Normal Operating Range, EnterModifiedCompliance- ComplianceSOS-
Compliance Preset/De-emphasis: -6dB de-emphasis, 0dB preshoot
LnkSta2: Current De-emphasis Level: -6dB, EqualizationComplete- EqualizationPhase1-
EqualizationPhase2- EqualizationPhase3- LinkEqualizationRequest-
Retimer- 2Retimers- CrosslinkRes: unsupported
Capabilities: [100 v1] Advanced Error Reporting
UESta: DLP- SDES- TLP- FCP- CmpltTO- CmpltAbrt- UnxCmplt- RxOF- MalfTLP- ECRC- UnsupReq- ACSViol-
UEMsk: DLP- SDES- TLP- FCP- CmpltTO- CmpltAbrt- UnxCmplt- RxOF- MalfTLP- ECRC- UnsupReq- ACSViol-
UESvrt: DLP+ SDES- TLP- FCP+ CmpltTO- CmpltAbrt- UnxCmplt- RxOF+ MalfTLP+ ECRC- UnsupReq- ACSViol-
CESta: RxErr- BadTLP- BadDLLP- Rollover- Timeout- AdvNonFatalErr-
CEMsk: RxErr- BadTLP- BadDLLP- Rollover- Timeout- AdvNonFatalErr+
AERCap: First Error Pointer: 00, ECRCGenCap+ ECRCGenEn- ECRCChkCap+ ECRCChkEn-
MultHdrRecCap- MultHdrRecEn- TLPPfxPres- HdrLogCap-
HeaderLog: 00000000 00000000 00000000 00000000
To be on the safe side I boot with /boot/loader.conf:
Code:
boot_serial="YES"
boot_multicons="YES"
console="comconsole,vidconsole"
console_speed="9600"
uplcom_load="YES"
I have also tried to set bitrate to 115200 in /boot/loader.conf and in /etc/ttys with no difference.
grep uart /var/run/dmesg.boot
Code:
uart0: <16550 or compatible> port 0x3f8-0x3ff irq 4 flags 0x10 on acpi0
uart0: console (9600,n,8,1)
pgrep -afl ttyu
Code:
2901 /usr/libexec/getty std.9600 ttyu0
stty -a -f /dev/ttyu0
Code:
speed 9600 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 -iutf8
oflags: -opost onlcr -ocrnl tab3 -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;
And last but not least:
/etc/ttys
Code:
console none unknown off secure
#
ttyv0 "/usr/libexec/getty Pc" xterm onifexists secure
# Virtual terminals
ttyv1 "/usr/libexec/getty Pc" xterm onifexists secure
ttyv2 "/usr/libexec/getty Pc" xterm onifexists secure
ttyv3 "/usr/libexec/getty Pc" xterm onifexists secure
ttyv4 "/usr/libexec/getty Pc" xterm onifexists secure
ttyv5 "/usr/libexec/getty Pc" xterm onifexists secure
ttyv6 "/usr/libexec/getty Pc" xterm onifexists secure
ttyv7 "/usr/libexec/getty Pc" xterm onifexists secure
ttyv8 "/usr/local/bin/xdm -nodaemon" xterm off secure
# Serial terminals
# The 'dialup' keyword identifies dialin lines to login, fingerd etc.
ttyu0 "/usr/libexec/getty std.9600" xterm on secure
ttyu1 "/usr/libexec/getty std.9600" xterm on secure
ttyu2 "/usr/libexec/getty std.115200" dialup onifexists secure
ttyu3 "/usr/libexec/getty std.115200" dialup onifexists secure
# Dumb console
dcons "/usr/libexec/getty std.9600" vt100 off secure
# Xen Virtual console
xc0 "/usr/libexec/getty Pc" xterm onifexists secure
I ended up setting everything to 9600 bps cause dmesg would always contain uart0: console (9600,n,8,1) no matter what, which kinda weirds me out.
I also find it weird how there's only one ttyu running, even though I have two ports? Is this to be expected? Even with boot_multicons?
Note that as mentioned, I have the driver for the adapter installed, and minicom and PuTTY set up on a Windows client that wants to access this machine but get absolutely no input/output on the connection.
Questions I have:
- On consumer devices it seems that COM ports usually get virtually mapped to some sort of USB adapter device/cable, do I expect my two hardware serial ports from this PCIe card to always show up whether a cable is connected or not?
- FreeBSD predefines 4 COM ports, 0 through 3. I have 2 serial interfaces but only one COM ttyu shows. Why? If anything I'd at least expect ttyu0 and ttyu1
- Does this look more like a driver issue to you, or like it might be misconfiguration (e.g. manually having to mess with device.hints or similar)?
- How do I further troubleshoot the connection to hopefully exclude either of the adapter, cable and configuration?