Professional Documents
Culture Documents
AN-IND-1-010 FlexRay-FlexRay Synchronization W CANoe As Gateway
AN-IND-1-010 FlexRay-FlexRay Synchronization W CANoe As Gateway
Gateway
Version 2.0
2017-06-12
Application Note AN-IND-1-010
Table of Contents
1.0 Overview ........................................................................................................................................1
1.1 Use Case / Motivation ..........................................................................................................2
1.2 Problem that is Handled in this Application Note .................................................................2
2.0 Synchronizing two FlexRay Buses..............................................................................................2
2.1 Solutions ..............................................................................................................................2
2.1.1 Hardware Controlled Synchronization .................................................................................3
2.1.2 Software Controlled Synchronization ...................................................................................4
2.2 Benefits vs. Restrictions .......................................................................................................4
3.0 Demonstrator .................................................................................................................................5
3.1 Goal ......................................................................................................................................5
3.2 Hardware/Software Setup of the Demo ...............................................................................5
3.3 Observation / Result ............................................................................................................6
4.0 Additional Information ..................................................................................................................6
5.0 Contacts .........................................................................................................................................6
1.0 Overview
One FlexRay bus provides a global system time on which all ECUs can synchronize. When two
FlexRay buses are required, they run normally independently of each other. Even if both buses
implement the same schedule, they have an offset to each other and they possibly drift. The
synchronous FlexRay time for ECUs on the different buses gets lost.
Moreover, when data must be transferred from one bus to the other, a so-called FlexRay – FlexRay
gateway creates a non-negligible delay in terms of multiples of the cluster’s period (in any of the
directions), because of the time-triggered bus access. For event-triggered buses (like CAN) the delay
only depends (on low bus loads) nearly on the reaction delay (which is much smaller than the
message’s cycle period) of the gateway application.
Additionally, due to a normally non-existing synchronization between both FlexRay clusters, they will
drift to each other. Therefore, the routing delay may vary during run-time and is in-deterministically.
FlexRay - FlexRay Synchronization with CANoe as Gateway
2.1 Solutions
A FlexRay controller can handle two FlexRay channels (A/B) for one bus. The clock synchronization
can work with either one or both channels. If the application requires only one channel, then the
second channel can be used for synchronization with the other bus (see Hardware Controlled
Synchronization).
Each FlexRay controller allows the ECU to add/subtract values from the local clock correction vector
via the CHI (Controller Host Interface). In normal application scenarios this is not required. This
feature allows synchronizing the cluster (under certain circumstances) to a super ordinate master
clock. This master clock might be the FlexRay clock of another bus.
This topology is not fully supported by the FlexRay specification. The FlexRay specification does not
allow the splitting of channel A into two segments while the second channel B is not split (IF1 and IF 2
of the gateway use the same line for channel B but different ones for channel A). For this reason
additional assumptions must be made:
1. On segment 2 of channel A exactly one extra ECU (except the gateway’s second interface) that is
sending a startup and/or sync frame must be connected (additional non-sync nodes are allowed).
This Sync Node may be the cold start helper of the gateway’s second interface itself.
2. On segment 1 of channel A at least one startup and/or sync node (in addition to the gateway’s first
interface) must exist. This Sync Node may be the cold start helper of the gateway’s first interface
itself.
3. The ECUs on the different segments of channel A and the gateway must be started in a well-
defined order. It must be assured that either segment 1 or segment 2 is already synchronous
before the other segment will be started.
4. It must be possible to send two additional startup/sync frames on channel A (one for segment 1
and the other for segment 2). These startup/sync frames must be sent by the gateway (one per
interface) on both channels (A and B).
5. For both segments the same FlexRay schedule (including the same TDMA parameters) must be
implemented.
6. The gateway’s FlexRay TDMA parameter pChannels for both interfaces must be set to 3 in order
to operate with both channels.
7. First segment 1 with IF 1 must be started and then segment 2 with IF 2 must be started.
If these requirements are fulfilled, then both segments will run absolutely synchronously (no offset and
no drift). In fact the common channel B connects both segments of channel A to ONE FlexRay cluster.
Nevertheless, all frames that have to be routed from one segment to the other by the gateway will
have a routing delay of at least one cycle length of the FlexRay bus. The received frame of one
segment can be sent soonest at the next possible cycle according to the frame’s scheduling on the
other segment. This is valid for both directions. Because of the synchronous execution of both
segments the minimal routing delay will be equal for both directions.
Also for this solution some restrictions must be fulfilled in order to work properly:
1. On cluster 2 exactly one extra ECU (except the gateway’s second interface) that is sending a
startup and/or sync frame must be connected (additional non-sync nodes are allowed). This Sync
Node may be the cold start helper of the gateway’s second interface itself (when ECU D is a non-
sync node).
2. The cycle period of cluster 1 must be a multiple of the cycle period of cluster 2 (or vice versa).
3. A special program on the gateway must periodically compare the cycle periods of both FlexRay
clusters. According to this deviation it must influence the clock synchronization of interface 2 in
order to explicitly prolong or shorten the cluster’s cycle period by manipulating the external clock
correction values.
This solution cannot guarantee absolutely synchronously running clusters. Their drift can be
eliminated, but a minimal offset may remain. Additionally the offset (+/- a specific minimal delta) can
deliberately be chosen, e.g. it is not required to be 0. This allows minimizing the routing delay for one
direction (while the routing delay for the other direction increases).
3.0 Demonstrator
A sample configuration is delivered with CANoe.FlexRay version ≥ 7.1 SP3. See start menu CANoe →
User Assistance → Sample Configurations → FlexRay → 2 Cluster Gateway. In this demo refer
especially to the desktop “FRFR Synchronization”.
3.1 Goal
Synchronize two FlexRay clusters by software. The time difference between the cycle starts of both
clusters can be set to a desired offset value. After the requested offset is achieved the clusters will be
synchronized within a given deviation interval in order to prevent drifting of the clusters.
The panel “FRFR Sync Control” that is shown in Figure 3 controls the synchronization (resp. the CAPL
include). With the sliders you can request a particular difference of the cycle starts of both clusters.
nd
The shifting of the 2 cluster will be started when the 'Automatic Adjust' is enabled. The shifting is
nd
performed by shortening or prolonging the 2 cluster's cycle time. This is achieved by manipulating
the external offset and rate correction of the FlexRay controller.
Note
If you run this demo in 'Real bus' mode, then you must pay attention to the following
requirements:
> 2 VN interfaces have to be connected to CANoe and must be mapped to channel
FlexRay 1 and FlexRay 2.
> Do NOT connect any nodes to the interfaces! All nodes are currently simulated.
> Do NOT interconnect the FlexRay channels between the interfaces!
> You must connect the hardware synchronization line between both interfaces by a
'Sync cable'!
> You must enable the hardware synchronization in the hardware configuration settings
of CANoe.
> Pay attention to the Write window that the hardware time synchronization works
properly during run-time.
5.0 Contacts
For a full list with all Vector locations and addresses worldwide, please visit http://vector.com/contact/.