Upload
khsniper
View
224
Download
0
Embed Size (px)
Citation preview
8/9/2019 08 Serial 1
1/38
Interface DesignInterface Design
Serial CommunicationsSerial Communications
8/9/2019 08 Serial 1
2/38
OutlineOutline
Concept of serialConcept of serial
communicationscommunications
Synchronous, AsynchronousSynchronous, Asynchronous
RSRS--232232 standardstandard
Hand shakingHand shaking
UART and USART chi sUART and USART chi s
8/9/2019 08 Serial 1
3/38
What is Serial CommunicationsWhat is Serial Communications
LONG
Non-Distort
Non-Expensiveshort
8/9/2019 08 Serial 1
4/38
Serial CommunicationSerial Communication
TypesTypesAsynchronous (transfer singleAsynchronous (transfer single
byte at a time)byte at a time)
Synchronous (block of data, chr.,Synchronous (block of data, chr.,
at a time)at a time)
Transfer:Transfer:
SimplexSimplex
8/9/2019 08 Serial 1
5/38
chipsetchipset
UART, e.g.UART, e.g. 82508250 COM portCOM port
USART, IntelUSART, Intel82518251
8/9/2019 08 Serial 1
6/38
Transfer TypesTransfer Types
Simplex, Half- and Full-Duplex Transfers
8/9/2019 08 Serial 1
7/38
Asynchronous Data FramingAsynchronous Data Framing
Idle (high): Mark
Low: Space
Overhead? (parity, start, stop)
Notransfer
8/9/2019 08 Serial 1
8/38
Data Transfer RateData Transfer Rate
Baud rateBaud rateFor Modems, # signal changes/secondFor Modems, # signal changes/second
In lectures, same as bpsIn lectures, same as bps
bpsbps
8/9/2019 08 Serial 1
9/38
VocabularyVocabulary
DTEDTEData Terminal EquipmentData Terminal Equipment
e.g. computer, terminale.g. computer, terminal
DCEDCEData Communication EquipmentData Communication Equipment
connects DTE to communication linesconnects DTE to communication lines
e.g. modeme.g. modem
8/9/2019 08 Serial 1
10/38
RSRS--232232 StandardStandard
Electronics Industries AssociationElectronics Industries AssociationEIAEIA 232232
Specifies the interface betweenSpecifies the interface betweenDTE and DCEDTE and DCE
Even used in applications whereEven used in applications where
there is no DCEthere is no DCE e.g. connecting computer to printer, magnetice.g. connecting computer to printer, magnetic
card reader, robot,card reader, robot, etc.etc.
Introduced inIntroduced in 19621962 but is stillbut is still
8/9/2019 08 Serial 1
11/38
MechanicalMechanical
CharacteristicsCharacteristics2525--pin connectorpin connector
99--pin connector is more commonly found inpin connector is more commonly found inIBMIBM--PC but it covers signals for asynchronousPC but it covers signals for asynchronous
serial communication onlyserial communication only
Use male connector on DTE andUse male connector on DTE andfemale connector on DCEfemale connector on DCE
Note: all signal names areNote: all signal names areviewed from DTEviewed from DTE
8/9/2019 08 Serial 1
12/38
2525--Pin RSPin RS232232 ConnectorConnector
Source: Duck, Bishop & Read, Data Communications for Engineers, Addison-Wesley
8/9/2019 08 Serial 1
13/38
99--Pin RSPin RS232232 ConnectorConnector
8/9/2019 08 Serial 1
14/38
DTE ConnectionsDTE Connections
8/9/2019 08 Serial 1
15/38
Electrical CharacteristicsElectrical Characteristics
SingleSingle--endedended one wire per signal, voltage levels are withone wire per signal, voltage levels are withrespect to system common (i.e. signal ground)respect to system common (i.e. signal ground)
Mark:Mark: 33V toV to 2525VV represent Logicrepresent Logic 11, Idle State (OFF), Idle State (OFF)
Space: +Space: +33 to +to +2525VV represent Logicrepresent Logic 00, Active State (ON), Active State (ON)
Usually swing betweenUsually swing between 1212V toV to++1212VV
Recommended maximum cableRecommended maximum cablelen th islen th is 1515m atm at 2020kb skb s
8/9/2019 08 Serial 1
16/38
Function of SignalsFunction of Signals
TD: transmitted dataTD: transmitted data
RD: received dataRD: received data
D
SR: data set readyD
SR: data set ready indicate whether DCE is powered onindicate whether DCE is powered on
DTR: data terminal readyDTR: data terminal ready indicate whether DTR is powered onindicate whether DTR is powered on
turning offDTR causes modem to hang up theturning offDTR causes modem to hang up thelineline
RI: ring indicatorRI: ring indicator
ON when modem detects phone callON when modem detects phone call
8/9/2019 08 Serial 1
17/38
Function of SignalsFunction of Signals
DCD: data carrier detectDCD: data carrier detect ON when two modems negotiated successfullyON when two modems negotiated successfully
and carrier signal is established on the phoneand carrier signal is established on the phone
lineline
RTS: request to sendRTS: request to send ON when DTE wants to send dataON when DTE wants to send data
Used to turn on and off modemUsed to turn on and off modems carrier signals carrier signalin multiin multi--point (i.e. multipoint (i.e. multi--drop) linesdrop) lines
Normally constantly ON in pointNormally constantly ON in point--toto--point linespoint lines
CTS: clear to sendCTS: clear to send ON when DCE is ready to receive dataON when DCE is ready to receive data
8/9/2019 08 Serial 1
18/38
Flow ControlFlow Control
Means to ask the transmitter toMeans to ask the transmitter tostop/resume sending in datastop/resume sending in data
Required when:Required when: DTE to DCE speed > DCE to DCE speedDTE to DCE speed > DCE to DCE speed
(e.g. terminal speed =(e.g. terminal speed = 115115..22kbps and linekbps and linespeed =speed = 3333..66kbps, in order to benefit fromkbps, in order to benefit from
modemmodems data compression protocol)s data compression protocol) without flow control, the buffer within modem willwithout flow control, the buffer within modem will
overflowoverflow sooner or latersooner or later
the receiving end takes time to process thethe receiving end takes time to process thedata and thus cannot be always ready todata and thus cannot be always ready toreceivereceive
8/9/2019 08 Serial 1
19/38
Hardware Flow ControlHardware Flow Control
RTS/CTSRTS/CTS the transmitting end activates RTS to informthe transmitting end activates RTS to inform
the receiving end that it has data to sendthe receiving end that it has data to send
if the receiving end is ready to receive, itif the receiving end is ready to receive, itactivates CTSactivates CTS
normally used between computer and modemnormally used between computer and modem
computer is always ready to receive data but modemcomputer is always ready to receive data but modem
is not, because terminal speed > link speedis not, because terminal speed > link speed
8/9/2019 08 Serial 1
20/38
Other StandardsOther Standards
8/9/2019 08 Serial 1
21/38
ProgrammableProgrammable
Communications Interface:Communications Interface:
UARTUART 82508250//1655016550
8/9/2019 08 Serial 1
22/38
TheThe 1655016550 can control a modemcan control a modemthrough DSR, DTR, CTS, RTS, RIthrough DSR, DTR, CTS, RTS, RI
and DCD.and DCD. In this context, the modem isIn this context, the modem is
called the data set while thecalled the data set while the
1655016550 is called the datais called the dataterminal.terminal.
8/9/2019 08 Serial 1
23/38
Pinout of thePinout of the 1655016550AA00, A, A11 and Aand A22: Select an: Select an
internal register forinternal register forprogramming and dataprogramming and datatransfer.transfer.
ADSADS:: Address strobe,Address strobe, used toused tolatch address and chip select.latch address and chip select.
BAUDOUTBAUDOUT: Clock signal from: Clock signal fromBaud rate generator inBaud rate generator in
transmitter.transmitter.
8/9/2019 08 Serial 1
24/38
Pinout of thePinout of the 1655016550 DD77--DD00: Data bus pins: Data bus pins
connected to processor dataconnected to processor databusbus
DCDDCD:: Data carrier detectData carrier detect used by modem to signalused by modem to signal 1655016550 thatthat
carrier is presentcarrier is present
DDISDDIS:: Disable driver outputDisable driver output
Set toSet to 00 to indicate that processor isto indicate that processor isreading data from the UARTreading data from the UART Used to change direction of data flowUsed to change direction of data flow
through a bufferthrough a buffer
8/9/2019 08 Serial 1
25/38
Pinout of thePinout of the 1655016550 contdcontd
DSRDSR:: Data set readyData set ready is inputis inputtoto 1655016550 indicates that modem (data set) is readyindicates that modem (data set) is ready
to operateto operate DTRDTR:: Data terminal readyData terminal ready isis
outputoutput indicates that data terminal (indicates that data terminal (1655016550) is) is
ready to functionready to function INTRINTR:: Interrupt requestInterrupt request isis
output to processor tooutput to processor torequest an interruptrequest an interrupt
Data receivedData received
8/9/2019 08 Serial 1
26/38
Pinout of thePinout of the 1655016550 MRMR:: Master resetMaster reset, connect to, connect to
system RESETsystem RESET OUTOUT11, OUT, OUT22: User defined: User defined
output pins for modem oroutput pins for modem orother device.other device. RCLKRCLK: Receiver clock,: Receiver clock,
clock input to receiver section of theclock input to receiver section of the
UARTUART alwaysalways 1616X the desired receiver BaudX the desired receiver Baud
raterate
RDRD: Read inputs: Read inputs cause data to be read from register givencause data to be read from register given
by the address inputsby the address inputs
8/9/2019 08 Serial 1
27/38
Pinout of thePinout of the 1655016550 RTSRTS: Request: Request--toto--send signalsend signal
to modemto modem indicating UART wishes to send dataindicating UART wishes to send data
SIN, SOUTSIN, SOUT: Serial data pins,: Serial data pins,in and outin and out RxRDYRxRDY: Receiver ready: Receiver ready
transfer received data via DMAtransfer received data via DMA
techniquestechniques TxRDYTxRDY: Transmitter ready: Transmitter ready
transfer transmitter data via DMAtransfer transmitter data via DMA
WRWR: Write: Write connects to micro write signal to transferconnects to micro write signal to transfer
8/9/2019 08 Serial 1
28/38
82508250//1645016450//1655016550 UARTUART
8/9/2019 08 Serial 1
29/38
UART in PCUART in PC
8/9/2019 08 Serial 1
30/38
RegistersRegisters
Transmitter holding registerTransmitter holding register
Receiver buffer registerReceiver buffer register
Interrupt enable registerInterrupt enable register
8/9/2019 08 Serial 1
31/38
RegistersRegisters
Interrupt identification registerInterrupt identification register
C (C (
8/9/2019 08 Serial 1
32/38
Line Control (DataLine Control (Data
Format) RegisterFormat) Register
8/9/2019 08 Serial 1
33/38
Modem RegistersModem Registers
8/9/2019 08 Serial 1
34/38
Line Status RegisterLine Status Register
8/9/2019 08 Serial 1
35/38
Divisor RegisterDivisor Register
8/9/2019 08 Serial 1
36/38
Synchronous ProtocolsSynchronous Protocols
(Serial Data Link Control)(Serial Data Link Control)
8/9/2019 08 Serial 1
37/38
CRCCRC
In SDLC:
G(X) = x**16 + x**12 + x**5 + 1
8/9/2019 08 Serial 1
38/38
82518251 Block DiagramBlock Diagram