SlideShare a Scribd company logo
1 of 23
Download to read offline
2/8/2016
1
MSCS-667: Industrial Automation Systems
Abu Sayed Md. Mostafizur Rahaman
Associate Professor
Department of Computer Science and Engineering
Jahangirnagar University
Lecture Today
• CAN Bus
• Sample Exercise
2/8/2016
2
CAN (Controller Area Network)
• Definition
– CAN (Controller Area Network) is a serial bus system used to communicate between
several embedded 8-bit and 16-bit microcontrollers.
– It was originally designed for use in the automotive industry but is used today in many
other systems (e.g. home appliances and industrial machines).
– Highest Baud Rate is 1Mbit.
– CAN uses a message oriented transmission protocol.
CAN (Cont…)
• Developed by
– Robert Bosch GmbH in the 1980s.
• Application Area
– Automotive sectors.
• Reason for developing:
– Increasing share of controller and automating technology
– lively data exchange
• i.e. a high number of communication process but only small data packets
• Advantages
– Minimization of wiring effort
– High error safety
– Small latency time
– Distributed systems, several receiver
– Good extensibility
– Priorization of messages
– Lower-cost
2/8/2016
3
Arbitration Process
• Bus level
– Dominant and the Recessive level
– Dominant level means logic 0 and the
Recessive level means logic 1
Overview ISO / OSI Layer Model
• Physical layer
– Serial data transmission in a bus topology.
• MAC Layer:
– Protocol (CSMA/CA)
• Each participant that wants to send listens
• if the bus is occupied ( carrier sense) and starts the sending process when
the bus was idle for a certain time.
• There is the possibility that several participants start to send at the same
time ( multiple access).
• The resolving of an eventually appearing collision is carried out as part of
the arbitration process.
• Hereby all the affected participants start by putting their frames (starting
with the identifier) bit by bit on the bus.
• After each bit the sender checks if the actual level on the bus corresponds
with the level that it applied on the bus. If not it stops sending
immediately.
• This results that message with the highest priority gains the bus access
without the destruction of the message (collision avoidance).
Out of the 7 layers, only the
blue colored ones ( 1, 2, and 7 )
are considered for field busses
2/8/2016
4
LLC- Logical Link Control
• The communication on the bus is based on four different frame formats:
– Data Frame
– Remote Frame
– Error Frame
– Overload Frame
LLC- Logical Link Control (Frame format)
Data Frame
• Start of Frame: 1 dominant bit to identify start
• Arbitration field: 11 bit identifier + 1 bit RTR (remote transmission
request bit)
• Control field: 2 bits reserved for extended CAN, 4 bits for data
length
• Data field: 0-8 byte of data possible, starting with MSB
• CRC-field: 15 bit + 1 recessive CRC delimiter bit
• ACK-field: 1 bit ACK-slot + 1 bit ACK delimiter (recessive):
transmitter sends recessive bit in the slot; recipients that received
error free,send a dominant bit in the slot.
• End of Frame: 7 bit
Data frame format
In total the minimum frame length results in 44 bits. Additionally are the 0-64 data bits and potentially stuff bits.
2/8/2016
5
LLC- Logical Link Control (Frame format)
• Remote Frame
– A participant of the bus uses the remote frame to trigger the sending of a special data frame
with the same identifier by a data source.
– Data frame and remote frame only differ in a varying RTR bit ( RTR bit of remote frame =1,
RTR bit for data frame=0 )
• Error Frame
– If a participant of the bus recognizes an erroneous frame ( e.g. wrong checksum in CRC field),
it reports this by sending an error frame.
– Therefore a sequence ( 6 bits with the same polarity) that isn’t permissible during normal
operation is switched on the bus.
– This implicates that all the other ( fully functional node) switch themselves an error frame on
the bus as the bit stuffing rule was violated. An error frame is terminated with 8 recessive bits.
• Overload Frame
– An overload frame is used to enlarge the spacing between two frames.
– It can only be send at the beginning of the spacing.
Safety Mechanisms
• In order to reduce the fault liability of the CAN bus the following safety
mechanisms are realized:
• Bit Monitoring
– Each transmitting network node monitors whether or not the bus level it has
transmitted is actually present on the bus. Otherwise a fault has appeared that has to be
dissolved or the sending process has to be terminated (arbitration phase).
• Frame Format Check
– As the frame format is fixed, every participant of the bus can check whether this
format is maintained ( e.g. recessive delimiter bits). Otherwise a fault is existent.
2/8/2016
6
Safety Mechanisms
• Bit-Stuffing
– The CAN protocol uses the NRZ bit coding ( non-return to zero).
– This means that there are longer phases without bit edges for synchronization.
– To avoid this an inverted stuff bit is set after 5 bits of the same polarity. This bit
permits the synchronization of every node and is deleted when received.
• Cyclic Redundancy Check (CRC)
– The transmitted message is secured again by CRC. Thereby the message is divided by
a special polynomial generator and the result is deposit in the CRC field. The message
is divided again by this polynomial generator by the receiver and the result is
compared with the transmitted CRC field. If there are not identical a transmission
error has appeared. (polynomial generator x15+x14+x10+x8+x7+x4+x3+1
CRC (Cont…)
• It should be clear by now that a major goal in designing error detection
algorithms is to maximize the probability of detecting errors using only a
small number of redundant bits. Cyclic redundancy checks use some fairly
powerful mathematics to achieve this goal.
• For example, an 8-bit message consisting of the bits 10011010 corresponds
to the polynomial,
• M(x) = 1×x7 +0×x6 + 0×x5 +1×x4 + 1×x3 + 0×x2 +1×x1 + 0×x0
= x7 +x4 + x3 +x1
2/8/2016
7
CRC (Cont…)
• We wanted to create a polynomial T(x) for transmission that is derived from
the original message M(x), is k bits longer than M(x), and is exactly divisible
by G(x).
• We can do this in the following way:
1. Multiply M(x) by xk, that is, add k zeros at the end of the message. Call this zero-extended message xk
M(x).
2. Divide xk M(x) by G(x) and find the remainder R(x).
3. Subtract the remainder from xk M(x) to get T(x).
It should be obvious that what is left at this point is a message that is exactly divisible by
G(x).
Example-1
2/8/2016
8
Sample Exercise
The CAN-specification does not restrict the number of bus nodes, the length of the bus
system and the maximum baud rate. Nevertheless, the bus length or the maximum baud rate,
respectively, is limited in a real bus system.
a) Give the correlation between the baud rate and the maximum bus length. Assume a
simplified bit-timing-model. What is the maximum bus length of a CAN bus system if a
baud rate of 500kbit/s shall be achieved? The signal propagation velocity is vSig =
0.2m/ns (signal propagation velocity on a two-wire line) and the delay time caused by
the signal processing is 100ns.
Solution
2/8/2016
9
• Three nodes start at the same time to write messages on the bus with the
identifiers 204 (hex), 208(hex) and 287(hex).
a) Write down the identifiers in binary notation. Take possible safety mechanisms into
account.
Answer:
204(hex) = 516(dec) = 010000010100 (bin) (Stuff-Bit)
208(hex) = 520(dec) = 010000011000 (bin) (Stuff-Bit)
287(hex) = 647(dec) = 01010000111 (bin)
b) Which message will prevail in the arbitration process? Why (give reasons)?
Answer:
The message with the identifier 204 will assert it elf since it has the lowest identifier and with that the
highest priority (zero-level is dominant).
c) Carry out the arbitration process step by step. At which time, do the nodes with the
lower priority stop their transmission? Which signal level results on the bus?
Answer:
2/8/2016
10
Exercise
The control of the power train of a new car requires four controllers to exchange safety
critical data. Motor controller and gearbox controller exchange data cyclically with a period
of 20 ms.
ABS-controller and motor controller exchange cyclically safety critical data with a period of
10 ms. Additionally, motor controller, gearbox controller, and ABS-controller shall send
acyclic data of variable length to the central diagnosis device.
Which one of the bus systems CAN, FlexRay, Profibus, or EtherCat is suited for the
interconnection of all four controllers? Explain for each bus system why it is suited or
unsuited!
Exercise: Solution
• FlexRay: best suited. It’s time triggered and allows deterministic
transmission of safety critical cyclic data and asynchronous data as well.
• Profibus: Master-Slave-communication Single-Point of failure
– No deterministic cycle time
– Not suited
• EtherCat: Special hardware required rather expensive
• CAN: suited, but CSMA-CA not deterministic
2/8/2016
11
Sample Questions:
1. Define CAN bus. Give the reason of developing of CAN bus.
2. List some application of CAN bus.
3. Describe the protocol used in CAN bus to MAC layer.
4. Give the bus level used in CAN bus with an example.
5. Describe briefly the data frame format used in CAN bus.
6. Define remote frame, error Frame and overload frame used in CAN bus.
7. Describe briefly the safety mechanism techniques used in CAN bus.
8. Describe CRC technique with an example.
Exercise
• CAN-Bus (approx. 35 min)
In an automation-project of an office building you have the task to engineer the
field bus. A CAN-bus is to be used. The office building consists of 7 floors
(including ground floor) with 14 offices each. The building automation system
is responsible for the climate control, fire monitoring, and lighting control.
Figure 1 shows the layout of a floor of the office building.
2/8/2016
12
The following requirements have to be considered:
• In each office a CAN node exist. The CAN node is connected with a smoke detector, a
temperature sensor, a light sensor, and a climate control unit to set the room temperature.
The coordination and control is realized through a central automation computer.
• The central automation computer should be able to query explicitly every sensor and
actuator in every room.
• In order to provide maximum safety, messages that come from the smoke detectors shall
have a higher priority than all other messages.
The sensor and actuator layout of an office is shown in Figure 2.
2/8/2016
13
1. Bus Configuration
In the first step, the basic parameters of the bus system are to be determined.
Question 2.1: Transmission Rate
The length of the bus cable is 1480 m.
What is the maximum possible transmission rate?
You may assume a simplified bit timing model. The signal propagation velocity is Vsig =
0.2 m/ns and the delay time caused by the signal processing is 100 ns.
Question 2.2: Message Transfer Time
The maximum message transfer time shall not exceed 1.25 ms. You may assume a maximum
message length of 80 Bit. Can this be realized with the maximum transmission rate? Justify
your answer with a calculation.
2/8/2016
14
Solution 2.1 & 2.2
2. Message Format
In the second step, the actual CAN messages are to be specified. The message identifier and
the respective data parts have to be defined.
Hint: Use binary representation!
Question 2.3: Message Coding
Each message to be transmitted shall contain the message type, the floor number, and the
office number.
a) Which messages must be distinguished in the system?
b) How do you define the encoding of message identifiers, taking message priorities into
account? Give a schematic definition of the message identifiers and justify your decision.
c) Give for each message occurring in the system an example with appropriate coding of the
message identifier.
2/8/2016
15
Solution 2.3
b) As any sensor/actuator is to be addressed individually, the coding has to be
done within the identifier Considering the higher priority of fire alarm
messages, the definition of the Identifiers is as follows:
2/8/2016
16
Question 2.4: Data Coding
The MEASURED-temperature values of a temperature sensor are measured in an interval of
0° C to 100° C with an accuracy of 0.1° C and sent to the central automation computer on demand. The SET-
temperature values of the climate control unit are provided in an interval of 5° C to 30° C with a resolution of
0.1° C. The smoke detector reports only the status (1 - smoke / 0 - no smoke). The MEASURED-light values
of a light sensor are measured in an interval of 0 lx to 10000 lx with an accuracy of 1 lx and sent to the central
automation computer on demand.
a) What is the minimum size of the required data part of the respective CAN messages in
bytes?
b) Write down the respective data parts of the minimum and maximum values. You do not
need to apply any safety mechanisms.
Question 2.5: Safety Mechanisms
Write down the message identifier and the data part for the message that represents a MEASURED-light value
of 2727 in office No. 13 in the 4th floor. Apply CAN-specific safety mechanisms where necessary. Explain
briefly your result.
Solution 2.4
• MEASURED Temperature:
Interval from 0°C-100°C with accuracy 0.1°C => 1000 values
Coding of 1000 values => 10bit => 2 Data byte necessary
Coding: binary 0 = 00000000 00000000 = 0°C (without Stuffing-Bit)
binary 1000 = 00000011 11101000 = 100°C (without Stuffing-Bit)
• SET-Temperature:
– Interval from 5°C - 30°C with accuracy 0.1°C => 250 values
– Coding of 250 values => 8 bit => 1 Data byte necessary
– Coding: binary 0 = 00000000 = 5°C
– binary 250 = 11111010 = 30°C
2/8/2016
17
• Fire alarm:
– 1 Status bit => 1 bit => 1 Data byte!
– Coding:
– 0_0_0_0_0_0_0_Status bit
• MEASURED-light:
– Interval from 0 – 10000 with accuracy 1 => 10000 values
– Coding of 10,000 values => 14 bit => 2 Data byte necessary
– Coding: binary 0 = 00000000 00000000 = 0°lx (without Stuffing-Bit)
– binary 10000 = 00100111 00010000 = 10000°lx (without Stuffing-Bit)
2/8/2016
18
Exercise: Home Automation
In this question we deal with ambient intelligence, which is a new trend in controlling the
living environment with respect to the human users. The plan shown in figure 3.1 shows the
top view of a house. The house is equipped with a CAN-Bus which can be used to connect
various devices together. One of the Bus members is an industrial PC (IPC), which has the
responsibility of coordination. It can also be used for manual inputs to the system by the
users. Your task as an automation engineer is conception of a CAN-Bus network to fulfill
the following requirements:
• Blind control: The blind is connected to the CAN-Bus via the PLC of question 2. Here
only the state of the two sensors (wind, light) are being sent to the IPC in one message.
• Radiator: There are 5 radiators placed in each room (except for the corridor and
balcony). The radiator sends the current temperature of the room to the IPC and receives
the desired temperature via the IPC.
• Fire Detector/sprinkler: In order to fight back against fire, “Fire Detectors” (Sensor)
and “sprinklers” (actuator) for detecting the fire and extinguishing it are used in pairs.
Each room contains one pair of fire detector/sprinkler, summing up to a total amount of 6
pairs. As soon as a fire is detected (fire detector activated), an alarm message is sent to
the IPC. The IPC, then, sends an activation message to the corresponding sprinkler.
• Air-Conditioning system: Altogether, there are 3 AC systems in the house. One in the
bedroom, one in the working office, and one in the living room. It sends the current room
temperature to the IPC and receives the desired temperature via the IPC. Furthermore, it
can explicitly be turned on/off from the IPC.
• Security system: The security system is being considered here as a black box. Its only
relevant action for us is to send an alarm message to the IPC in case of security issues.
2/8/2016
19
• Industrial-PC: The IPC implements a user interface for communication
between the CAN-Network and the user; it presents information about the
connected devices to the CAN-Bus and allows interaction with them.
Furthermore, if a message from one of the Bus members affects another Bus
member, this has to be sent first to the IPC and via the IPC to the
corresponding component.
2/8/2016
20
Question 3.1: CAN-Node architecture
Design a suitable bus topology (arrangement of the nodes) that realizes the requirements of
the house. Mention all your CAN nodes.
Question 3.2: CAN-Messages
Identify the messages that are necessary to communicate between different node. Write
down for each node which message(s) are being sent or received by it. Combine messages of
equal type to one message.
Question 3.3: Message-Identifiers
For the purpose of addressing various nodes on the CAN-Bus System, you have been given
an address range from 300(hex) to 400(hex). Determine the message identifiers for the
messages you have detected in 3.2. Take into account the realistic requirements on the
system.
Question 3.4: Baud rate
The length of the CAN-Bus System is 40m. Calculate the maximum baud rate of the Bus.
Consider the signal propagation velocity is 0.2m/ns and electrical switching time 200ns.
Question 3.5: Extension to the security system
In case of an alarm from the security system, a picture taken from a camera installed in the
house will be sent to the IPC through the CAN-Bus system. The size of the picture is 340
kByte. Since the size of a standard CAN message is not sufficient for sending such a picture,
it must be separated into several parts. Create a concept to efficiently encode the data parts.
Consider the order of the part messages. Write down your concept and mention the required
number of CAN messages for transmitting one picture.
2/8/2016
21
Exercise: Ship Accident
After the fatal Costa Concordia cruise ship accident, the junior engineers of the Jahangirnagar
University have received the task to construct a new cruising ship, Costa Concordia v2.
Employing automation engineering techniques and highly modern technologies, the new cruising
ship should provide her passengers more comfort and safety. Due to cost matters it must, first a small
prototype of the cruising ship should be constructed. If this fulfills the requirements, an order for
constructing the real cruising ship will be allotted. From now on the small prototype is meant,
whenever Costa Concordia v2 is mentioned.
The Costa Concordia v2 consists of 7 floors with 14 cabins and a restaurant on each (see figure 1.1).
The following decisions/requirements are to be considered in Costa Concordia v2:
• Each cabin and restaurant has a smoke detector, which in case of fire sends a signal to the central
control unit. This signal causes a chain of alarms to go off. For more simplicity the chain of
alarms is considered as one alarm. Furthermore, simultaneous occurrence of two or more alarms
from different cabins or restaurants is ignored.
• In each cabin and restaurant there is a temperature sensor and a temperature selector installed. The
temperature sensor sends the current temperature to the central control unit. Via the temperature selector a
person can set the desired temperature, manually. Once a person has set a desired temperature, it is sent to
the central control unit. Furthermore, the temperature can be set automatically by the central control unit,
regardless of the selector.
• On the outside body of the cruising ship (under the water) a modern sonar unit (Sound Navigation and
Ranging Unit) is installed. The sonar unit can detect the underwater reefs, which might be hazardous for the
cruising ship. In case such a reef is detected, a signal is sent to the central control unit.
• The central control unit should be able to access all the sensors/actors in each cabin or restaurant.
• In order to make the future passengers of Costa Concordia v2 always positively remember the junior
engineers of the University of Stuttgart a further comfort function should be included. Each cabin will have
a cool box, which will be filled with German beer. An integrated sensor in the cool box detects how many
beer bottles are left. If the amount of beer bottles is not equal to the maximal capacity of the cool box, a
signal is sent to the central control unit. This signal will from thereon be forwarded to the catering staff to
take care of. The catering staff is not considered here.
2/8/2016
22
The distribution of the sensor and actor elements of the cabins and restaurants, shown in figure 1.1, is the same
for each floor.
Question 1.1: CAN Baud Rate
The length of the bus system is 1590 m. What is the maximal possible baud rate? Assume that the signal
propagation velocity is v line) and the delay time caused by the signal processing is 100 ns.
Question 1.2: CAN Message Length
The maximal message transmission time should be 1.5 ms. How big is the maximal message size allowed to
be?
Question 1.3: CAN Identifier
Each transmitted message should include the type of the message, the floor number and the cabin number.
Design an identification coding, which fulfills the above mentioned requirements. How would you choose your
coding? Provide an example for each type of message.
2/8/2016
23
The measured temperature values of the temperature sensors are measured in an interval of 0°C to 100°C with
an accuracy of 0.1° and can be sent to the central control unit on demand. The desired temperature values,
given via the temperature selectors, are provided in an interval of 5°C to 30°C with a resolution of 0.5°C. The
smoke detectors, sonar unit and cool boxes send only the status (1 -smoke / 0 - no smoke), (1 - reef detected /
0- no reef detected) and (1 cool box full- / 0 – cool box not full).
a) What is the minimum size of the required data part of each CAN message type in bits and bytes? Justify
your answer.
b) Write down, in binary form, for each type of message the data field corresponding to the start value of the
message and the end value of that message. E.g. for the type of message “desired temperature” the binary
forms of the CAN messages 5°C and 30°C are requested.
Hint:
· Write down only those bytes, which are required for each data field.
· Ignore any CAN specific safety mechanisms.
Question 1.5: CAN Message Examples
Write down the message identifier and the data part for the message that represents the
measured temperature value of 25.6° C of the cabin number 14 on the 7th floor and the
measured temperature value of 12.8° C of the cabin number 1 on the 1th floor. Write your
answer in binary as it will appear on the bus. Apply CAN-specific safety mechanisms where
necessary.
Question 1.6: CAN Arbitration
The two temperature messages of the question 1.5 are put simultaneously on the bus. Which
message receives the bus access? Justify your answer. Sketch the arbitration process and the
sending behavior of each CAN node. What appears on the bus?

