You are on page 1of 48

Interface Design Serial Communications

Omid Fatemi

1

Typical Interface Design

Connect

Compute

Convey

Cooperate

Sense Reality Touch Reality Connect Transform

Embedded Systems Micros Assembler, C Real-Time Memory Peripherals Timers DMA

PC interfaces HCI

Busses Protocols Standards PCI IEEE488 SCSI USB & FireWire CAN
2

Outline

• Concept of serial communications • Synchronous, Asynchronous • RS-232 standard • Hand shaking • UART and USART chips

• 8250 and 8251 chips
3

What is Serial Communications

4

Serial Communication Types • Asynchronous • Synchronous • Transfer: – Simplex – Half duplex – Full duplex 5 .

Transfer Types 6 .

stop) 7 .Asynchronous Data Framing Idle (high): Mark Low: Space Overhead? (parity. start.

Data Transfer Rate • Baud rate • bps 8 .

28 : mechanical and electrical characteristics – V. magnetic card reader.24 : functional and procedural characteristics • Even used in applications where there is no DCE – e.28 • Specifies the interface between DTE and DCE: – V. connecting computer to printer. • Introduced in 1962 but is still widely used • Stand for Recommended Standard 9 .g.RS-232 Standard • EIA 232 = ITU-T V. robot. … etc.24/V.

modem 10 . computer.Vocabulary • DTE – data terminal equipment – e.g. terminal • DCE – data communication equipment – connects DTE to communication lines – e.g.

DTE Connections 11 .

Mechanical Characteristics • 25-pin connector – 9-pin connector is more commonly found in IBM-PC but it covers signals for asynchronous serial communication only • Use male connector on DTE and female connector on DCE • Note: all signal names are viewed from DTE 12 .

Bishop & Read. Data Communications for Engineers.25-Pin RS232 Connector Source: Duck. Addison-Wesley 13 .

9-Pin RS232 Connector 14 .

Electrical Characteristics • Single-ended – one wire per signal. voltage levels are with respect to system common (i. at 20kbps 15 . Active State (ON) • Usually swing between –12V to +12V • Recommended maximum cable length is 15m. signal ground) • Mark: –3V to –15V – represent Logic 1. Idle State (OFF) • Space: +3 to +15V – represent Logic 0.e.

TTL to RS-232 Line drivers and line receivers 16 .

RS-232 Frame Format Example Start bit 0 b0 b1 … bn p s1 s 2 Parity Stop bit ASCII 111101000001111 Idle A 17 .

RS232 Logic Waveform 18 .

Function of Signals • TD: transmitted data • RD: received data • DSR: data set ready – indicate whether DCE is powered on • DTR: data terminal ready – indicate whether DTR is powered on – turning off DTR causes modem to hang up the line • RI: ring indicator – ON when modem detects phone call 19 .

Function of Signals • DCD: data carrier detect – ON when two modems have negotiated successfully and the carrier signal is established on the phone line • RTS: request to send – ON when DTE wants to send data – Used to turn on and off modem’s carrier signal in multi-point (i.e. multi-drop) lines – Normally constantly ON in point-to-point lines • CTS: clear to send – ON when DCE is ready to receive data • SG: signal ground 20 .

g. in order to benefit from modem’s data compression protocol) » without flow control.6kbps.2kbps and line speed = 33. terminal speed = 115.Flow Control • Means to ask the transmitter to stop/resume sending in data • Required when: – DTE to DCE speed > DCE to DCE speed (e. the buffer within modem will overflow – sooner or later – the receiving end takes time to process the data and thus cannot be always ready to receive 21 .

because terminal speed > link speed 22 . it activates CTS – normally used between computer and modem » computer is always ready to receive data but modem is not.Hardware Flow Control • RTS/CTS – the transmitting end activates RTS to inform the receiving end that it has data to send – if the receiving end is ready to receive.

Xoff is sent to the transmitting end to ask it to stop – when data have been processed by the receiving end and the buffer has space again. a graphics file) contains a byte equal to 13H (Xoff) 23 . Xon is sent to the transmitting end to notify it to resume – advantage: only three wires are required (TD. RD and GND) – disadvantage: confusion arises when the transmitted data (e.Software Flow Control • Xon/Xoff – when the buffer within the receiving end is nearly full.g.

RS-232 (con) • Communication between two nodes Software Handshaking data transmission Hardware Handshaking Are you ready to RTS receive? CTS RTS transmitter receiver transmitter x-off x-on CTS No RTS receiver CTS Yes Send character TD data transmission RD 24 .

doing flow control) 25 .Null Modem Cables • Used to directly connect two DTEs together • Many possibilities – depending on whether and how the two DTEs handshake (i.e.

Cambridge University Press 26 . The Art of Electronics.Null Modem Cables Examples Source: Horowitz and Hill.

Other Standards 27 .

8250/16450/16550 UART 28 .

UART in PC 29 .

Registers • Transmitter holding register • Receiver buffer register • Interrupt enable register 30 .

Registers • Interrupt identification register 31 .

Line Control 32 .

Modem Registers 33 .

Line Status 34 .

Divisor Register 35 .

Example 36 .

Example 2 37 .

Synchronous Protocols 38 .

CRC In SDLC: G(X) = x**16 + x**12 + x**5 + 1 39 .

8251 Block Diagram 40 .

8251 Registers 41 .

Mode Register 42 .

Mode Instruction (Asynchronous) 43 .

Mode Instruction (Synchronous) 44 .

Command Register 45 .

Status Register 46 .

8251 Timing 47 .

Summary 48 .