You are on page 1of 8

DESIGN OF CONTROL AREA NETWORK PROTOCOL

P.Sasipriya1, P.Thenmozhi2 and R.lakshmi3


1
Student, Department of ECE Gnanamani College of Technology, Pachal, Namakkal.
2.3
Assistant Professor2, Department of ECE Gnanamani College of Technology, Pachal, Namakkal.
Abstract-German automotive system supplier Robert Bosch was invented the concept of Controller
Area Network (CAN) in the mid-1980s for automotive applications as a method for enabling robust
serial communication. The goal was to make automobiles more reliable, safe and fuel-efficient while
decreasing wiring harness weight and complexity. Since its inception, the CAN protocol has gained
widespread popularity in industrial automation and automotive/truck applications. Other markets where
networked solutions can bring attractive benefits like medical equipment, test equipment and mobile
machines are also starting to utilize the merits of CAN.
Keywords: CAN, Network mobile machine, Bit stuffing, SOF.LANGUAGE USED - VHDL TOOLS
REQUIRED
Simulation: ModelSim XE III 6.4b.
Synthesis: XiLinx ISE 10.1.
I. INTRODUCTION OF CAN
Controller Area Network (CAN) is a network protocol which allows multiple nodes in a system
to communicate efficiently with each other. It is a serial communication bus for real time applications
which operates at a data rate of 1Megabits per second. CAN is event triggered and not time triggered
and is more suitable for a periodic communication. Communication through CAN is very reliable and
robust, thus used in noisy environments.CAN is widely used for Automotive Applications to replace the
complex wiring problems. Nowadays CAN bus is used for in-car electronics, aerospace, ships, medical
electronics and also in Textile machineries.
II. HISTORY OF CONTROLLER AREA NETWORK
Robert Bosch introduced CAN to be used in Automotive Application in order to reduce the
complex wiring problems inside passenger cars. Most of the cars which are manufactured since 1980’s
uses CAN as a standard for in vehicle communication.

CAN is documented as an International standard as ISO11898 for high speed applications and
ISO11519 for low speed applications. To discuss the growth of CAN several user groups have been
formed. One of the first is CAN in Automation (CiA). Now in its 20th year CAN is still enhanced. In the
future CAN would be used in every type of embedded systems and machines.
OSI Model

The Open System Interconnection Model is a reference to how messages are transferred in a
network. All the communication protocols including CAN follows this standard.

When a message is transmitted through a communication network, it is being processed by all


the seven Layers of the OSI model. The top layer is the Software or Hardware Application which is

DOI:10.21884/IJMTER.2017.4352.C180W 109
International Journal of Modern Trends in Engineering and Research (IJMTER)
Volume 04, Issue 11, [November– 2017] ISSN (Online):2349–9745; ISSN (Print):2393-8161

trying to send the message through the network. The seven layers in the OSI model is shown in the
following figure.

Figure.1.CAN Bus OSI Model


CAN and the OSI Model
Many communication bus protocols do not use all the seven layers of this OSI Model. Since
CAN is a closed network it doesn’t need to have security and to present the data in a user interface. Also
it does not need to maintain sessions and logins. Hence it uses only two Layers such as Physical and
Data Link Layer. The CAN OSI model shown in figure1explains the transfer of data between two nodes.

Figure 2.Two Layers of CAN


The Physical Layer ensures the physical connection between the nodes in the successful network.
The Data Link layer contains Frames and information to identify the frames and errors. It has
information also to determine the bus access.
III. OPERATION OF CAN
CAN is a bit stream oriented communication protocol through which the complete transmission
of message is carried stand alone by the CAN controller. CAN is a broadcast communication system in
which the message frames which are transmitted on the bus do not have any source or destination
addresses. Instead the Frames have identifiers with which the nodes which receive the messages can run
an acceptance test (filtering) to make sure whether to accept the corresponding message or to ignore it.
The Identifier has information about the content of data inside the frame and also the priority of the
message. Higher the priority, lower the number. The length of the Identifier is normally 11bits (Standard
CAN) and the second generation CAN have an Identifier 29 bits (Extended CAN).

1. Bus Arbitration

@IJMTER-2017, All rights Reserved 110


International Journal of Modern Trends in Engineering and Research (IJMTER)
Volume 04, Issue 11, [November– 2017] ISSN (Online):2349–9745; ISSN (Print):2393-8161

