WelcomeWelcome | FAQFAQ | DownloadsDownloads | WikiWiki

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

Offline nick65go

  • Hero Member
  • *****
  • Posts: 832
getty: Set up for high-speed serial UART communication
« on: August 14, 2020, 03: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: 11041
Re: getty: Set up for high-speed serial UART communication
« Reply #1 on: August 15, 2020, 02:40:05 AM »
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: 11576
Re: getty: Set up for high-speed serial UART communication
« Reply #2 on: August 15, 2020, 09: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

  • Hero Member
  • *****
  • Posts: 832
Re: getty: Set up for high-speed serial UART communication
« Reply #3 on: August 15, 2020, 12:55:05 PM »
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, 01:11:25 PM by nick65go »

Offline mocore

  • Hero Member
  • *****
  • Posts: 633
  • ~.~
Re: getty: Set up for high-speed serial UART communication
« Reply #4 on: March 22, 2023, 03:13:00 PM »

just ftr , see also 
TC Max Serial Port Baudrate  - https://forum.tinycorelinux.net/index.php?topic=15436.0