How to use UART#
Attention
sm2s-al/sm2s-el may require some of UART interfaces to be enabled in BIOS setup, see corresponding User Manual for SMARC module in question.
minicom
orpicocom
packages should be installed on the target image if terminal access to UART is required.
Available UART interfaces#
You can list available UARTs by using ls
on /dev
$ ls -lah /dev/ttyS*
crw------- 1 root tty 4, 64 Apr 28 17:44 /dev/ttyS0
crw-rw---- 1 root dialout 4, 65 Apr 28 17:42 /dev/ttyS1
crw-rw---- 1 root dialout 4, 66 Apr 28 17:42 /dev/ttyS2
crw-rw---- 1 root dialout 4, 67 Apr 28 17:42 /dev/ttyS3
One of the UARTS might be utilized as a serial console, to check which one you can look at kernel command line:
$ cat /proc/cmdline | grep -Eo 'console=ttyS[^ ]+'
console=ttyS0,115200
Configuration#
You can configure and access UART from command-line using following commands
$ stty -F /dev/ttyS1 115200 cs8 -parenb -cstopb
$ echo Test > /dev/ttyS1
$ cat /dev/ttyS1
Standard baud rates and settings might be found in the table below
Baud rates:
1200
2400
4800
9600
19200
38400
57600
115200
230400
460800
921600
Stop bits:
one (
-cstopb
)two (
cstopb
)
Parity:
none (
-parenb
)even (
parenb -parodd
)odd (
parenb parodd
)
Interactive UART#
You can interact with UART as a terminal using terminal emulation packages like
picocom
or minicom
.
$ picocom -b 115200 /dev/ttyS1
picocom v3.1
port is : /dev/ttyS0
flowcontrol : none
baudrate is : 115200
parity is : none
databits are : 8
stopbits are : 1
escape is : C-a
local echo is : no
noinit is : no
noreset is : no
hangup is : no
nolock is : no
send_cmd is : sz -vv
receive_cmd is : rz -vv -E
imap is :
omap is :
emap is : crcrlf,delbs,
logfile is : none
initstring : none
exit_after is : not set
exit is : no
Type [C-a] [C-h] to see available commands
Terminal ready
*** Picocom commands (all prefixed by [C-a])
*** [C-x] : Exit picocom
*** [C-q] : Exit without reseting serial port
*** [C-b] : Set baudrate
*** [C-u] : Increase baudrate (baud-up)
*** [C-d] : Decrease baudrate (baud-down)
*** [C-i] : Change number of databits
*** [C-j] : Change number of stopbits
*** [C-f] : Change flow-control mode
*** [C-y] : Change parity mode
*** [C-p] : Pulse DTR
*** [C-t] : Toggle DTR
*** [C-g] : Toggle RTS
*** [C-|] : Send break
*** [C-c] : Toggle local echo
*** [C-w] : Write hex
*** [C-s] : Send file
*** [C-r] : Receive file
*** [C-v] : Show port settings
*** [C-h] : Show this message
*** local echo: yes ***
Hello