0% found this document useful (0 votes)
6 views

Communication Protocols Shell -Final

The document provides an overview of communication protocols, focusing on wired communication systems such as UART, SPI, and CAN. It explains the components of communication systems, classifications like serial vs parallel, and the importance of protocols in embedded systems. Additionally, it details the operation and structure of various protocols, including their advantages and error handling mechanisms.

Uploaded by

mohamed.ismail05
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PPTX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
6 views

Communication Protocols Shell -Final

The document provides an overview of communication protocols, focusing on wired communication systems such as UART, SPI, and CAN. It explains the components of communication systems, classifications like serial vs parallel, and the importance of protocols in embedded systems. Additionally, it details the operation and structure of various protocols, including their advantages and error handling mechanisms.

Uploaded by

mohamed.ismail05
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PPTX, PDF, TXT or read online on Scribd
You are on page 1/ 45

Communication

protocols
Day 4
CONTENTS OF THIS
TEMPLATE
Font used is Monteserrat of all sizes and weights
Fonts Click here to download
If not available, use Poppins

#2d317c (blue)
#344382 (blue)
#3c5688 (blue shade)
Colors #43688e (blue shade)
#4b7a93 (blue shade)
White , grey
TABLE OF CONTENTS

01 02 03
Into UART SPI

04 05 06
I2C CAN Practical
01
Introduction to
communication
protocols
What is a communication system?
● Definition: A communication system is a framework that allows the exchange of data
between two or more devices. It consists of hardware and software components that ensure
efficient data transfer.

● A simple communication system consists of :


1) Transmitter :It is the device that modifies the data to be able to transmit safely .

2) Transmission media :The channel through which data is transmitted (wired/wireless).

3) Receiver :It is the device that retrieves the original data .

4) Protocol : A set of rules governing communication.

● Why is it Important in Embedded Systems?


Enables microcontrollers, sensors, and peripherals to exchange information.
Types of Communication:

● Wired Communication:: Uses physical connections as data


are transmitted into wires (e.g., UART, SPI, CAN, I2C).
● Wireless Communication:Uses radio waves (e.g., Wi-Fi,
Bluetooth, Ethernet).

But we will focus on wired communication…..


Classifications of communication
system
Serial vs Parallel Communication
● Serial communication uses a single wire to transfer the data bits one at a
time.
● Parallel communication uses multiple wires running parallel to each other, and
can transmit data on all the wires simultaneously.
Classifications of communication
system
Serial vs Parallel Communication

Feature v
Serial communication Parallel communication

Data Transfer Bit by bit (1 wire) Multiple bits at once (many wires)

Wiring Complexity Simple (fewer wires) Complex (many wires) which could
lead to crosstalk and data skew

Speed Slower Faster

Best For Long- Short-distance, high-speed


distance,microcontroller applications
communication

Examples UART, SPI, CAN, I2C RAM, Data Buses


Classifications of communication
system

In simplex operation, a network cable or communications channel can only send information
in one direction; it's a “one-way street”. A good example would be your keyboard to your
CPU. The CPU never needs to send characters to the keyboard but the keyboard always
sends characters to the CPU. In many cases, Computers almost always send characters to
printers, but printers usually never send characters to computers (there are exceptions,
some printers do talk back). Simplex requires only one lane (in the case of serial).
Classifications of communication
system

Technologies that employ half-duplex operation are capable of sending information in both
directions between two nodes, but only one direction or the other can be utilized at a time.
This is a fairly common mode of operation when there is only a single network medium
(cable, radio frequency and so forth) between devices. The only advantage that Half-Duplex
would have is the single lane or single track is cheaper than the double lane or double track.
Classifications of communication
system

In full-duplex operation, a connection between two devices is capable of sending data in


both directions simultaneously. Full-duplex channels can be constructed either as a pair of
simplex links (as described above) or using one channel designed to permit bidirectional
simultaneous transmissions. A full-duplex link can only connect two devices, so many such
links are required if multiple devices are to be connected together. .
Classifications of communication
system

In this type of communication there is a master node that can send data to any other nodes
(Slaves). The master is the only node that can initiate the communication, the slave can
never initiate the communication. The slave can send data to master only when the master
permit the slave to send. The Master / Slave network can be divided to: Single Master Single
Slave (SMSS) Single Master Multi Slave (SMMS) Multi Master Multi Slave (MMMS)
Classifications of communication
system
Synchronous vs Asynchronous Communication
● Synchronous Communication : (e.g., SPI,I2C).

Data is transmitted with the help of a shared clock between sender and receiver.

The sender and receiver are synchronized by the clock.

Data is transmitted continuously in a structured manner.


● Asynchronous Communication : (e.g., UART).
Data is transmitted without a shared clock; instead, it relies on start and stop bits for
synchronization.

Each data frame has start and stop bits to indicate the beginning and end.

No continuous clock signal; sender and receiver operate independently.


Classifications of communication
system
Bit rate and Baud rate

● Bit rate
Bit rate refers to Number of data bits transferred per second. Unit of Bit rate is bits per
second(bps). For example bit rate is 10kbps means 10,000 bits are transferred within one
second.

● Baud rate
Baud rate refers to number of signal or voltage level changes per second. Unit of baud rate
is bauds per second. For example baud rate is 9600 means 9600 signal level changes are
happening within a second.
02
UART
Communication
Protocol
What is UART?
UART stands for Universal Asynchronous Receiver Transmitter .There is one
wire for transmitting data , and one wire to receive data , a common
parameter is the baud rate known as “bps” whish stands for bits per
second . If a transmitter is configured with 9600bps , then the receiver must
be listening on the other end at the same speed.
UART Frame
UART Frame
•Start bit: 1 bit indicates the start of a new frame, always
logic low.
•Data: 5 to 9 bits of sent data.
•Parity bit: 1 bit for error checking
•Even parity: Clear parity bit if number of 1s sent is even.
•Odd parity: Clear parity bit if number of 1s sent is odd.
03
SPI
Communication
Protocol
What is SPI?
Serial Peripheral Interface (SPI) bus is a synchronous
serial communication interface specifications used for
short distance communication.