More Related Content

What's hot

SPI Protocol
SPI ProtocolSPI Protocol
SPI ProtocolAnurag Tomar
 
Turbo codes.ppt
Turbo codes.pptTurbo codes.ppt
Turbo codes.pptPrasant Barik
 
CAN (Controller Area Network) Bus Protocol
CAN (Controller Area Network) Bus ProtocolCAN (Controller Area Network) Bus Protocol
CAN (Controller Area Network) Bus ProtocolAbhinaw Tiwari
 
ARM CORTEX M3 PPT
ARM CORTEX M3 PPTARM CORTEX M3 PPT
ARM CORTEX M3 PPTGaurav Verma
 
OVERVIEW OF MSP430G2553
OVERVIEW OF MSP430G2553OVERVIEW OF MSP430G2553
OVERVIEW OF MSP430G2553shams tabrez
 
Lect 2 ARM processor architecture
Lect 2 ARM processor architectureLect 2 ARM processor architecture
Lect 2 ARM processor architectureDr.YNM
 
Design and implementation of uart on soc
Design and implementation of uart on socDesign and implementation of uart on soc
Design and implementation of uart on socIjrdt Journal
 
I2C Protocol
I2C ProtocolI2C Protocol
I2C ProtocolAnurag Tomar
 
Forward error correction
Forward error correctionForward error correction
Forward error correctionPrankit Mishra
 
