Date post: | 14-Apr-2018 |
Category: |
Documents |
Upload: | dgkanade72 |
View: | 222 times |
Download: | 0 times |
of 64
7/27/2019 Controller Area Network_DGK.pptx
1/64
Controller Area Network
CAN
ByKanade D G
7/27/2019 Controller Area Network_DGK.pptx
2/64
Controller Area Network Invented by Robert Bosch GmbH in 1980 for automotive
applications
Asynchronous Serial Bus
Simple 2-wire differential bus Absence of node addressing
Message identifier specifies contents and priority
Lowest message identifier has highest priority
Non-destructive arbitration system by CSMA with collisiondetection
Multi-master / Broadcasting concept
Sophisticated error detection & handling system
What is CAN ?
7/27/2019 Controller Area Network_DGK.pptx
3/64
The CAN is an ISO standard (ISO 11898) for serialcommunication
Today CAN has gained widespread use:
Industrial Automation
Automotive, etc.
The CAN standard includes:
Physical layer
Data-link layer
Some message types
Arbitration rules for bus access
Methods for fault detection and fault confinement
What is CAN ?
7/27/2019 Controller Area Network_DGK.pptx
4/64
Why CAN?
Mature Standard
CAN protocol more than 25 years
Numerous CAN products and tools in the market
Hardware implementation of the protocol
Combination of error handling and fault confinement with hightransmission speed (up to 1Mb/s)
Simple Transmission Medium
Twisted pair of wires is the standard, but also just one wire willwork
Other links works, too: Opto - or radio links
Excellent Error Handling
CRC error detection mechanism
Fault Confinement
Built-in feature to prevent faulty node to block system
Most used protocol in industrial and automotive world
7/27/2019 Controller Area Network_DGK.pptx
5/64
Example Application of CAN
7/27/2019 Controller Area Network_DGK.pptx
6/64
Introduction
Originally designed for automotive industry
Is a specification for serial network
ISO standard
Used in Embedded Systems
Network established among micro-controllers.
It is two wire, half duplex, high speed network
system .
Well suited for high speed applications using
short messages
7/27/2019 Controller Area Network_DGK.pptx
7/64
Applications
Today CAN has gained widespread use:
Industrial Automation
Automotive
Home Area Networks , etc.
The CAN standard includes
Physical Layer
Data-link layer
7/27/2019 Controller Area Network_DGK.pptx
8/64
7. Application Layer
5. Session Layer
6. Presentation Layer
4. Transport Layer
3. Network Layer
2. Data Link Layer
1. Physical Layer
CAN Protocol
HLPs: CANopen, DeviceNet, OSEK/VDX
Partially Implemented by
High Layer Protocol (HLP)
CANL
ayers
ISO-OSI Reference Model
ISO-OSI Reference Model
7/27/2019 Controller Area Network_DGK.pptx
9/64
Basics of CAN
Transmitter
A node which originates the message.
Remains the transmitter until the bus becomes
idle or loses arbitration.
Any node can start transmitting if the bus is free.
Receiver
A node is called receiver if it is not sending the
message , and bus is not idle.
7/27/2019 Controller Area Network_DGK.pptx
10/64
Basic Concepts
Message: Information on the bus sent in fixed
format message of different but limited length
Message Routing: Each message is named by
an IDENTIFIER
The IDENTIFIER does not indicate the destination
of the message, but describes the meaning of the
data, so that all nodes in the network are able todecide by MESSAGE FILTERING whether the data is
to be acted upon by them or not.
7/27/2019 Controller Area Network_DGK.pptx
11/64
Concepts
Multicast: As a consequence of the concept of
MESSAGE FILTERING any number of nodes can
receive and simultaneously act upon the same
message.
Priorities: The IDENTIFIER defines a static
message priority during bus access.
Remote Data Request: A node requiring data
may request another node to send the
corresponding DATA FRAME.
7/27/2019 Controller Area Network_DGK.pptx
12/64
Arbitration
Arbitration: If two or more units start
transmitting message at the same time, the
bus access conflict is resolved by bitwise
arbitration using the IDENTIFIER.
The mechanism of arbitration guarantees that
neither information nor time is lost.
7/27/2019 Controller Area Network_DGK.pptx
13/64
Physical Layer
CAN transmits signals on the CAN bus whichconsists of two wires, a CAN-High and a CAN-Low.
Two wires operate in differential mode (carrying
inverted voltages) to decrease noise interference
Optical fibres are also used.
Must support bit dominance.
The low bits are always dominant
If one node tries to send a low and another node tries to
send a high, the result on the bus will be low
7/27/2019 Controller Area Network_DGK.pptx
14/64
Controller CAN
Controller
CAN
Transceiver
CANB
us
CAN_H
CAN_L
TXD
RXD
CAN Bus is a simple 2-wire differential serial bus
CAN Bus is terminated on each side by a 120 Ohm resistor
Typical CAN Node
7/27/2019 Controller Area Network_DGK.pptx
15/64
CAN Physical Layer
Differential
Bus Driver
Optical
Transmitter
Receiver
CAN_Txd
CAN_Rxd
Physical CAN Bus Differential e.g.
Twisted Pair
CAN_Txd
CAN_Rxd
Optical
Fiber
120 ohm Rresistor
120 ohm Rresistor
7/27/2019 Controller Area Network_DGK.pptx
16/64
Node 1 Node 2 Node 3 Bus
D D D D
D D r D
D r D D
D r r D
r D D D
r D r D
r r D D
r r r r
1 Recessive (r)
0 Dominant (D)
Two logic states on the CAN bus
Bus in dominant state
Wired-AND Function
Bus in recessive state
or idle
CAN Bus Logic
7/27/2019 Controller Area Network_DGK.pptx
17/64
Bit Encoding
Non-return to Zero-Level Two different voltages for 0 and 1 bits
Voltage constant during bit interval
No transition i.e. no return to zero voltage
Absence of voltage for zero, constant positive voltagefor one.
More often, negative voltage for one value andpositive for the other
This is NRZ-L
Fewer transitions (on average): less EMI, butrequire less oscillator drift.
7/27/2019 Controller Area Network_DGK.pptx
18/64
Bit Coding : NRZ (Non-Return-To-Zero code) does not
ensure enough edges for synchronization Stuff Bits are inserted after 5 consecutive bits of the
same level
Stuff Bits have the inverse level of the previous bit.
No deterministic encoding, frame length depends ontransmitted data
Number of consecutive bits
with the same polarity
CAN Bit Coding & Bit Stuffing
7/27/2019 Controller Area Network_DGK.pptx
19/64
Types of Frames
Communication is performed using the following
five types of frames.
Data frame Remote frame
Error frame
Overload frame Interframe space
7/27/2019 Controller Area Network_DGK.pptx
20/64
Of these frames, the data and the remote
frames need to be set by the user.
The other frames are set by the hardware part
of CAN.
The data and the remote frames come in two
frame formats: standard and extended.
The standard format- 11-bit ID,
The extended format - 29-bit ID.
Types of Frames....
7/27/2019 Controller Area Network_DGK.pptx
21/64
Frame Types and Roles of Each FrameFrames Roles of Frames User Settings
Data frame This frame is used by transmit unit to send
message to the receive unit
Necessary
Remote Frame This frame is used by the receive unit to
request transmission of message that has
the same ID from the transmit unit
Necessary
Error frame When error is detected, this frame is used tonotify other units of the detected error
Unnecessary
Overflow frame This frame is used by the receive unit to
notify that it has not been prepared to
receive frame yet
Unnecessary
Interframe space This frame is used to separate a data or
remote frame from preceding frame
Unnecessary
7/27/2019 Controller Area Network_DGK.pptx
22/64
Structure of Data Frame
7/27/2019 Controller Area Network_DGK.pptx
23/64
Data Frame
The data frame is used by the transmit unit to send a
message to the receive unit, and is the most fundamental
frame handled by the user.
The data frame consists of seven fields.
(1) Start of frame (SOF) This field indicates the beginning of a data frame.
(2) Arbitration field
This field indicates the priority of a frame.(3) Control field
This field indicates reserved bits and the number ofdata bytes.
7/27/2019 Controller Area Network_DGK.pptx
24/64
Data Frame
(4) Data field This is the content of data. Data in the range 0 to
8 bytes can be transmitted.
(5) CRC field
This field is used to check the frame for atransmission error.
(6) ACK field
This field indicates a signal for confirmation that
the frame has been received normally.(7) End of frame
This field indicates the end of a data frame.
7/27/2019 Controller Area Network_DGK.pptx
25/64
Data Frame
Start of Frame(SOF)
This field indicates the beginning of a frame.
It consists of one dominant bit.
7/27/2019 Controller Area Network_DGK.pptx
26/64
Data Frame
Arbitration field:-This field indicates the priority ofdata.
7/27/2019 Controller Area Network_DGK.pptx
27/64
Data frame : Arbitration field
The standard format ID consists of 11 base ID
bits (ID28ID18). These ID bits are transmitted
sequentially beginning with ID28.
The 7 high-order bits cannot all be recessive.
IDs set to 1111111XXXX are prohibited.
Up to 2,032 discrete IDs can be set.
In no case can multiple units on the bus transmit
data frames with the same ID at the same time.
7/27/2019 Controller Area Network_DGK.pptx
28/64
Data FrameControl fieldThis 6-bit field indicates the number of data bytes in a
message to be transmitted.
7/27/2019 Controller Area Network_DGK.pptx
29/64
Continued.
7/27/2019 Controller Area Network_DGK.pptx
30/64
Data Frame
Data field (common to both standard and extended formats)This field indicates the content of data.
Zero to 8 bytes of data set in the control field can be
transmitted.
The data is output beginning with the MSB side.
7/27/2019 Controller Area Network_DGK.pptx
31/64
Data Frame
CRC field (common to both standard and extended formats)This field is used to check the frame for a transmission error.
It consists of a 15-bit CRC sequence and a 1-bit CRC delimiter
(separating bit).
7/27/2019 Controller Area Network_DGK.pptx
32/64
Data Frame: CRC field
CRC sequence
The CRC sequence consists of a CRC valuegenerated by the polynomial
P(X) = X15 + X14 + X10 + X8 + X7 + X4 + X3 + 1
The CRC calculation range includes The start of frame, arbitration field, control field, and
data field.
On the receive unit side too, a CRC value is calculatedin the same range of fields.
The calculated CRC and the received CRC sequenceare compared, and if they do not match, an error isassumed.
7/27/2019 Controller Area Network_DGK.pptx
33/64
Data FrameACK field
This field indicates a signal for confirmation that the framehas been received normally.
It consists of 2bits, one for ACK slot and one for ACK
delimiter.
7/27/2019 Controller Area Network_DGK.pptx
34/64
Data Frame: ACK Field
ACK field of the transmit unit
The transmit unit sends the ACK slot and ACK
delimiter in recessive bits.
ACK field of the receive unit
The receive unit that has received a correct
message sends a dominant bit in the ACK slot of
the received frame to notify the transmit unitthat it has finished receiving normally. This is
referred to as sending ACK or returning ACK.
7/27/2019 Controller Area Network_DGK.pptx
35/64
Data Frame
End of frame
This field indicates the end of a frame. Itconsists of 7 recessive bits.
7/27/2019 Controller Area Network_DGK.pptx
36/64
Remote Frame
Difference Between Data Frame &
7/27/2019 Controller Area Network_DGK.pptx
37/64
Difference Between Data Frame &
Remote Frame
The remote frame does not have a data field, and that theRTR bit in its arbitration field is of a recessive level.
The data frame without a data field and the remote framecan be discriminated by the RTR bit.
What does the data length code of the remote frame thathas no data fields indicate?
It indicates the data length code of the corresponding dataframe.
For what is the data frame without a data field used?
For example, this data frame may be used by each unit toconfirm or respond for connection periodically, or to placereal information in the arbitration field itself.
7/27/2019 Controller Area Network_DGK.pptx
38/64
Error Frame
Error flag
There are two types of error flags:
Active-error flag: 6 dominant bits
Passive-error flag: 6 recessive bits
O l d F
7/27/2019 Controller Area Network_DGK.pptx
39/64
Overload FrameThe overload frame is used by the receive unit to notify
that it has not been prepared to receive frames yet.It consists of an overload flag and an overload delimiter.
(1)Overload flag - 6 dominant bits.
(2)Overload delimiter - 8 recessive bits.
Error flag overlapping
Depending on timing as for the error flag, overload flags may overlap
one on top of another, up to 12 bits in total length.
I t f S
7/27/2019 Controller Area Network_DGK.pptx
40/64
Interframe Space
Used to separate the data and the remote frames
Are separated from the preceding frame by an inserted
Interframe space
Continued
7/27/2019 Controller Area Network_DGK.pptx
41/64
Continued.(1) Intermission
Consists of 3 recessive bits.
If a dominant level is detected during an intermission, anoverload frame must be transmitted. However, if the thirdbit of an intermission is of a dominant level, theintermission is recognized as the SOF.
(2) Bus idle
Consists of a recessive level. There are no limitations on itslength (it can be zero bits in length).
While in this state, the bus is thought to be free, and anytransmit unit can start sending a message.
(3) Suspend transmission (transmission pause period) Consists of 8 recessive bits.
This field is included in only an interframe space if theimmediately preceding message transmit unit was in an
error-passive state.
7/27/2019 Controller Area Network_DGK.pptx
42/64
Priority Resolution by Arbitration
7/27/2019 Controller Area Network_DGK.pptx
43/64
Priority of data and remote frames
7/27/2019 Controller Area Network_DGK.pptx
44/64
CAN Message Format
SOF: Start Of Frame
CRC: Cyclic Redundancy Code
ACK: Acknowledge
EOF: End of Frame
IFS: Inter Frame Space
DATA Frame
Message Field Details
7/27/2019 Controller Area Network_DGK.pptx
45/64
Message Field Details
ARBITRATION FIELD
The ARBITRATION FIELD consists of the IDENTIFIER andthe RTR-BIT
The IDENTIFIERs length is 11 bits (std Message),29 bitsfor extended frame.
Lower value implies higher priority
CONTROL FIELD
The CONTROL FIELD consists of six bits. It includes theDATA LENGTH CODE and two bits reserved for futureexpansion.
DATA FIELD
The DATA FIELD consists of the data to be transferred
within DATA FRAME. It can contain 0 to 8 bytes
7/27/2019 Controller Area Network_DGK.pptx
46/64
Field Details
CRC FIELD
Contains the CRC SEQUENCE followed by a CRC
DELIMITER(15 bits)
ACK FIELD
END OF FRAME
EACH DATA FRAME and REMOTE FRAME is
delimited by a flag sequence consisting of 7
recessive bits.
Arbitration Mechanism
7/27/2019 Controller Area Network_DGK.pptx
47/64
Arbitration Mechanism CAN is multi master network
It uses CSMA/CD + AMP (Carrier Sense MultipleAccess /Collision Detection with Arbitration on
Message Priority)
Network nodes transmits synchronously
All nodes start sending their identifier fields at the
same time.
If node hears a dominant bit in the identifier when it
tries to send recessive bit, it stops transmitting It stops transmitting, letting the other node, with a
higher priority message, continue uninterrupted.
A bi i
7/27/2019 Controller Area Network_DGK.pptx
48/64
Arbitration
Two nodes on the network are not allowed tosend message with the same id
If two nodes try to send a message with same id at
the same time arbitration will not work.
One of the transmitting nodes will detect that his
message is distorted outside arbitration field.
The nodes will then use the error handling of CAN,
which in this case ultimately will lead to one of thetransmitting node being switched off ( bus-off
mode).
7/27/2019 Controller Area Network_DGK.pptx
49/64
Remote frames
Remote frames can be described as a requestfor information.
A frame with the RTR bit set means thetransmitting node is asking for information of the
type given by the identifier A node which has the information available should
then respond by sending the information onto thenetwork.
Depending on the implementation of the CANcontroller the answer may be sentautomatically.
7/27/2019 Controller Area Network_DGK.pptx
50/64
Remote Transfer Frame
SOF Arbitration
Field
Control
FieldCRC
Field
ACK
Field
EOF
Remote FrameInter frame Space Inter frame Space
Or Overload Frame
Or Error Frame
7/27/2019 Controller Area Network_DGK.pptx
51/64
Error Control
CAN bus is very reliable. The error control, signaling and fault confinement
defined in the CAN standards
Data Link layer functionality
The information is correct and consistent
The built in error detection of the controllers
together with the error signaling .
Faulty nodes will go to modes where they do
not disturb the traffic on the bus.
7/27/2019 Controller Area Network_DGK.pptx
52/64
The CAN Error Process
The error is detected by the CAN controller ( a transmitter or a receiver).
An error frame is immediately transmitted.
The message is cancelled at all nodes.
The state of CAN controllers are updated
The message is re-transmitted.
If several controllers have messages to send ,
normal arbitration is used.
7/27/2019 Controller Area Network_DGK.pptx
53/64
Error Detection
Error detection is handled automatically by
the CAN controller. The detected errors are
Bit Errors
Bit stuffing errors
Receiving node detects Bit stuffing violation
Bit Errors
Transmitting node detects the bit on the bus is notwhat it has sent and which is not a part arbitration field
or ack field
7/27/2019 Controller Area Network_DGK.pptx
54/64
Message Errors
Checksum Error
Receiving node checks CAN message for checksum
error
Frame Error
Error will be flagged if receiver not finds
predefined bit value at certain point within CAN
frame Acknowledgement Error
Transmitter determines that message has not
been acknowledged and ACK error is flagged
7/27/2019 Controller Area Network_DGK.pptx
55/64
CAN Controller Modes Error active
Normal operating mode for a controller
Messages can be received and transmitted
On detecting an error an active error flag is sent
Error passive
A mode entered when the controller has frequent problems intransmitting or receiving messages
Messages can be received and transmitted
On detecting an error while receiving, a passive error flag issent
Bus off
Entered if the controller has serious problems withtransmitting messages.
No messages can be transmitted or received until the CAN
controller is reset by host microcontroller or processor.
7/27/2019 Controller Area Network_DGK.pptx
56/64
Error States and Counter Values
E St t f U it
7/27/2019 Controller Area Network_DGK.pptx
57/64
Error States of a Unit
E Si li
7/27/2019 Controller Area Network_DGK.pptx
58/64
Error Signaling When error is detected by a node it sends an error flag
on the bus This prevents any other node from accepting the message
and ensures consistency of data throughout the network
The active error flag consists of six low bits and is usedif the node transmitting the error frame is in active
error state.
As low is dominant all other nodes will detect bit stuffing
violation and send their own error flag
After this, nodes that want to transmit(including the
one sending the interrupted message) will start to do
so.
Error Signaling
7/27/2019 Controller Area Network_DGK.pptx
59/64
Error Signaling
If the CAN controller is in error passive mode the
error frame will consists of six passive(high) bits. Since the error flag consists of passive bits, the bus is not
affected.
If no other node detected an error, the message will be
sent un interrupted.
This ensures that a node having problems with receivingcan not block the bus
All of this advanced error handling is doneautomatically by CAN controller, without any needfor the host microcontroller to do anything. This isone of the biggest advantages.
7/27/2019 Controller Area Network_DGK.pptx
60/64
Error frame
Error Frame
Error Flag
Superposition of Error Flag
Data Frame
Interframe
Space or
Overload
Frame
Error Delimiter
Basic CAN Controller
7/27/2019 Controller Area Network_DGK.pptx
61/64
Basic CAN Controller
Interesting messages are filtered out using two registers, thatoperate on the message identifier. Each bit in the identifierare checked against the filter. If the message matches the
filter it is stored in one of the receive buffer.
Bus
Interface
CAN
Protocol
Controller
Acceptance
Filtering
Data ControlRegister
Transmit
Buffer
Receive
Buffering
Host
Inte
rface
Main
Controller
CAN
Bus
Higher Layer Protocol
7/27/2019 Controller Area Network_DGK.pptx
62/64
Higher Layer Protocol
The CAN protocol defines only the physical andlow data link layers.
The HLP defines:
Start-up behavior
Definition of message identifiers for the different nodes
Flow control
Transportation of messages greater than 8-bytes
Definition of contents of data frames Status reporting in the system
Some HLP:CANopen, DeviceNet, SAE J1939 (Heavy
vehicles)
CAN Applications
7/27/2019 Controller Area Network_DGK.pptx
63/64
CAN Applications Building Automations
Heating control, Air conditioning(AC), Security(fire,
burglar), Access control, Light control Domestic & Food distribution appliances
Washing machines, Dish cleaner, self service bottledistributors connected to internet.
Automotive & Transportation Dash board electronics, Comfort electronics
Production Automation Control and link of production machines, production control,
Tool machines. Medical
Agriculture Harvester Machines Seeding/Sowing machines, Tractor control, Control of live
stock breeding equipment.
7/27/2019 Controller Area Network_DGK.pptx
64/64
Thank You