Understanding Serial Interfaces: COM, UART, USB, and More

Electronic products, such as computers, mice, chargers, and even cars, have many interfaces around us. This article will introduce you to these interfaces, what they look like, where they are used, how to use them, and their principles. This article serves as a simple description for beginners.

  • 1. Serial Port

  • 2. UART

  • 3. TTL Level

  • 4. USB

  • 5. RS-232

  • 6. RS-485

  • 7. IIC

  • 8. SPI

  • 9. CAN

  • 10. 1-WIRE

1. Serial Port

1. Overview of Serial Port

  The serial interface, commonly known as the serial port, is also called the serial communication interface and is generally referred to as the COM port. It is a generic term for interfaces that use serial communication, and it is a hardware interface.

2. Male and Female Connectors

  There are male and female connectors. You can remember that the one with holes on the left is the female connector, and the other one is the male connector.

Understanding Serial Interfaces: COM, UART, USB, and More
Male and Female Connectors

3. Serial vs. Parallel

Serial: Communication method where one bit of data is transmitted at a time over a computer bus or other data channel.

  Parallel: Communication method that transmits several bits of data simultaneously over a serial port, making parallel communication faster than serial.

Understanding Serial Interfaces: COM, UART, USB, and More
Serial and Parallel

2. UART

 UART stands for Universal Asynchronous Receiver/Transmitter, which means a universal asynchronous transceiver. UART includes TTL level serial ports and RS-232 level serial ports, and both devices communicating using UART must comply with the UART protocol.

3. TTL Level

1. Overview of TTL

 TTL stands for Transistor-Transistor Logic, which is a type of level logic based on transistor-transistor logic.

2. Standard TTL Level Logic

  Logic 1 represents high level, connected to power VCC, while logic 0 represents low level, connected to ground.

  • Logic 1, high level, VCC (3.3V/5V)
  • Logic 0, low level, GND (0V)

  TTL has a voltage range, divided into output high, low levels and input high, low levels. Output high level is represented, and output low level is represented; input high level is represented, and input low level is represented.

  For TTL level devices, when the input voltage is above 2V, it is recognized as logic 1, and when the input low level is below 1.2V, it is recognized as 0. This is why the output high level is 2.4V, above 2V; and the output low level is 0.8V, below 1.2V. Below is the standard TTL level, with various types of TTL differing in voltage.

  • ,
  • ,

3. USB to TTL

  Those who have worked with 51 microcontrollers have used the CH340G module to download HEX files. This module’s function is to convert USB to TTL level, as microcontrollers generally use TTL level. The internal chip of the module is CH340T, recommended by ST.

Understanding Serial Interfaces: COM, UART, USB, and More
<span>USB to TTL Module</span>

  Using the CH340T chip, the circuit schematic for USB to TTL level.

Understanding Serial Interfaces: COM, UART, USB, and More
<span>USB</span><span>to</span><span>TTL</span><span>Schematic</span>

4. Connecting to Microcontroller

 For communication between TTL level devices, only three signal lines are needed: TXD, RXD, and GND. The connection to the microcontroller is straightforward; a 3.3V microcontroller connects to 3.3V, and a 5V microcontroller connects to 5V. If the microcontroller has separate power supply, neither 3.3V nor 5V should be connected.Understanding Serial Interfaces: COM, UART, USB, and More

<span>USB to TTL Module Connection to Microcontroller</span>

4. USB

1. Overview of USB

  USB stands for Universal Serial Bus, which is an external bus standard used to regulate the connection and communication between computers and external devices. It is an interface technology applied in the PC field, characterized by fast transmission speeds, hot-swapping support, and the ability to connect multiple devices.

  USB can be seen in many places, such as mice, keyboards, and phone chargers. Almost all electronic charging devices now have USB interfaces, as shown below with various USB physical interfaces.

Understanding Serial Interfaces: COM, UART, USB, and More
<span>USB</span><span>Interface Classification</span>

2. USB Rates

  • 1MB/s=8Mbps (1 Byte equals 8 bits)

  • USB1.0 Low Speed transmission rate is 1.5Mbps;

  • USB1.1 Full Speed transmission rate is 12Mbps;

  • USB2.0 High Speed transmission rate is 480Mbps;

  • USB3.0 SuperSpeed transmission rate is 5Gbps;

  • USB3.1 Gen2 SuperSpeed+ transmission rate is 10Gbps;

