uart - bunnyamin/bunnix GitHub Wiki

UART

  • Screen - Full-screen window manager that multiplexes a physical terminal

Physical connection

Print information on available serial ports:

  • dmesg | grep tty output example usb 1-6: cp210x converter now attached to ttyUSB0

Information about the device, such as its maximum baud rate:

  • stty < /dev/ttyUSB0

Information about loaded modules, for example is cp210x loaded?

  • lsmod

Logical connection

Configuration Value
Baud rate 1500000
Data bit 8
Parity check None
Stop bit 1
Flow control None

The program stty can be used to determine the arguments for configuring the TTY-device.

  • stty --help
Option Explanation
baud_rate The baud rate.
csN Set character size to N bits where N in <5..8>.
[-]parenb Generate parity bit in output and expect parity bit in input.
[-]cstopb Two stop bits per character (one with '-').
[-]crtscts Enable RTS/CTS handshaking (hardware flow control).

The program can also be used to configure the device. For example,

  • stty -F /dev/ttyUSB0 cs8 -parenb -cstopb -crtscts

Alternatively, configure the device on connection:

  • # screen -fnL /dev/ttyUSB0 1500000,cs8,-parenb,-cstopb,-crtscts
  • -fn turns flow-control off
  • -L -LogFile <filename> log output to the same directory in which screen was executed.
    • Or log in prompt with Ctrl+A, : then hardcopy -h <file>
  • Ctrl+A then k to kill the process.
  • Ctrl+A then i for information about connection.

In a separate terminal, confirm that the connection is configured as intended:

  • stty -F /dev/ttyUSB0 -a
  • The -a for human readable output, use -g for TTY form.
⚠️ **GitHub.com Fallback** ⚠️