Follow+Star Public Account, don’t miss out on exciting content

Author | strongerHuang WeChat Official Account | strongerHuang
A few days ago, I saw a discussion in my technical group about the issue of “TTL, RS232, and RS485 transmission distances”.
Today I took some time to share related content.
Overview
Many readers might not know what TTL, RS232, and RS485 actually are, so this section will briefly outline what they are.1. TTL LevelTTL: Transistor-Transistor Logic. For example, 0V represents a logic low level, while 5V represents a logic high level. The logic high level output from the STM32 microcontroller’s serial port pin is 3.3V.You might ask: What is a logic level?
Logic level is a specific voltage or state that a signal can exist, typically represented as “0/1” or “on/off” or “ON/OFF” or “LOW/HIGH”, etc.

With the rapid development of electronic technology, the voltage of logic high levels is also getting lower; for example, the supply voltage for DDR5 memory is only 1.1V.
For more information related to this chapter, you can refer to an article I previously shared: The World of Logic Levels 0 and 1.
2. RS232RS232, also known as 232, stands for EIA-RS-232.EIA: Electronic Industry Association, USA.RS: Recommended Standard.232: Represents the identification number.RS232 has multiple versions such as RS232A, RS232B, RS232C···F, etc., and currently, the commonly used version is RS-232C.RS232 was originally used for modems, thus its pin definitions are related to modem transmission.In the early days, a 25-pin connector (DB25) was commonly used, which was prevalent in early printers and fax machines, but is rarely used now.Many people might not have seen it; when I was in university, I used this DB25 interface to download programs for the MSP430.

Now it’s usually DB9, which everyone is familiar with, but we mostly only use pins 2, 3, and 5.
| Number | Definition | Function |
|---|---|---|
| 1 | DCD | Data Carrier Detect |
| 2 | RXD | Data Receive |
| 3 | TXD | Data Transmit |
| 4 | DTR | Data Terminal Ready |
| 5 | GND | Signal Ground |
| 6 | DSR | Data Set Ready |
| 7 | RTS | Request to Send |
| 8 | CTS | Clear to Send |
| 9 | RI | Ring Indicator |
DB9 is still retained on many computer rear panels; even if it is not on the back panel, the motherboard still has a DB9 interface. (Recently, when I built a computer, I specifically bought an external DB9 interface)

3. RS485RS485 can be said to have developed based on RS232, aimed at increasing anti-interference capability and signal transmission distance.RS232 uses voltage to represent logic levels, such as ±15 volts.RS485 uses differential voltage, which means the voltage difference between two signal lines (A, B) represents logic high and low levels.RS232 supports full-duplex communication, while RS485 is half-duplex communication.

Transmission Distance
In university, teachers might tell you that the transmission distance for RS232 is 15 meters.Or, you might see in some books that RS485 has a transmission distance of 1200 meters.The actual communication transmission distance is related to many factors, and there is a significant difference between theoretical and practical distances; in certain cases, even 500 meters of RS485 transmission might have issues.The communication transmission distance is influenced by many factors such as communication method, baud rate, connection cable, interference, etc.Here, I will briefly discuss these issues in the context of serial (UART) communication.1. Communication MethodThe communication methods referred to here are the different communication methods such as “TTL, RS232, 485” mentioned in the title.Under normal circumstances, the communication distances are: TTL < RS232 < 485.TTL is usually used within a board (on the same board), for example, communication between chip A’s serial port and chip B’s serial port.RS232 can still be used in many scenarios, typically for communication between devices, usually connected via DB9 or two signal wires.(In a previous project I participated in, I expanded 8 serial ports from a computer PCI card using the 232 method.)RS485 is more commonly used in industrial products, allowing multiple devices to be connected on a 485 bus, with longer transmission distances and stronger anti-interference capabilities.2. Baud RateBaud rate, 1 baud refers to the transmission of 1 symbol per second. Baud (unit symbol: Bd) can be understood as the speed of signal transmission, for example, serial port 9600bps.The higher the baud rate, the higher the frequency, and under the same conditions, the shorter the transmission distance.The baud rate of the serial port can be very high, for example, 115200bps, but transmitting at this baud rate through RS232 may encounter issues after 10 meters.3. Connection CableThe connection cable is also a key factor; the material of the cable (copper, aluminum, iron), thickness, and whether it is shielded will all affect the transmission signal distance.In a clean environment (like a laboratory or office), the differences might not be noticeable, but in complex environments (like factories, especially in environments with many large machinery), the differences can be felt.Thus, RS485 uses differential signals and twisted pairs, and better cables with shielding will have advantages in industrial environments.4. Interference FactorsThose who have worked on industrial products know that not only are the EMC requirements high, but the communication requirements are also high.If a large piece of equipment starts up suddenly nearby, it could very likely cause your communication to fail (or the chip to reset, crash, etc.).You might think RS485 can transmit 1200 meters, but in a factory, even 200 meters of communication might fail.In summary, to increase transmission distance while ensuring the stability of the transmission signal, one usually needs to stay as far away from interference sources (large machinery), increase shielding measures, and lower transmission rates (baud rates).
———— END ————

● Column “Embedded Tools”
● Column “Embedded Development”
● Column “Keil Tutorial”
● Selected Tutorials from the Embedded Column
Follow the public account and reply “Join Group” to join the technical group according to the rules, reply “1024” to see more content.


Click “Read Original” to see more shares.