3. USB Interface Definition

  The most common Type-A USB interface definition is as follows.

Pin# Name Color
1 VBUS/+5V Red
2 D-/Data-/DM White
3 D+/Data+/DP Green
4 GND Black
Understanding Serial Interfaces: COM, UART, USB, and More
<span>Type-A</span><span>Interface</span>

5. RS-232

1. Overview of RS-232

 The RS-232 interface complies with the serial data communication interface standard set by the Electronic Industries Alliance (EIA) in the United States. Its original number is EIA-RS-232 (abbreviated as 232, RS232). It is widely used for connecting computer serial interface peripherals, connecting cables, and mechanical and electrical characteristics, signal functions, and transmission processes.

2. RS-232 Level Logic

  RS-232 differs from TTL level logic in that it uses negative logic, where -12V represents high level logic 1, and +12V represents low level logic 0, with voltage also having a standard range.

  • High level, logic 1, -15V to -3V
  • Low level, logic 0, +3V to +15

  In addition to TTL and RS232, a common CMOS level standard also exists, with the following voltage ranges:

  • ,
  • ,

3. DB9 Interface Definition

 The following diagram shows the definition of DB9 male and female connectors. The most commonly used signals are RXD, TXD, and GND.

Understanding Serial Interfaces: COM, UART, USB, and More
<span>DB9</span><span>Male and Female Connector Signal Definitions</span>

  In industrial settings, DB-25 RS232 is also used, and DB9 and DB25 interfaces can be converted.

Understanding Serial Interfaces: COM, UART, USB, and More
<span>DB9</span><span>to</span><span>DB25</span>

4. USB to RS-232

  USB to 232 can first convert USB to TTL, then convert TTL to RS232. Of course, there are many USB to RS232 cables on the market that integrate conversion circuits. For example, some USB to RS232 cables use FT232 and SP213 chips.

Understanding Serial Interfaces: COM, UART, USB, and More
<span>USB</span><span>to</span><span>RS232</span><span>Cable</span>

5. TTL and RS-232 Conversion

  Microcontroller interfaces are generally TTL level. If connecting to a 232 level peripheral, a TTL to RS232 module is needed, and the conversion direction is bidirectional.

  The most commonly used chips for converting TTL and RS232 levels are MAX232 and SP3232.

Understanding Serial Interfaces: COM, UART, USB, and More
<span>TTL and RS-232 Conversion Module</span>

6. RS-485

1. Overview of RS-485

  RS-485, like RS-232, is a serial communication standard. The current standard name is TIA/EIA-485-A, commonly referred to as the RS-485 standard. RS-485 compensates for the shortcomings of RS-232 in short communication distances and low speeds.

  RS-485 uses differential transmission, unlike RS-232’s single-ended transmission, using a pair of twisted wires, one defined as A and the other as B.

2. RS-485 Level Logic

  RS-485 is differential transmission, and typically a transceiver consists of a transmitter and a receiver. The following diagram shows a typical functional block diagram of a transceiver.

  For enable signals, the letter with a line above indicates low level active, while without a line indicates high level active.

Understanding Serial Interfaces: COM, UART, USB, and More<span> RS-485 Internal Structure</span>

For the transmitter, the truth table is as follows:

  • When the driver enable pin is high, the differential output follows the logic state at the data input. A high at the data input causes A to go high and B to go low. In this case, the defined differential output voltage is positive. When low, the output state reverses, becoming high, low, and negative.
  • When low, both outputs become high impedance. In this case, the logic state at the data input is irrelevant.
Understanding Serial Interfaces: COM, UART, USB, and More
<span>RS-485 Transmitter Truth Table</span>

  For the receiver, the truth table is as follows:

  • When the receiver enable pin is low, the receiver is activated. When the differential input voltage is positive and above the positive input threshold, the receiver output goes high. When it is negative and below the negative input threshold, the receiver output goes low. If it is between the two, the output is uncertain.
  • When high or floating, the receiver output is high impedance, irrespective of the magnitude and polarity.
Understanding Serial Interfaces: COM, UART, USB, and More
<span>RS-485 Receiver Truth Table</span>

