WelcomeWelcome | FAQFAQ | DownloadsDownloads | WikiWiki

Author Topic: getty: Set up for high-speed serial UART communication  (Read 432 times)

Offline nick65go

  • Sr. Member
  • ****
  • Posts: 383
getty: Set up for high-speed serial UART communication
« on: August 14, 2020, 12:26:04 PM »
getty: Set up for high-speed serial UART communication
The limiting factor on the UART speed is that UART Clock. It only allows baudrates of UART_CLK/16
Code: [Select]
tc@box:~$ sudo cat /sys/class/tty/tty1/subsystem/ttyS0/uartclk
1843200
tc@box:~$ calc 1843200/16
115200
tc@box:~$ sudo stty -F /dev/tty `calc 38400*3`
tc@box:~$ stty | grep speed
speed 115200 baud; line = 0;
tc@box:~$ sudo stty -F /dev/tty `calc 38400*30`
tc@box:~$ stty | grep speed
speed 1152000 baud; line = 0;

Code: [Select]
tc@box:~$ cat /sbin/autologin
#!/bin/busybox sh
. /etc/init.d/tc-functions
useBusybox

if [ -f /var/log/autologin ] ; then
    exec /sbin/getty 1152000 tty1
else
    touch /var/log/autologin
    exec login -f root
fi

Code: [Select]
# /etc/inittab: init configuration for busybox init.
# Boot-time system configuration/initialization script.
#
::sysinit:/etc/init.d/rcS

# /sbin/getty respawn shell invocations for selected ttys.
# data flow rate as 38.4k 115.2k 230.4k 460.8k. 921.6k 1152000
tty1::respawn:/sbin/getty -nl /sbin/autologin 1152000 tty1
tty2::respawn:/sbin/getty 38400 tty2
Summary: if you like to experiment with TC scripts, here is how I increased the speed 30 times for login.
Of course double of nothing is nothing, so do not expect more than few milliseconds gain, it was just for fun.

Offline curaga

  • Administrator
  • Hero Member
  • *****
  • Posts: 10274
Re: getty: Set up for high-speed serial UART communication
« Reply #1 on: August 14, 2020, 11:40:05 PM »
The speed only affects serial consoles. It's a no-op for linux consoles.
The only barriers that can stop you are the ones you create yourself.

Offline Rich

  • Administrator
  • Hero Member
  • *****
  • Posts: 8149
Re: getty: Set up for high-speed serial UART communication
« Reply #2 on: August 15, 2020, 06:41:19 AM »
Hi nick65go
...
Code: [Select]
# /etc/inittab: init configuration for busybox init.

 ...
# data flow rate as 38.4k 115.2k 230.4k 460.8k. 921.6k 1152000

 ...
...

115.2k is an integer multiple (16) of 1843200. 1152000 is not an integer multiple (1.6) of 1843200. Baud rates need to be an integer
multiple of the clock.

Offline nick65go

  • Sr. Member
  • ****
  • Posts: 383
Re: getty: Set up for high-speed serial UART communication
« Reply #3 on: August 15, 2020, 09:55:05 AM »
i understand. those were the values that allowed me to "see" with grep without errors. So maybe div by 16 is a mistake from where I read this info. samples, try and errors:
Code: [Select]
tc@box:~$ sudo stty -F /dev/tty `calc 115200*9`
stty: invalid argument '1036800'
tc@box:~$ sudo stty -F /dev/tty `calc 115200*10`
tc@box:~$ stty | grep speed
speed 1152000 baud; line = 0;
tc@box:~$

but as curaga observed, is about ttyS# (serial) not tty# (terminal). basically what i did was to test the parameters that I did not understand.
« Last Edit: August 15, 2020, 10:11:25 AM by nick65go »