Sie sind auf Seite 1von 39

Universitt Stuttgart

Institut fr Automatisierungs- und Softwaretechnik


Prof. Dr.-Ing. M. Weyrich

Laboratory Course
Industrial Automation
Experiment Nr. 6
Introduction to the FlexRay bus system

FlexRay Basics

Room 1.126

Grundlagen FlexRay BasicsV 1.1

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

TECHNICAL BASICS .................................................................................................. 12


2.1
2.2
2.3
2.4
2.5
2.6
2.7
2.8
2.9
2.10
2.11

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

FlexRay Cycle ............................................................................................................................ 32

2.11.2

Bus access ................................................................................................................................... 32

2.11.3

Static segment ............................................................................................................................. 33

2.11.4

Dynamic segment ....................................................................................................................... 33

2.11.5

Symbol Window ......................................................................................................................... 34

2.11.6

Network Idle Time .................................................................................................. 35

2.12 FRAME FORMAT .......................................................................................................... 35


2.12.1

Header ......................................................................................................................................... 35

2.12.2

Payload ....................................................................................................................................... 36

2.12.3

Trailer ......................................................................................................................................... 36

2.12.4

Null frame ............................................................................................................. 36

2.13 PROTOCOL DATA UNIT ............................................................................................... 37


2.14 SCHEDULING AND CYCLE MULTIPLEXING .................................................................. 38
LITERATURE ....................................................................................................................... 39

12.10.2012

Grundlagen FlexRay BasicsV 1.1

Abbreviations
AP

Action Point

APO

Action Point Offset

ASAM

Association for Standardization of Automation and Measuring


Systems

BD

Bus Driver

BM

Bus Minus

BP

Bus Plus

BSS

Byte Start Sequence

Capacitor

CAN

Controller Area Network

CAPL

Communication Access Programming Language

CAS

Collision Avoidance Symbol

CC

Communication Controller

CHI

Controller Host Interface

CI

Channel Idle

CID

Channel Idle Delimiter

CODEC

Coding and Decoding Process

CRC

Cycle Redundancy Check

CSMA/CA

Carrier Sense Multiple Access / Collision Avoidance

CSN

Coldstart Node

CSP

Clock Synchronization Process

DTS

Dynamic Trailing Sequence

ECU

Electronic Control Unit

EMV

Elektromagnetische Vertrglichkeit (engl. electromagnetic


compatibility)

ESP

Elektronisches Stabilittsprogramm (engl. electronic stability control)

FES

Frame End Sequence

12.10.2012

Grundlagen FlexRay BasicsV 1.1


FIBEX

Field Bus Exchange Format

FSS

Frame Start Sequence

FSP

Frame and Symbol Processing

FTDMA

Flexible Time Division Multiple Access

FTM

Fault Tolerant Midpoint Algorithm

ID

Identifier

I/O

Input/Output

HW

Hardware

IAS

Institut fr Automatisierungs- und Softwaretechnik

ISO

International Organization for Standard

Inductivity

LIN

Local Interconnect Network

MAC

Media Access Control

MiL

Model in the Loop

MT

Macrotick

MTS

Media Access Test Symbol

MOST

Media Oriented Systems Transport

Microcontroller

Microtick

NIT

Network Idle Time

NM

Network Management

OSI

Open Systems Interconnection

PDU

Protocol Data Unit

I-PDU

Interaction Layer PDU

L-PDU

Link Layer PDU

N-PDU

Network Layer PDU

POC

Protocol Operation Control

Resistor

12.10.2012

Grundlagen FlexRay BasicsV 1.1


RxD

Receive Data signal

SDL

Specification and Description Language

SPI

Serial Peripheral Interface

SuF

Startup Frame

SW

Software

SyF

Sync Frame

TDMA

Time Division Multiple Access

TP

Test Point

TRP

Time Reference Point

TSS

Transmission Start Sequence

TxEN

Transmit data Enable Not signal

TxD

Transmit Data signal

WUP

Wakeup Pattern

WUS

Wakeup Symbol

XML

Extensible Markup Language

12.10.2012

Grundlagen FlexRay BasicsV 1.1

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.

table 2 Parameter prefix 2


Prefix_2 Typ
d

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

Grundlagen FlexRay BasicsV 1.1

Glossary
AUTOSAR

Development partnership in the automotive sector, which defines


standards for the development of software components

Backbone

A backbone is a network with a high data rate