Can Bus communication Protocol
Can Bus communication ProtocolCan Bus communication Protocol
Can Bus communication ProtocolPedro Campana Cueto
 
Controller area network -ppt
Controller area network -pptController area network -ppt
Controller area network -pptvelichetiphani
 
Unit II arm 7 Instruction Set
Unit II arm 7 Instruction SetUnit II arm 7 Instruction Set
Unit II arm 7 Instruction SetDr. Pankaj Zope
 
I2c protocol - Inter–Integrated Circuit Communication Protocol
I2c protocol - Inter–Integrated Circuit Communication ProtocolI2c protocol - Inter–Integrated Circuit Communication Protocol
I2c protocol - Inter–Integrated Circuit Communication ProtocolAnkur Soni
 
Introduction to arm architecture
Introduction to arm architectureIntroduction to arm architecture
Introduction to arm architectureZakaria Gomaa
 

What's hot (20)

SPI Protocol
SPI ProtocolSPI Protocol
SPI Protocol
 
Turbo codes.ppt
Turbo codes.pptTurbo codes.ppt
Turbo codes.ppt
 
CAN (Controller Area Network) Bus Protocol
CAN (Controller Area Network) Bus ProtocolCAN (Controller Area Network) Bus Protocol
CAN (Controller Area Network) Bus Protocol
 
ARM programmer's model.pdf
ARM programmer's model.pdfARM programmer's model.pdf
ARM programmer's model.pdf
 
ARM CORTEX M3 PPT
ARM CORTEX M3 PPTARM CORTEX M3 PPT
ARM CORTEX M3 PPT
 
OVERVIEW OF MSP430G2553
OVERVIEW OF MSP430G2553OVERVIEW OF MSP430G2553
OVERVIEW OF MSP430G2553
 
