CAN BUS in
Automotive systems
Raziuddin khazi
Chemnitz University of Technology
Embedded Systems
Second Semester
Contents
• Introduction
• CAN requirements
• CAN frame format
• CAN bit stuffing
• CAN OSI layers
Physical layer
Data link layer
• Advantages
• CAN vs Flexrays
• References
2 2
Introduction
• CAN was dedicatedly developed for automobile in the 1980’s, today CAN
chips are manufactured by Motorola, Intel, Phillips etc.
• Half duplex, Message based protocol that overtook Ethernet and USB
because of its price to performance ratio & simple hardware.
• ISO-11898 is the CAN standard, CAN2.0A – 11 bit identifier and CAN2.0B
-29 bit identifier.
• High speed CAN - 1Mbps(suspension , engine control ) and Low speed
CAN – 125kbps(power window, wiper control).
Continued..
3
Introduction
Typical CAN bus
Source: http://processors.wiki.ti.com
4
CAN requirements
• Twisted pair cable eliminate the electromagnetic interference.
• Recommended to have maximum 30 nodes with 120 ohm termination .
• According to the ‘rule of thumb’, signal rate * length <= 50
Bus length in Signal rate in
meters Mbps
40 1
100 0.5
500 0.10
1000 0.05
Source : http://digital.ni.com Source : www.esp elecrtonics.com
5
CAN frame format
Source: https://en.wikipedia.org
Arbitration : When multiple nodes access the bus same time, the node
with least arbitration wins.
RTR : When RTR = ‘1’ then it is remote frame, otherwise data frame.
IDE : Select standard CAN when ‘0’ and extended CAN when ‘1’
Continued..
6
CAN frame format
Source: http://canbus.pl
Continued..
7
CAN frame format
• DLC: Data length code(4 bits) contains number of bytes of data being transmitted.
• DATA: up to 64 bits (8 bytes) of data can be transmitted.
• CRC: 16 bit cyclic redundancy check detects the transmission error.
• ACK: Dominant bit(0) after receiving correct data, otherwise writes recessive bit(1).
• EOF: Marks the end of frame and disable the bit stuffing .
• IFS: Inter frame space is the time required to move correctly received frame to
message buffer area.
8
CAN bit stuffing
Stuff error:
Active error:
• It has six ‘0’s & eight ‘1’s, For every active error count increments by 8 and rest all
receiving nodes increments by 1.
Passive error:
• Do not block bus traffic but keeps counting, if count is beyond 256 it results into bus
off error.
Bus off error:
• Internally disconnects the node and only re-initialization can solve the issue.
Bit stuffing :
• Transmitter adds the opposite level bit on detecting 5 consecutive same level bits,
and receiver discard the stuffed bit when receiving.
9
CAN OSI : Physical layer
• Physical layer can only be implemented on hardware.
• When transmitting it converts 1’s and 0’s into electrical signal and back again to
bits when receiving.
Source: http://www.ti.com/product/SN65HVD231/datasheet
Continued..
10
CAN OSI : Datalink layer
• It can be implemented both on hardware and software.
• Carrier Sense: Nodes checks the bus status, if the bus is idle then accesses it
otherwise wait.
• Multiple Access/CD+ AMP: Avoid collision when multiple nodes access the bus
same time.
CSMA/CD+AMP explained Source: http://canbus.pl
11
Advantages
• CAN is multi master capable communication.
• Reduce the wiring complexity between nodes.
.
• Error detection and correction capability.
• Easy interface with other protocol.
• High speed up to 1Mbps .
Source: www.ixxat.com
12
CAN vs Flex ray
Properties CAN bus Flex ray
Standard ISO-11898 ISO-17458
Max speed 1 Mbps 10 Mbps
Topology Bus Bus and Star
Cost Low High
Source : https://en.wikipedia.org/
13
References
[1] Controller area network and its applications , Akshay Rane, Ajit schendge,
Volume 4, Issue 3 March 2014.
[2] A novel bit stuffing technique for controller area network(CAN) protocol,
Tapas ranjan, Ayas kant and kamala kant , 978-1-4799-2206-2/14, 2014
[3] Introduction to controller area network by Texas Instruments
http://www.ti.com/lit/an/sloa101b/sloa101b.pdf (accessed on 8-06-2017)
[4] CAN hardware software manual by National instruments
http://www.ni.com/pdf/manuals/370289g.pdf (accessed on 8-06-2017)
[5] http://hem.bredband.net/stafni/developer/CAN.htm (accessed on 6-06-2017)
[6] https://www.kvaser.com/about-can/the-can-protocol/can-physical-layers/
(accessed on 6-06-2017)
14
THANK YOU