2

I try to get an RS485 PCI card working on a computer having Debian Jessie installed (using systemd). I adapted the kernel using a patch provided by the card manufacturer. This seems to work as the card is detected and all eight serial ports are initialised.

The kernel should set the following properties:

.flags       = FL_BASE0,
.base_baud   = 921600,
.uart_offset = 0x200,

When I tried to work with these ports, I always saw the baud rate of 921600. Since then I changed the following: I uninstalled ModemManager (because it was non-stopping probing the serial ports and on this computer there will be never no modem). I added rules to /etc/udev/rules.d/ creating symbolic links and changing user and group of these RS485 ports. I adapted the groups to be able to read from and write to these ports not only as root.

Since then I notice strange behaviour. The baud rate is initialised with 921600 (I look this up using "dmsg"), but whenever I read it out it is set to 9600 (using "stty -F /dev/stty11 -a").

Finally I have the following outputs:

me@my-system:$ sudo udevadm info -a -p $(udevadm info -q path -n /dev/ttyS11)

Udevadm info starts with the device specified by the devpath and then
walks up the chain of parent devices. It prints for every device
found, all possible attributes in the udev rules key format.
A rule to match, can be composed by the attributes of the device
and the attributes from one single parent device.

  looking at device '/devices/pci0000:00/0000:00:1b.2/0000:06:00.0/0000:07:0f.0/tty/ttyS11':
    KERNEL=="ttyS11"
    SUBSYSTEM=="tty"
    DRIVER==""
    ATTR{irq}=="17"
    ATTR{line}=="11"
    ATTR{port}=="0x0"
    ATTR{type}=="21"
    ATTR{flags}=="0x13000040"
    ATTR{iomem_base}=="0xDF100000"
    ATTR{custom_divisor}=="0"
    ATTR{iomem_reg_shift}=="0"
    ATTR{uartclk}=="14745600"
    ATTR{xmit_fifo_size}=="64"
    ATTR{close_delay}=="50"
    ATTR{closing_wait}=="3000"
    ATTR{io_type}=="2"

  looking at parent device '/devices/pci0000:00/0000:00:1b.2/0000:06:00.0/0000:07:0f.0':
    KERNELS=="0000:07:0f.0"
    SUBSYSTEMS=="pci"
    DRIVERS=="serial"
    ATTRS{irq}=="17"
    ATTRS{subsystem_vendor}=="0x0702"
    ATTRS{broken_parity_status}=="0"
    ATTRS{class}=="0x070002"
    ATTRS{driver_override}=="(null)"
    ATTRS{enabled}=="1"
    ATTRS{consistent_dma_mask_bits}=="32"
    ATTRS{dma_mask_bits}=="32"
    ATTRS{local_cpus}=="00000000,00000000,00000000,00000000,00000000,00000000,00000000,00000000,00000000,00000000,00000000,00000000,00000000,00000000,00000000,0000000f"
    ATTRS{device}=="0x90f0"
    ATTRS{msi_bus}==""
    ATTRS{local_cpulist}=="0-3"
    ATTRS{vendor}=="0x1402"
    ATTRS{subsystem_device}=="0x0010"
    ATTRS{numa_node}=="-1"
    ATTRS{d3cold_allowed}=="0"

  looking at parent device '/devices/pci0000:00/0000:00:1b.2/0000:06:00.0':
    KERNELS=="0000:06:00.0"
    SUBSYSTEMS=="pci"
    DRIVERS==""
    ATTRS{irq}=="18"
    ATTRS{subsystem_vendor}=="0x0000"
    ATTRS{broken_parity_status}=="0"
    ATTRS{class}=="0x060401"
    ATTRS{driver_override}=="(null)"
    ATTRS{enabled}=="1"
    ATTRS{consistent_dma_mask_bits}=="32"
    ATTRS{dma_mask_bits}=="32"
    ATTRS{local_cpus}=="00000000,00000000,00000000,00000000,00000000,00000000,00000000,00000000,00000000,00000000,00000000,00000000,00000000,00000000,00000000,0000000f"
    ATTRS{device}=="0x8892"
    ATTRS{msi_bus}=="1"
    ATTRS{local_cpulist}=="0-3"
    ATTRS{vendor}=="0x1283"
    ATTRS{subsystem_device}=="0x0000"
    ATTRS{numa_node}=="-1"
    ATTRS{d3cold_allowed}=="1"

  looking at parent device '/devices/pci0000:00/0000:00:1b.2':
    KERNELS=="0000:00:1b.2"
    SUBSYSTEMS=="pci"
    DRIVERS=="pcieport"
    ATTRS{irq}=="18"
    ATTRS{subsystem_vendor}=="0x8086"
    ATTRS{broken_parity_status}=="0"
    ATTRS{class}=="0x060400"
    ATTRS{driver_override}=="(null)"
    ATTRS{enabled}=="1"
    ATTRS{consistent_dma_mask_bits}=="32"
    ATTRS{dma_mask_bits}=="32"
    ATTRS{local_cpus}=="00000000,00000000,00000000,00000000,00000000,00000000,00000000,00000000,00000000,00000000,00000000,00000000,00000000,00000000,00000000,0000000f"
    ATTRS{device}=="0xa169"
    ATTRS{msi_bus}=="1"
    ATTRS{local_cpulist}=="0-3"
    ATTRS{vendor}=="0x8086"
    ATTRS{subsystem_device}=="0x7270"
    ATTRS{numa_node}=="-1"
    ATTRS{d3cold_allowed}=="0"

  looking at parent device '/devices/pci0000:00':
    KERNELS=="pci0000:00"
    SUBSYSTEMS==""
    DRIVERS==""