CAN BUS.ppt
CAN BUS.pptCAN BUS.ppt
CAN BUS.ppt
 
Lect 2 ARM processor architecture
Lect 2 ARM processor architectureLect 2 ARM processor architecture
Lect 2 ARM processor architecture
 
Design and implementation of uart on soc
Design and implementation of uart on socDesign and implementation of uart on soc
Design and implementation of uart on soc
 
I2C Protocol
I2C ProtocolI2C Protocol
I2C Protocol
 
Forward error correction
Forward error correctionForward error correction
Forward error correction
 
Can Bus communication Protocol
Can Bus communication ProtocolCan Bus communication Protocol
Can Bus communication Protocol
 
ARM Processor Tutorial
ARM Processor Tutorial ARM Processor Tutorial
ARM Processor Tutorial
 
Controller area network -ppt
Controller area network -pptController area network -ppt
Controller area network -ppt
 
SRAM
SRAMSRAM
SRAM
 
Arm 7 nxp
Arm 7 nxpArm 7 nxp
Arm 7 nxp
 
Unit II arm 7 Instruction Set
Unit II arm 7 Instruction SetUnit II arm 7 Instruction Set
Unit II arm 7 Instruction Set
 
I2c protocol - Inter–Integrated Circuit Communication Protocol
I2c protocol - Inter–Integrated Circuit Communication ProtocolI2c protocol - Inter–Integrated Circuit Communication Protocol
I2c protocol - Inter–Integrated Circuit Communication Protocol
 
Introduction to arm architecture
Introduction to arm architectureIntroduction to arm architecture
Introduction to arm architecture
 
Pcie basic
Pcie basicPcie basic
Pcie basic
 

Similar to can bus theory solution

Can network development using arm cortex m3
Can network development using arm cortex m3Can network development using arm cortex m3
Can network development using arm cortex m3Ankur Rastogi
 
Can network development using arm cortex m3
Can network development using arm cortex m3Can network development using arm cortex m3
Can network development using arm cortex m3Ankur Rastogi
 
profibus theory solution
profibus theory solutionprofibus theory solution
profibus theory solutionMd. Mashiur Rahman
 
Shubham chakravarty ppt_wcan
Shubham chakravarty ppt_wcanShubham chakravarty ppt_wcan
Shubham chakravarty ppt_wcanShubhamChakravarty1
 
Role of CAN BUS in automotives
Role of CAN BUS in automotivesRole of CAN BUS in automotives
Role of CAN BUS in automotivesYuga Aravind Kumar
 
IJSTEV2I12120
IJSTEV2I12120IJSTEV2I12120
IJSTEV2I12120manju147147
 
Nigga.pdf
Nigga.pdfNigga.pdf
Nigga.pdfpdegree76
 
Controller area network
Controller area networkController area network
Controller area networkDivi1597
 
Lasseq f can
Lasseq f canLasseq f can
Lasseq f canfouziaaddal
 
Thesis Presentation on Renewal theory based 802.15.6 latest.pptx
Thesis Presentation on Renewal theory based 802.15.6 latest.pptxThesis Presentation on Renewal theory based 802.15.6 latest.pptx
Thesis Presentation on Renewal theory based 802.15.6 latest.pptxssuserc02c1f
 
2014 IEEE JAVA NETWORKING PROJECT Receiver based flow control for networks in...
2014 IEEE JAVA NETWORKING PROJECT Receiver based flow control for networks in...2014 IEEE JAVA NETWORKING PROJECT Receiver based flow control for networks in...
2014 IEEE JAVA NETWORKING PROJECT Receiver based flow control for networks in...IEEEFINALSEMSTUDENTSPROJECTS
 
IEEE 2014 JAVA NETWORKING PROJECTS Receiver based flow control for networks i...
IEEE 2014 JAVA NETWORKING PROJECTS Receiver based flow control for networks i...IEEE 2014 JAVA NETWORKING PROJECTS Receiver based flow control for networks i...
IEEE 2014 JAVA NETWORKING PROJECTS Receiver based flow control for networks i...IEEEGLOBALSOFTSTUDENTPROJECTS
 
A427 nic card
A427 nic cardA427 nic card
A427 nic cardsurajbhai
 
Control Area Network
Control Area NetworkControl Area Network
Control Area Networkvenkat thangella
 

Similar to can bus theory solution (20)

Can network development using arm cortex m3
Can network development using arm cortex m3Can network development using arm cortex m3
Can network development using arm cortex m3
 
Can network development using arm cortex m3
Can network development using arm cortex m3Can network development using arm cortex m3
Can network development using arm cortex m3
 
profibus theory solution
profibus theory solutionprofibus theory solution
profibus theory solution
 
Shubham chakravarty ppt_wcan
Shubham chakravarty ppt_wcanShubham chakravarty ppt_wcan
Shubham chakravarty ppt_wcan
 
CAN BUS.pptx
CAN BUS.pptxCAN BUS.pptx
CAN BUS.pptx
 
Role of CAN BUS in automotives
Role of CAN BUS in automotivesRole of CAN BUS in automotives
Role of CAN BUS in automotives
 
CAN.ppt
CAN.pptCAN.ppt
CAN.ppt
 
IJSTEV2I12120
IJSTEV2I12120IJSTEV2I12120
IJSTEV2I12120
 
Canbus
CanbusCanbus
Canbus
 
Nigga.pdf
Nigga.pdfNigga.pdf
Nigga.pdf
 
Controller area network
Controller area networkController area network
Controller area network
 
Lasseq f can
Lasseq f canLasseq f can
Lasseq f can
 
Thesis Presentation on Renewal theory based 802.15.6 latest.pptx
Thesis Presentation on Renewal theory based 802.15.6 latest.pptxThesis Presentation on Renewal theory based 802.15.6 latest.pptx
Thesis Presentation on Renewal theory based 802.15.6 latest.pptx
 
CAN_Introduction.docx
CAN_Introduction.docxCAN_Introduction.docx
CAN_Introduction.docx
 
CAN Bus
CAN BusCAN Bus
CAN Bus
 
2014 IEEE JAVA NETWORKING PROJECT Receiver based flow control for networks in...
2014 IEEE JAVA NETWORKING PROJECT Receiver based flow control for networks in...2014 IEEE JAVA NETWORKING PROJECT Receiver based flow control for networks in...
2014 IEEE JAVA NETWORKING PROJECT Receiver based flow control for networks in...
 
IEEE 2014 JAVA NETWORKING PROJECTS Receiver based flow control for networks i...
IEEE 2014 JAVA NETWORKING PROJECTS Receiver based flow control for networks i...IEEE 2014 JAVA NETWORKING PROJECTS Receiver based flow control for networks i...
IEEE 2014 JAVA NETWORKING PROJECTS Receiver based flow control for networks i...
 
A427 nic card
A427 nic cardA427 nic card
A427 nic card
 
Control Area Network
Control Area NetworkControl Area Network
Control Area Network
 
Data link layer
Data link layerData link layer
Data link layer
 

More from Md. Mashiur Rahman (20)

Rule for creating power point slide
Rule for creating power point slideRule for creating power point slide
Rule for creating power point slide
 
Advance DBMS
Advance DBMSAdvance DBMS
Advance DBMS
 
Final exam in advance dbms
Final exam in advance dbmsFinal exam in advance dbms
Final exam in advance dbms
 
Answer sheet of switching & routing
Answer sheet of switching & routingAnswer sheet of switching & routing
Answer sheet of switching & routing
 
Routing and switching question1
Routing and switching question1Routing and switching question1
Routing and switching question1
 
Lecture 1 networking & internetworking
Lecture 1 networking & internetworkingLecture 1 networking & internetworking
Lecture 1 networking & internetworking
 
Lec 7 query processing
Lec 7 query processingLec 7 query processing
Lec 7 query processing
 