Bus

A bus is a shared connection between several units (in this case:


FlexRay nodes)

Bus system

A communication system for data transfer

Bus Driver

An electronic component with a transmitter and a receiver, which


enables the communication of the communication controller and the
bus

Branch

A sub-network of a cluster

Channel Idle

A state where no data is transmitted on the bus

Cluster

A FlexRay network

Coldstart Node

A network node, which is allowed to initialize a startup procedure on


an idle bus

Communication
Controller

An electronic component, which implements the FlexRay protocol in


each FlexRay node

Communication
Cycle

A communication cycle is a complete instance of a communication


structure in the FlexRay system, which is repeated cyclic. The
communication cycle consists of a static segment, a dynamic segment
(optional), a symbol window (optional) and the NIT.

Communication
Slot

In the TDMA method, every node is assigned a time interval for


exclusive bus access. This interval is called a communication slot an is
identified by a unique Slot ID,

Cycle Counter

The number of the current communication cycle

Cycle Time

The current duration of a communication cycle in macrotics. The cycle


time is reset to zero at the start of a new communication cycle.

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

This slot consists of several minislots, and is variable in its length

12.10.2012

Grundlagen FlexRay BasicsV 1.1

FIBEX

Data format based on XML, which defines the entire FlexRay network

Frame

A Frame is a basic structure, which is used to transmit data via the


FlexRay network. A frame consists of a header, payload, and trailer
segment.

FTDMA

Access method, which assigns a node a time window, in which the


node has exclusive resource access

Header

First part of a frame, which includes information on the frame

Host

The host contains the user software of an ECU

Jitter

A derivation in time towards the synchronous clock

Knoten/Node

Active functional unit, which can send and receive messages

Layer

Architectural layer, which describes the functions and tasks of a


component within that layer

Macrotick

A cycle is globaly divided into macrotics. Macrotics are generated out


of the local microtics. The duration of a macrotic is adjusted dring the
synchronization.

Microtick

The duration of a microtic is derived from the local osciliator of a node.


They are used for bus synchronization.

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

This segment contains all payload data of a frame.

PDU

PDUs are bus-independent units of data, consisting of payload and


control data.

Slot

See Communication 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

Communication slot in which a startup frame is sent.

12.10.2012

Grundlagen FlexRay BasicsV 1.1

Static
Communication
Slot

These slots have a fixed length and a unique slot ID. A corresponding
note has exclusive bus access.

Static Segment

The static segment is used to transmit cyclic data. It is included in


every cycle, and uses the TDMA method.

Sync Frame

A sync frame is used to synchronise the FlexRay bus. It is identified by


the Sync Frame Indicator bit in the header.

Sync Slot

A communication slot in which a sync frame is sent,

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

A cluster node, which has permission to send a wakeup pattern.

12.10.2012

Grundlagen FlexRay BasicsV 1.1

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

1.2 Requirements and properties


While defining the requirements for the new bus systems, the following points have played an
important role:

Transmission rate a transmission rate significantly higher than CAN (500 Kbit/s)
should be achieved

Redundant communication channels by implementing two separate physical


communication channels (A/B), the system offers to transmit data redundant, or to
double the data rate..

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

Grundlagen FlexRay BasicsV 1.1

11

Reliability of transmission Transmission of information should be reliable and


have deterministic timing, since the CSMA method used by the CAN bus can lead to
massive fluctuations in timing.

Physical layer the physical layer should be robust and simple.

Extendibility The network should be easily extendable. Single ECUs should be able
to be removed or added to the network..

Support for time- and event-based communication since depending on the


application - both of these methods of communication may be suited better, both
methods should be supported.

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

Grundlagen FlexRay BasicsV 1.1

12

A detailed overview of the requirements can be found in the FlexRay Requirements


Specification V2.1 [FRRS05].
Because of these properties, the FlexRay system is suited as a backbone, and for use in realtime and safety-critical applications.
FlexRay is currently used in the BMW X5, BMW 7, Audi A8, and the new S-Class by
Daimler [VeSc11].

2 Technical basics
2.1 OSI-Model

Figure 2.1 OSI-Model fort he bus system and protocols


