4 Communication Protocols
4 Communication Protocols
Team Emertxe
Communication Protocols I
● Introduction
● UART
● SPI
● I²C
● CAN
Introduction
Introduction
● What do mean by Communication?
● Mode of Communications
● Type of Communications
● Why Protocols?
UART
UART
● Introduction
● Interface
● Hardware Configurations
● Frame Format
UART
Introduction
● Asynchronous
● Duplex - Any
● Master / Slave
UART
Interface
● RX
● TX
UART
Hardware Configuration
Device 1 Device 2
TX RX
RX TX
UART
Frame Format
S D0 D1 D2 D3 D4 D5 D6 D7 P ST
Device 1 S D0 D1 D2 D3 D4 D5 D6 D7 P ST
Device 2 S D0 D1 D2 D3 D4
1 1 1 1 1
0 0 0 0 0
11 11 11 11
10 10
01 01
00 00
100 200 300 400 500 600 700 800 900 1000
milliseconds
Serial Peripheral Interface
Serial Peripheral Interface
● Introduction
● Interface
● Hardware Configurations
● Data Transmission
– Data Validity
SPI
Introduction
● Synchronous
● Full Duplex
● Master / Slave
SPI
Interface
● SCLK
● MOSI
● MISO
● nSS
SPI
Hardware Configuration
Master Slave 1
SCLK SCLK
MOSI MOSI
MISO MISO
SS1 SS
SCLK SCLK
MOSI MOSI
MISO MISO
SS1 SS
SS2
SS2 Slave
2
SCLK
MOSI
MISO
SS
Slave 3
SCLK
MOSI
MISO
SS
SCLK SCLK
MOSI MOSI
MISO MISO
SS1 SS
Slave
2
SCLK
MOSI
MISO
SS
Slave 3
SCLK
MOSI
MISO
SS
MASTER SLAVE
MOSI SDI
MISO SDO
1 0 1 0 0 0 1 1 0 0 1 1 1 0 1 1
SCLK SCK
CONTROL SS CS CONTROL
SPI
Data Transmission
MASTER SLAVE
MOSI SDI
MISO SDO
0 1 0 0 0 1 1 0 0 1 1 1 0 1 1 1
SCLK SCK
CONTROL SS CS CONTROL
SPI
Data Transmission
MASTER SLAVE
MOSI SDI
MISO SDO
1 0 0 0 1 1 0 0 1 1 1 0 1 1 1 0
SCLK SCK
CONTROL SS CS CONTROL
SPI
Data Transmission
MASTER SLAVE
MOSI SDI
MISO SDO
0 0 0 1 1 0 0 1 1 1 0 1 1 1 0 1
SCLK SCK
CONTROL SS CS CONTROL
SPI
Data Transmission
MASTER SLAVE
MOSI SDI
MISO SDO
0 0 1 1 0 0 1 1 1 0 1 1 1 0 1 0
SCLK SCK
CONTROL SS CS CONTROL
SPI
Data Transmission
MASTER SLAVE
MOSI SDI
MISO SDO
0 1 1 0 0 1 1 1 0 1 1 1 0 1 0 0
SCLK SCK
CONTROL SS CS CONTROL
SPI
Data Transmission
MASTER SLAVE
MOSI SDI
MISO SDO
1 1 0 0 1 1 1 0 1 1 1 0 1 0 0 0
SCLK SCK
CONTROL SS CS CONTROL
SPI
Data Transmission
MASTER SLAVE
MOSI SDI
MISO SDO
1 0 0 1 1 1 0 1 1 1 0 1 0 0 0 1
SCLK SCK
CONTROL SS CS CONTROL
SPI
Data Transmission
MASTER SLAVE
MOSI SDI
MISO SDO
0 0 1 1 1 0 1 1 1 0 1 0 0 0 1 1
SCLK SCK
CONTROL SS CS CONTROL
SPI
Data Validity
SCK
SDI/O
Data Write
Data Read
Inter Integrated Circuits
Inter Integrated Circuits
● Introduction
● Bus Features
● The Protocol
● Bus Speeds
2
IC
Introduction
● Synchronous
● Half Duplex
● Multi Master / Slave
2
IC
Bus Features
● Two Line Interface
● Software Addressable
● Multi Master with CD
● Serial, 8 bit Oriented, Bidirectional with 4 Modes
● On Chip Filtering
2
IC
Protocol
● Example
● Signals
● A Complete Data Transfer
2
IC
Example
Microcontroller
LCD Driver EEPROM RTC
A
DATA
CLOCK
Temperature Microcontroller
ADC
Sensor B
2
IC
Signals
● Two-wired Interface
– SDA
– SCL
● Wired-AND
● Conditions and Data Validity
● Transmission
2
IC
Signals – Wired-AND
VDD
SCL
SDA
DEVICE1 DEVICE2
2
IC
Signals – Conditions and Data Validity
SCL
SDA
S P
Data Write
Data Read
Conditions
2
IC
Signals – Transmission
● Data on SDA
● Clocking on SCL
● Clock Synchronization
● Data Arbitration
2
IC
Signals – Data on SDA
SCL
1-8 9 1-8 9
SDA - T / R
D7 - D0
SDA - R / T
D7 - D0
SDA Actual
D7 - D0 D7 - D0
P
S or
Sr
2
IC
Signals – Clocking on SCL
SCL
1-8 9 1-8 9
SDA
D7 - D0
SCL1
SCL2
SCL
2
IC
Signals – Data Arbitration
SCL
SDA1
SDA2
SDA
2
IC
A Complete Data Transfer
SDA
S P
2
IC
Bus Speeds
● Bidirectional Bus
– Standard Mode - 100 Kbit/s
– Fast Mode - 400 Kbits/s
– Fast Mode Plus - 1 Mbits/s
– High Speed Mode - 3.4 Mbits/s
● Unidirectional Bus
– Ultra Fast Mode – 5 Mbits/s
● Uses Push-Pull Drivers (No Pullups)
Controller Area Network
Controller Area Network
●
Introduction to CAN
●
Basic Concepts
●
Message Transfer
●
Error Handling
●
Fault Confinement
CAN
Introduction
●
Asynchronous
●
Half Duplex
●
Multi Master / Slave
CAN
Basic Concepts
● Example
● Versions
● Absence of node addressing
– Message identifier specifies contents and priority
– Lowest message identifier has highest priority
● Non-destructive arbitration system by CSMA with collision
detection
● Simple Transmission Medium
– Twisted pair – CAN H and CAN L
● Properties
● Layered Architecture
CAN
Basic Concepts - Example
● Prioritization of Messages
● Guarantee of Latency Times
● Configuration Flexibility
● Multicast Reception with Time Synchronization
● System wide Data Consistency
● Multi master
● Error Detection and Error Signaling
● Automatic Retransmission
● Distinction between temporary errors and permanent failures
of nodes and autonomous switching off of defect nodes
CAN
Basic Concepts - Layered Architecture
7 Application Application
6 Presentation Presentation
5 Session Session
4 Transport Transport
3 Network Network
1 Physical Physical
OSI Model
CAN
Basic Concepts - Layered Architecture
LLC:
7 Application Acceptance Filtering
Overload Notifications
Recovery Managment
6 Presentation MAC:
Data En / Decapsulation
Frame Coding (Stuffing,
5 Session Destuffing)
Medium Access Managment
Error Detection
4 Transport Error Signalling
Acknowledgement
3 Network Serialization / Deserialization
OSI Model
CAN
Message Transfer
● Frame Formats
– Standard Frame - 11 bits Identifiers
– Extended Frame - 29 bits Identifiers
● Frame Types
– Data Frame
– Remote Frame
– Error Frame
– Overload Frame
● Frame Fields
CAN
Message Transfer – Data Frame
● The first bit is IDE bit for the standard format but is
used as reserved bit r1 in extended format.
● r0 is reserved bit.
● DLC3…DLC0 stands for data length and can be from
0000 (0) to 1000 (8).
CAN
Frame Fields – Arbitration Field
●
Consists of two bits
●
The first bit is the acknowledgement bit.
●
This bit is set to recessive by the transmitter,
but will be reset to dominant if a receiver
acknowledges the data frame.
●
The second bit is the ACK delimiter and is
recessive.
CAN
Error Handling
● Error Detection
– Bit Error
– Stuff Error
● Error Signaling
– CRC Error
– Form Error
– Acknowledgment Error
CAN
Fault Confinement
●
Counters
– Transmit Error Counter & Receive Error Counter
Thank You