Lec 1 indexing and hashing
Lec 1 indexing and hashing Lec 1 indexing and hashing
Lec 1 indexing and hashing
 
Cloud computing lecture 7
Cloud computing lecture 7Cloud computing lecture 7
Cloud computing lecture 7
 
Cloud computing lecture 1
Cloud computing lecture 1Cloud computing lecture 1
Cloud computing lecture 1
 
parallel Questions & answers
parallel Questions & answersparallel Questions & answers
parallel Questions & answers
 
Mis 8
Mis 8Mis 8
Mis 8
 
Mis 3
Mis 3Mis 3
Mis 3
 
Mis 1
Mis 1Mis 1
Mis 1
 
Mis 5
Mis 5Mis 5
Mis 5
 
Mis 2
Mis 2Mis 2
Mis 2
 
Mis 9
Mis 9Mis 9
Mis 9
 
Mis 6
Mis 6Mis 6
Mis 6
 
Mis 7
Mis 7Mis 7
Mis 7
 
Mis 4
Mis 4Mis 4
Mis 4
 

Recently uploaded

Final demo Grade 9 for demo Plan dessert.pptx
Final demo Grade 9 for demo Plan dessert.pptxFinal demo Grade 9 for demo Plan dessert.pptx
Final demo Grade 9 for demo Plan dessert.pptxAvyJaneVismanos
 
Procuring digital preservation CAN be quick and painless with our new dynamic...
Procuring digital preservation CAN be quick and painless with our new dynamic...Procuring digital preservation CAN be quick and painless with our new dynamic...
Procuring digital preservation CAN be quick and painless with our new dynamic...Jisc
 
18-04-UA_REPORT_MEDIALITERAСY_INDEX-DM_23-1-final-eng.pdf
18-04-UA_REPORT_MEDIALITERAСY_INDEX-DM_23-1-final-eng.pdf18-04-UA_REPORT_MEDIALITERAСY_INDEX-DM_23-1-final-eng.pdf
18-04-UA_REPORT_MEDIALITERAСY_INDEX-DM_23-1-final-eng.pdfssuser54595a
 