CAN use “Carrier-Sense Multiple Access with Collision Avoidance“ (CSMA/CA) for the bus
access. Every node in the network can access the bus when the bus is free for 3 bit period. In case of
collision, the message with a higher priority wins the bus access and transmits. If more than one node
tries to send data through the bus, then the bus access is decided by a bitwise arbitration. The nodes
which needs to send the message transmits the message bits at the same time. The node which sends a
dominant (0) bit will gain the access on the bus there on. The other node which sends a recessive (1) bit
changes its state to a receiver and starts to receive the message frame which is on the bus. The
transmission of lower priority message is stalled and transmitted again automatically when the bus is
free.
The message contains 0-8 bytes of date which is specified as Data Length Code (DLC) in the
Control Bits of the message frame. For the error detection a 15 bit checksum is transmitted along with
the message.
2. Bit Stuffing
The receiving node synchronises itself with every start bit of the message. CAN uses a technique
called Bit stuffing to have the proper communication of the messages. After every consecutive bit levels,
the transmitter will automatically stuff a bit of opposite polarity in to the bit stream. The receiver of the
message will automatically destuff (delete) this stuff bit. So if any receiving node detects six consecutive
bits of the same level, then a stuff error is flagged. Theoretically for every 5 bits a stuff bit is sent by the
sender. On an average every message has 3 to 4 stuff bits.

Figure.3. Bit Stuffing(CAN-Frame before and after the addition of stuff bits (in purple))
The CAN controller of every receiving node checks the message format and also the checksum.
It sends an acknowledgement or Error frame within the Acknowledge and EOF (End of Frame) fields in
the frame. In case of an error frame, the received message is ignored by all the nodes in the network.
The sender will automatically try to send the message later on the bus.
3. Bit timing
The nominal bit timing is the time needed to transmit a bit across the network. All the nodes in
the network should have the same bit rate. That is why the synchronisation is being done in several
ways.

@IJMTER-2017, All rights Reserved 111


International Journal of Modern Trends in Engineering and Research (IJMTER)
Volume 04, Issue 11, [November– 2017] ISSN (Online):2349–9745; ISSN (Print):2393-8161

Maximum transmission time for a message with 8 data bytes and of higher priority is 225 micro
seconds. And with 29 bit identifier is 260 micro seconds. Therefore the maximum data rate is 35KB/sec
for 11 bit identifier and 30KB/sec for 29 bit identifier.

Figure 4. An example CAN bit timing with 10 time quanta per bit
IV. CAN IMPLEMENTATIONS
In CAN there are two main Hardware Implementations, they are Basic CAN and Full CAN.
1. Basic CAN
Basic CAN has only one Message buffer for Receive and Transmit messages. The received
message is accepted or ignored after acceptance filtering. The decision to process a message or to
ignore it is also achieved by acceptance filtering. This acceptance filtering of the node is done by
software in Basic CAN. To reduce the software load at the nodes, there is a possibility to ignore some
messages by ignoring specific identifiers. This is realized by bit mask for the message identifiers.
2. Full CAN
In Full CAN, there are 8 to 16 memory buffers for every transmitted or received message. Here
the acceptance filtering is done by hardware and not by the
software. Every buffer can be configured to accept messages with specific ID’s.
Since the acceptance filtering is done by hardware, the software load is greatly reduced.
Different messages ensures more time for the processing of the received messages and the
transmitted message can be handled according to the priority levels. Configuring each buffer for every
message ensures also the data consistency in Full CAN.
3. Message Frame Formats
CAN systems have four different types of frame formats
1. Data Frame
2. Error Frame
3. Remote Frame
4. Over load Frame.

Figure:5. The standard CAN frame format


4.1. Data frame:
This is a common message frame used to transfer date over the network. Data frame consists of
Arbitration field (ACK), Control field with control information, Data field and CRC field for error

@IJMTER-2017, All rights Reserved 112


International Journal of Modern Trends in Engineering and Research (IJMTER)
Volume 04, Issue 11, [November– 2017] ISSN (Online):2349–9745; ISSN (Print):2393-8161

detection and the Acknowledgement field. The arbitration field contains the Message Identifier which is
used to determine the priority of the message when two nodes compete to gain access of the bus. The
arbitration field contains 11 bit Identifier for CAN 2.0A with RTR bit and 29 bit Identifier for CAN
2.0B with RTR bit.
The RTR (Remote Transmission Request) bit is dominant for data frames. Next is the data field
which holds 0 to 8 bytes of data and 16 bit CRC for error detection. Finally the ACK field, which is
transmitted as recessive, is overwritten with a dominant bit by a receiver when acknowledged.
The transmitter checks the ACK field to be dominant and transmits the message again on the bus
if it is not.

