LabSession1_Protocols
LabSession1_Protocols
1
Introduction
• Communication protocols can be broadly classified as
Serial and parallel
Synchronous and Asynchronous
Simplex, Half duplex and full duplex
2
Serial Vs parallel
• Serial Vs Parallel
3
Asynchronous Vs Synchronous
• Asynchronous – no clock signal to time
the data communication
• Handshaking signals are used to indicate
start and stop
• Synchronous transmission is properly timed
Through the clock signal sent by the master
4
Simplex, Half Duplex and Full Duplex
• Simplex – Transmission in one
direction only
• Half Duplex – Transmission in either
direction is possible but at different time
Slots ( single wire for Tx and Rx)
• Full Duplex – Transmission in either
Direction is possible at the same time.
5
Single Ended Vs Differential
6
Communication Protocols
Most of the microcontrollers support the following protocols for serial
communication
7
UART
• Developed by Digital Equipment Corporation (DEC)
• Transforms parallel data to serial and vice versa
• Used in conjunction with RS 232, Rs 422 or RS 485.
• The term ‘universal’ indicates that the data format and transmission
speeds are configurable
• Level shifter is used after UART to format the voltage to the required
levels
(To conform with the cable standards)
8
UART interfacing
RS232/RS422
9
UART data frame
10
UART protocol
• Start bit – one bit normally -Logic LOW
• Data bits - with or without parity bit
• Stop bits – one or two – Logic HIGH
11
Example
• Transmission of 0x32 and 0x3C at a baud rate of 9600 bits/sec
12
UART – Internal circuitry
13
UART Summary
No of masters – 1
No of slaves – 1
No of wires – 2
Baud rate – normally 9600 bits/sec
14
Serial Peripheral Interface (SPI)
• Synchronous, serial, full duplex data transmission protocol
Speed up to 10 Megabits per second
Pin Details
MOSI (Master Output/Slave Input) – Line for the
master to send data to the slave.
15
A closer look
16
SPI data transmission process
Step 1: Master sends the clock
17
SPI data transmission protocol
• Step 2 : To activate the slave, the master switches the SS/CS pin to a low
voltage state.
18
Data transfer from master to slave
• Step 3: If master wants to transfer data, it is transferred through MOSI
pin.
19
Data transfer from slave to master
• Step 4: If slave wants to send a response, data is transferred from slave
to master through MISO pin.
20
Typical SPI configuration
21
Typical SPI
• Only one master device can control multiple independent slave devices.
• However, an independent chip select signal is required for each slave
device which is provided by the master device.
• The obvious pitfall of this configuration is that the number of chip select
pins required with the master devices should be equal to the number of
slave devices we want to use.
• This is also known as an independent slave configuration.
22
Daisy Chained SPI
23
Daisy Chained SPI
• In this configuration, only one chip select signal from the master device
controls all slave devices and also all slave devices work on the same
clock signal.
• But only the first slave device gets data from the master device directly,
all other slave devices receive data on their input pin from the
subsequent slave device.
• In this mode, slave devices act like cooperative devices instead of
independent devices.
24
Example
25
I2C ( Inter Integrated Communication)
• Multiple master multiple slave communication protocol.
• Synchronous , serial, single ended bus configuration
• Developed by Philips Semiconductor Division ( currently popular as NXP
Semiconductors)
• Low speed communication protocol
• Only two wires are required
• Each slave has a unique address
26
I2C ( Inter Integrated Communication)
27
Start and Stop Condition
• SDA (Serial Data) line: This wire sends data to a slave device. Any data
sent from one device to another goes through the SDA wire.
• SCL (Serial Clock) line: It provides the necessary synchronization clock for
the data transfer.
• Start condition: A high to low transition of SDA.
• Stop condition: A low to high transition of SDA.
28
I2C protocol
29
Message Frame
30
Address Frame ( 7 bit address)
31
Address Frame ( 10 bit address)
32