MARGINALIZATION (Different learners in Marginalized Group
MARGINALIZATION (Different learners in Marginalized GroupMARGINALIZATION (Different learners in Marginalized Group
MARGINALIZATION (Different learners in Marginalized GroupJonathanParaisoCruz
 
What is Model Inheritance in Odoo 17 ERP
What is Model Inheritance in Odoo 17 ERPWhat is Model Inheritance in Odoo 17 ERP
What is Model Inheritance in Odoo 17 ERPCeline George
 
Historical philosophical, theoretical, and legal foundations of special and i...
Historical philosophical, theoretical, and legal foundations of special and i...Historical philosophical, theoretical, and legal foundations of special and i...
Historical philosophical, theoretical, and legal foundations of special and i...jaredbarbolino94
 
Alper Gobel In Media Res Media Component
Alper Gobel In Media Res Media ComponentAlper Gobel In Media Res Media Component
Alper Gobel In Media Res Media ComponentInMediaRes1
 
Introduction to AI in Higher Education_draft.pptx
Introduction to AI in Higher Education_draft.pptxIntroduction to AI in Higher Education_draft.pptx
Introduction to AI in Higher Education_draft.pptxpboyjonauth
 
Capitol Tech U Doctoral Presentation - April 2024.pptx
Capitol Tech U Doctoral Presentation - April 2024.pptxCapitol Tech U Doctoral Presentation - April 2024.pptx
Capitol Tech U Doctoral Presentation - April 2024.pptxCapitolTechU
 
“Oh GOSH! Reflecting on Hackteria's Collaborative Practices in a Global Do-It...
“Oh GOSH! Reflecting on Hackteria's Collaborative Practices in a Global Do-It...“Oh GOSH! Reflecting on Hackteria's Collaborative Practices in a Global Do-It...
“Oh GOSH! Reflecting on Hackteria's Collaborative Practices in a Global Do-It...Marc Dusseiller Dusjagr
 
Organic Name Reactions for the students and aspirants of Chemistry12th.pptx
Organic Name Reactions  for the students and aspirants of Chemistry12th.pptxOrganic Name Reactions  for the students and aspirants of Chemistry12th.pptx
Organic Name Reactions for the students and aspirants of Chemistry12th.pptxVS Mahajan Coaching Centre
 
Proudly South Africa powerpoint Thorisha.pptx
Proudly South Africa powerpoint Thorisha.pptxProudly South Africa powerpoint Thorisha.pptx
Proudly South Africa powerpoint Thorisha.pptxthorishapillay1
 
Pharmacognosy Flower 3. Compositae 2023.pdf
Pharmacognosy Flower 3. Compositae 2023.pdfPharmacognosy Flower 3. Compositae 2023.pdf
Pharmacognosy Flower 3. Compositae 2023.pdfMahmoud M. Sallam
 
How to Make a Pirate ship Primary Education.pptx
How to Make a Pirate ship Primary Education.pptxHow to Make a Pirate ship Primary Education.pptx
How to Make a Pirate ship Primary Education.pptxmanuelaromero2013
 
POINT- BIOCHEMISTRY SEM 2 ENZYMES UNIT 5.pptx
POINT- BIOCHEMISTRY SEM 2 ENZYMES UNIT 5.pptxPOINT- BIOCHEMISTRY SEM 2 ENZYMES UNIT 5.pptx
POINT- BIOCHEMISTRY SEM 2 ENZYMES UNIT 5.pptxSayali Powar
 
EPANDING THE CONTENT OF AN OUTLINE using notes.pptx
EPANDING THE CONTENT OF AN OUTLINE using notes.pptxEPANDING THE CONTENT OF AN OUTLINE using notes.pptx
EPANDING THE CONTENT OF AN OUTLINE using notes.pptxRaymartEstabillo3
 

Recently uploaded (20)

Final demo Grade 9 for demo Plan dessert.pptx
Final demo Grade 9 for demo Plan dessert.pptxFinal demo Grade 9 for demo Plan dessert.pptx
Final demo Grade 9 for demo Plan dessert.pptx
 
Model Call Girl in Bikash Puri Delhi reach out to us at 🔝9953056974🔝
Model Call Girl in Bikash Puri  Delhi reach out to us at 🔝9953056974🔝Model Call Girl in Bikash Puri  Delhi reach out to us at 🔝9953056974🔝
Model Call Girl in Bikash Puri Delhi reach out to us at 🔝9953056974🔝
 
Procuring digital preservation CAN be quick and painless with our new dynamic...
Procuring digital preservation CAN be quick and painless with our new dynamic...Procuring digital preservation CAN be quick and painless with our new dynamic...
Procuring digital preservation CAN be quick and painless with our new dynamic...
 
18-04-UA_REPORT_MEDIALITERAСY_INDEX-DM_23-1-final-eng.pdf
18-04-UA_REPORT_MEDIALITERAСY_INDEX-DM_23-1-final-eng.pdf18-04-UA_REPORT_MEDIALITERAСY_INDEX-DM_23-1-final-eng.pdf
18-04-UA_REPORT_MEDIALITERAСY_INDEX-DM_23-1-final-eng.pdf
 
MARGINALIZATION (Different learners in Marginalized Group
MARGINALIZATION (Different learners in Marginalized GroupMARGINALIZATION (Different learners in Marginalized Group
MARGINALIZATION (Different learners in Marginalized Group
 
OS-operating systems- ch04 (Threads) ...
OS-operating systems- ch04 (Threads) ...OS-operating systems- ch04 (Threads) ...
OS-operating systems- ch04 (Threads) ...
 
What is Model Inheritance in Odoo 17 ERP
What is Model Inheritance in Odoo 17 ERPWhat is Model Inheritance in Odoo 17 ERP
What is Model Inheritance in Odoo 17 ERP
 
Historical philosophical, theoretical, and legal foundations of special and i...
Historical philosophical, theoretical, and legal foundations of special and i...Historical philosophical, theoretical, and legal foundations of special and i...
Historical philosophical, theoretical, and legal foundations of special and i...
 
Alper Gobel In Media Res Media Component
Alper Gobel In Media Res Media ComponentAlper Gobel In Media Res Media Component
Alper Gobel In Media Res Media Component
 
Model Call Girl in Tilak Nagar Delhi reach out to us at 🔝9953056974🔝
Model Call Girl in Tilak Nagar Delhi reach out to us at 🔝9953056974🔝Model Call Girl in Tilak Nagar Delhi reach out to us at 🔝9953056974🔝
Model Call Girl in Tilak Nagar Delhi reach out to us at 🔝9953056974🔝
 
Introduction to AI in Higher Education_draft.pptx
Introduction to AI in Higher Education_draft.pptxIntroduction to AI in Higher Education_draft.pptx
Introduction to AI in Higher Education_draft.pptx
 
Capitol Tech U Doctoral Presentation - April 2024.pptx
Capitol Tech U Doctoral Presentation - April 2024.pptxCapitol Tech U Doctoral Presentation - April 2024.pptx
Capitol Tech U Doctoral Presentation - April 2024.pptx
 
“Oh GOSH! Reflecting on Hackteria's Collaborative Practices in a Global Do-It...
“Oh GOSH! Reflecting on Hackteria's Collaborative Practices in a Global Do-It...“Oh GOSH! Reflecting on Hackteria's Collaborative Practices in a Global Do-It...
“Oh GOSH! Reflecting on Hackteria's Collaborative Practices in a Global Do-It...
 
Organic Name Reactions for the students and aspirants of Chemistry12th.pptx
Organic Name Reactions  for the students and aspirants of Chemistry12th.pptxOrganic Name Reactions  for the students and aspirants of Chemistry12th.pptx
Organic Name Reactions for the students and aspirants of Chemistry12th.pptx
 
Proudly South Africa powerpoint Thorisha.pptx
Proudly South Africa powerpoint Thorisha.pptxProudly South Africa powerpoint Thorisha.pptx
Proudly South Africa powerpoint Thorisha.pptx
 
Pharmacognosy Flower 3. Compositae 2023.pdf
Pharmacognosy Flower 3. Compositae 2023.pdfPharmacognosy Flower 3. Compositae 2023.pdf
Pharmacognosy Flower 3. Compositae 2023.pdf
 
How to Make a Pirate ship Primary Education.pptx
How to Make a Pirate ship Primary Education.pptxHow to Make a Pirate ship Primary Education.pptx
How to Make a Pirate ship Primary Education.pptx
 
POINT- BIOCHEMISTRY SEM 2 ENZYMES UNIT 5.pptx
POINT- BIOCHEMISTRY SEM 2 ENZYMES UNIT 5.pptxPOINT- BIOCHEMISTRY SEM 2 ENZYMES UNIT 5.pptx
POINT- BIOCHEMISTRY SEM 2 ENZYMES UNIT 5.pptx
 
9953330565 Low Rate Call Girls In Rohini Delhi NCR
9953330565 Low Rate Call Girls In Rohini  Delhi NCR9953330565 Low Rate Call Girls In Rohini  Delhi NCR
9953330565 Low Rate Call Girls In Rohini Delhi NCR
 
EPANDING THE CONTENT OF AN OUTLINE using notes.pptx
EPANDING THE CONTENT OF AN OUTLINE using notes.pptxEPANDING THE CONTENT OF AN OUTLINE using notes.pptx
EPANDING THE CONTENT OF AN OUTLINE using notes.pptx
 

can bus theory solution

  • 1. 2/8/2016 1 MSCS-667: Industrial Automation Systems Abu Sayed Md. Mostafizur Rahaman Associate Professor Department of Computer Science and Engineering Jahangirnagar University Lecture Today • CAN Bus • Sample Exercise
  • 2. 2/8/2016 2 CAN (Controller Area Network) • Definition – CAN (Controller Area Network) is a serial bus system used to communicate between several embedded 8-bit and 16-bit microcontrollers. – It was originally designed for use in the automotive industry but is used today in many other systems (e.g. home appliances and industrial machines). – Highest Baud Rate is 1Mbit. – CAN uses a message oriented transmission protocol. CAN (Cont…) • Developed by – Robert Bosch GmbH in the 1980s. • Application Area – Automotive sectors. • Reason for developing: – Increasing share of controller and automating technology – lively data exchange • i.e. a high number of communication process but only small data packets • Advantages – Minimization of wiring effort – High error safety – Small latency time – Distributed systems, several receiver – Good extensibility – Priorization of messages – Lower-cost
  • 3. 2/8/2016 3 Arbitration Process • Bus level – Dominant and the Recessive level – Dominant level means logic 0 and the Recessive level means logic 1 Overview ISO / OSI Layer Model • Physical layer – Serial data transmission in a bus topology. • MAC Layer: – Protocol (CSMA/CA) • Each participant that wants to send listens • if the bus is occupied ( carrier sense) and starts the sending process when the bus was idle for a certain time. • There is the possibility that several participants start to send at the same time ( multiple access). • The resolving of an eventually appearing collision is carried out as part of the arbitration process. • Hereby all the affected participants start by putting their frames (starting with the identifier) bit by bit on the bus. • After each bit the sender checks if the actual level on the bus corresponds with the level that it applied on the bus. If not it stops sending immediately. • This results that message with the highest priority gains the bus access without the destruction of the message (collision avoidance). Out of the 7 layers, only the blue colored ones ( 1, 2, and 7 ) are considered for field busses
  • 4. 2/8/2016 4 LLC- Logical Link Control • The communication on the bus is based on four different frame formats: – Data Frame – Remote Frame – Error Frame – Overload Frame LLC- Logical Link Control (Frame format) Data Frame • Start of Frame: 1 dominant bit to identify start • Arbitration field: 11 bit identifier + 1 bit RTR (remote transmission request bit) • Control field: 2 bits reserved for extended CAN, 4 bits for data length • Data field: 0-8 byte of data possible, starting with MSB • CRC-field: 15 bit + 1 recessive CRC delimiter bit • ACK-field: 1 bit ACK-slot + 1 bit ACK delimiter (recessive): transmitter sends recessive bit in the slot; recipients that received error free,send a dominant bit in the slot. • End of Frame: 7 bit Data frame format In total the minimum frame length results in 44 bits. Additionally are the 0-64 data bits and potentially stuff bits.
  • 5. 2/8/2016 5 LLC- Logical Link Control (Frame format) • Remote Frame – A participant of the bus uses the remote frame to trigger the sending of a special data frame with the same identifier by a data source. – Data frame and remote frame only differ in a varying RTR bit ( RTR bit of remote frame =1, RTR bit for data frame=0 ) • Error Frame – If a participant of the bus recognizes an erroneous frame ( e.g. wrong checksum in CRC field), it reports this by sending an error frame. – Therefore a sequence ( 6 bits with the same polarity) that isn’t permissible during normal operation is switched on the bus. – This implicates that all the other ( fully functional node) switch themselves an error frame on the bus as the bit stuffing rule was violated. An error frame is terminated with 8 recessive bits. • Overload Frame – An overload frame is used to enlarge the spacing between two frames. – It can only be send at the beginning of the spacing. Safety Mechanisms • In order to reduce the fault liability of the CAN bus the following safety mechanisms are realized: • Bit Monitoring – Each transmitting network node monitors whether or not the bus level it has transmitted is actually present on the bus. Otherwise a fault has appeared that has to be dissolved or the sending process has to be terminated (arbitration phase). • Frame Format Check – As the frame format is fixed, every participant of the bus can check whether this format is maintained ( e.g. recessive delimiter bits). Otherwise a fault is existent.
  • 6. 2/8/2016 6 Safety Mechanisms • Bit-Stuffing – The CAN protocol uses the NRZ bit coding ( non-return to zero). – This means that there are longer phases without bit edges for synchronization. – To avoid this an inverted stuff bit is set after 5 bits of the same polarity. This bit permits the synchronization of every node and is deleted when received. • Cyclic Redundancy Check (CRC) – The transmitted message is secured again by CRC. Thereby the message is divided by a special polynomial generator and the result is deposit in the CRC field. The message is divided again by this polynomial generator by the receiver and the result is compared with the transmitted CRC field. If there are not identical a transmission error has appeared. (polynomial generator x15+x14+x10+x8+x7+x4+x3+1 CRC (Cont…) • It should be clear by now that a major goal in designing error detection algorithms is to maximize the probability of detecting errors using only a small number of redundant bits. Cyclic redundancy checks use some fairly powerful mathematics to achieve this goal. • For example, an 8-bit message consisting of the bits 10011010 corresponds to the polynomial, • M(x) = 1Ă—x7 +0Ă—x6 + 0Ă—x5 +1Ă—x4 + 1Ă—x3 + 0Ă—x2 +1Ă—x1 + 0Ă—x0 = x7 +x4 + x3 +x1
  • 7. 2/8/2016 7 CRC (Cont…) • We wanted to create a polynomial T(x) for transmission that is derived from the original message M(x), is k bits longer than M(x), and is exactly divisible by G(x). • We can do this in the following way: 1. Multiply M(x) by xk, that is, add k zeros at the end of the message. Call this zero-extended message xk M(x). 2. Divide xk M(x) by G(x) and find the remainder R(x). 3. Subtract the remainder from xk M(x) to get T(x). It should be obvious that what is left at this point is a message that is exactly divisible by G(x). Example-1
  • 8. 2/8/2016 8 Sample Exercise The CAN-specification does not restrict the number of bus nodes, the length of the bus system and the maximum baud rate. Nevertheless, the bus length or the maximum baud rate, respectively, is limited in a real bus system. a) Give the correlation between the baud rate and the maximum bus length. Assume a simplified bit-timing-model. What is the maximum bus length of a CAN bus system if a baud rate of 500kbit/s shall be achieved? The signal propagation velocity is vSig = 0.2m/ns (signal propagation velocity on a two-wire line) and the delay time caused by the signal processing is 100ns. Solution
  • 9. 2/8/2016 9 • Three nodes start at the same time to write messages on the bus with the identifiers 204 (hex), 208(hex) and 287(hex). a) Write down the identifiers in binary notation. Take possible safety mechanisms into account. Answer: 204(hex) = 516(dec) = 010000010100 (bin) (Stuff-Bit) 208(hex) = 520(dec) = 010000011000 (bin) (Stuff-Bit) 287(hex) = 647(dec) = 01010000111 (bin) b) Which message will prevail in the arbitration process? Why (give reasons)? Answer: The message with the identifier 204 will assert it elf since it has the lowest identifier and with that the highest priority (zero-level is dominant). c) Carry out the arbitration process step by step. At which time, do the nodes with the lower priority stop their transmission? Which signal level results on the bus? Answer:
  • 10. 2/8/2016 10 Exercise The control of the power train of a new car requires four controllers to exchange safety critical data. Motor controller and gearbox controller exchange data cyclically with a period of 20 ms. ABS-controller and motor controller exchange cyclically safety critical data with a period of 10 ms. Additionally, motor controller, gearbox controller, and ABS-controller shall send acyclic data of variable length to the central diagnosis device. Which one of the bus systems CAN, FlexRay, Profibus, or EtherCat is suited for the interconnection of all four controllers? Explain for each bus system why it is suited or unsuited! Exercise: Solution • FlexRay: best suited. It’s time triggered and allows deterministic transmission of safety critical cyclic data and asynchronous data as well. • Profibus: Master-Slave-communication Single-Point of failure – No deterministic cycle time – Not suited • EtherCat: Special hardware required rather expensive • CAN: suited, but CSMA-CA not deterministic
  • 11. 2/8/2016 11 Sample Questions: 1. Define CAN bus. Give the reason of developing of CAN bus. 2. List some application of CAN bus. 3. Describe the protocol used in CAN bus to MAC layer. 4. Give the bus level used in CAN bus with an example. 5. Describe briefly the data frame format used in CAN bus. 6. Define remote frame, error Frame and overload frame used in CAN bus. 7. Describe briefly the safety mechanism techniques used in CAN bus. 8. Describe CRC technique with an example. Exercise • CAN-Bus (approx. 35 min) In an automation-project of an office building you have the task to engineer the field bus. A CAN-bus is to be used. The office building consists of 7 floors (including ground floor) with 14 offices each. The building automation system is responsible for the climate control, fire monitoring, and lighting control. Figure 1 shows the layout of a floor of the office building.
  • 12. 2/8/2016 12 The following requirements have to be considered: • In each office a CAN node exist. The CAN node is connected with a smoke detector, a temperature sensor, a light sensor, and a climate control unit to set the room temperature. The coordination and control is realized through a central automation computer. • The central automation computer should be able to query explicitly every sensor and actuator in every room. • In order to provide maximum safety, messages that come from the smoke detectors shall have a higher priority than all other messages. The sensor and actuator layout of an office is shown in Figure 2.
  • 13. 2/8/2016 13 1. Bus Configuration In the first step, the basic parameters of the bus system are to be determined. Question 2.1: Transmission Rate The length of the bus cable is 1480 m. What is the maximum possible transmission rate? You may assume a simplified bit timing model. The signal propagation velocity is Vsig = 0.2 m/ns and the delay time caused by the signal processing is 100 ns. Question 2.2: Message Transfer Time The maximum message transfer time shall not exceed 1.25 ms. You may assume a maximum message length of 80 Bit. Can this be realized with the maximum transmission rate? Justify your answer with a calculation.
  • 14. 2/8/2016 14 Solution 2.1 & 2.2 2. Message Format In the second step, the actual CAN messages are to be specified. The message identifier and the respective data parts have to be defined. Hint: Use binary representation! Question 2.3: Message Coding Each message to be transmitted shall contain the message type, the floor number, and the office number. a) Which messages must be distinguished in the system? b) How do you define the encoding of message identifiers, taking message priorities into account? Give a schematic definition of the message identifiers and justify your decision. c) Give for each message occurring in the system an example with appropriate coding of the message identifier.
  • 15. 2/8/2016 15 Solution 2.3 b) As any sensor/actuator is to be addressed individually, the coding has to be done within the identifier Considering the higher priority of fire alarm messages, the definition of the Identifiers is as follows:
  • 16. 2/8/2016 16 Question 2.4: Data Coding The MEASURED-temperature values of a temperature sensor are measured in an interval of 0° C to 100° C with an accuracy of 0.1° C and sent to the central automation computer on demand. The SET- temperature values of the climate control unit are provided in an interval of 5° C to 30° C with a resolution of 0.1° C. The smoke detector reports only the status (1 - smoke / 0 - no smoke). The MEASURED-light values of a light sensor are measured in an interval of 0 lx to 10000 lx with an accuracy of 1 lx and sent to the central automation computer on demand. a) What is the minimum size of the required data part of the respective CAN messages in bytes? b) Write down the respective data parts of the minimum and maximum values. You do not need to apply any safety mechanisms. Question 2.5: Safety Mechanisms Write down the message identifier and the data part for the message that represents a MEASURED-light value of 2727 in office No. 13 in the 4th floor. Apply CAN-specific safety mechanisms where necessary. Explain briefly your result. Solution 2.4 • MEASURED Temperature: Interval from 0°C-100°C with accuracy 0.1°C => 1000 values Coding of 1000 values => 10bit => 2 Data byte necessary Coding: binary 0 = 00000000 00000000 = 0°C (without Stuffing-Bit) binary 1000 = 00000011 11101000 = 100°C (without Stuffing-Bit) • SET-Temperature: – Interval from 5°C - 30°C with accuracy 0.1°C => 250 values – Coding of 250 values => 8 bit => 1 Data byte necessary – Coding: binary 0 = 00000000 = 5°C – binary 250 = 11111010 = 30°C
  • 17. 2/8/2016 17 • Fire alarm: – 1 Status bit => 1 bit => 1 Data byte! – Coding: – 0_0_0_0_0_0_0_Status bit • MEASURED-light: – Interval from 0 – 10000 with accuracy 1 => 10000 values – Coding of 10,000 values => 14 bit => 2 Data byte necessary – Coding: binary 0 = 00000000 00000000 = 0°lx (without Stuffing-Bit) – binary 10000 = 00100111 00010000 = 10000°lx (without Stuffing-Bit)
  • 18. 2/8/2016 18 Exercise: Home Automation In this question we deal with ambient intelligence, which is a new trend in controlling the living environment with respect to the human users. The plan shown in figure 3.1 shows the top view of a house. The house is equipped with a CAN-Bus which can be used to connect various devices together. One of the Bus members is an industrial PC (IPC), which has the responsibility of coordination. It can also be used for manual inputs to the system by the users. Your task as an automation engineer is conception of a CAN-Bus network to fulfill the following requirements: • Blind control: The blind is connected to the CAN-Bus via the PLC of question 2. Here only the state of the two sensors (wind, light) are being sent to the IPC in one message. • Radiator: There are 5 radiators placed in each room (except for the corridor and balcony). The radiator sends the current temperature of the room to the IPC and receives the desired temperature via the IPC. • Fire Detector/sprinkler: In order to fight back against fire, “Fire Detectors” (Sensor) and “sprinklers” (actuator) for detecting the fire and extinguishing it are used in pairs. Each room contains one pair of fire detector/sprinkler, summing up to a total amount of 6 pairs. As soon as a fire is detected (fire detector activated), an alarm message is sent to the IPC. The IPC, then, sends an activation message to the corresponding sprinkler. • Air-Conditioning system: Altogether, there are 3 AC systems in the house. One in the bedroom, one in the working office, and one in the living room. It sends the current room temperature to the IPC and receives the desired temperature via the IPC. Furthermore, it can explicitly be turned on/off from the IPC. • Security system: The security system is being considered here as a black box. Its only relevant action for us is to send an alarm message to the IPC in case of security issues.
  • 19. 2/8/2016 19 • Industrial-PC: The IPC implements a user interface for communication between the CAN-Network and the user; it presents information about the connected devices to the CAN-Bus and allows interaction with them. Furthermore, if a message from one of the Bus members affects another Bus member, this has to be sent first to the IPC and via the IPC to the corresponding component.
  • 20. 2/8/2016 20 Question 3.1: CAN-Node architecture Design a suitable bus topology (arrangement of the nodes) that realizes the requirements of the house. Mention all your CAN nodes. Question 3.2: CAN-Messages Identify the messages that are necessary to communicate between different node. Write down for each node which message(s) are being sent or received by it. Combine messages of equal type to one message. Question 3.3: Message-Identifiers For the purpose of addressing various nodes on the CAN-Bus System, you have been given an address range from 300(hex) to 400(hex). Determine the message identifiers for the messages you have detected in 3.2. Take into account the realistic requirements on the system. Question 3.4: Baud rate The length of the CAN-Bus System is 40m. Calculate the maximum baud rate of the Bus. Consider the signal propagation velocity is 0.2m/ns and electrical switching time 200ns. Question 3.5: Extension to the security system In case of an alarm from the security system, a picture taken from a camera installed in the house will be sent to the IPC through the CAN-Bus system. The size of the picture is 340 kByte. Since the size of a standard CAN message is not sufficient for sending such a picture, it must be separated into several parts. Create a concept to efficiently encode the data parts. Consider the order of the part messages. Write down your concept and mention the required number of CAN messages for transmitting one picture.
  • 21. 2/8/2016 21 Exercise: Ship Accident After the fatal Costa Concordia cruise ship accident, the junior engineers of the Jahangirnagar University have received the task to construct a new cruising ship, Costa Concordia v2. Employing automation engineering techniques and highly modern technologies, the new cruising ship should provide her passengers more comfort and safety. Due to cost matters it must, first a small prototype of the cruising ship should be constructed. If this fulfills the requirements, an order for constructing the real cruising ship will be allotted. From now on the small prototype is meant, whenever Costa Concordia v2 is mentioned. The Costa Concordia v2 consists of 7 floors with 14 cabins and a restaurant on each (see figure 1.1). The following decisions/requirements are to be considered in Costa Concordia v2: • Each cabin and restaurant has a smoke detector, which in case of fire sends a signal to the central control unit. This signal causes a chain of alarms to go off. For more simplicity the chain of alarms is considered as one alarm. Furthermore, simultaneous occurrence of two or more alarms from different cabins or restaurants is ignored. • In each cabin and restaurant there is a temperature sensor and a temperature selector installed. The temperature sensor sends the current temperature to the central control unit. Via the temperature selector a person can set the desired temperature, manually. Once a person has set a desired temperature, it is sent to the central control unit. Furthermore, the temperature can be set automatically by the central control unit, regardless of the selector. • On the outside body of the cruising ship (under the water) a modern sonar unit (Sound Navigation and Ranging Unit) is installed. The sonar unit can detect the underwater reefs, which might be hazardous for the cruising ship. In case such a reef is detected, a signal is sent to the central control unit. • The central control unit should be able to access all the sensors/actors in each cabin or restaurant. • In order to make the future passengers of Costa Concordia v2 always positively remember the junior engineers of the University of Stuttgart a further comfort function should be included. Each cabin will have a cool box, which will be filled with German beer. An integrated sensor in the cool box detects how many beer bottles are left. If the amount of beer bottles is not equal to the maximal capacity of the cool box, a signal is sent to the central control unit. This signal will from thereon be forwarded to the catering staff to take care of. The catering staff is not considered here.
  • 22. 2/8/2016 22 The distribution of the sensor and actor elements of the cabins and restaurants, shown in figure 1.1, is the same for each floor. Question 1.1: CAN Baud Rate The length of the bus system is 1590 m. What is the maximal possible baud rate? Assume that the signal propagation velocity is v line) and the delay time caused by the signal processing is 100 ns. Question 1.2: CAN Message Length The maximal message transmission time should be 1.5 ms. How big is the maximal message size allowed to be? Question 1.3: CAN Identifier Each transmitted message should include the type of the message, the floor number and the cabin number. Design an identification coding, which fulfills the above mentioned requirements. How would you choose your coding? Provide an example for each type of message.
  • 23. 2/8/2016 23 The measured temperature values of the temperature sensors are measured in an interval of 0°C to 100°C with an accuracy of 0.1° and can be sent to the central control unit on demand. The desired temperature values, given via the temperature selectors, are provided in an interval of 5°C to 30°C with a resolution of 0.5°C. The smoke detectors, sonar unit and cool boxes send only the status (1 -smoke / 0 - no smoke), (1 - reef detected / 0- no reef detected) and (1 cool box full- / 0 – cool box not full). a) What is the minimum size of the required data part of each CAN message type in bits and bytes? Justify your answer. b) Write down, in binary form, for each type of message the data field corresponding to the start value of the message and the end value of that message. E.g. for the type of message “desired temperature” the binary forms of the CAN messages 5°C and 30°C are requested. Hint: · Write down only those bytes, which are required for each data field. · Ignore any CAN specific safety mechanisms. Question 1.5: CAN Message Examples Write down the message identifier and the data part for the message that represents the measured temperature value of 25.6° C of the cabin number 14 on the 7th floor and the measured temperature value of 12.8° C of the cabin number 1 on the 1th floor. Write your answer in binary as it will appear on the bus. Apply CAN-specific safety mechanisms where necessary. Question 1.6: CAN Arbitration The two temperature messages of the question 1.5 are put simultaneously on the bus. Which message receives the bus access? Justify your answer. Sketch the arbitration process and the sending behavior of each CAN node. What appears on the bus?