# PCIe serial adapter recognised but not functional



## Dismounted (Jan 1, 2019)

Hi all!

You might be wondering why someone would add a serial port in this day in age... but I need it to monitor some other (older) devices.

My PCIe adapter is correctly recognised in FreeBSD 12.0-RELEASE, but it does not seem to be functional. The device /dev/cuau2 is present.

*Relevant output in dmesg:*

```
uart2: <Sunix SER5xxxx Serial Port> port 0xe800-0xe81f,0xe400-0xe41f irq 16 at device 0.0 on pci2
```
*
Output of  sysctl -a | grep 'uart.2':*

```
dev.uart.2.pps_mode: 2
dev.uart.2.%parent: pci2
dev.uart.2.%pnpinfo: vendor=0x1fd4 device=0x1999 subvendor=0x1fd4 subdevice=0x0001 class=0x070004
dev.uart.2.%location: slot=0 function=0 dbsf=pci0:2:0:0
dev.uart.2.%driver: uart
dev.uart.2.%desc: Sunix SER5xxxx Serial Port
```

I've currently got a loopback cable connected to it, and running either `cu -l /dev/cuau2` or `picocom /dev/cuau2` does not produce any loopback output. The normal escape commands do not work within `cu` (~) or `picocom` (C-x) and I have to forcibly kill the processes, so I'm lead to believe that FreeBSD isn't able to open/configure the port?

Additionally, I have tested my cable using a USB-to-serial adapter on the same machine, and this works as expected. I have also tested the PCIe adapter and cable on a different machine running Ubuntu, and it also works correctly there. Hence, I believe I must be missing something in the FreeBSD environment that's causing this.

*Any help/suggestions would be greatly appreciated - thanks in advance!*


----------



## Phishfry (Jan 1, 2019)

The first step here is to determine if the device is being properly recognized by FreeBSD.
https://forums.freebsd.org/threads/pcie-rs232-board-not-detected.56789/
Checkout what `pciconf -lvc` says for the device node.

You also might need to add uart2 hints to /boot/device.hints Also checkout /dev/ttyu* devices.
https://www.freebsd.org/doc/en_US.ISO8859-1/books/handbook/serial.html


----------



## Polyatomic (Jan 2, 2019)

My lord Dismounted, greetings go to you. A glorious serial card you have.


Dismounted said:


> You might be wondering why someone would add a serial port in this day  in  age


If I may, the  device  has  value,  entering  single  user-mode  on a  headless computer is one example I carry.


Dismounted said:


> The normal escape commands do not work within `cu` (~) or `picocom` (C-x) and I have to forcibly kill the processes, so I'm lead
> to believe that FreeBSD isn't able to open/configure the port?


This speciality can take some practice in `/usr/bin/cu`,  however  the behaviour you experience may be a symptom of evil in your computer `:(`.

Marching politely forward, all apologies for not arriving with answers to solve the riddle. Routing even further, if I can source this device I will cordially edit my post here.


----------



## Dismounted (Jan 2, 2019)

Phishfry said:


> The first step here is to determine if the device is being properly recognized by FreeBSD.
> https://forums.freebsd.org/threads/pcie-rs232-board-not-detected.56789/
> Checkout what `pciconf -lvc` says for the device node.


Both /dev/cuau2 and /dev/ttyu2 are created - this device file only appears when I have the PCIe adapter installed, so FreeBSD does properly recognise the adapter as a UART one.

Output of `pciconf -lvc`:

```
uart2@pci0:2:0:0:       class=0x070004 card=0x00011fd4 chip=0x19991fd4 rev=0x00 hdr=0x00
    vendor     = 'SUNIX Co., Ltd.'
    device     = 'Multiport serial controller'
    class      = simple comms
    subclass   = UART
    cap 01[60] = powerspec 3  supports D0 D3  current D0
    cap 05[68] = MSI supports 32 messages, 64 bit, vector masks enabled with 1 message
    cap 10[80] = PCI-Express 2 legacy endpoint max data 128(256) RO NS
                 link x1(x1) speed 2.5(2.5) ASPM disabled(L0s/L1)
    ecap 0001[100] = AER 1 0 fatal 0 non-fatal 1 corrected
```


----------



## Phishfry (Jan 2, 2019)

From the looks of your output device.hints entry should not be needed. The chipset is supported and PCI ID's are included..
I do see a recent problem with another similar card user on FreeNAS:
https://forums.freenas.org/index.php?threads/help-ups.72297/

I just bought a 4 port SIIG serial port PCIe card for serial server usage. So I will let you know what I encounter.

When working on the APU2 I had enabled some extra serial ports for a project. The BIOS basically remuxes some of the GPIO pins to serial ports.
I did have to add them to device.hints in that case. They were not showing up in dmesg. Yours appear to be showing up fine.


----------

