Asynchronous Serial Communication Peter Szyszko Agenda Serial Basics
Asynchronous Serial Communication Peter Szyszko
Agenda § Serial Basics § Async serial communication data format § Async communication types § RS-232 Essential § FIB 1 -SRLM-SC 002
Async Serial Communication Data Format § § Start bit: Always fill “ 0” Data bit: 5, 6, 7, 8 bit Parity: None, Odd, Even, Space, Mark Stop bit: 1, 1. 5(Data bit =5), 2 bit Start Data Parity Stop 0 5, 6, 7, 8 1 1, 1. 5, 2 § Data Frame Length If N, 8, 1: Data frame length is 10 bits. If E, 7, 2: Data frame length is 11 bits. Unit: bit
Async Communication Types RS-232 RS-422 RS-485 Speed Full-duplex Half-duplex Distance 15 M@9600 bps 1. 2 KM@9600 bps Pins Tx. D, RTS, CTS, DTR, DSR, DCD, GND Tx. A, Tx. B, Rx. A, Rx. B, GND Data. A, Data. B, GND Cable cost High Medium Low Topology Point-to-point Multidrop Software Compatibility High Medium(No H/W flow control) Lowest(Some Need Protocol) Trouble-shooting Easy Hard
RS-232 signal definition Tx. D Transmit Data Rx. D Receive Data RTS Request to Send CTS Clear to Send DTR Data Terminal Ready DSR Data Set Ready DCD Data Carrier Detect GND Ground 5 V 0 V D 0 …… D 7 Parallel UART Stop. Parity Start Data Start Parity Stop Transceiver Stop. Parity Start Data Parity Stop 5 V 0 V TTL Start RS-232 +12 V -12 V Tx Rx +12 V -12 V
RS-232 Connection Type - I § § Example: PC + Null Modem cable + PC RS-232 Signals DTE Signals Tx. D RTS CTS DTR DSR DCD GND § Wiring DTE Signals Tx. D RTS CTS DTR DSR DCD GND Short DCD with DSR to ensure all type of software works. Such as serial console port on rack server.
RS-232 Connection Type - II § Example: PC + Straight cable + Modem § RS-232 Signals DTE Signals Wiring DCE Signals Tx. D Rx. D Tx. D RTS CTS RTS DTR DSR DTR DCD GND § DCD on DCE device is generally an output signal
H/W Flow Control PC 1 RTS CTS Tx Rx * RTS PC 2 RTS CTS Rx Tx stop to transmit data. Advantage 1. Guaranteed no data loss 2. Least software effort 3. Directly suitable for binary & ASCII data. Disadvantage 1. More cabling cost 2. Not applicable to RS-422 or RS-485 software Tips Choose 16 C 550 C above to ensure 100% no data lost by chip level hardware flow control
S/W Flow Control 1. Xon Rx PC 1 Tx PC 2 3. Xoff 2. Start to Send Tx Rx X 4. Stop to send Advantage 1. Low cable cost 2. Suitable for all kind of communications, such as RS-422, RS-485 Disadvanta 1. The result depends on the process speed on both devices. Data loss ge may happen. 2. The result depends on the FIFO size on both devices. 3. Low performance. 4. Not directly suitable for binary data transmission. Tips 1. Make sure the FIFO size is the same for both devices. 2. When data loss happens, try to slow down data transmission frequency.
Flow Control Comparison Types H/W flow control S/W flow control Any Speed Low Speed Suitable Application Response Time Suitable Interface Transmission Character Possibility of Data Loss Faster Slower RS-232/422/485 Any Can’t Use XON/XOFF None Yes Wiring Complex Easy
3 -Wire RS-232 Wiring Site A Signal Site B Signal ================= Tx -------------- Rx Rx -------------- Tx GND ------------- GND Suitable Scenario 1. Low speed data acquisition 2. ASCII terminal connection Feature Require software flow control Advantage 1. Low cabling cost 2. Suitable for low baud rate, few data, and no flow control application Disadvantage 1. Not applicable for modem control 2. Low speed communication
8 -Wire RS-232 Wiring Site A Signal Site B Signal ================= Tx -------------Rx Rx -------------Tx RTS -------------CTS -------------RTS DTR -------------DSR -------------DTR DCD ------------- DCD GND ------------- GND
8 -Wire RS-232 Wiring Suitable Scenario Advantage 1. ASCII/Binary terminal connection 2. Modem control 1. Applicable for all kind of communication 2. Applicable for high speed communication Disadvantage 1. Higher cabling cost Tip If you enable H/W flow control and the RTS, CTS wiring is incorrect, your software will not work.
3 -Wire vs. 8 -Wire 3 -Wire RS-232 Support 8 -Wire RS-232 Data signals + Modem signals Low speed High speed Software Flow Control Hardware Flow Control Software Flow Control Wiring Cost Low High Advantage 1. Low cabling cost 2. Suitable for low baud rate, few data, and no flow control application 1. Applicable for all kind of communication 2. Applicable for high speed communication 1. Higher cabling cost Disadvantage 1. Not applicable for modem control 2. Low speed communication Signals Suitable Environment Data Flow Control
Transmission Distance § Distance -- EIA Standard / Real World Performance Interface property Max. length (standard) Max. Length test result RS-232 15 M @9600 bps RS-422 1. 2 KM @9600 bps 100 M @ 38400 bps 1. 4 KM @ 9600 bps 50 M @ 57600 bps 1. 1 KM @ 38400 bp 20 M @ 115200 bps RS-485 1. 2 KM @9600 bps 1. 4 KM @ 9600 bps 1. 1 KM @ 38400 bp
FIB 1 -SRLM-SC 002
- Slides: 16