1 / 51

Serial Communications

Serial Communications. Introduction to UART and USART Intel 8250 and 8251. Outline. Concept of serial communications Synchronous, Asynchronous RS-232 standard Hand shaking UART and USART chips 8250 and 8251 chips. What is Serial Communication. Serial Communication Types.

brody-ayers
Télécharger la présentation

Serial Communications

An Image/Link below is provided (as is) to download presentation Download Policy: Content on the Website is provided to you AS IS for your information and personal use and may not be sold / licensed / shared on other websites without getting consent from its author. Content is provided to you AS IS for your information and personal use only. Download presentation by click this link. While downloading, if for some reason you are not able to download a presentation, the publisher may have deleted the file from their server. During download, if you can't get a presentation, the file might be deleted by the publisher.

E N D

Presentation Transcript


  1. Serial Communications Introduction to UART and USART Intel 8250 and 8251

  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 Communication

  4. Serial Communication Types • In Terms of Data on a Line • Asynchronous • Synchronous • In Terms of Number of Senders • Simplex • Half duplex • Full duplex

  5. Transfer Types

  6. Asynchronous Data Framing Sending Character ‘A’ = 0x41 on the Line Idle (high): Mark Low: Space Overhead? (parity, start, stop)

  7. Vocabulary • DTE • data terminal equipment • e.g. computer, terminal • DCE • data communication equipment • connects DTE to communication lines • e.g. modem • Data Transfer Rate • Baud Rate Baud (Symbol representing n bits) • BPS Bit per second

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

  9. DTE Connections

  10. 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

  11. 25-Pin RS232 Connector

  12. 9-Pin RS232 Connector

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

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

  15. Example RS-232 Frame Format Start bit ASCII Parity Stop bit 111101000001111 A Idle

  16. RS232 Logic Waveform

  17. 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

  18. 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

  19. Flow Control • Means to ask the transmitter to stop/resume sending in data • Required when: • DTE to DCE speed > DCE to DCE speed (e.g. terminal speed = 115.2kbps and line speed = 33.6kbps, in order to benefit from modem’s data compression protocol) • without flow control, 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

  20. 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, it activates CTS • normally used between computer and modem • computer is always ready to receive data but modem is not, because terminal speed > link speed

  21. Software Flow Control • Xon/Xoff • when the buffer within the receiving end is nearly full, 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, 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.g. a graphics file) contains a byte equal to 13H (Xoff)

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

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

  24. Null Modem Cables Examples

  25. Other Standards

  26. UART in PC 115200*16=1843200

  27. 8250/16450/16550 UART

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

  29. Registers • Interrupt identification register

  30. Line Control

  31. Modem Registers Modem Control Register Modem Status Register

  32. Line Status

  33. Divisor Register

  34. Example Program the divisor Latch for 300 baud. Assume Xin=1.8432MHz The Base Address: 0x3F8

  35. Example 2 Program the divisor Latch for 2400 baud. Assume Xin=1.8432MHz The Base Address: 0x3F8

  36. Example 3 Program 8250 for 2400 baud, 8 data bit, even parity and 1 stop bit. Assume Xin=1.8432MHz The Base Address: 0x3F8 MOV AL,80H ; Accessing DLAB MOV DX,3FBH ;Line Control Register Address OUT DX,AL MOV AX,48 ;baud=2400 115200:48=2400 MOV DX,3F8H ;Low byte of Divisor OUT DX,AL MOV AL,AH INC DX OUT DX,AL MOV AL,00011011 ; DLAB,Break,Even,1 stop, 8 data MOV DX,3FBH ;LCR OUT DX,AL

  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. 8251 RS232 D[7:0] TxD RD RD RxD WR WR A0 C/D TxC CLK CLK RxC A7 A6 A5 A4 A3 A2 A1 IO/M 8251 USART Interface

  48. 7 6 5 4 3 2 1 0 Mode register Number of Stop bits Baud Rate Parity enable 0: disable 1: enable 00: Syn. Mode 01: x1 clock 10: x16 clock 11: x64 clock 00: invalid 01: 1 bit 10: 1.5 bits 11: 2 bits Character length 00: 5 bits 01: 6 bits 10: 7 bits 11: 8 bits Parity 0: odd 1: even Programming 8251 • 8251 mode register

  49. Programming 8251 • 8251 command register EH IR RTS ER SBRK RxE DTR TxE command register TxE: transmit enable DTR: data terminal ready RxE: receiver enable SBPRK: send break character ER: error reset RTS: request to send IR: internal reset EH: enter hunt mode

  50. DSR SYNDET FE OE PE TxEMPTY RxRDY TxRDY Programming 8251 • 8251 status register status register TxRDY: transmit ready RxRDY: receiver ready TxEMPTY: transmitter empty PE: parity error OE: overrun error FE: framing error SYNDET: sync. character detected DSR: data set ready

More Related