Both sides previous revisionPrevious revisionNext revision | Previous revision |
en:iot-open:embeddedcommunicationprotocols2:uart [2023/06/25 21:31] – ktokarz | en:iot-open:embeddedcommunicationprotocols2:uart [2024/05/27 11:26] (current) – ktokarz |
---|
==== UART ==== | ====== UART ====== |
| {{:en:iot-open:czapka_b.png?50| General audience classification icon }}{{:en:iot-open:czapka_e.png?50| General audience classification icon }}\\ |
| UART name is an abbreviation of Universal Asynchronous Receiver Transmitter. It is one of the most often used communication methods, traditionally named serial interface or serial port. In contrast to previously presented interfaces, UART uses direct point-to-point communication. |
| UART is the communication unit implemented in microcontrollers rather than the communication protocol. It sends the series of bits via the TxD pin and receives a stream of bits with the RxD pin (figure {{ref>uart1}}). It is important to remember that pin TxD from one device should be connected to pin RxD in another device. This is a general rule, but please always check the documentation for some non-standard markings. |
| |
UART name is an abbreviation of Universal Asynchronous Receiver Transmitter. It is one of the most often used communication methods, traditionally named serial interface or serial port. In opposite to previously presented interfaces, UART uses direct point-to-point communication. | <figure uart1> |
UART is the communication unit implemented in microcontrollers rather than the communication protocol. It sends the series of bits via TxD pin and receives a stream of bits with RxD pin. It is important to remember that pin TxD from one device should be connected to pin RxD in another device. This is a general rule but please always check the documentation for some non-standard markings. | {{ en:iot-open:embeddedcommunicationprotocols2:uart_diagram.png?500 | UART connection}} |
| <caption>UART connection</caption> |
<figure label> | |
{{ en:iot-open:embeddedcommunicationprotocols2:uart_diagram.png?nolink&450 |}} | |
<caption>UART connection.</caption> | |
</figure> | </figure> |
| |
| |
To properly transmit data the speed of transmission, otherwise speaking the duration of bit, must be the same at the transmitter and receiver. Although the speed of transmission can be freely chosen, there are some standard, commonly used baudrates. They differ from 300 to 115200 bits per second. In modern microcontrollers, higher baudrates are also available like 230400, 250000, 500000, 1M 2M or 3Mbps. In UART data is sent in frames. The frame begins with the start bit of value “zero”. Next from five to eight data bits are sent. Next optional parity pit can appear. The frame is finished with the stop bit of value “one”. Stop bit can be prolonged to 1,5 or even 2 times the normal bit duration. After at least one stop bit, the next frame can be sent, of course, beginning with a start bit. | The transmission speed and bit duration must be the same at the transmitter and receiver to properly transmit data. Although the transmission speed can be freely chosen, some standard, commonly used baud rates exist. They differ from 300 to 115200 bits per second. Higher baud rates are also available in modern microcontrollers, like 230400, 250000, 500000, 1M, 2M or 3Mbps. In UART, data is sent in frames. The frame begins with the start bit of value “zero”. Next, from five to eight data bits are transmitted. Next, an optional parity bit can appear. The frame is finished with the stop bit of value “one”. Stop bit can be prolonged to 1.5 or 2 times the standard bit duration. After at least one stop bit, the next frame can be sent, beginning with a start bit. |
Start and stop bits are used to keep the synchronization between the receiver and transmitter. | Start and stop bits are used to synchronise the receiver and transmitter. Sample transmission flow is present in figure {{ref>uart2}}. |
| |
<figure label> | <figure uart2> |
{{ en:iot-open:embeddedcommunicationprotocols2:uart_frame.png?nolink&450 |}} | {{ en:iot-open:embeddedcommunicationprotocols2:uart_frame.png?550 | UART frame}} |
<caption>UART frame.</caption> | <caption>UART frame</caption> |
</figure> | </figure> |
| |
UART, namely Serial Port is used in many modern microcontrollers to upload the executable program, debug, and as the standard input/output for the user interface. For example in Arduino functions that operate on the serial port are included in a standard set of built-in functions. | UART, namely Serial Port, is used in many modern microcontrollers to upload the executable program, debug, and as the standard input/output for the user interface. For example, in Arduino, functions that operate on the serial port are included in a common set of built-in functions. |
<note> | <note> |
Many modern PC computers (except industrial ones) do not have a serial port exposed that's why USB to serial converters must be used. Some development boards have a USB - serial converter on board (e.g. Arduino Uno, NodeMCU, STM Nucleo etc.) | Many modern PC computers (except industrial ones) do not have a serial port exposed, so USB to serial converters must be used. Some development boards have a USB-serial converter on board (e.g. Arduino Uno, NodeMCU, STM Nucleo, etc.) |
</note> | </note> |
<note> | <note> |
Even if a PC computer has a serial port it is usually compatible with the RS-232 standard, which uses the same frame structure but different voltage levels with opposite zero-one encoding). | Even if a PC computer has a serial port, it is usually compatible with the RS-232 standard. It uses the same frame structure but different voltage levels (with opposite zero-one encoding, known as reverse logic). |
</note> | </note> |
| |
| |