Lecture 5 - 6 - Comm. - Shlomo
Lecture 5 - 6 - Comm. - Shlomo
381-1-0103
1
Lecture 7 – Serial
Communication
Shlomo Greenberg
Memory
SPI
Virtual
Cache
y
Memory
Primary
Devices
MMU
Central Control
Interrupt Processin ler /
Decode
Controller g Unit r
(CPU)
IO Secondar
DMA Control y
Controller ler / Memory
Process Devices
IO
Bus Boot / or Devices
Configurati
on
Syllabus (7/9)
3
Broadcast
Switching
Broadcast-Based Networks
7
7.
4.
3.
1,2.
24 Communication Types
Serial vs. Parallel
25
Communication
Microprocessors are based mostly on 8-
bit registers. Thus, their fastest I/O is 8-
bit parallel ports.
But, wiring cost of a long distance
communication is very expensive if you
carry 8-wires.
Remedy is to transfer data serially in bits
instead of in bytes or words.
Wired vs. Wireless
26
Asynchronous
Sync at the beginning of each datum
Asynchronous Transmission
30
Start and Stop Bits
Start bit is required to synchronize the
internal clock of receiver.
Stop bit is required to test the clock
frequency.
Only DATA is transmitted, internal clock
is generated locally.
Multi-drop Daisy-chain
Highest
Loop Priority
Distributed Communication
34
Example – Ethernet
Multiple access communication
Protocol is CSMA/CD
CS – Carrier Sense - Is the line silent?
MA – Multiple Access - using random wait
time to initiate transaction. Collisions are
probable.
CD – Collision Detection
Data Transfer Rate
35
RS-232 protocol
“Slow” speed communication protocols:
SPI, I2C, USART, and more
“High” speed communication protocols:
Serial Rapid IO (SRIO), PCI Express
(PCIe), Common Protocol Radio Interface
(CPRI), and more
42 UART Device
UART
43
Serial to Parallel
conversion using
a Universal
Asynchronous
Receiver
Transmitter:
UART / USART
45
OSI UART
Several Common Protocols
52
using UART
Special Transceiver
53
Conditions
Overrun error - the receiver cannot process the
character that just came in before the next one
arrives
Underrun error - the UART transmitter has
completed sending a character and the transmit
buffer is empty
Framing error - the designated "start" and "stop"
bits are not found
Parity error - the parity of the number of 1 bits
disagrees with that specified by the parity bit
Break condition - the receiver input is at the
"space" (logic low, i.e., '0') level for longer than some
duration of time, typically, for more than a character
time
UART in MODEM-s
54
Connector:
DB-connector with 25 pinsDCE
DTE
(Femal
(only 8 are usually used) e)
(Male)
PGN Protective Ground – Reduces
D noise
TXD Transmit Data
RXD Receive Data
RTS Request to Send
CTS Clear to Send
GND Ground
DSR Data Set Ready
DTR Data Terminal Ready
RLSD Received Line Signal Detect
RS-232 - Mechanical
62
However, neither the UART, nor the RS-232 standard define what is
sent on the TX and RX lines. Generally, when people use RS-232,
they use a simple 8 bit NRZ encoding with one start bit and one stop
bit. Most equipment today manufactured uses this encoding, but
there's no requirement to do so. You can find older equipment that
includes parity bits, or uses 7 or 9 bits. The UART can be configured
to support these various protocols on its TX and RX lines.
UARTs do not typically interface directly with RS-232. You will need to
convert the output of the UART to the +/-12V standard that RS-232
requires. A complete RS-232 interface will typically involve both a
UART and an RS-232 level converter. The RS-232 standard includes
the definition of several other signaling pins besides TX and RX,
which you may need to use depending on the equipment you need to
connect to. These will also need to be level converted, and your
UART may, or may not, support these signals. If it does not you will
have to control them with your software/firmware directly.
So while a UART may help you implement an RS-232 interface, it is
not an RS-232 interface itself.
67 RS-485 Protocol
RS-485
68
RS-485 multi-
drop half-
duplex
network
structure:
RS-485 – Waveform
71
example
The diagram below shows potentials of
the '+' and '−' pins of an RS-485 line
during transmission of one byte (0xD3,
least significant bit first) of data using an
asynchronous start-stop method (e.g.
UART)
72 4-20 mA (Current Loop)
Current Loop
73
Receiver
Data Bus Buffer
8b data bus used
to read or write
status, command
word or data
from or to the
8251A
Read/Write Control Logic
Interfaces the chip
with MPU, determines
the functions of the
chip according to the
control word in the
control register &
monitors the data
flow
Includes:
Six input signals
Three buffer registers:
control register
status register
Data register
Control Logic: Input signals
CS (Chip Select): When signal goes low, the 8251A is
selected by the MPU for communication.
C/D (Control/Data): When signal is high, the control or
status register is addressed; when it is low, data buffer
is addressed (Control register & status register are
differentiated by WR and RD signals).
WR: When signal is low, the MPU either writes in the
control register or sends output to the data buffer.
RD: When signal goes low, the MPU either reads a
status from the status register or accepts data from
data buffer.
RESET: A high on this signal reset 8252A & forces it
into the idle mode.
CLK: Clock input, usually connected to the system clock
for communication with the microprocessor.
Control Logic: Control
Register
16-bit register for a control word.
Consists of two independent bytes:
Mode word: Specifies the general
characteristics of operation such as baud,
parity, number of bits etc.
Command word: Enables the data
transmission and reception.
Register can be accessed as an output
port when the Control/Data pin is high.
Control Register: Mode
108
Word
Control Register: Command
109
Word
Control Logic: Status
110
Register
Checks the
ready status of
the peripheral.
Status word in
the status
register
provides the
information
concerning
register status
and
Control Logic: Data Register
111
CS C/ WR RD Operation
D
0 0 1 0 MPU reads data from the data
buffer
0 0 0 1 MPU writes data to the data buffer
0 1 0 1 MPU writes a word to control
register
0 1 1 0 MPU reads a word from status
register
1 X X X Chip is not selected for any
operation
Modem Control
DSR (Data Set Ready): Checks
if the Data Set is ready when
communicating with a modem.
DTR (Data Terminal Ready):
Indicates that the device is
ready to accept data when the
8251 is communicating with a
modem.
CTS (Clear to Send): If its low,
the 8251A is enabled to
transmit the serial data
provided the enable bit in the
command byte is set to ‘1’.
RTS (Request to Send Data):
Low signal indicates the
modem that the receiver is
ready to receive a data byte
from the modem.
Transmitter – Block Diagram
113
7b/10b addressing
Multi-master
transmitter/receiver
mode
Slave
receiver/transmitter
mode
Standard mode
(100kbps) and fast
mode (400kbps)
support
Serial Communication -
130
Summary
Serial communication has been
standardized using Open System
Interconnection (OSI) into 7 layers
“Slow”, but extremely useful, serial
communication protocols include UART
(w/ RS-232 or RS-485), SPI and I2C
Intel 8251A Communication Controller is
an example of a UART controller
TI MSP430 Communication Controller is
an example of a UART/SPI/I2C controller
131 End of lecture 7
References
132