Kernel 5.0 Serial now seems to be on TTYS0
The latest kernel appears to set the serial port on TTYS0, S4 returns permission denied unless I use sudo.
$ sudo setserial -g /dev/ttyS[01234]
/dev/ttyS0, UART: 16550A, Port: 0x03f8, IRQ: 4
/dev/ttyS1, UART: unknown, Port: 0x02f8, IRQ: 3
/dev/ttyS2, UART: unknown, Port: 0x03e8, IRQ: 4
/dev/ttyS3, UART: unknown, Port: 0x02e8, IRQ: 3
/dev/ttyS4, UART: 16550A, Port: 0x0000, IRQ: 39
I've got a loop back on pin 8,10 and no longer have a working serial port.
Suggestions?
Comments
-
Neither /dev/ttyS0 or /dev/ttyS4 allows serial data
Have added myself to tty group since:
ls -l /dev/ttyS[04]
crw-rw-rw- 1 root dialout 4, 64 Jun 25 11:36 /dev/ttyS0
crw--w---- 1 root tty 4, 68 Jun 25 11:36 /dev/ttyS4Note that even if I chmod 666 /dev/ttyS4 it works for one test (that shows no serial data), then reverts to these permissions and denies access to /dev/ttyS4
Further info: dmesg | egrep -i 'serial|ttys'
[ 2.276992] Serial: 8250/16550 driver, 32 ports, IRQ sharing enabled
[ 2.297537] 00:01: ttyS0 at I/O 0x3f8 (irq = 4, base_baud = 115200) is a 16550A
[ 2.454883] usb usb1: New USB device strings: Mfr=3, Product=2, SerialNumber=1
[ 2.454895] usb usb1: SerialNumber: 0000:00:14.0
[ 2.456452] usb usb2: New USB device strings: Mfr=3, Product=2, SerialNumber=1
[ 2.456462] usb usb2: SerialNumber: 0000:00:14.0
[ 2.815964] usb 2-1: New USB device strings: Mfr=1, Product=2, SerialNumber=3
[ 2.815973] usb 2-1: SerialNumber: 816513020192
[ 3.098224] usb 1-2: New USB device strings: Mfr=0, Product=0, SerialNumber=0
[ 3.379412] usb 1-7: New USB device strings: Mfr=0, Product=0, SerialNumber=0
[ 3.777892] usb 1-7.2: New USB device strings: Mfr=1, Product=2, SerialNumber=3
[ 3.777900] usb 1-7.2: SerialNumber: 1.0
[ 3.959649] usb 1-7.4: New USB device strings: Mfr=0, Product=2, SerialNumber=0
[ 7.167551] 8086228A:00: ttyS4 at MMIO 0xa171b000 (irq = 39, base_baud = 2764800) is a 16550AHow do I configure a working UART on this with the latest Kernel 5.0?
-
I believe this shows the console is still enabled.
dmesg | grep tty
[ 0.223388] printk: console [tty0] enabled
[ 2.287260] 00:01: ttyS0 at I/O 0x3f8 (irq = 4, base_baud = 115200) is a 16550A
[ 2.615205] tty ttyS21: hash matches
[ 7.289724] 8086228A:00: ttyS4 at MMIO 0xa171b000 (irq = 39, base_baud = 2764800) is a 16550AHow do I disable the console if that's correct?
-
sudo systemctl disable getty@ttyS0
(or ttyS4) and then reboot
I am not sure what you are experiencing is due to the presence of a serial terminal.
We are currently investigating the issue with the new kernel -
You were correct, console on/off made little difference. Let me know if there's any further diagnostics I can run to help isolate this.
I'm stuck here until I get serial working.
-
You can try to make a simple loopback test and use minicom to read/write characters
“Serial Port Debugging 101 : Loopback Test” by Amita https://link.medium.com/J27kjJpCO7
-
That's where I began this post, with loopback in place. Minicom on ttyS0 and ttyS4, no characters. Python script to test serial, no characters. Motor controller python script can't communicate on serial (either ttyS0, ttyS4, serial0, or serial1)
-
Still don't have a functioning serial on Up board with Kernel 5.0. uname returns Linux 5.0.0-1-generic x86_64
sudo minicom -D /dev/ttyS0 returns no characters with the loopback wire in place on 8,10 as shown in pic above.
sudo minicom -D /dev/ttyS4 opens an SSH login which appears to be me accessing the console via ttyS4 with minicomthe following python serial test code
import time import threading import serial class Threads(): def __init__(self): self.kill=1 self.ser = serial.Serial( port='/dev/ttyS0', baudrate=9600, timeout=1 ) print(self.ser.name) def SendData(self): counter=0 while self.kill: self.ser.write(str(counter)) self.ser.flush() time.sleep(1) counter +=1 def ReadData(self): counter=0 while 1: try: x=self.ser.readline() if (counter == int(x)): print ('Successful data recieved over Serial') counter +=1 except: print ('No Serial data read, check wiring and setup') self.kill=0 break if counter >= 3: print ('Serial communication verified! \nExiting') self.kill=0 break def main(): mythread = Threads() clientThread = threading.Thread(target=mythread.SendData,args=()) clientThread.start() mythread.ReadData() if __name__ == '__main__': main()
returns
/dev/ttyS0
No Serial data read, check wiring and setupdoes the same on /dev/ttyS4 but only if I run with root permission
-
Thanks for the additional details.
We have opened an issue internally and we will use your additional information to speed up the debugging.
-
Hello @BeningFun
After testing again both UART interfaces on UP we cannot replicate your issue.
Our setup is the following
USB to UART 3V3TTL on host pc with serial terminal
pin connected from the USB to UART adapter on the header are 6 (GND), 8 (UART RX), 10 (UART TX)
on the UP Board we use minicom (sudo minicom) and we set the following:
Press Ctrl+A > O > Serial port setup
A - Serial Device : /dev/ttyS4
B - Lockfile Location : /var/lock
C - Callin Program :
D - Callout Program :
E - Bps/Par/Bits : 115200 8N1
F - Hardware Flow Control : No
G - Software Flow Control : NoAfter that we can see characters when typed in both directions.
Please make sure both host and UP Board serial configuration are the same.
you can do the same using the UART debug port (ttyS0).