The general structure of a communication system is described by the OSI-Model. As seen in
Figure 2.1, the model consists of layers. Every layer is assigned a specific function, and is
based on the layers below itself.
A FlexRay system defines OSI-Layers 1 and 2, the other layers are not defined by FlexRay.
The physical layer (OSI-Layer 1) is defined in the FlexRay Communications System
Electrical Physical Layer Specification [FREPLS06].
The data link layer (OSI-Layer 2) specifies the actual communication protocol, and is defined
in the FlexRay Communications System Protocol Specification [FRPS05].
As mentioned before, the higher layers are not defined by FlexRay. In the automotive sector,
this role is taken by the AUTOSAR specification. The application layer (OSI-Layer 7)
enables the applications to access the hardware, and provides data structures and protocols.

2.2 Structure of a communication node


A FlexRay network consists of several communication nodes and communication channels. A
FlexRay node (see Figure 2.2) consists of a Microcontroller (C, also called host), a
Communication Controller (CC), an optional Bus Guardian (BG), and one or two Bus Driver
(BD). The Bus Driver isnt used in practical applications, since there are no available
components on the market. In the future, a second Communication Controller will be used,
which renders the Bus Driver useless [VeSc11].

12.10.2012

Grundlagen FlexRay BasicsV 1.1

13

Figure 2.2 Structure of a FlexRay node [VeSc11]


Every component has specific tasks. There are different types of microcontrollers, with or
without an integrated Communication Controller. The Bus Driver provides the physical
connection to the respective channel. The Bus Guardian was designed as a security system
between Communication Controller and Bus Driver, but isnt used as discussed before.
The Communication Controller implements the FlexRay protocol. It controls the bus access
(Media Access Control (MAC)), verifies the timing specified by the scheduling and the
syntax of the frames (Frame and Symbol Processing (FSP)), performs the transformation of
payload data into a bit stream (Coding and Decoding Process (CODEC)) and the
synchronization with the global time base (Clock Synchronization Process (CSP)). An indepth description of these processes can be found in the FlexRay Communications System
Protocol Specification [FRPS05], where they are described in the Specification and
Description Language (SDL).
The host runs the actual application, which controls the Communication Controller via the
Controller Host Interface (CHI) and the Protocol Operation Control (POC)).

12.10.2012

Grundlagen FlexRay BasicsV 1.1

14

Figure 2.3 States of the Communication Controllers [FRPS05]


The Communication Controller can be in the following states (see also Figure 2.3):

default config Startup state of the Communication Controller. In this state, no


communication is possible, since no information concerning the connected FlexRay
network are available.

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.

wakeup If the FlexRay node is connected to an idle network, the microcontroller


can instruct the Communication Controller to wake up the network. The controller
switches to the wakeup state, and starts transmitting the Wakeup Pattern, see section
2.6.

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

Grundlagen FlexRay BasicsV 1.1

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].

Figure 2.4 Structure of a FlexRay Active Star node [VeSc11]


In between Branches of a FlexRay network, an Active Star (AS) can be used. It consists only
of Bus Drivers, as shown in Figure 2.4.

2.3 Termination of nodes


To achieve a better signal quality on the bus and to prevent reflections on the end of the
cables, the cables get terminated at the ends. The most simple way to do that is shown in
Figure 2.5. It uses a resistor RT = 80...110 (110 typical) between Bus Plus (BP) and Bus
Minus (BM).

12.10.2012

Grundlagen FlexRay BasicsV 1.1

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

Figure 2.6 Termination with RC filter [FREPLA06]


The properties of the termination and the electromagnetic compliance can be further
increased, by using a Common Mode Choke. The configuration is shown in Figure 2.7. The
stray inductivity Lstray should be low.

RLine1

L100H

Lstray<1H

Figure 2.7 Termination with RCL filter[FREPLA06]


Not every node of the bus can be equipped with a terminating resistor, because the resistance
of the whole bus would be too low. At nodes without terminations (see Figure 2.8), the Bus
Driver is directly connected to the bus.

12.10.2012

Grundlagen FlexRay BasicsV 1.1

17

UnterminiertesKabelende

Figure 2.8 Open termination [FREPLS06]


All terminating resistors in a branch are parallel. The resulting resistance RDCLoad has to be
between 40 and 55. The usage of a choke is allowed, too. Depending on the topology, there
are different setups for bus termination and the placement of the resistors. The resulting
resistance has to be in the defined range for RDCLoad.

2.4 Physical topology


The physical topology describes the structural setup of the network. Figure 2.9 shows the
most basic passive connection between two nodes, called Point-to-Point or Peer-to-Peer. The
maximum length of the cable lBus is 24m. Both ends have to be terminated with resistors.