The following are the fields in the CAN frame format. The format is as shown in figure.

Figure.6..Message Format of CAN


4.1.1. Start of Frame (SOF):
A dominant bit which indicates the start of the message frame. All the nodes in the network
synchronises with this bit after being idle.
a.)Identifier: The arbitration field consists of the 11 bit Identifier for the basic CAN message, which
determines the priority of the message.
b.)Remote transmission request (RTR): This RTR bit differentiates the frame between a data and
request frame.
c.)Identifier Extension (IDE): A dominant IDE bit means CAN base format and a recessive IDE bit
means extended CAN format.
d.)r0: Reserved bit for future use
e.)Data Length Code (DLC): Data Length Code indicates Length of the Data Bytes transmitted in the
Data field. It is 4 bits long.
f.) Data: Data field is the pay load of the message frame. Up to 64 bits of data can be transmitted.
g.) CRC: 16 Bit CRC (15 bit CRC plus 1 bit de limiter) has checksum (no. of bytes transmitted) for
error detection.
4.1.2. ACK field:
Acknowledgement field is transmitted as recessive bit by the transmitter. If a receiver gets the
frame without errors then this ACK field is overwritten by a dominant bit. If a receiving node detects an

@IJMTER-2017, All rights Reserved 113


International Journal of Modern Trends in Engineering and Research (IJMTER)
Volume 04, Issue 11, [November– 2017] ISSN (Online):2349–9745; ISSN (Print):2393-8161

error on the frame then it ignores the frame and leaves this bit recessive. In this way data reliability is
guaranteed by each node. ACK field consists of 2 bit acknowledgement field and 1 bit delimiter.

4.1.3. EOF: The End of frame field indicates the end of the CAN message. It is 7 Bits long and should
be recessive to indicate the complete transmission of a error free message. If any of the ACK delimiter
or EOF bits were transmitted dominantly then it indicates the start of an Error frame.
4.2. Remote Frame
Remote frame is determined by the Remote Transmission Request (RTR) bit in the Arbitration
field. If this bit is dominant then it means that this frame is a Data frame. If this RTR bit is recessive
then it is a request for data. In this way, during an arbitration process a data frame dominates over a
remote frame with a same Identifier. This frame will not have any data. These frames are sent out in a
regular basis to update the values from the sensors in the system.
4.3. Error Frame
The receiver sends the Error frame when it detects an error in the receiving frame. By doing so it
makes all the nodes in the network to ignore the message which is currently on the bus. This frame can
be sent out at any time but before the completion of Data or Remote frame. The transmitter constantly
monitors the bus while transmitting and stops its transmission when it detects an error frame. After
detecting the error frame, the transmitting node tries to send the message again when the bus is idle for
the next time.
4.4. Over load Frame
This is equivalent to a data frame which is sent by a busy node.
i.)Error confinements
CAN controllers of each node in the network have error counters for transmit and receive
messages respectively. Every error message will increment this counter value. Transmission errors have
a weighting of 8 and increment the Transmit Error counter whereas the Receive Errors have a weighting
of 1and increment the Receive Error counter. For every successful transmission or reception of
messages the counter values are decrement by one. Depending upon these counter values, each node can
be in one of the following states.
ii) Error Active mode
In this mode the node is working normally. It can take part in communication and send error
flags when it detects an error frame, thereby destroying the transmitted frame. In this state the counts of
both the error counter would be less than 127. When the error count reaches zero, these node will return
to normal mode form error active mode.
iii) Error Passive mode
When the Error Counters exceed 127, then the node transforms itself from Error active to Error
Passive mode. The Node is still capable of sending and receiving messages. This node is not allowed to
send any error frames with active error flags, instead it is allowed to send out error frames with passive
error flags.After an Error frame, this node has to wait for certain bit times to start its retransmission. By
these tedious procedures the Nodes with higher error counts are limited by the bus to avoid their
interference in the communication. Obviously the node becomes error active again at the point where its
error count falls below 127.
4.5 Buss off state
If an Error counter of a node reaches 255, then the node gets isolated from the bus by
transforming itself from error passive to buss off state. In bus off mode the node can only receive and

