CAN Basic Traininig
CAN Basic Traininig
CAN Basic Traininig
16.05.2008
Continental AG
Training content
1. WHY we need CAN
2. WHAT is CAN
3. HOW does CAN work! (protocol explained)
4. PROGRAM presentations(CAN tools)
5. PRACTICE session (CAN in real life)
Information exchange
Information exchange
Information
Information exchange
exchange
Information exchange
Information exchange
Information exchange
Information exchange
Information exchange
Information exchange
Information exchange
Information exchange
Information exchange
Information exchange
Information exchange
Information exchange
Information exchange
WHAT is CAN
WHAT is CAN
CAN is Reliable
- Sophisticated error detection and error handling
- High immunity against electromagnetic interference
- Automatic retransmission of erroneous messages
- Recovery of temporary errors
- Automatic switch-off of defective nodes
- Guaranteed data consistency
A CAN network running 2000 hours per year at a CAN bus speed of 500 kbit/s with 25% bus load statistically will result in 1 undetected error every 1000 years .
WHAT is CAN
CAN is Real-Time.
- High baud rate
- Short message length
- Low latency
- Multi-master
- Arbitration
WHAT is CAN
CAN is Fast
- 8-Byte limit on messages
- Bus access prioritized
- 1 Mbps baud rate
WHAT is CAN
CAN is Flexible
- Number of nodes not limited by protocol (only by physical layer)
- Changes possible without disturbing communications
A Data Frame is generated by a CAN node when a node wishes to transmit data. Here, we
see an example of a Standard CAN Data Frame. The frame begins with a dominant Start Of
Frame bit for hard synchronization of all nodes
The Start of Frame bit is followed by the Arbitration Field, consisting of 12 bits, which includes
the 11-bit Identifier that reflects the contents and priority of the message, and the Remote
Transmission Request bit. The Remote Transmission Request bit is used to distinguish a Data
Frame, when RTR is dominant, from a Remote Frame, when RTR is recessive.
The next field is the Control Field, consisting of 6 bits. The first bit of this field is called the Identifier
Extension, or IDE bit. When this bit is in a dominant state it specifies that the frame is a Standard Frame.
The bit following the IDE bit is reserved and is defined as a dominant bit. The remaining 4 bits of the
Control Field represent the Data Length Code, or DLC, which specifies the number of bytes of data
contained in the message, that is, 0 to 8 bytes.
The data being sent follows in the Data Field which, as weve seen, is of the length defined by the DLC.
The Data Field can contain anywhere from 0 to 8 bytes, or 0 to 64 bits.
Following the Data Field, we have the Cyclic Redundancy Field, or CRC field. This field is used to detect
possible transmission errors. The CRC Field consists of a 15 bit CRC sequence, completed by the
recessive CRC Delimiter bit.
The next field is the Acknowledge Field. The Acknowledge Slot bit is transmitted as a recessive bit. Any
node that has received an error free frame acknowledges the correct reception of the frame by sending
back a dominant bit, regardless of whether the node is configured to accept that specific message or
not. This shows that CAN belongs to the "in-bit-response" group of protocols. The recessive
Acknowledge Delimiter completes the Acknowledge Slot and may not be overwritten by a dominant bit.
The next field is the Acknowledge Field. The Acknowledge Slot bit is transmitted as a recessive bit. Any
node that has received an error free frame acknowledges the correct reception of the frame by sending
back a dominant bit, regardless of whether the node is configured to accept that specific message or
not. This shows that CAN belongs to the "in-bit-response" group of protocols. The recessive
Acknowledge Delimiter completes the Acknowledge Slot and may not be overwritten by a dominant bit.
Between any two frames the bus must remain in the recessive state for at least a further 3 bit times. This
is called Intermission. If, following the frame, no nodes wish to transmit, then the bus stays in the
recessive state, or Bus Idle state.
One CAN bit time, that is one high or low pulse of the NRZ code, is specified as
constructed from four non-overlapping time segments.
For many CAN module implementations, the Propagation Time Segment and Phase Buffer Segment One
are combined into one segment often called Timing Segment One for ease of programming. Phase Buffer
Segment Two is then known as Timing Segment Two.
CAN connectors
PROGRAM PRESENTATIONS
CAN db objects:
- Vehicles (not available in CAN db++)
- Networks
- Control Units (ECUs)
- Environment Variables
- Node Groups (logical grouping of nodes)
- Network Nodes
- Messages
- Signals
CAN db objects:
- Networks
CAN db objects:
- Control Units (ECUs)
CAN db objects:
- Environment Variables
Input and output variables of Network Nodes, such as
switch position, sensor signals and actuator signals.
In the CANdb++ data model environment variables are
assigned to the Control Unit.
CAN db objects:
- Network Nodes
Network nodes are the interfaces of the Control Unit to a Network, over which the control unit outputs
information and receives information via the CAN bus.
A network node is defined by the following System Parameters:
Address
In addition, value tables and values for user defined attributes can be attached to a network node.
CAN db objects:
- Messages
Messages can be transmitted over the CAN bus. A message is defined by the following System
Parameters:
. Other parameters
CAN db objects:
- Signals
Signals represent the smallest unit of information. A signal is defined by the following System
Parameters:
Signal length
The signal length is set in bits.
CANoe
CANoe is a universal
- development
- testing and
- analysis environment for CAN bus systems
CANoe
CANoe is a universal
- development
- testing and
- analysis environment for CAN bus systems
CANoe - development
all real network nodes are connected to the bus in a stepby-step manner. To do this, the network node models can
be switched-off individually in the simulator of the
remainder of the bus.
CANoe in action
CANoe Development
Elements of CANoe:
-built-in (analysis, architecture, measurements,
simulation setups, wizards etc)
-user defined
-panels (graphical control elements user
interaction)
-CAPL programs (implement user interaction)
Trace
Graphics
Interactive generator
Panels
- windows defined by the user that can present
information or drive CAN behavior
Panels
-defining graphical interface using PANEL EDITOR
-define behavior using CAPL programs
Panel Editor
-defines graphically the interface
-defines link between elements and CAPL control
variables (environment variables)
CAPL editor
CAPL is the
programming
language of CANoe
very similar to "C"
code
uC implementation
uC implementation
-done with CANgen (.dbc + config files) =>
generated files. Not the point of this training
-From application point of view there are: [BMW]
-SET_SIG_CAN(signal_name, value)
-SET_SIG_CAN_FORCED(signal_name, value)
-GET_SIG_CAN(signal_name)