Figure 2.9 Point-to-Point connection [FREPLS06]


There are two additional passive bus topologies, the linear passive bus (Figure 2.10), and the
passive star (Figure 2.11). The linear passive bus extends the Point-to-Point connection by
additional nodes. The number of nodes is defined between 4 and 22.
The maximum bus length lBus = lStubn+ lSpliceDistancen,m + lStubm = 24m must not be
exceeded. Typically, the stub lines lStub2 or lStub3 connecting to the main bus are only a few
centimeters long, and do not contain additional stub lines.

12.10.2012

Grundlagen FlexRay BasicsV 1.1

18

Figure 2.10 Linear passive bus [FREPLS06]


A passive star does not have a main line. The maximal bus length is lBus = lStubn + lStubm =
24m. In practical applications, commonly 3 nodes with a length lStubn = 8m are used. The
maximum number of nodes is 22. However, the length of the stub lStubn decreases rapidly
with each additional stub, e.g. with 6 stubs, lStubn << 4m.

Figure 2.11 Passive Star [FREPLS06]


A possibility to increase the bus length are active stars, see Figure 2.12. In this configuration,
a length lActiveStarn = 24m and a maximum length between two stars lStarStar = 24m is
permitted.
The usage of active stars also permits mixed topologies, as seen in Figure 2.13. In this case,
every branch of an active star has to be considered as an independent network, and has to
obey the rules of the used passive structure.
By decreasing the data rate, the bus length can be increased further (10Mbit/s lBus = 24m,
5Mbit/s lBus = 48m, etc.).

12.10.2012

Grundlagen FlexRay BasicsV 1.1

19

Figure 2.12 Active Star [FREPLS06]

Figure 2.13 Example for a mixed topology


If an Active Star is used in a network topology, it is important to verify there isnt a second
path to an ECU, because that would create a feedback, and would render the structure invalid.
Channels must not be interrupted in a branch.

12.10.2012

Grundlagen FlexRay BasicsV 1.1

20

2.5 Signal transmission


FlexRay uses two twisted wires for transmitting signal data. The transmission uses differential
voltage levels around 2.5V. The transmit level uBus results out of the difference between uBP
and uBM.

Figure 2.14 FlexRay level diagram [FREPLS06]


Using the different levels shown in Figure 2.14, the FlexRay bus can have four different
states:

Idle_LP (Idle Low Power) the level uBus is 0 V, and transceivers pull the voltage
level of the FlexRay bus to GND.

Idle the level uBus is 0 V, uBP and uBM are 2.5 V

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

Grundlagen FlexRay BasicsV 1.1

21

Figure 2.15 Definition of FlexRay network test points [FREPLS06]


Table 2.1 Voltage levels at the test ponts
Bus state
Idle_LP
Idle
Data_0
Data_1

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

Figure 2.16 Eye diagram [FREPLS06]


If the bus is at Idle_LP, the Bus Driver is in a sleep mode, and has to be put in normal mode
by a local event in order to wake up the bus.

12.10.2012

Grundlagen FlexRay BasicsV 1.1

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.

Figure 2.17 Wakeup Pattern [EPLS06]


A network may only contain up to 3 Wakeup Nodes, since an overlap of several Wakeup
Patterns could prevent a correct detection, see Table 2.2.
Table 2.2 Wakeup Pattern Detection [EPLS06]
Name
dWU0Detect
dWUIdleDetect
dWUTimeout

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

Grundlagen FlexRay BasicsV 1.1

23

Figure 2.18 Example of a wakeup


After completing the Wakeup Phase, the Coldstart Nodes try to establish a communication on
the bus,

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

Grundlagen FlexRay BasicsV 1.1

24

2. Scenario single Coldstart Node in the cluster


