1 / 26

5: Serial I/O

5: Serial I/O. CET360 Microprocessor Engineering by J. Sumey. Introduction. serial , i.e. bit-at-a-time , interfacing techniques are useful when parallel interfacing limitations become problematic distance limitations due to crosstalk cabling costs

danika
Download Presentation

5: Serial I/O

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. 5: Serial I/O CET360Microprocessor Engineeringby J. Sumey

  2. Introduction • serial, i.e. bit-at-a-time, interfacing techniques are useful when parallel interfacing limitations become problematic • distance limitations due to crosstalk • cabling costs • was popularized in the 1960s by teletypes and modem technologies • standardized as RS-232C in 1969 by the EIA • used by many I/O peripherals • mice, printers, digital cameras, PDAs, GPS receivers,POS terminals (cash drawers & scanners) • predecessor to USB 11001010000100101110

  3. Serial Interface Components • at a minimum, a serial interface requires: • transmit / receive registers • holds parallel data before/after serialization • PISO/SIPO shift registers • handles serialization/deserialization • clock circuitry (Baud rate generator) • timing signals used by shift registers • referred to as UARTs or SCI • Universal Asynchronous Receiver/Transmitter • Serial Communication Interface (Motorola) • also: COM ports on PCs

  4. Example: S12 SCI

  5. Serial Data Transmission Issues • a pair of devices communicating over a serial link must agree on a number of parameters… • communication type • data coding • transmission (Baud) rate • clocking method • error handling • handshaking

  6. 1 – Communication Type • refers to how the 2 devices communicate with each other • simplex – fixed, 1-way over a single channel • half-duplex – 2-way over a single, shared (unidirectional but reversible) channel • full-duplex – 2-way over a pair of unidirectional channels

  7. 2 – Data Coding • choice of binary code used to represent alphanumeric data • ASCII – American Standard Code for Information Interchange • EBCDIC – Extended Binary Coded Decimal Interchange Code (IBM) • proprietary – ex: credit card scanner • also may refer to the logic levels used • 1=mark, 0=space

  8. KEY NUL = Null SOH = Start Of Header STX = Start of Transmission ETX = End of Transmission EOT = End of Text ENQ = Enquiry ACK = Acknowledge BEL = Audible Bell BS = BackSpace HT = Horizontal Tab LF = Line Feed VT = Vertical Tab FF = Form Feed CR = Carriage Return SO = Shift Out SI = Shift In DLE = Data Link Escape DCx = Device Control x NAK = Negative Acknowledge SYN = Synchronization char. ETB = End Transmission Block CAN = Cancel EM = End of Medium SUB = Substitute ESC = Escape FS = Field Separator GS = Group Separator RS = Record Separator US = Unit Separator DEL = Delete ASCII Chart!

  9. 3 – Baud Rate • speed at which bits (per sec.) are sent over a serial data link • may (asynchronous) or may not (synchronous) include “overhead” bits • also: bit rate = number of data bits per sec. • common baud rates:110, 300, 1200, 2400, 4800, 9600, 19.2k, 38.4k

  10. 4 – Clocking Method • determines how receiver is synchronized to transmitter • synchronous • same clock source is either sent along with or encoded within a continuous data stream, ex: Ethernet LAN • bit rate = baud rate • asynchronous • no common clock, Tx & Rx run from separate clocks • data bits are framed with Start/Stop bits • Start bit: a fixed 0 bit prefixing the data bits • Stop bit: a fixed 1 bit suffixing the data bits • bit rate < baud rate (because of overhead)

  11. Asynchronous Format • line is held in inactive mark state (1) when no data to send • data bits are sent/received LSB to MSB • characters may be sent back-to-back • but not a requirement! • ex – 2 chars using 8 data, 1 stop, no parity: • challenge: show waveform for the message “Hi”

  12. 5 – Error Handling • deals with how errors are detected and/or corrected • parity • each sent character may have an odd or even parity bit added to it, directly before the stop bit • based on the total number of 1s in the character (including parity bit) • used for simple error detection, only 50% accurate • checksum • better method based on 1’s complement of binary sum • 8-bit performance: 255/256 accuracy, also 16-bit, 32-bit • cyclic redundancy check (CRC) • more sophisticated error detection mechanism based on polynomial math, 99.99%+ accurate

  13. 6 - Handshaking • additional control interface signals • RTS/CTS – Request To Send/Clear To Send • DTR/DSR – Data Terminal Ready/Data Set Ready • DCD – Data Carrier Detect • RI – Ring Indicate • used to control / throttle the transmitter • may be optional depending on hardware and software implementation

  14. Serial Communication Standards • a number of industry-wide serial standards are commonly used, some have been defined by the Electronic Industries Alliance (EIA) • 20/60ma current loop • T.T.L. • RS-232C (1969) • RS-423  EIA-423 • RS-422  EIA-422 • RS-485  EIA-485 • USB • SATA

  15. Serial Standards • 20/60ma current loop • original standard used by teletypes • I=1, no I=0 • once popular in (noisy) industrial settings • T.T.L. • simple, logic-level based • +5VDC=1, 0VDC=0 • good for on-PCB device-to-device transfer, otherwise not useful for much distance due to noise vulnerability

  16. RS-232C Standard • defines many characteristics of a serial interface • 20 signal names & functions: TxD, RxD, RTS, CTS, etc. • connectors & pinouts: DB-25, DE-9, RJ-45 • cable specs – upto 20kbps upto 50’ • voltage levels • 1=mark=off=-3..-25V, 0=space=on=+3..+25V • notice avoidance of ground level!

  17. RS-232C Standard • classifies devices as being either:Data Terminal Equipment (DTE) orData Communication Equipment (DCE) • defines which pins transmit, receive, etc. • requires interface drivers to convert logic levels • ex: Maxim’s MAX232http://datasheets.maxim-ic.com/en/ds/MAX220-MAX249.pdf

  18. MAX232/MAX232A 5V Supply! Charge Pump Inverter “Logic” side “EIA” side 18

  19. RS-232C Pinouts* *with respect to DTE device

  20. EIA-423 Standard • an improved version of RS-232 using high-performance drivers and receivers • single-ended / unbalanced like RS-232 but with better performance • provides up to 100 kbps and up to 4000' • supports multi-drop connections • up to 10 receivers on a single line

  21. EIA-422 Standard • similar to EIA-423 but with even better performance • provides up to 10 Mbps and upto 4000' • eliminates ground loop problems by transmitting bits as a voltage difference over a unidirectional wire pair • has a very high common mode rejection ratio (CMRR) • works better with long cable runs • Note: Ethernet LANs work the same way! • great for use as an RS-232 extender

  22. EIA-422 Example • RS-422 4-wire network using balanced differential drivers (generators) and receivers

  23. EIA-485 Standard • similar to EIA-422 but allows multiple receivers and drivers (up to 32 each) to share a single 2-wire differential pair in half-duplex fashion • thus, is multi-point… • readily supports low-cost local networking • ex: PLCs on factory floors, home/building automation • provides up to 35 Mbps and up to 4000'

  24. EIA-485 2-wire Network Example

  25. Universal Serial Bus (USB) • similar to EIA-422 (half-duplex, differential), but uses communication protocols to packetize data transfers • used by current PCs to support connection of modern peripherals • supports upto 127 devices, upto 16’ • 4 different transfer speeds • low speed (1.0) = 1.5Mbps • full speed (1.1) = 12Mbps • hi speed (2.0) = 480Mbps • superspeed (3.0) = 4.8Gbps

  26. References • Wikipedia Articles: • http://en.wikipedia.org/wiki/Current_loop • http://en.wikipedia.org/wiki/RS-232 • http://en.wikipedia.org/wiki/RS-485 • RS-232 tutorial: • http://www.radio-electronics.com/info/telecommunications_networks/rs232/rs232-serial-interface-basics-tutorial.php • B&B Electronics RS-422 & RS-485 App Note: • http://www.bb-elec.com/bb-elec/literature/tech/485appnote.pdf • Maxim MAX-232 IC: • http://datasheets.maxim-ic.com/en/ds/MAX220-MAX249.pdf

More Related