UART (Universal Asynchronous Receiver-Transmitter) is a simple protocol for exchanging data between two devices. It uses one line for transmitting and one receiving data.
Clock rate & encoding
The clock rate & encoding must be configured beforehand on both devices, as UART does not provide a way to negotiate settings.
There are several ways to encode the data.
The encoding is usually indicated as
<Hz> <data bits><parity><stop bits>
9600 8N1 indicates a clock of 9600Hz with 8 data bits, no parity bit and 1 stop bit.
38400 7E2 indicates a clock of 38400Hz, 7 data bits, 1 even parity bit and 2 stop bits.
The parity bit is used for error detection. It can detect a single bit flip during transmission.
|N||No parity bit|
|E||Even parity bit. 0 if even amount of data bits with value of 1, otherwise 1.|
|O||Odd parity bit. 1 if even amount of data bits with value of 1, otherwise 0.|
By default (idle), the line must be pulled high. When data is about to be transmitted, the line must be pulled low (start). Then the data and parity bits must be sent. Finally, the stop bit(s) must be sent which will pull the line high, completing the transaction.
On Linux, you can use minicom to communicate with a UART-enabled device. It allows you to configure the encoding & data rate and save the settings to a file.
If the device is connected over USB, it will show up as
/dev/ttyUSBX, where X is some integer.