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

CAN Protocol

The document provides an introduction to the Controller Area Network (CAN) protocol, detailing its purpose, features, and applications primarily in the automotive domain. It highlights the protocol's asynchronous communication, message-based structure, and comparison with other communication protocols, emphasizing its robustness against electrical noise and short latency. Additionally, it describes the types of CAN frames and the acknowledgment method used in the protocol.
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)
5 views

CAN Protocol

The document provides an introduction to the Controller Area Network (CAN) protocol, detailing its purpose, features, and applications primarily in the automotive domain. It highlights the protocol's asynchronous communication, message-based structure, and comparison with other communication protocols, emphasizing its robustness against electrical noise and short latency. Additionally, it describes the types of CAN frames and the acknowledgment method used in the protocol.
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/ 27

Introduction to CAN Protocol

AGENDA

 What is CAN protocol


 Why CAN protocol
 Where is CAN protocol used
 Compare CAN protocol to similar protocols
What is CAN?
Controller
Area
Network

Nodes
Network
ECUs
Speed
Length
Data
Why CAN?
Automotive Domain needed a way for all ECUs to communicate the data
among themselves.

Communication could be started by any node – Asynchronous|Multimaster

Highly immune to electrical noise – Dual twisted pair

Short latency period – Small frame size (8bytes data)


Comparing CAN with other protocols
CAN Features
1) CAN Speed
2) CAN Data
3) CAN Bus
4) CAN Logic
5) CAN Controllers and Transceivers
6) CAN Network Topology
CAN Speed
 CAN frames can go up to 1mbps speed with the bus length at max of 40 mts.
 As the bus length increases above the maximum speed reduces.
 In industry usually the CAN is configured at 500kbps speed

 Lets say the baud rate is 500kbps  In 1 second, 500 *1000 bits can be transmitted
 Lets say a single frame takes about 125 bits for example (without stuffing 111 bits)
 So in a second the bus can fit around 2000 (500k /125) frames
Data Limit
Application 1 Application 2

frame Data

ECU 1 ECU 2

 Frame has 2 parts: PCI and Data


 As per CAN protocol How much data can be sent in each frame?  8 Bytes
 Is the data size variable?  Yes we can have 0 bytes or 1 byte or 2 bytes etc. Max is 8 bytes.
 Is it possible to have data in bits?  No. Its in bytes. We cant have 2 bit or 27 bits etc its
always in bytes.
CAN Bus

120 ohm
Can High Can Low

 CAN bus is a Dual-Twisted pair wires called CanHigh and CanLow


 Differential Voltage Logic CAN_H CAN_L Delta V
 Logic1 = Recessive bit
 Logic0 = Dominant bit
Logic 1 2.5v 2.5v 0
Logic 0 3.5v 1.5v 2

 Why twisted pair?  Noise Immunity


 Terminated with 120 ohm resistor  Impedance matching

Micro controllers work with TTL and not CAN logic


CAN Network Topology
CAN Properties
Wired – Wireless
Serial – Parallel
Synchronous – Asynchronous
Peer2Peer – Broadcast
Message Based Protocol
Message Filtering
Simplex – Half Duplex – Full Duplex
Acknowledgement method
CSMA-CA Protocol
Temporary and Permanent Node failures
Wired and Wireless Communication
 Telephone is Wired and Mobile is
wireless

 Wireless Protocols
• Bluetooth,
• WIFI

 Wired Protocols
• Ethernet
• CAN

When we go for Wired and when we go for


Wireless?

CAN is a Wired Protocol – Bus Topology


Serial and Parallel Communication
How many bits can the bus carry
simultaneously
N = 1  Serial communication
N > 1  Parallel communication

Parallel Bus: Data Bus, Address Bus etc within


microcontroller

Serial Bus: SPI, LIN, I2C etc

CAN is SerialBus protocol with MSB going first


Synchronous & Asynchronous
Here the Time factor comes in. At what point of time can a node start
transmitting the frame on the Bus.

Synchronous: If a node has a frame to transmit, then it has to wait till its slot.
The time units are quantized and Nodes can transmit at particular point of
time only. Here all the nodes are in synch always and hence the name. Tx and
Rx nodes are synchronized with respect to time or clock. Eg: SPI, Flexray