After the Wakeup of a Coldstart node, it enters POC:startup state. As a next step, it
checks weather there is already an active communication on the channels. In that case,
it synchronizes itself to the cycle, and enters POC:normal active state.
If there is no communication, the node starts the Startup procedure by sending a
Collision Avoidance Symbol (CAS). This identifies the node als Leading Coldstart
Node. After that, the node sends 4 Startup Sync Frames (SyF), see Figure 2.20 - (1). If
no other node answers (like in this scenario), the Coldstart Node stops its activity after
a defined number of retries, and waits for another node to take the role of Leading
Coldstart Node.
3. Scenario two or more Coldstart Node in the cluster
After racing for the role of Leading Startup Node, the winning node commences the
Startup Procedure as described in scenario 2. All other Coldstart Nodes are called
Following Coldstart Nodes. These commence scheduling after receiving the first two
Sync Frames (SyF), and start synchronizing in the following cycle. In the fourth cycle,
the Following Coldstart Node start sending Sync Frames on their own, the so called
Coldstart Join (see Figure 2.19 and Figure 2.20 - (2)). All other nodes start scheduling
at the 0th cycle, followed by the synchronization. After the 7th cycle, they start
transmitting data (see Figure 2.20 - (3)). As with the 8th cycle, there is a normal
communication on the bus, all nodes are in POC: normal active state.

Figure 2.19 Startup sequence


This behavior can be recorded and verified in CANoe, see Figure 2.20. In this case, two
Coldstart Nodes have ben simulated by the software. The control unit under test joins the
communication as expected.

12.10.2012

Grundlagen FlexRay BasicsV 1.1

25

Figure 2.20 FlexRay Startup CANoe log file

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

Figure 2.21 Synchronization of the ECUs [VeSc11]


For adjusting the local timer, a combination of offset- and frequency-adjustment is used, see
Figure 2.22 and Figure 2.23. By combining these methods it is ensured, that the local times of
all nodes are almost identical at one point of time, and dont diverge while time progresses.

12.10.2012

Grundlagen FlexRay BasicsV 1.1

26

Figure 2.22 Principle of offset adjustment


For the offset-adjustment, the cycle start point Ti of every Sync Node is derived from the local
oscillator, and is compared to the starting time t on the bus. The resulting offset Toffset_i is
just to calculate the adjustment.
The calculation of the offset is done in every cycle, while an adjustment of the value is done
only in odd numbered cycles. In these cycles, the Network Idle Time (NIT) will be shorted or
longer, depending on the calculated value.
Calculating the cycle time of a Sync Node Ti, by comparing two successive cycle start times
of node I, we can calculate the derivation Trate_i by subtracting the expected cycle time t.
This is used for frequency-adjustment. The adjustment of the frequency is calculated and
applied over two successive cycles.

12.10.2012

Grundlagen FlexRay BasicsV 1.1

27

Figure 2.23 Principle of frequency adjustment


For the calculation of the adjustments, only Sync Frames may be used. The maximum number
of nodes who are permitted to transmit Sync frames is limited to cSyncNodeMax = 15.
Fault Tolerant Midpoint (FTM) Algorithms [VeSc11]:

Gathering all values for Toffset_i und Trate_i

Sorting the values from lowest to highest.

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)

Calculating the adjustment:


_

If a node detects a massive discrepancy during the procedure, it stops transmitting and
switches to POC:normal passiv state.

2.9 Re-Synchronization (Bit-Synchronization)


Even after the synchronization, there still is a discrepancy between the timers. Also, messages
are transmitted and received with an offset. To be able to properly evaluate the data, it is
necessary to re-synchronize on a bit-level.
12.10.2012

Grundlagen FlexRay BasicsV 1.1

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.

Figure 2.24 Action Point and Action Point Offset [VeSc11]


The APO is derived from the actual Action Point (AP) of the sender. The received frame can
be shifted in between the start and the end of a slot. This guarantees, that all ECUs receive a
message in the correct slot.

Figure 2.25 Static Segment Frame [FRPS05]


While transmitting and receiving, the Bus Driver has to switch between these two modes,
because the FlexRay bus is used bi-directional. Therefore, for activating the Bus Driver after
the Action Pont, a Transmission Start Sequence (TSS) is used. The length of the TSS varies
between 3 and 15 bit, depending on the number of Bus Drivers connected to the channel,
12.10.2012

Grundlagen FlexRay BasicsV 1.1

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.

Figure 2.26 Dynamic Segment [FRPS05]

12.10.2012

Grundlagen FlexRay BasicsV 1.1

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.

Figure 2.27 FlexRay timing hierarchy


