Serial Communication Buses
Total Page:16
File Type:pdf, Size:1020Kb
Computer Architecture 10 Serial Communication Buses Made wi th OpenOffi ce.org 1 Serial Communication SendingSending datadata oneone bitbit atat oneone time,time, sequentiallysequentially SerialSerial vsvs parallelparallel communicationcommunication cable cost (or PCB space), synchronization, distance ! speed ? ImprovedImproved serialserial communicationcommunication technologytechnology allowsallows forfor transfertransfer atat higherhigher speedsspeeds andand isis dominatingdominating thethe modernmodern digitaldigital technology:technology: RS232, RS-485, I2C, SPI, 1-Wire, USB, FireWire, Ethernet, Fibre Channel, MIDI, Serial Attached SCSI, Serial ATA, PCI Express, etc. Made wi th OpenOffi ce.org 2 RS232, EIA232 TheThe ElectronicElectronic IndustriesIndustries AllianceAlliance (EIA)(EIA) standardstandard RS-232-CRS-232-C (1969)(1969) definition of physical layer (electrical signal characteristics: voltage levels, signaling rate, timing, short-circuit behavior, cable length, etc.) 25 or (more often) 9-pin connector serial transmission (bit-by-bit) asynchronous operation (no clock signal) truly bi-directional transfer (full-duplex) only limited power can be supplied to another device numerous handshake lines (seldom used) many protocols use RS232 (e.g. Modbus) Made wi th OpenOffi ce.org 3 Voltage Levels RS-232RS-232 standardstandard convertconvert TTL/CMOS-levelTTL/CMOS-level signalssignals intointo bipolarbipolar voltagevoltage levelslevels toto improveimprove noisenoise immunityimmunity andand supportsupport longlong cablecable lengthslengths TTL/CMOS → RS232: 0V = logic zero → +3V…+12V (SPACE) +5V (+3.3V) = logic one → −3V…−12V (MARK) Some equipment ignores the negative level and accepts a zero voltage level as the "OFF" state The "dead area" between +3V and -3V may vary, many receivers are sensitive to differentials of 1V or less Made wi th OpenOffi ce.org 4 Data frame CompleteComplete one-byteone-byte frameframe consistsconsists of:of: start-bit (SPACE), data bits (7, 8), stop-bits (MARK) e.g. 9600, 8N1, 19200, 7E1 TTL (5V) RS-232 byte transfer (ASCII 'b'=0x61 hex) Voltage converter Typical RS-232 byte transfer (ASCII 'b'=0x61 hex) Made wi th OpenOffi ce.org 5 Data Rates PurePure EIAEIA RS-232CRS-232C standardstandard permitspermits datadata ratesrates upup toto 1920019200 bpsbps andand cablecable lengthslengths upup toto 400400 metersmeters (but(but notnot both)both) DataData ratesrates asas highhigh asas 256kbps256kbps (over(over lessless thanthan 22 m)m) areare possiblepossible UniversalUniversal AsynchronousAsynchronous Receiver/TransmitterReceiver/Transmitter (UART)(UART) –– componentcomponent responsibleresponsible forfor fastfast communicationcommunication viavia RS-232RS-232 CommonCommon 1655016550 UARTUART incorporatesincorporates aa 16-byte16-byte FIFOFIFO andand isis mandatorymandatory forfor communicationscommunications atat speedsspeeds aboveabove 96009600 bpsbps Made wi th OpenOffi ce.org 6 DTE and DCE TheThe RS-232RS-232 definesdefines twotwo classesclasses ofof devices:devices: male chauvinism? data terminal equipment (DTE) – computer (male) data communication equipment (DCE) – modem (female) e.g. TD is output line on DTE, but input line on DCE distinction between DTE&DCE allows to avoid confusion Made wi th OpenOffi ce.org 7 Signals Complete RS232 standard define a lot of signals and is fairly complex Many communications options exist, but only very few are used in practice CTS Clear To Send [DCE --> DTE] DCD Data Carrier Detected (Tone from a modem) [DCE --> DTE] DCE Data Communications Equipment eg. modem DSR Data Set Ready [DCE --> DTE] DSRS Data Signal Rate Selector [DCE --> DTE] (Not common) DTE Data Terminal Equipment eg. computer, printer DTR Data Terminal Ready [DTE --> DCE] FG Frame Ground (screen or chassis) NC No Connection RCk Receiver (external) Clock input RI Ring Indicator (ringing tone detected) RTS Request To Send [DTE --> DCE] RxD Received Data [DCE --> DTE] SG Signal Ground SCTS Secondary Clear To Send [DCE --> DTE] SDCD Secondary Data Carrier Detected (Tone)[DCE -> DTE] SRTS Secondary Ready To Send [DTE --> DCE] SRxD Secondary Received Data [DCE --> DTE] STxD Secondary Transmitted Data [DTE --> DTE] TxD Transmitted Data [DTE --> DTE] Made wi th OpenOffi ce.org 8 Handshaking HardwareHardware handshakinghandshaking RTS/CTS ● DTE asserts the "request to send" (RTS) signal when it is ready to receive data and deasserts it when it cannot accept data; a DCE asserts "clear to send" (CTS) when it is ready to receive data DTR/DTE ● DTE asserts the "data terminal ready" (DTR) signal, and DCE asserts the "data set ready" (DSR) signal SoftwareSoftware handshakinghandshaking XON/XOFF ● requires that the receiver send a character (Control-S, ASCII 19) to halt data transfer and another character (Control-Q, ASCII 17) to resume transfer Made wi th OpenOffi ce.org 9 Seldom used features SignalSignal raterate selectionselection The DTE or DCE can specify use of a "high" or "low" signaling rate TimingTiming signalssignals Some synchronous devices provide a clock signal to synchronize data transmission SecondarySecondary channelchannel Data can be sent over a secondary channel, which is equivalent to the primary channel Made wi th OpenOffi ce.org 10 Interface Sub-DSub-D 25,25, Sub-DSub-D 9,9, RJ45RJ45 andand othersothers DTEDTE↔D↔DCECE –– StraightStraight connectionconnection DTEDTE↔↔DTEDTE –– Null-modemNull-modem (cross-over(cross-over cable)cable) DTEDTE –– LoopbackLoopback wiringwiring VariousVarious DB25DB25 toto DB9DB9 adaptersadapters Made wi th OpenOffi ce.org 11 Null-modem Wirings Made wi th OpenOffi ce.org 12 Loopback Wirings Made wi th OpenOffi ce.org 13 Weaknesses CommonCommon groundground RequirementRequirement forfor positivepositive andand negativenegative suppliessupplies LowLow transfertransfer raterate Point-to-pointPoint-to-point onlyonly communicationcommunication AsymmetricalAsymmetrical definitionsdefinitions ofof DTEDTE andand DCEDCE ManyMany unnecessaryunnecessary communicationcommunication optionsoptions NoNo methodmethod forfor sendingsending powerpower toto aa devicedevice RecommendedRecommended connectorconnector isis largelarge byby currentcurrent standardsstandards Made wi th OpenOffi ce.org 14 Strengths RS-232RS-232 isis graduallygradually beingbeing supersededsuperseded byby USBUSB forfor locallocal communicationscommunications butbut ...... USB is more complex (physical layer + protocol + driver) and has no direct analog to the terminal programs for 'raw' communication RS232 control lines of the interface can be easily manipulated by software to control various simple hardware devices (lamps, relays, etc.) Lots of communication protocols can be easily implemented over RS232 (by software or hardware) Simplicity makes it good for all applications where speed is not critical but distance may be quite long It is available in most of microcontrollers Made wi th OpenOffi ce.org 15 RS232 Forever ... PCI-Express Card with 1 RS232C Port Made wi th OpenOffi ce.org 16 Related Standards RS-422RS-422 similar to RS-232 but with differential signaling RS-485RS-485 a two-wire differential signaling (U+, U-) half-duplex multipoint serial connection (inexpensive local networks) speeds up to 35 Mbit/s (10 m) and 100 kbit/s (1200 m) Made wi th OpenOffi ce.org 17 Differential Signaling ToleranceTolerance ofof groundground offsetsoffsets SuitabilitySuitability forfor useuse withwith low-voltagelow-voltage electronicselectronics ResistanceResistance toto electromagneticelectromagnetic interferenceinterference RS-485,RS-485, PCIPCI Express,Express, USB,USB, ...... Made wi th OpenOffi ce.org 18 USB UniversalUniversal SerialSerial BusBus (USB)(USB) waswas intendedintended toto helphelp retireretire allall legacylegacy varietiesvarieties ofof serialserial andand parallelparallel portsports (1995)(1995) single standardized interface socket plug-and-play + hot swapping providing power to low-consumption devices allowing many standard devices to be used without requiring manufacturer specific NoNo directdirect accessaccess toto physicalphysical layerlayer ComplexComplex software+hardwaresoftware+hardware error correction, protocols, device classes, etc. Made wi th OpenOffi ce.org 19 USB Bus Topology USBUSB system:system: host+interconnect+deviceshost+interconnect+devices USBUSB alwaysalways connectsconnects devicesdevices withwith hosthost InterconnectInterconnect topologytopology isis aa tieredtiered starstar Made wi th OpenOffi ce.org 20 Speed ThereThere areare 33 datadata rates:rates: USB high-speed 480 Mb/s USB full-speed 12 Mb/s USB low-speed 1.5 Mb/s Experimental USB 3.0 Super-Speed ● 4.8 Gbit/s (600 MB/s) TheThe actualactual throughputthroughput attainedattained withwith realreal devicesdevices isis aboutabout ⅔⅔ ofof thethe maximummaximum theoreticaltheoretical bulkbulk datadata transfertransfer raterate Made wi th OpenOffi ce.org 21 Electrical Interface Four-wireFour-wire cable,cable, differentialdifferential signaling,signaling, half-duplex,half-duplex, TwistedTwisted pairpair datadata cablecable withwith 90Ω90Ω ±15%±15% impedanceimpedance 0.0–0.3V0.0–0.3V LowLow andand 2.8–3.6V2.8–3.6V HighHigh (Low/Full(Low/Full Speed)Speed) ±±400mV400mV inin HighHigh SpeedSpeed (+(+ protocolprotocol toto negotiatenegotiate HS)HS) ClockClock tolerance:tolerance: 480.00 Mbit/s ±0.05% 12.000 Mbit/s ±0.25% 1.50 Mbit/s ±1.5% Made wi th OpenOffi ce.org 22 Data Signaling (Low/Full) DataData transmissiontransmission isis organizedorganized inin packetspackets NRZINRZI (non-return-to-zero(non-return-to-zero