Beruflich Dokumente
Kultur Dokumente
Laboratory Course
Industrial Automation
Experiment Nr. 6
Introduction to the FlexRay bus system
FlexRay Basics
Room 1.126
Table of contents
TABLE OF CONTENTS ......................................................................................................... 2
ABBREVIATIONS .................................................................................................................. 3
NAME CONVENTIONS ......................................................................................................... 6
GLOSSARY .............................................................................................................................. 7
1
FLEXRAY....................................................................................................................... 10
1.1
1.2
MOTIVATION .............................................................................................................. 10
REQUIREMENTS AND PROPERTIES ............................................................................... 10
OSI-MODEL ............................................................................................................... 12
STRUCTURE OF A COMMUNICATION NODE .................................................................. 12
TERMINATION OF NODES............................................................................................. 15
PHYSICAL TOPOLOGY ................................................................................................. 17
SIGNAL TRANSMISSION ............................................................................................... 20
WAKEUP ..................................................................................................................... 22
STARTUP ..................................................................................................................... 23
SYNCHRONIZATION .................................................................................................... 25
RE-SYNCHRONIZATION (BIT-SYNCHRONIZATION) ..................................................... 27
TIMING ....................................................................................................................... 30
COMMUNICATION STRUCTURE .................................................................................... 32
2.11.1
2.11.2
2.11.3
2.11.4
2.11.5
2.11.6
Header ......................................................................................................................................... 35
2.12.2
Payload ....................................................................................................................................... 36
2.12.3
Trailer ......................................................................................................................................... 36
2.12.4
12.10.2012
Abbreviations
AP
Action Point
APO
ASAM
BD
Bus Driver
BM
Bus Minus
BP
Bus Plus
BSS
Capacitor
CAN
CAPL
CAS
CC
Communication Controller
CHI
CI
Channel Idle
CID
CODEC
CRC
CSMA/CA
CSN
Coldstart Node
CSP
DTS
ECU
EMV
ESP
FES
12.10.2012
FSS
FSP
FTDMA
FTM
ID
Identifier
I/O
Input/Output
HW
Hardware
IAS
ISO
Inductivity
LIN
MAC
MiL
MT
Macrotick
MTS
MOST
Microcontroller
Microtick
NIT
NM
Network Management
OSI
PDU
I-PDU
L-PDU
N-PDU
POC
Resistor
12.10.2012
SDL
SPI
SuF
Startup Frame
SW
Software
SyF
Sync Frame
TDMA
TP
Test Point
TRP
TSS
TxEN
TxD
WUP
Wakeup Pattern
WUS
Wakeup Symbol
XML
12.10.2012
Name conventions
The following name conventions are geared to the FlexRay specification 2.1.
<Variable> := <prefix_1>[<prefix_2>]<Name>
<Prefix_1> := a | c | v | g | p
<Prefix_2> := d | l | n | s | u
table 1 Parameter prefix 1
Prefix_1 Typ
a
c
v
auxiliary
parameter
Protocol
constant
Node
variable
Network
parameter
Node
parameter
Beschreibung
Thisauxiliaryparameterisusedtodefineorderiveotherparametersor
limits.
This value defines properties or limits of the protocol. The value is
providedintheprotocolandcannotbechanged.
Valuewhichcanchangedependingontime,eventsetc.
Globalparameter,whichisvalidforallnodes.Itcanbedefinedinthe
POC:default config state and can only be altered in the POC:config
state.
Parameter which can have different values for different nodes in the
network.ItcanbedefinedinthePOC:defaultconfigstateandcanonly
bealteredinthePOC:configstate.
Time
l
n
s
u
Length
Amount
Set
Voltage
Beschreibung
A value (parameter, variable ) which describes a period of time
betweentwopointsoftime
Physicallength,e.g.ofacable
Amount,e.g.ofslots
Asetofvalues(parameters,variables)
Voltagedifferencebetweentwocables
12.10.2012
Glossary
AUTOSAR
Backbone
Bus
Bus system
Bus Driver
Branch
A sub-network of a cluster
Channel Idle
Cluster
A FlexRay network
Coldstart Node
Communication
Controller
Communication
Cycle
Communication
Slot
Cycle Counter
Cycle Time
Dynamic Segment The dynamic segment is used to transmit non-regular data. It use is
optional in a FlexRay-cycle, and it utilizes the FTMDA method.
Dynamic
Communication
Slot
12.10.2012
FIBEX
Data format based on XML, which defines the entire FlexRay network
Frame
FTDMA
Header
Host
Jitter
Knoten/Node
Layer
Macrotick
Microtick
Minislot
These slots divide the dynamic segment into up to 7986 parts. They can
be combined into a dynamic slot.
Null Frame
A frame which does not include any data for the receiver is called null
frame. It is identified by a bit in the header, and all data bytes are set to
Data_0
Payload
PDU
Slot
Startup Frame
Startup frames are FlexRay frames which are identified by the Startup
Frame Indicator bit in the header. They are sent for 8 cycles at the start
of the synchronization process. A startup frame always is a sync frame
as well.
Startup Slot
12.10.2012
Static
Communication
Slot
These slots have a fixed length and a unique slot ID. A corresponding
note has exclusive bus access.
Static Segment
Sync Frame
Sync Slot
TDMA
The TMDA method assigns a time slot to every node, in which the
node has exclusive access to the bus.
Trailer
The trailer is the last part of a frame, and includes three bytes CRC for
error detection.
Wakeup Node
12.10.2012
10
1 FlexRay
1.1 Motivation
Because of the huge potential for innovation in automotive electronics, and the resulting
possibilities to make driving safer, more comfortable and more economic, the automotive
sector is undergoing a trend towards electrification since the 90s. This trend continues up until
today [Joch07].
To provide the desired level of functionality in a modern day car, a variety of electronic
control units (ECU) have to interact with each other.
For historic reasons, and because of the low data transfer rates needed in the past, the CAN
bus system has been established as the primary bus system in modern cars. For special use
cases, there are additional bus systems. As an example, the connection between the actuators
and sensors inside of a door is realized by the low-cost LIN bus [LIN11], and the MOST bus
is used for multimedia applications [MOST11].
Since the requirements for electronic and mechatronic control units are getting higher for
modern-day and future cars (e.g. for steer-by-wire), there is a need for a real-time
communication with high data rates. Since such a communication is not possible with CAN, a
consortium has been founded in the year 2000, to develop a new bus which complies with
these requirements.
Founding members were the companies BMW, Daimler, Motorola and Philips. During the
years, the structure of the consortium has been divided in Core, Premium Associate, Associate
and Development members. In the year 2009, the consortium has been closed, as the FlexRay
specification 3.0 had been released. At this point, the Core members were BMW, Bosch,
Daimler, Freescale, GM, NXP and VW. There were 28 Premium members, more than 60
Associate members, and several hundred Development members.
Currently, the FlexRay specification 2.1 is being used. It can be downloaded from the official
homepage [Flex11], until the specification 3.0 has been successfully merged into the
following ISO standards:
ISO 10681-1:2010 Road vehicles Communication on FlexRay Part 1: General
information and use case definition
ISO 10681-2:2010 Road vehicles Communication on FlexRay Part 2: Communication
layer services
Transmission rate a transmission rate significantly higher than CAN (500 Kbit/s)
should be achieved
Global synchronous time base the communication protocol should provide a global
time base, which can be used to synchronize the various ECUs.
12.10.2012
11
Extendibility The network should be easily extendable. Single ECUs should be able
to be removed or added to the network..
CSMA:
TDMA:
Figure 1.1 Examples for time- (CSMA) and event-based (TDMA) communication
[Ghn10]
As a result of these requirements, the properties of the FlexRay system have been specified.
The key parameter of any communication system is the data rate. In respect to current and
future demand for bandwidth, a sufficiently high data rate of 10 Mbit/s per channel has been
selected.
A synchronous time base is provided, which ensures the deterministic character of the system.
Because of that, the event-based communication process using priorities (CSMA/CA), as used
in the CAN bus, had to be abandoned. Instead, a time-based method (TDMA) is used for data
transmission, see Figure 1.1. By using scheduling, an accurate time plan is possible, while
still allowing for a jitter of 0.5 to 10 S (1 to 3S typical)..
Because the communication process is organized in cycles, providing each ECU with defined
slots, a deterministic delay for messages can be guaranteed.
The focus during the development was to make the system flexible and extendable. As a
result, it is possible to choose which messages should be transmitted redundant, and the
system can be optimized for reliability or performance, using static or dynamic bandwidth
allocation.
As many as 60 parameters e.g. message length or cycle length - in the network design allow
an optimization of the network for the specific application or task.
12.10.2012
12
2 Technical basics
2.1 OSI-Model
12.10.2012
13
12.10.2012
14
config The microcontroller submits specific data from the FIBEX or AUTOSAR
file, which is necessary for the operation of the Communication Controller.
ready The Communication Controller has been successfully set up and is ready for
starting the communication process. It can either join an existing system, or wakeup
an idle network.
startup In this state, the node tries to synchronize with the bus. Depending on the
role of the node, there are two different procedures. If the node is a Coldstart Node, it
actively participates in the synchronization process of the network. Otherwise, it uses
the existing bus communication to synchronize itself.
12.10.2012
15
normal active This is the main operating state of the Communication Controller, in
which communication with the bus is possible
normal passive In case of specific errors, the node autonomously switches to this
state or the halt state. The node is only allowed to listen to the bus, but is prohibited
from transmitting data. If the AUTOSAR specification is used, this state isnt used for
security reasons, since the microcontroller isnt able to control the transition to the
state.
halt All processes in the Communication Controllers are stopped. This state is
reached, if an internal error of the Communication Controller occurs. It can only be
left via the default config state.
For detailed information, consult the FlexRay Communication System Protocol Specification
[FRPS05].
12.10.2012
16
Terminatedendofacable
RT=80110
Figure 2.5 Termination with a resistor [FREPLS06]
A ECU with termination is marked by a filled black square.
A better way of termination is shown in Figure 2.6. The resistor RT is replaced by two
identical resistors RTA and RTB. In between these two resistors, a 20 MHz RC filter is placed.
RTA,RTB=40...55
R1<10
C1=4700pF
RLine1
L100H
Lstray<1H
12.10.2012
17
UnterminiertesKabelende
12.10.2012
18
12.10.2012
19
12.10.2012
20
Idle_LP (Idle Low Power) the level uBus is 0 V, and transceivers pull the voltage
level of the FlexRay bus to GND.
Data_0 the level uBus is -2 V, since at least one FlexRay transceiver has set Bus
Plus to 1.5 V and Bus Minus to 3.5 V.
Data_1 the level uBus is -2 V, since at least one FlexRay transceiver has set Bus
Plus to 3.5 V and Bus Minus to 1.5 V.
The bus states Idle, Data_0 and Data_1 are detected by the Bus Drivers in normal mode of
operation, and have different values, depending on their position in the network. These Test
Points (TP) are defined in Figure 2.15, and Table 2.1 shows the valid levels of uBus.
Additionally, Figure 2.16 shows the timing of the falling and rising edges and the signal
duration.
12.10.2012
21
uBus [mV]
TP4
TP1
TP4
TP1
TP4
TP1
TP4
Min
-150
0
-150
-600
-400
600
400
Max
150
30
150
-2000
-2000
2000
2000
12.10.2012
22
2.6 Wakeup
The transition from the low power state to a powered state of the Bus Drivers is called
Wakeup. This transition can be initialized by the Communication Controller, or by the bus
itself, if the Bus Driver receives Wakeup Patterns. For the latter, the Bus Driver has to
identify at least two Wakeup Symbols.
Not every ECU on a network is allowed to send Wakeup Patterns. If a ECU has the
permission to send such patterns, it is called a Wakeup Node, and may send 2 to 63 Wakeup
Symbols.
A Wakeup Symbol is defined (see Figure 2.17) as a Data_0 phase followed by an Idle phase.
To ensure the Bus Driver can identify these phases, the following timing constraints have to
be obeyed: dWU01, dWUIdle1, dWU02, dWUIdle2 > 4s und dWU < 48s.
Description
Acceptable limits for detecting a
Data_0 phase.
Acceptable limits for detecting an
Idle phase.
Acceptable limits for detecting a
Wakeup Pattern
Min
1
Max
4
Unit
s
48
140
However, it is possible to define different Wakeup Nodes for channels A and B. This opens
up additional possibilities for the network designer, as seen in the example in Figure 2.18.
Here, the network on channel A is woken up by ECU1 due to a local event, while channel B is
still asleep.
12.10.2012
23
2.7 Startup
While starting up a FlexRay network, all timers of the ECUs are synchronized. The difficulty
consists of synchronizing nodes with the communication, while not disrupting nodes which
are already synchronized. This is examined in-depth in section 2.8.
There are several scenarios which can occur during the Startup of a FlexRay network. It has to
be considered that only Coldstart Nodes are allowed to send Startup Frames. Also, the ECUs
have to be in POC:ready state, before they can participate in the Startup of the cluster.
1. Scenario no Coldstart Node in the cluster
This scenario occurs, if no Coldstart Node has been defined in the cluster, or if these
nodes arent in POC:ready state.
In practical use, this situation often occurs while testing a single ECU. For starting the
communication in that case, the software has to simulate the Coldstart Nodes.
12.10.2012
24
12.10.2012
25
2.8 Synchronization
A precondition for using the TDMA method is a synchronized bus. For this, FlexRay uses a
mechanism for distributed clock synchronization, i.e. as shown in Figure 2.21 , every node
derives the cycle clock from its own clock
12.10.2012
26
12.10.2012
27
Discarding of extreme values, depending on the number of nodes in the cluster. (If the
number is between 3 and 7 , the highest value and the lowest value are discarded. If
the number of nodes exceeds 7, the two highest values and the two lowest values are
discarded)
If a node detects a massive discrepancy during the procedure, it stops transmitting and
switches to POC:normal passiv state.
28
As a security measure, the Action Offset Point (APO) in each slot has been introduced (see
Figure 2.24). With the help of the APO, it is possible to compensate slight timing differences
between ECUs, and to compensate for bus delay, without interfering with the global
synchronization process.
29
since it is shortened by every Bus Driver for latency reasons. After that, the Frame Start
Sequence (FSS) starts, which is used as a safety buffer against quantization error while bit
sampling.
After that, the actual frame starts. In front of every byte, a Byte Start Sequence (BSS) is
transmitted, to help bit synchronization. After the last byte, the static frame is delimited by an
Frame end Sequence (FES).
In Figure 2.25 and Figure 2.26 you can also see the signals TxD and TxEN, which are
generated by the Communication Controller while transmitting.
In a frame in the dynamic segment (Figure 2.26), the FES is followed by a Dynamic Trailing
Sequence (DTS).. It is a Low phase with variable length, which extends every frame until the
next Media Access Control (MAC), to enable an exact assignment to the Minislot-ID. The
dynamic frame is delimited by the High bit of the DTS. The bus goes to Idle level after that.
12.10.2012
30
2.10 Timing
In addition to the signal levels, timing plays an important role in the communication of a
FlexRay bus, since without timing none of the protocol mechanisms would work. In Figure
2.27, the hierarchical structure of the different time units is shown.
(2)
(3)
12.10.2012
31
(4)
From the selected bus data rate of 10 Mbit/s results the bit duration gdBit = 0.1s (1), by
multiplying the number of samples per bit cSamplePerBit = 8 with the sample duration
gdSamplesClockPeriod.
As for choosing the duration of a Microtick pdMicroTick, there are three different
configurations to choose from, depending on the ECU. For example, with an oscillator
frequency of 80MHz the number of samples per Microtick equals pSamplesPerMicroTick = 1
an using (2) , the duration of a Microtick equals pdMicroTick = 0.0125s.
By selecting the length of a Macrotick gdMacroTick it is possible to create a standardized
proportion pMicroPerMacroNom between Microtick und Macrotick (3). Using the cycle
length gdCycle we are able to calculate the number of Macroticks per Cycle gMacroPerCycle
(4).
Even more details can be found in the FlexRay Specification [FRPS05].
12.10.2012
32
StaticSegment:
Timetriggeredtransmission
BusaccessusingTDMA
DynamicSegment(optional):
EventtriggeredTransmission
BusaccessusingFTDMA
SymbolWindow(optional):
TestsymbolperCyclefortheusewithaBusGuardian
NITNetworkIdleTime:
Segmentforsynchronizationofthenodes
12.10.2012
33
12.10.2012
34
35
Figure 2.31 shows that the optional Symbol Window follows the dynamic segment. It can be
used to send one Symbol per Cycle.
The length gdSymbolWindow of the Symbol Windows can be defined between 0 and 142
Macroticks. The Media Access Test Symbol (MTS) is used to check the Bus Guardian and is
the only Symbol currently used. The length cdCAS of the Media Access Test Symbols is 30
low bits, just like the one of the Collision Avoidance Symbol. The Collision Avoidance
Symbol isnt transmitted in the Symbol Window, but during the Startup oft he cluster.
2.11.6 Network Idle Time
Every communication cycle ends with the Network Idle Time. In this segment, the bus is
silent, there is no communication.
The Network Idle Time is used to synchronize the ECUS, and is defined by the parameter
gdNIT (2 to 805 Macroticks). As seen in Figure 2.31, the Network Idle is divided in two parts.
During Channel Idle (CI) the synchronization calculation is performed, and is adjusted in the
Offset Correction Segment.
Status Bits at the start of a frame, the Reserved Bit, Payload Preamble Indicator,
Null Frame Indicator, Sync Frame Indicator and Startup Frame Indicator are
transmitted. The bits describe the type of payload transmitted. A detailed description is
available in [FRPS05].
12.10.2012
36
Frame-ID also called Slot ID. Defines in which slot the frame should be
transmitted. The ID has a length of 11 bit and has a range from 1 to 2047, since 0 is
reserved for invalid frames.
Payload Length defines the number of bytes in the payload segment, divided by
two. It is only possible to configure payloads with an even number of bytes. Using its
seven bits, a range from 0 to cPayloadLengthMax = 127 can be configured, which
translates into a payload length of 0 to 254 bytes..
In any given network, the length of the payload in the static segment is identical. In
the dynamic segment, the length of the payload may differ from cycle to cycle. It may
also be different for the two channels.
Header CRC is a checksum, which is calculated over the area marked in red in
Figure 2.32. The Header Cycle Redundancy Check (CRC) polynome is:
1
Cycle Count defines, in which cycle the Frame shall be send. It is possible to
address 0 to cCycleCountMax = 63 with this 6 bit value..
2.12.2 Payload
The payload area contains the actual data transmitted by the node. The length of the FlexRay
payload is 0 to 127 words, which translates to 0 to 254 bytes. A part of the payload can be
used for the Network Management Vector in the static segment or the Message ID in the
dynamic segment by setting the Payload Preamble Indicator.
2.12.3 Trailer
The trailer contains the CRC which is calculated over the entire length of the frame. With its
help, received data can be checked for validity. The polynome used in FlexRay has a
Hamming Distance of 6 at a frame length of 248 bytes. That means it is possible to detect up
to 5 bit transmission errors per frame. If the frame length is increased to 254 bytes, the
Hamming Distance decreases to 4.
Das polynome for the calculation is:
1
1
1
1
For the calculation of the CRC, both FlexRay channels are initialized using differ values. That
way, only data for the correct channel can be verified successfully.
2.12.4 Null frame
A null frame has the Null Frame Indicator bit set to zero, such a frame does not contain any
data. The payload section exists, but al data is filled up with zeros.
This frame is sent in the static segment, if the transmit buffer is blocked by the host, but the
node has to send in his slot. If such a case occurs in the dynamic segment, there is no frame
sent at all.
This method is important, especialy for Startup and Sync Fames. These actions are done by
the Communication Controller, and dont require interaction from the host.
12.10.2012
37
I-PDU Interaction Layer PDU, can consist of one or more signals, has its own
Update Bit.
L-PDU Data Link Layer PDU are the equivalent to Frames. They can contain one or
more I-PDU. It is possible to split up a single I-PDU between multiple L-PDU
Since FIBEX Version 3.0 I-PDUs are supported, but there is no definition for N- und LPDUs.
Using PDUs offers a lot of advantages. The receiver only has to process the data, if the
corresponding Update-Bit is set. Since otherwise the data has not been refreshed yet, or is
invalid. This saves processing power. It is also possible to have an easier structure for data.
Also, the data is directly provided, and it isnt necessary to search for it in the frame.
12.10.2012
38
If we take a look on node M in Table 2.4, we can see that it is assigned slots 2 and 7. In the
static segment, node M uses channel A only. Here, it sends three different frames, e.g. frame
y, which has a base cycle of 2 and a repetition factor of 4. That means, that frame y is sent in
cycle 2 for the first time, and after that every 2+4n (with n = 1..15) cycle.
In the dynamic segment, it is acceptable for different nodes to use the same slot. Further, the
nodes are allowed to send different frames, and different nodes may use the different channels
of a slot. Again, all frames have to provide the information needed for Cycle Multiplexing.
If we take a look at slot 7, we can see that node M shares this slot with nodes L and O. In a
cycle, it is possible to send different frames from different nodes. It is also possible for
Channels A and B to be asynchronous, i.e. for a given point of time, A has a different slot id
than B.
12.10.2012
39
Literature
[Joch07]
[Ghn10]
[Flex11
[FRPS05]
System
Protocol
[LIN11]
[MOST11]
[Vect11]
[VeSc11]
12.10.2012