The so-called Microtick is derived from the Sample Clock. The duration of a Microtick may
differ between ECUs, since it depends on component tolerances, temperature and time drift of
the oscillator of each ECU.
Macroticks (MT) are composed from local Microticks, and are global synchronous time units.
Since the duration of a Macrotick is the same throughout the whole cluster, the number of
Microticks to a Macrotick may differ from ECU to ECU.
A Communication Cycle consists of a constant number of Macroticks, and has the same
duration for every node.
The duration of a bit in FlexRay is determined by the Sample Clock, i.e. is independent of
Macroticks and Microticks. Since the duration of a bit has to be equal for all ECUs, they get
re-synchronized on bit-level.
With the following formulas [FRPS05] and the system parameters in Table 2.3, the following
example values can be calculated:
(1)

(2)
(3)

12.10.2012

Grundlagen FlexRay BasicsV 1.1

31
(4)

Table 2.3 Timing Parameter [VeSc11], example

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

Grundlagen FlexRay BasicsV 1.1

32

2.11 Communication structure


The communication structure of a FlexRay bus is organized in Cycles. The duration of a
Cycle is constant, and is defined by the parameter gdMacroPerCycle. The current active cycle
is saved in vCycleCounter, it can be 0 to 63 cCycleCountMax.
2.11.1 FlexRay Cycle
Figure 2.28 shows FlexRay Cycles. Every Cycle is divided in four segments, which each have
different properties.

StaticSegment:
Timetriggeredtransmission
BusaccessusingTDMA

DynamicSegment(optional):
EventtriggeredTransmission
BusaccessusingFTDMA

SymbolWindow(optional):
TestsymbolperCyclefortheusewithaBusGuardian

NITNetworkIdleTime:
Segmentforsynchronizationofthenodes

Figure 2.28 Segments in a FlexRay cycle [VeSc11]


The static segment is used for time-triggered data transfer, and is divided into slots, which are
available and have to be used in every cycle. As bus access method TDMA is used, and
therefore the defined access of the ECU to their slot(s) is guaranteed.
In the dynamic segment, an event-triggered data transfer is possible. The length of the
dynamic Slots may vary, and is implemented using the FTMDA method.
The Symbol Window can be used to transmit test symbols, e.g. for the use with a bus
guardian.
The Network Idle Time is used by the nodes to perform the necessary time synchronization.
Only the static segment and the Network Idle time are needed for a valid communication. The
dynamic segment and the Symbol Window are optional. Therefore, there are four different
possibilities for bus access.
2.11.2 Bus access
Depending on the application, the bus access can be configured flexibly. A FlexRay cluster
can use either one of the modes shown in Figure 2.29.

12.10.2012

Grundlagen FlexRay BasicsV 1.1

33

Figure 2.29 Different division of a FlexRay cycle into segments


(1) Pure Static Only the static segment is used.
(2) Pure Static with Symbol The static segment and the Symbol Window are used.
(3) Mixed The static and the dynamic segments are used.
(4) Mixed with Symbol All segments are used.
In real-life applications, mode (3) is used most commonly. Mode (1) is rare in the automotive
sector. Modes (2) and (4) are not used, since the Bus Guardian is not used.
2.11.3 Static segment
The static segment is always the first segment of a cycle. As seen in Figure 2.30, the segment
is divided into slots with corresponding IDs. These are assigned exclusively to the ECUs in
the cluster, and enable a cyclic communication. The number of slots in the static segment can
be set by the parameter gNumberOfStaticSlots. The value can be in the range of 2 to
cStaticSlotIDMax = 1023 slots, and is constant for every cycle. The length of a slot
gdStaticSlot kann can be selected from 4 to 661 Macroticks and is constant as well. This way,
it can be ensured that every node is able to send its message always in the same slot of a
cycle.
In the static slots, Static Frames can be sent. The length of these Frames is constant as well,
since it depends on gdStaticSlot. Every static frame consists of header, payload, and trailer,
see section 2.12. The Channel Idle Delimiter (CID) delimits the static frame, its length
cChannelIdleDelimiter is 11 Bit.
2.11.4 Dynamic segment
The static segment is followed by the optional dynamic segment, which can be used for
spontaneous transmission of messages (e.g. diagnostic messages), using the assigned Slot ID
The segment is divided into Minislots and has a constant length. The length is defined by the
amount gNumberOfMiniSlots 0 to 7986 Minislots and the duration gdMiniSlot 2 to 63
Macroticks.

12.10.2012

Grundlagen FlexRay BasicsV 1.1

34

Figure 2.30 Static and dynamic FlexRay segment [VeSc11]