@IJMTER-2017, All rights Reserved 114


International Journal of Modern Trends in Engineering and Research (IJMTER)
Volume 04, Issue 11, [November– 2017] ISSN (Online):2349–9745; ISSN (Print):2393-8161

cannot transmit. Because only the transmit errors have caused the node to be off the bus. When the error
counts reach 128 or below then the node come back to error passive node and take part in
communication again. Otherwise by resetting the error counters and the CAN controller, they can take
part in communication after 128 occurrences of 11 consecutive bits.
The following figure may help to understand the error states more clearly.

Figure.7.CAN Error State machine


Errors during communication can also occur by external forces, that is why the CAN systems are
designed to reduce their error counters once they successfully transmit or receive messages.
V. CAN BENEFITS
1. Low-Cost, Lightweight Network
2. Broadcast Communication
3. Priority
4. Error Capabilities
VI. CAN APPLICATIONS
CAN was first created for automotive use, so its most common application is in-vehicle
electronic networking. However, as other industries have realized the dependability and advantages of
CAN over the past 20 years, they have adopted the bus for a wide variety of applications. Railway
applications such as streetcars, trams, undergrounds, light railways, and long-distance trains incorporate
CAN. You can find CAN on different levels of the multiple networks within these vehicles – for
example, in linking the door units or brake controllers, passenger counting units, and more. CAN also
has applications in aircraft with flight-state sensors, navigation systems, and research PCs in the cockpit.
In addition, you can find CAN buses in many aerospace applications, ranging from in-flight data
analysis to aircraft engine control systems such as fuel systems, pumps, and linear actuators. Medical
equipment manufacturers use CAN as an embedded network in medical devices. In fact, some hospitals
use CAN to manage complete operating rooms. Hospitals control operating room components such as
lights, tables, cameras, X-ray machines, and patient beds with CAN-based systems. Lifts and escalators
use embedded CAN networks, and hospitals use the CANopen protocol to link lift devices, such as

@IJMTER-2017, All rights Reserved 115


International Journal of Modern Trends in Engineering and Research (IJMTER)
Volume 04, Issue 11, [November– 2017] ISSN (Online):2349–9745; ISSN (Print):2393-8161

panels, controllers, doors, and light barriers, to each other and control them. CANopen also is used in
nonindustrial applications such as laboratory equipment, sports cameras, telescopes, automatic doors,
and even coffee machines
VII. CAN PHYSICAL LAYERS
1. High-Speed/FD CAN
2. Low-Speed/Fault-Tolerant Hardware
3. Single-Wire CAN Hardware
4. Software-Selectable CAN Hardware
VIII. NATIONAL INSTRUMENTS CAN TOOLS
1. NI-XNET Software Driver
i.) NI-XNET: One API, Many Embedded Networks
ii.)Top Performance with Less Programming
2. NI-CAN Software Driver

Figure 8. NI PCI-8513 Software-Selectable (XS) CAN Device


REFERENCE
[1] K.Ramya and K.Pavithradevi “Effective Wireless Communication,” International Journal of Advanced Research,
volume 4(12), pp. 1559-1562 Dec 2016.
[2] "Controller Area Network (CAN)". Vector Group. Retrieved 25 Sep 2013.
[3] L.Gomathi,K.Ramya “Data Mining Analysis using query Formulation In AggregationRecommendation”,International
Journal of Emerging Technology in Computer Science & Electronics,Volume 2 Issue 1- October 2013.
[4] Arunachalam.G,Ramya.K,Vimala.M,Shanmugapriya.M,C.Krishnaveni”Future principle of TCP High-Speed
Networks”,International Journal For Research & Development In Technology,Volume 7,Issue-2 , Feb 2017.
[5] K.Ramya,G.Arunachalam,M.Shanmugapriya,P.Sathya” Mobile computing Broadband Networks” International Journal
For Research in Applied Science & Engineering Technology,Volume5,Issue II,Febrauary 2017.
[6] Ramya.K,Pavithradevi.K”Flexible Data Access Using vetwork security”,International Journal For Research &
Development In Technology,Volume 7,Issue-2 , Feb 2017.
[7] K.Pavithradevi,K.Ramya,Nandhini.S,Punitha.G”History and Applications in Body Area Network” International Journal
For Research in Applied Science & Engineering Technology,Volume5,Issue II,Febrauary 2017.

@IJMTER-2017, All rights Reserved 116

You might also like