•SCLK: Serial clock (output from master


•MOSI: Master output , slave input
•MISO: Master input , slave output
• Slave Select: slave select
How it works SPI?
The SPI operation is a shift register operation. The master
swaps a bit with the slave every clock cycle.
SPI Network
Independent Slaves : SPI can be set up
to operate with a single master and a
single slave, and it can be set up with
multiple slaves controlled by a single
master. There are two ways to connect
multiple slaves to the master. If the master
has multiple slave select pins, the slaves
can be wired in parallel like this
SPI Network
Daisy Chain : If only one slave select pin
is available, the slaves can be daisy-
chained like this
SPI Clock
The clock signal synchronizes the output of data bits from the master to the
sampling of bits by the slave. One bit of data is transferred in each clock cycle,
so the speed of data transfer is determined by the frequency of the clock
signal. SPI communication is always initiated by the master since the master
configures and generates the clock signal.
SPI Clock Parameters:
Clock Polarity: Defines the idle state of the clock
Clock Phase : Define the leading action to be taken. Because the clock has 2
edges; rising and falling edge, it is configurable to choose what to be done with
the first edge (Called also Leading Edge). The master can choose to send data
(Called also Toggle or Setup) with the leading edge. Or to choose to read data
with leading edge (called also Sample).
SPI Clock
Data Transmitter steps
1. The master outputs the clock signal:

2. The master switches the SS/CS pin to a low voltage state, which
activates the slave:
Data Transmitter steps
3. The master sends the data one bit at a time to the slave along the
MOSI line. The slave reads the bits as they are received:

4. If a response is needed, the slave returns data one bit at a time to


the master along the MISO line. The master reads the bits as they are
received:
05
CAN Bus
What is CAN Bus ? Why do we need it
?CAN (Controller Area Network) :
● is a serial communication protocol used for real-time, reliable
communication in automotive, industrial, and embedded
systems.
● Developed by Bosch in 1986 for reducing wiring in vehicles
● .Multi-master protocol :Each node can send or receive data at
any time.
● Broadcasting protocol :When a node send data ,this data
received by all other nodes.
● Built-in Error detection and Error Handling mechanisms.
● Message based protocol as data sent within a message “Data
frame”.
What is CAN Bus ? Why do we need it
?
A standard CAN node consists of the following three
main parts:
● CAN Controller (MCU with CAN Interface)
● CAN Transceiver
● CAN Bus Interface (Physical Connection)
CAN Bus Physical Layer
● The CAN bus physical layer is responsible for defining the electrical
characteristics of communication between nodes. It ensures robust
and noise-free transmission using differential signaling (CAN_H
(High) ,CAN_L (Low)).
● The CAN transceiver is the interface between the MCU (CAN controller)
and the CAN bus (physical layer) as it Converts digital logic (MCU
TX/RX) into CAN_H and CAN_L differential signals.
How a CAN Transceiver Works
A. Transmission (TX → CAN Bus)
1. The MCU sends a digital signal (TX) to the transceiver.
2. The transceiver converts the digital signal into a differential
voltage across CAN_H and CAN_L.
3. The message is placed onto the CAN bus and received by all
nodes.
A. Reception (CAN Bus → RX)
1. The CAN transceiver reads the differential signals from the
bus.
2. It converts the signal back into a digital format (RX).
3. The MCU reads the data from the transceiver’s RX pin.
CAN Bus Signaling
The bus can exist in two states :
● Dominant (Logic 0)→ Active transmission
● Recessive (Logic 1) → Idle or no transmission
Why Use Dominant & Recessive States?
The dominant-recessive mechanism is crucial for bus arbitration
and collision detection.
CAN Bus Signaling
● Arbitration Process (Deciding Which Node Transmits):
1. If multiple nodes start transmitting at the same time, each
one monitors the bus while sending its message.
2. If a node sends a recessive (1) bit but sees a dominant (0)
bit on the bus, it stops transmitting .
3. This ensures that the node with the highest priority message
( Lowest ID ) always gets the bus first.

● Collision Avoidance as CAN doesn’t allow two nodes to


transmit simultaneously.
CAN Bus Signaling
CAN Bus Frame Structure
● CAN protocol is a message based protocol and each
message has a unique identifier.
● Standard CAN message frame uses an 11 bit message
identifier (CAN 2.0A) which allows up to 2048 messages.
● Extended CAN message frame uses an 29 bit (11 bit base id
+ 18 bit extended id )message identifier (CAN 2.0B) which
allows up to 536,870,912 messages.
CAN Bus Frame Structure
CAN Bus Frame Structure
CAN Bus Communication Process
Message Transmission
● Any node can send data (multi-master).
● Messages are sent continuously until acknowledged.
Arbitration (Priority-based Messaging)
If two nodes transmit simultaneously:
● Node with lower ID wins (dominates).
● The losing node stops and retries later.
Error Handling in CAN
Types of Errors:
● Bit Error – When a transmitted bit doesn't match the
expected bit.
● Stuff Error – When more than 5 consecutive bits of the same
type appear.
● CRC Error – Data corruption detected via CRC check.
● Form Error – Incorrect format detected in a field.
● Acknowledgment Error – No ACK received.

CAN nodes detect and correct errors automatically.


THANK YOU !!
Implementation & more explanation

You might also like