Definition and characteristics of UART
A universal asynchronous receiver/transmitter (UART) shouldn’t be confused with communication protocols like I2C or SPI. As a rule, it's a self-contained IC or a physical circuit in a microcontroller, the main mission of which is serial data transferring and receiving.
A UART (Universal Asynchronous Receiver/Transmitter) is the programmable microchip used to control a computer's interface to its attached serial devices. It allows the computer to communicate and exchange data with serial devices by providing the RS-232C Data Terminal Equipment (DTE) interface. As part of that interface the UART also performs other functions.
- It converts the bytes received in parallel from the computer into a single serial bit stream required for successful outbound transmission.
- On inbound transmission, the serial bit streams received from devices is converted into bytes that the computer understands.
- A parity bit is added to the outgoing transmission and parity bytes are checked and discarded on incoming transmissions if parity and parity checking have been selected.
- Start and stop delineators are added to outbound transmissions and stripped from inbound ones.
- Handles the special interrupts generated from the keyboard and mouse and their dedicated ports.
- Can be used to handle additional interrupts and device management tasks related to the coordination of the speed of the computer and associated devices.
One of the primary advantages of UART is that it utilizes only 2 cables for data transfer between devices. UART communication is quite simple: UART1, after converting parallel data from a controlling device (e.g.: CPU) into a serial format, transfers it to UART2, which in its turn transforms the serial data back into parallel form for the receiving device. Therefore, data streams from the Tx pin of UART1 to the Rx pin of UART2 (see Fig 1). UARTs interact with each other directly, requiring only two wires for data transmission between them.
Data is transferred asynchronously by UARTs, that’s why there won’t be any clock signal for synchronization neither of the output of bits from the transmitting UART nor of the sampling of bits by the receiving UART. As a substitute for a clock signal, the transmitting UART adds start and stop bits to the transferred data packet to designate its beginning and end, thus letting the receiving UART know when it can start reading the bits.
Once the receiving UART spots a start bit, it begins reading incoming bits at a certain frequency, referred to as a baud rate. The baud rate measures data transmission speed in bits per second (bps). UARTs should both work at almost identical baud rate. At least, the difference between baud rates of receiving and transmitting UARTs shouldn't exceed 10 percent before the timing of bits gets too far off.
So, is it possible to share UART data over Ethernet? If yes, how to do it best?
When using UART protocol, you can easily track all the passing streams and save them into a file. However, if you need to work with a remote UART device, located within the Ethernet network coverage area, you can do nothing but utilize additional hardware or software.
Hardware UART to Ethernet Converter
UART TO ETH module, mostly utilized for transparent data transmission, seems to be a simple solution for communicating between UART and Ethernet. It is a serial TTL to Ethernet module that can be customized via web page. For TCP or UDP socket data to serial UART conversion a data transparent transmission appliance (USR-TCP232-T) is used.
Capabilities and characteristics of Ethernet serial module:
- 10/100M auto detect interface;
- Automatic MDI/MDI-X support. Possibility of utilizing parallel cable connection or a crossover cable;
- Different work modes available: UDP Client, UDP Server, TCP Server, TCP Client;
- Possibility to adjust working model settings via a COM port or network;
- Supports 3.3V TTL level (module products);
- Support of virtual COM port;
- Ensures reliable connection due to its exclusive heartbeat package mechanism, eliminating connect feign death;
- No packet broadcasting in UDP mode, has better anti-interference ability; through the gateway/switches/routers;
- Works in LAN/Internet (external network) and so on.
To sum up, the aforementioned converter is an ideal solution for local networks and nearby devices. However, what should you do to access UART over Ethernet being far away, let's say, from some other part of the world? How can you employ UART via network?