Asynchronous: If a node has a frame to transmit, then it can initiate the


transmission at any time. The nodes (Rx and Tx) will be synchronized based
on the frame itself and no separate clock signal is needed.

CAN is a Asynchronous Communication Protocol


Peer to Peer & Broadcast
 Peer-to-Peer is like mobile phone and Broadcast is like FM Radio.

 Example of Peer-to-Peer protocols: Ethernet which uses Switch, SPI which uses CS.

 Example of Broadcast protocols: CAN, Flexray

CAN Protocol is a Multicast (Similar to Broadcast) type.


Message Based Protocol
 CAN protocol is message based protocol and not Node based protocol.

 Each CAN frame is identified with Message ID and no info about the Tx or Rx node.

 Node based Can be understood with mobile phones. Usually Peer-Peer are node based.

 Since CAN is multicast, It is message based protocol.

 Message ID has 3 purpose:


• Identify the Data carried by the frame
• Decides the message Priority and hence decides which frame gets the bus if clash
happens.
• Used in Message Filtering
Message Filtering

 Node D is transmitting the frame. Node A,B, C are getting the Message. Node A and B filters
the message IN and Node C Filters message Out
 Filtering of Frame happens depending on Message ID.
 Message filtering happens within CAN controller hardware using 2 configured parameters
called as mask and filter.
Simplex – Half Duplex – Full Duplex

CAN Protocol is a Half-Duplex Communication.


Acknowledgement Method

 CAN has a beautiful acknowledgement method


 There is no separate acknowledgement frame
 In every frame, there is a special Acknowledgement
field where The Receivers will acknowledge proper
reception of data to them.
 SO Ack is achieved without increasing the Bus load.
 This concept will be clear when frame format will be
explained
CSMA-CA Protocol
CSMA-CA stands for Carrier Sense Multiple Access Collision Avoidance Protocol

I have a data to transmit


Listen to bus if any ongoing Tx CSMA
If free then only transmit

CA CD CR
BUS

In CSMA : A transmitter attempts to determine whether another transmission is in progress


before initiating a transmission using a carrier-sense mechanism

CA: Collision Avoidance  Doesn’t let collision happen between its frames
CD: Collision Detection  If collision happens between the frames, it is detected and a proper action taken.
CR: Collision Resolution  If collision happens between frames, its resolved in that instance only successfully.
Temporary and Permanent Node Failures
 Temporary Node failure is when the current ongoing frame is
destroyed by the node.

 Permanent Node failure is when the node withdraws itself from


the BUS communication. No Tx No Rx.
Types of CAN Frames
CAN protocol has 4 types of frames.
Data Frame
Remote Frame
Error Frame
Overload Frame
Data Frame
Frame carrying the data from transmitter node to all receiver nodes.

Serves the main purpose of CAN protocol

Two types of Data Frames


 Standard Frame : 11 bit message ID
 Extended Frame : 29 bit message ID {split as 11 bit Base ID + 18 bit ID Extension}

In CAN when we are normally talking of frames, we are referring Data
frames only.
Remote Frame
 Frame Requesting for a Data Frame

 A node wants a particular Data frame, so It sends the Remote frame with same
Message ID on the Bus.

 This remote frame is followed by the Data frame on the bus transmitted by the node
who owns that data frame.

 Hence Remote frame sending node got the data it requested for.

 Now a days Remote frame is obsolete and not used in CAN protocol.
Error Frame
 Error Frame signals an error condition in the data frame being transmitted currently.

 If a node detects an error in the data frame being transmitted on the bus currently,
then it destroys that data frame and signals all other nodes by transmitting a error
frame.

 The error can be detected by any of the receiver nodes or the transmitter node.
Overload Frame
Overload frame is transmitted by a node when it is overloaded and needs
some time to process the data frame received previously.

Overload frame format is same as that of an error frame.

Strategy is that since the overloaded node needs some time so it buys that
time by keeping the bus busy with its overload frame preventing other
nodes to start transmitting data frames.

Maximum of 3 consecutive overload frames can be transmitted by each


node after a data frame.
Standard Data Frame Format

Refer : https://images.app.goo.gl/HyeBWwdpXUeRLVg18

You might also like