Using setserial:

me@my-system:$ sudo setserial -a /dev/ttyS11
/dev/ttyS11, Line 11, UART: undefined, Port: 0x0000, IRQ: 17
    Baud_base: 921600, close_delay: 50, divisor: 0
    closing_wait: 3000
    Flags: spd_normal skip_test

And reading the current setting:

me@my-system:$ sudo stty -F /dev/ttyS11 -a
speed 9600 baud; rows 0; columns 0; line = 0;
intr = ^C; quit = ^\; erase = ^?; kill = ^U; eof = ^D; eol = <undef>; eol2 = <undef>;
swtch = <undef>; start = ^Q; stop = ^S; susp = ^Z; rprnt = ^R; werase = ^W; lnext = ^V;
flush = ^O; min = 1; time = 0;
-parenb -parodd -cmspar cs8 hupcl -cstopb cread clocal -crtscts
-ignbrk -brkint -ignpar -parmrk -inpck -istrip -inlcr -igncr icrnl ixon -ixoff -iuclc
-ixany -imaxbel -iutf8
opost -olcuc -ocrnl onlcr -onocr -onlret -ofill -ofdel nl0 cr0 tab0 bs0 vt0 ff0
isig icanon iexten echo echoe echok -echonl -noflsh -xcase -tostop -echoprt echoctl echoke

Within /proc/tty/driver/ is one file "serial":

serinfo:1.0 driver revision:
...
11: uart:XR17D15X mmio:0xDF100000 irq:17 tx:0 rx:0
12: uart:XR17D15X mmio:0xDF100200 irq:17 tx:0 rx:0
13: uart:XR17D15X mmio:0xDF100400 irq:17 tx:0 rx:0
14: uart:XR17D15X mmio:0xDF100600 irq:17 tx:0 rx:0
15: uart:XR17D15X mmio:0xDF100800 irq:17 tx:0 rx:0
16: uart:XR17D15X mmio:0xDF100A00 irq:17 tx:0 rx:0
17: uart:XR17D15X mmio:0xDF100C00 irq:17 tx:0 rx:0
18: uart:XR17D15X mmio:0xDF100E00 irq:17 tx:0 rx:0

What is wrong here? Why is the baud rate changing? How can I avoid this? Is "UART: undefined" OK?

  • 1
    Ignore the baud rate number reported in the kernel log / dmesg. Dump the contents of files in /proc/tty/driver. – sawdust May 12 '17 at 23:40
  • @sawdust I added the related information of /proc/tty/driver. There is only one file serial contained in this directory. – Schnoof May 15 '17 at 7:19
2

The problem is resolved and it is really stupid. The one who asked me to setup the computer told me that the computer contains an RS485 card, but an RS232 card was ordered and bought. Both cards are merchandised under the same name, using the same manuals and patches. So it was not easy to see. I borrowed the RS485 card of another machine and everything is working fine.

I am very uncomfortable with this but at least it was not my fault.

| improve this answer | |

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.