RS-485 Level Logic Explanation

  Many transceivers meet or exceed the TIA/EIA-485A specifications, and in practical use, the SPEC parameters of the device are paramount.

Understanding Serial Interfaces: COM, UART, USB, and More

3. TTL and RS-485 Conversion

 Converting TTL to RS-485 is common, and there are many transceiver chips available on the market, such as MAX485, which are easy to use. Generally, the left side connects to the MCU’s GPIO for control.

Understanding Serial Interfaces: COM, UART, USB, and More
<span>TTL to RS-485</span>

4. RS-232 and RS-485 Conversion

  Conversion between RS-232 and RS-485 is possible. One method is to convert RS-232 to TTL, and then TTL to RS-485. There are also chips that support direct conversion from RS-232 to RS-485, allowing for bidirectional conversion.

Understanding Serial Interfaces: COM, UART, USB, and More
<span>RS-232 and RS-485 Conversion Module</span>

7. IIC

1. Overview of IIC

  The IIC bus is a simple, bidirectional, two-wire synchronous serial bus developed by Philips. IIC only requires two wires for communication: SDA (Serial Data Line) and SCL (Serial Clock Line).

  The following diagram shows a typical structure of the I2C bus, which can have a single master with multiple slaves or a single master with a single slave at the same time. Any device on the I2C bus can act as a master, with the MCU generally serving as the master. When there are multiple masters, one is selected through bus arbitration, and the others act as slaves.

Understanding Serial Interfaces: COM, UART, USB, and More
<span>IIC Bus Architecture</span>

2. IIC Rates

  • Standard Mode: 100Kbit/s
  • Fast Mode: 400Kbit/s
  • High-Speed Mode: 3.4Mbit/s

8. SPI

1. Overview of SPI

  SPI stands for Serial Peripheral Interface, which is a high-speed, full-duplex, synchronous communication bus. SPI’s rate is higher than I2C, generally reaching tens of Mbps, with different rates for different devices acting as master or slave.

2. SPI Signal Lines

  • MISO – Master Input Slave Output, data input from the master, data output from the slave;
  • MOSI – Master Output Slave Input, data output from the master, data input from the slave;
  • SCLK – Serial Clock, clock signal generated by the master;
  • CS – Chip Select, slave enable signal controlled by the master;

3. Typical Applications of SPI

  The most typical application of SPI is a single master with a single slave. The following diagram shows the wiring method, although multiple slaves can also be used.

Understanding Serial Interfaces: COM, UART, USB, and More
<span>SPI Single Master Single Slave Connection Method</span>

9. CAN

1. Overview of CAN

 CAN stands for Controller Area Network, which is a serial communication network that effectively supports distributed control or real-time control. It is now the standard protocol for automotive networks.

2. CAN Level Logic

Level Logic Bus Value
Dominant Level 0 CAN_H=3.5V, CAN_L=1.5V
Recessive Level 1 CAN_H=2.5V, CAN_L=2.5V

10. 1-WIRE

1. Overview of 1-WIRE

  The 1-WIRE bus is a peripheral serial expansion bus technology introduced by DALLAS, which differs from SPI and I2C in that it uses a single signal line to transmit both clock and data, and the data transmission is bidirectional.

2. Typical Block Diagram of 1-WIRE

  The following is a typical block diagram of 1-WIRE, showing that there is only one wire between the microprocessor and the 1-WIRE device.

  • When the MCU sends logic 1, the inverter causes the bus to present logic 0, and logic 0, after passing through the inverter of the 1-WIRE device, will receive logic 1;

  • When the MCU sends logic 0, the inverter causes the bus to present logic 1, and logic 1, after passing through the inverter of the 1-WIRE device, will receive logic 0;

  • Similarly, when the 1-WIRE device sends logic 1, the NMOS at Tx will turn on, causing the bus to present logic 0, and after passing through the MCU Rx inverter, the MCU will receive logic 1;

  • When sending logic 0, the NMOS will be off, causing the bus to present logic 1, and the MCU will receive logic 0;

Understanding Serial Interfaces: COM, UART, USB, and More

<span>1-WIRE</span><span>Structure Diagram</span>

Join the Chip Language Column, We Invite You to Join👇

Understanding Serial Interfaces: COM, UART, USB, and More

Leave a Comment