If an ECU sends data in the dynamic segment, several minislots are replaced by a dynamic
slot, see Figure 2.30. The length of a dynamic slot can be chosen, unlike the length of static
frames. If it is still possible to send the frame can be determined using pLatestTx (0 to 7980
Minislots). This parameter shows if there is enough space for the dynamic frame in the
current dynamic segment.
To determine the current Slot ID, the counter of each node is incremented with every Minislot
or dynamic slot. It is only possible to assign Slot IDs that have not been used in the static
segment, the maximum Slot ID is cSlotIDMax = 2047. The lowest Slot ID has the highest
priority.
The length of a dynamic frame depends on the amount and length of data in the payload, and
is therefore variable. Header, trailer and Channel Idle Delimiter are identical to the ones in a
static frame, but the length of the payload can differ between cycles. The Dynamic Trailing
Sequence (DTS) acts as a buffer, so the frame length can be adjusted to the length of a
Minislot.
2.11.5 Symbol Window

Figure 2.31 Symbol Window and Network Idle Time [VeSc11]


12.10.2012

Grundlagen FlexRay BasicsV 1.1

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.

2.12 Frame format


A frame consists of three parts, header, payload, and trailer, see Figure 2.32.

Figure 2.32 Structure of a Frames


2.12.1 Header
The first 40 bits of a frame are called header. It contains information which is necessary for
the protocol.

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

Grundlagen FlexRay BasicsV 1.1

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

Grundlagen FlexRay BasicsV 1.1

37

2.13 Protocol Data Unit


Protocol Data Units (PDU) are bus-independent data units, consisting of protocol data and
payload, which are processed by the layers of the protocol stack A PDU can consist of a
single signal or multiple signals. It has its own timing, and is able to show if its data is valid
by using an update-bit.

Figure 2.33 Overview of PDUs [VeSc11]


In AUTOSAR, there are different PDUs for each OSI-Layer (see Figure 2.33):

I-PDU Interaction Layer PDU, can consist of one or more signals, has its own
Update Bit.

N-PDU Network Layer PDU (optional)

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

Grundlagen FlexRay BasicsV 1.1

38

2.14 Scheduling and Cycle Multiplexing


The scheduling is defined during the network design. By defining static and dynamic slots, a
fixed time frame is provided. This enables the unique assignment of frames to the
corresponding slots in each channel.
The number of slots is constant and cannot be changed after the network design. The
flexibility and the usage of the bandwidth is defined during development.
Table 2.4 Scheduling example [VeSc11]

In Table 2.4, a scheduling for nodes K, L, M, N and O is provided. It is allowed to send


different frames in different cycles for the same slot. This is called Cycle Multiplexing.
For Cycle Multiplexing, the following information is needed:

Slot-ID in the cycle 0...2047


Base or Start Cycle 0...63
Repetition Factor {rep = 2x with 0 x 7}
Channel {A, B, A&B}
Name of the node

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

Grundlagen FlexRay BasicsV 1.1

39

Literature
[Joch07]

Jochim, M.: Zeitig steuern In: ct Magazin fr Computertechnik,


http://publications.markusjochim.de/2007/FlexRay_Artikel_CT/Zeitig_steuern.pdf H. 2 S. 190-195, 2007

[Ghn10]

Ghner, P.: Automatisierungstechnik I. Uni Stuttgart, Skript SS2010, S.


227229

[Flex11

FlexRay Consortium: www.flexray.com, Stand 02/2011

[FRPS05]

FlexRay Consortium: FlexRay Communications


Specification, Version 2.1 Rev. A, 2005

System

Protocol

[FREPLA06] FlexRay Consortium: FlexRay Communications System Electrical Physical


Layer Application Notes, Version 2.1 Rev. B, 2006
[FREPLS06] FlexRay Consortium: FlexRay Communications System Electrical Physical
Layer Specification, Version 2.1 Rev. B, 2006
[FRRS05]

FlexRay Consortium: FlexRay Requirements Specification, Version 2.1, 2005

[LIN11]

LIN Consortium: http://www.lin-subbus.org/, Stand 02/2011

[MOST11]

MOST Cooperation: http://www.mostcooperation.com/home/index.html, Stand


02/2011

[Vect11]

Vector Informatik GmbH: www.vector.com, Stand 02/2011

[VeSc11]

Vector Informatik GmbH: Unterlagen zum FlexRay Workshop, In:


CANoe/CANalyzer.FlexRay Workshop, 2011

12.10.2012

Das könnte Ihnen auch gefallen