Download Serial Communication: UART, SPI, and I2C Explained and more Slides Microprocessor and Assembly Language Programming in PDF only on Docsity!
Serial Communication (Asynchronous
UART and Synchronous SPI, I2C)
Chapter 11, 12
Definition of Serial Communication
Bit by bit transmission of information in series
A B
Travels in series
Data Transmission
Serial^ Parallel
Cost
Speed
Transmissio n Amount
Txn Lines
Txn Distance
Example
Cheap
Slow
Single bit
One line to transmit one to receive
Long distance
Modem
Expensive
Fast
8 bits (8 data lines) Transmitter & Receiver
8 lines for simultaneous transmission
Short distance (synchronization)
Printer Connection
Serial Communication Implementation
Popular implementation found in older and some newer
computers is known as the RS-232 serial connection found
in microcomputers
Newer type of serial connections
Universal Serial Bus (USB)
IEEE 1394 serial connection that is also known as the FireWire
connection
Many popular serial communication standards exist—some
examples are:
RS-232 (using UART)
Serial peripheral interface (SPI)
System management bus (SMBus)
Serial ATA (SATA) (abbreviated from Serial AT Attachment )
Serial Cable
DB25 Connector
DB9 Connector
Source Black Box
Asynchronous Serial
Communication
With asynchronous communication, the transmitter
and receiver do not share a common clock
Transmitter + Receiver
1 byte-wide Data
Dat a
1 byte-wide Data
The Receiver
Extracts the data using its
own clock
Converts the serial data
back to the parallel form
after stripping off the
start, stop and parity bits
The Transmitter
Shifts the parallel data
onto the serial line using
its own clock
Also adds the start, stop
and parity check bits
Add: Start, Stop, Parity Bits
Remove: Start, Stop, Parity Bits
Asynchronous Serial Communication
(^) Asynchronous transmission is easy to implement but
less efficient as it requires an extra 2-3 control bits for every 8 data bits
(^) This method is usually used for low volume transmission
Synchronous Serial Communication
(^) In the synchronous mode, the transmitter and receiver share a common clock (^) The transmitter typically provides the clock as a separate signal in addition to the serial data
Transmitter Receiver Data
Clock
The Receiver
Extracts the data
using the clock
provided by the
transmitter
Converts the serial
data back to the
parallel form
The Transmitter
Shifts the data onto the
serial line using its own
clock
Provides the clock as a
separate signal
No start, stop, or parity
1 byte-wide Data
1 byte-wide Data
Tx and Rx
The UART has a transmission engine, and also
a reception engine (they can operate
simultaneously)
Software controls the UART’s operations by
accessing several registers, using the CPU’s
input and output instructions
A little history is needed for understanding some
of the UART’s terminology
Serial data-transmission
0 1 1 0 0 0 0 1
The Transmitter Holding Register (8-bits)
0 1 1 0 0 0 0 1
The transmitter’s internal ‘shift’ register
clock
Software outputs a byte of data to the THR
The bits are immediately copied into an internal ‘shift’-register
The bits are shifted out, one-at-a-time, in sync with a clock-pulse
1 - 0-1-1-0-0-0-0-1 -
start bit
stop bit
data-bits
clock-pulses trigger bit-shifts
DCE and DTE
Original purpose of the UART was for PCs to
communicate via the telephone network
Telephones were for voice communication
(analog signals) whereas computers need so
exchange discrete data (digital signals)
Special ‘communication equipment’ was needed
for doing the signal conversions (i.e. a
modulator/demodulator, or modem )
PC with a modem
computer terminal modem
serial
cable
phone wire
Data
Terminal
Equipment
(DTE)
Data
Communications
Equipment
(DCE)
Signal functions
CD: Carrier Detect The modem asserts this
signal to indicate that it successfully made its
connection to a remote device
RI: Ring Indicator The modem asserts this
signal to indicate that the phone is ringing at the
other end of its connection
DSR: Data Set Ready Modem to PC
DTR: Data Terminal Ready PC to Modem
Signal functions (continued)
RTS: Request To Send PC is ready for the
modem to relay some received data
CLS: Clear To Send Modem is ready for the PC
to begin transmitting some data