1
FlexRay: The New Time-Triggered Protocol for Drive-
by-Wire ApplicationsSyed Masud Mahmud, Ph.D.
Electrical and Computer Engg. Dept.Wayne State University
Detroit MI [email protected]
January 12, 20065th Annual Winter Workshop
U.S. Army Tank-Automotive RD&E Center, Warren, MI
Flexray: A Time-Triggered Protocol
© 2006 Syed Masud Mahmud2
Speaker’s Background• Received Ph.D. in Electrical Engineering
from the University of Washington, Seattle (1984).
• Worked for Oakland University, Rochester, Michigan, during 1984-1988.
• Has been working for Wayne State University since 1988.
• Published over 90 technical papers in referred journals and conference proceedings.
2
Flexray: A Time-Triggered Protocol
© 2006 Syed Masud Mahmud3
Speaker’s Current Areas of Interest
• Intelligent Vehicles, • Intelligent Transportation Systems, • In-Vehicle Networking, • Time Triggered Protocols for Real-Time
Applications,• Collision Warning and Collision
Avoidance systems,• Security in Wireless Communications,
and• Embedded Systems.
Flexray: A Time-Triggered Protocol
© 2006 Syed Masud Mahmud4
Outline of the Talk
• Need for New Types of In-Vehicle Networks.
• A Quick Overview of the CAN Protocol• Need for Time-Triggered Protocols.• A Quick Overview of the Time
Triggered CAN (TTCAN) Protocol.• The FlexRay Protocol.• Comparison of TTCAN and FlexRay.
3
Flexray: A Time-Triggered Protocol
© 2006 Syed Masud Mahmud5
Need for New Types of In-Vehicle Networks
• Drive-by-wire, • Telematics, • Entertainment, • Multimedia, • Pre-Crash Warning, • Hit Avoidance, • Remote Diagnostic• Remote Software Update, etc.
Flexray: A Time-Triggered Protocol
© 2006 Syed Masud Mahmud6
Need for New Types of In-Vehicle Networks (contd..)
• Drive-by-Wire and Active Collision Avoidance Systems need fault tolerant networks with time-triggered protocols, to guarantee deterministic latencies.
4
Flexray: A Time-Triggered Protocol
© 2006 Syed Masud Mahmud7
Need for New Types of In-Vehicle Networks (contd..)
• Multimedia Systems need networks with high bandwidth to transfer video files
• Body control electronics need low-bandwidth networks to keep the cost down.
Flexray: A Time-Triggered Protocol
© 2006 Syed Masud Mahmud8
A Quick Overview of the CAN Protocol
5
Flexray: A Time-Triggered Protocol
© 2006 Syed Masud Mahmud9
CAN Protocol
• CAN is a serial protocol.• It supports distributed real-time control
with high level of data integrity.
Flexray: A Time-Triggered Protocol
© 2006 Syed Masud Mahmud10
Dominant and Recessive BitsBus Values• During simultaneous transmission of
dominant and recessive bits, the resulting bus value will be dominant.
• For example, in the wired-AND implementation of the bus, the dominant value will be ‘0’ and the recessive value will be ‘1’.
6
Flexray: A Time-Triggered Protocol
© 2006 Syed Masud Mahmud11
CAN Message FramesData Frame: It carries data from a
transmitter to the receivers.Remote Frame: It is transmitted by a
node to request the transmission of a Data frame with the same identifier.
Error Frame: It is transmitted by any node after detecting a bus error.
Overload Frame: It is used to provide additional delay between two data or remote frames.
Flexray: A Time-Triggered Protocol
© 2006 Syed Masud Mahmud12
Data Frame
There are seven fields in a Data frame.• Start of Frame (SOF): It marks the
beginning of a data or remote frame. It consists of only one dominant bit.
7
Flexray: A Time-Triggered Protocol
© 2006 Syed Masud Mahmud13
Arbitration Field of Data Frame
• Arbitration Field: This field consists of the identifier and the RTR bit.
• Identifier: There are 11 or 29 bits in the identifier.
Flexray: A Time-Triggered Protocol
© 2006 Syed Masud Mahmud14
Arbitration Field of Data Frame• The Identifier performs the following
operations:Determines the type of a message.Performs acceptance test of a message.Arbitrates & determines the priority of the message.
8
Flexray: A Time-Triggered Protocol
© 2006 Syed Masud Mahmud15
Arbitration Technique• Any potential bus conflicts are resolved by
bit-wise arbitration.• A dominant state (logic 0) has precedence
over a recessive state (logic 1).• Example: Assume that Node-1, Node-2
and Node-3 are going to compete for the bus with the following identifiers:
Node-1 0010100 . . Node-2 0001100 . .Node-3 0000111 . .
Flexray: A Time-Triggered Protocol
© 2006 Syed Masud Mahmud16
Arbitration Technique• Transmission of identifier bits by
Nodes 1, 2 and 3 are as follows:
9
Flexray: A Time-Triggered Protocol
© 2006 Syed Masud Mahmud17
RTR Bit• RTR bit (Remote Transmission Request
Bit): In Data frames the RTR bit must be dominant. In Remote frames it must be recessive.
RTR bit Type of Framed Data Framer Remote Frame
Flexray: A Time-Triggered Protocol
© 2006 Syed Masud Mahmud18
Control Field• Out of the 6 bits, 4 bits are used to indicate the
length of the data and the other two bits are reserved for future expansion.
• Reserved bits must be sent as dominant bits.
10
Flexray: A Time-Triggered Protocol
© 2006 Syed Masud Mahmud19
Data Field
• The data field contains the data to be transmitted.
• The data field can contain 0 to 8 bytes.
Flexray: A Time-Triggered Protocol
© 2006 Syed Masud Mahmud20
CRC Field• It contains a 15-bit CRC Sequence followed
by a 1-bit (a recessive bit) CRC Delimiter.
11
Flexray: A Time-Triggered Protocol
© 2006 Syed Masud Mahmud21
Bit-Stream Coding• The frame segments: Start of frame,
Arbitration field, Control field, Data field and CRC Sequence are coded by the method of bit stuffing.
• Whenever a transmitter detects five consecutive bits of identical value in the bit-stream to be transmitted, it automatically inserts a complementary bit in the actual transmitted bit-stream.
Flexray: A Time-Triggered Protocol
© 2006 Syed Masud Mahmud22
Bit-Stream CodingExample• Original Bit Sequence:
000000011111111• Transmitted Bit Seq.:
00000100111110111
Stuff Bits
12
Flexray: A Time-Triggered Protocol
© 2006 Syed Masud Mahmud23
Acknowledge Field
• The ACK field consists of two bits.• One bit for ACK slot and another bit for
ACK delimiter.• The TRANSMITTING node sends two
recessive bits through the ACK field.
Flexray: A Time-Triggered Protocol
© 2006 Syed Masud Mahmud24
Acknowledge Field• The RECEIVING node sends a dominant
bit through the ACK slot after receiving a valid message.
• Since the CRC and ACK delimiters are both recessive bits, the ACK slot is always surrounded by two recessive bits.
13
Flexray: A Time-Triggered Protocol
© 2006 Syed Masud Mahmud25
End of Frame• Each data frame and remote frame is
delimited by a flag sequence consisting of seven recessive bits.
• This is a contradiction to the Bit Stuffing technique.
Flexray: A Time-Triggered Protocol
© 2006 Syed Masud Mahmud26
Need for Time Triggered Protocols
14
Flexray: A Time-Triggered Protocol
© 2006 Syed Masud Mahmud27
Average Latency and Maximum Allowed Latency
Flexray: A Time-Triggered Protocol
© 2006 Syed Masud Mahmud28
Latency Boundaries
15
Flexray: A Time-Triggered Protocol
© 2006 Syed Masud Mahmud29
Failure of all Deadlines
Flexray: A Time-Triggered Protocol
© 2006 Syed Masud Mahmud30
Need for Time Triggered Protocols
• Safety critical messages must meet their deadlines even at maximum bus load.
16
Flexray: A Time-Triggered Protocol
© 2006 Syed Masud Mahmud31
Time Triggered CAN: TTCAN
Flexray: A Time-Triggered Protocol
© 2006 Syed Masud Mahmud32
Time Triggered CAN (TTCAN)
• TTCAN is a higher layer protocol above the standard CAN protocol.
• A message that needs a guaranteed latency can be transmitted at a specific time slot, without competing with other messages for the bus.
17
Flexray: A Time-Triggered Protocol
© 2006 Syed Masud Mahmud33
Time Triggered CAN (TTCAN)
• The activities of a TTCAN system are determined by the progression of a globally synchronized time.
Flexray: A Time-Triggered Protocol
© 2006 Syed Masud Mahmud34
TTCAN Principle
• Message “a” is sent if the system clock reaches 3 and 6 while message “b” is sent at 5, and message “d” is sent at 9.
18
Flexray: A Time-Triggered Protocol
© 2006 Syed Masud Mahmud35
TTCAN Time Windows• There are three time windows in a TTCAN
system:Exclusive Window.Arbitrating Window.Free Window
Flexray: A Time-Triggered Protocol
© 2006 Syed Masud Mahmud36
Exclusive Window• It is used by a message that needs guaranteed
latencies.• A particular Exclusive Window is reserved for a
particular message.• Thus, the message does not have to compete
for the bus.
19
Flexray: A Time-Triggered Protocol
© 2006 Syed Masud Mahmud37
Arbitrating Window• It is used by messages that can tolerate latency
jitters. • Like the standard CAN system, various messages
compete for the bus during this time window.• The highest priority message (among the
competing messages) get the bus.
Flexray: A Time-Triggered Protocol
© 2006 Syed Masud Mahmud38
Free Window• It is reserved for the future expansion of the
system.• Depending upon the need (during system
expansion) some Free Windows can be converted to new Exclusive Windows and others can be converted to new Arbitrating Windows.
20
Flexray: A Time-Triggered Protocol
© 2006 Syed Masud Mahmud39
Master Node
• A node called the Master Node is responsible for maintaining global time.
• The Master Node periodically broadcasts its local time (global time for the entire system) through a message called the Reference Message.
Flexray: A Time-Triggered Protocol
© 2006 Syed Masud Mahmud40
Reference Message
• All nodes read the global time from the reference message and then synchronize their own local time with the global time.
21
Flexray: A Time-Triggered Protocol
© 2006 Syed Masud Mahmud41
Local Offset• A node captures its own local time at the
beginning of a Reference Message.• The node then extracts the global time
from the Reference Message.• It then computes the local offset as: Local
Offset = Global Time – Local Time.• After that, the node keeps track of the
current Global Time by adding the Local Offset with its current Local Time.
Flexray: A Time-Triggered Protocol
© 2006 Syed Masud Mahmud42
Keeping Track of the Global Time by a Node
Current Global Time = Current Local Time + Local Offset
22
Flexray: A Time-Triggered Protocol
© 2006 Syed Masud Mahmud43
Potential Master Nodes
• There are several potential master nodes in a TTCAN system.
• If the potential master nodes detect the absence of the Reference Message within a timeout period, then they understand that the Master Node is dead.
Flexray: A Time-Triggered Protocol
© 2006 Syed Masud Mahmud44
Potential Master Nodes
• The potential masters then compete for the bus to become the new master.
• The highest priority active potential master will become the new master of the system.
• The new master will then start broadcasting reference messages.
23
Flexray: A Time-Triggered Protocol
© 2006 Syed Masud Mahmud45
Basic Cycle
• The period between two consecutive reference messages is called the basic cycle.
Flexray: A Time-Triggered Protocol
© 2006 Syed Masud Mahmud46
The System Matrix of a TTCAN System
• Several basic cycles are connected to build a matrix cycle called the System Matrix.
• This allows to combine multiple sending patterns, e.g. sending every basic cycle, sending every second basic cycle, or sending only once within the whole system matrix.
24
Flexray: A Time-Triggered Protocol
© 2006 Syed Masud Mahmud47
System Matrix
Flexray: A Time-Triggered Protocol
© 2006 Syed Masud Mahmud48
Cycle Time
• The cycle time at a node is defined as:
Cycle Time = Current Local time – The Local Time when the last Reference Message was received
• In other words, it is the offset of the local time with respect to the beginning of the last Reference Message
25
Flexray: A Time-Triggered Protocol
© 2006 Syed Masud Mahmud49
Cycle Time
Flexray: A Time-Triggered Protocol
© 2006 Syed Masud Mahmud50
Time Marks• The Time Marks specify the beginning of
the TTCAN Windows.
26
Flexray: A Time-Triggered Protocol
© 2006 Syed Masud Mahmud51
NETWORK TIME UNIT (NTU)
• The granularity of any timing information within a TTCAN system is the Network Time Unit (NTU).
• All time parameters in a TTCAN system are measured in terms of the NTU.
• For example, the Current Global Time is 620 NTUs or the Current Cycle Time at a node is 20 NTUs
Flexray: A Time-Triggered Protocol
© 2006 Syed Masud Mahmud52
NETWORK TIME UNIT (NTU)
27
Flexray: A Time-Triggered Protocol
© 2006 Syed Masud Mahmud53
NETWORK TIME UNIT (NTU)
• To establish a system wide NTU, each local node has to divide its oscillator frequency by a ratio called the Time Unit Ratio (TUR).
• For a given value of NTU, the value of TUR will vary from node to node depending upon the oscillator frequency of the node.
Flexray: A Time-Triggered Protocol
© 2006 Syed Masud Mahmud54
TURs of Different Nodes
• Assume that NTU = 0.25micro sec. Nodes 1, 2, 3 and 4 have oscillators of frequencies 8MHz, 6MHz, 10MHz and 12MHz, respectively. What are the values of TURs of different nodes?
• Since NTU=0.25micro sec, the frequency of NTU clock is 4MHz.
28
Flexray: A Time-Triggered Protocol
© 2006 Syed Masud Mahmud55
TURs of Different Nodes
• TUR of Node-1 = 8MHz/4MHz = 2• TUR of Node-2 = 6MHz/4MHz = 1.5• TUR of Node-3 = 10MHz/4MHz = 2.5• TUR of Node-4 = 12Hz/4MHz = 3• However, if off-the-shelf micros are used
to build a TTCAN system, then it might be difficult to have TUR values like 1.5, 2.5 and 3. Normally the Timers of a micro support pre-scale values 1,2,4,8,16, . . and so on.
Flexray: A Time-Triggered Protocol
© 2006 Syed Masud Mahmud56
Retransmission of a Faulty Message is not allowed in a
TTCAN System• In case of a fault, retransmission of a
message is not allowed through any windows (Exclusive or Arbitrating).
• This is due to the fact that the retransmitted message may cross over the boundary of the current window.
29
Flexray: A Time-Triggered Protocol
© 2006 Syed Masud Mahmud57
Retransmission of a Faulty Message . . . .
• Thus, in a TTCAN system, if a safety critical message can not go through its Exclusive Window, then it will be delayed significantly.
• The message that could not go will have to wait until its next Exclusive Window.
Flexray: A Time-Triggered Protocol
© 2006 Syed Masud Mahmud58
Length of a TTCAN Window
• A TTCAN window must be long enough to carry its message plus possible error flags
30
Flexray: A Time-Triggered Protocol
© 2006 Syed Masud Mahmud59
Wastage of Some Bus Bandwidth
• Since every TTCAN window has to keep some space for transmitting an Error Frame, some bus bandwidth is wasted.
Flexray: A Time-Triggered Protocol
© 2006 Syed Masud Mahmud60
Fault Tolerant TTCAN• Safety critical messages could be
significantly delayed if any faults occur in a TTCAN system.
• Thus, a fault tolerant design is desirable.
31
Flexray: A Time-Triggered Protocol
© 2006 Syed Masud Mahmud61
Secondary Bus• The secondary bus could be a standard
CAN or any other type of bus.• It could be even shared by other systems.
Flexray: A Time-Triggered Protocol
© 2006 Syed Masud Mahmud62
Shared Secondary Bus
32
Flexray: A Time-Triggered Protocol
© 2006 Syed Masud Mahmud63
Flexray: A Time-Triggered Protocol
© 2006 Syed Masud Mahmud64
Core Partners of theFlexRay Consortium
BMW, DaimlerChrysler, General Motors Corporation,
Freescale GmbH, Philips GmbH, Robert Bosch GmbH,
and Volkswagen.
33
Flexray: A Time-Triggered Protocol
© 2006 Syed Masud Mahmud65
FlexRay: Basic Characteristics• Synchronous and asynchronous
frame transfer.• Guaranteed frame latency.• Prioritization of frames during
asynchronous transfer.• Multi-master clock synchronization.• Error detection and signaling.• Error containment on the physical
layer.• Scalable fault tolerance.
Flexray: A Time-Triggered Protocol
© 2006 Syed Masud Mahmud66
A Differential Voltage Link
Signal Voltage = VoltBP - VoltBM
34
Flexray: A Time-Triggered Protocol
© 2006 Syed Masud Mahmud67
Electrical Signaling
Idle_LP: The Bus is in Idle Low Power Mode. Both BP and BM pins are at 0v.
Idle: The Bus is in Idle Mode. Both BP and BM pins are biased to a certain voltage.
Flexray: A Time-Triggered Protocol
© 2006 Syed Masud Mahmud68
Terminated Cable End
35
Flexray: A Time-Triggered Protocol
© 2006 Syed Masud Mahmud69
Un-Terminated Cable End
Flexray: A Time-Triggered Protocol
© 2006 Syed Masud Mahmud70
Point to Point Terminated Connection
36
Flexray: A Time-Triggered Protocol
© 2006 Syed Masud Mahmud71
Network Topology
• Single Channel Passive Bus• Dual Channel Passive Bus• Single Channel Passive Star• Dual Channel Passive Star• Single Channel Active Star• Dual Channel Active Star• Various Combinations of Bus and Star
Topologies
Flexray: A Time-Triggered Protocol
© 2006 Syed Masud Mahmud72
A Single Channel Passive Bus
37
Flexray: A Time-Triggered Protocol
© 2006 Syed Masud Mahmud73
A Dual Channel Passive Bus
Flexray: A Time-Triggered Protocol
© 2006 Syed Masud Mahmud74
A Single Channel Passive Star
38
Flexray: A Time-Triggered Protocol
© 2006 Syed Masud Mahmud75
A Single Channel Active Star
Flexray: A Time-Triggered Protocol
© 2006 Syed Masud Mahmud76
Internal Block Diagram of an Active Star with Four Branches
39
Flexray: A Time-Triggered Protocol
© 2006 Syed Masud Mahmud77
Internal Logic of an Active Star with Two Branches
Flexray: A Time-Triggered Protocol
© 2006 Syed Masud Mahmud78
A Single Channel Cascaded Active Stars
40
Flexray: A Time-Triggered Protocol
© 2006 Syed Masud Mahmud79
A Single Channel Hybrid Topology
Flexray: A Time-Triggered Protocol
© 2006 Syed Masud Mahmud80
A Dual Channel Active Star Network
41
Flexray: A Time-Triggered Protocol
© 2006 Syed Masud Mahmud81
A Dual Channel Cascaded Active Star Network
Flexray: A Time-Triggered Protocol
© 2006 Syed Masud Mahmud82
A Dual Channel Hybrid Network
42
Flexray: A Time-Triggered Protocol
© 2006 Syed Masud Mahmud83
Node Architecture
Flexray: A Time-Triggered Protocol
© 2006 Syed Masud Mahmud84
Host – Communication Controller Interface
• The host provides control and configuration information to the CC, and provides payload data that is transmitted during the communication cycle.
• The CC provides status information to the host and delivers payload data received from communication frames.
43
Flexray: A Time-Triggered Protocol
© 2006 Syed Masud Mahmud85
Bus Guardian• The bus guardian (BG) has a-priori
knowledge of the transmission times of the node.
• If the bus guardian detects any mismatch between the schedules of the communication controller and the bus guardian, it signals an errorcondition to the host and inhibits any further transmission attempts.
Flexray: A Time-Triggered Protocol
© 2006 Syed Masud Mahmud86
Host – Bus Guardian Interface
• The interface between BG and the host is a serial peripheral interface (SPI).
• This interface allows the host to send configuration data to the BG and receive status information from the BG.
44
Flexray: A Time-Triggered Protocol
© 2006 Syed Masud Mahmud87
CC–BG Interface
• This interface serves to synchronize the BG to the schedule of the CC.
• The CC also receives synchronization information back from the BG via the BGE signal.
Flexray: A Time-Triggered Protocol
© 2006 Syed Masud Mahmud88
Block Diagram of a Dual-Channel Node.
45
Flexray: A Time-Triggered Protocol
© 2006 Syed Masud Mahmud89
FlexRay Frame Format
Flexray: A Time-Triggered Protocol
© 2006 Syed Masud Mahmud90
Header Segment (40 bits)
Reserved Bit (1 bit): • It is reserved for future use.• A transmitting node shall set this bit to ‘0’.• A receiving node shall ignore the reserved bit.
46
Flexray: A Time-Triggered Protocol
© 2006 Syed Masud Mahmud91
Header Segment (40 bits)
Payload Preamble Indicator (1 bit): 1: The payload segment contains a network
management vector (NMV) in the static segment or a message ID (MID) in the dynamic segment.
0: The payload segment has no NMV or MID.
Flexray: A Time-Triggered Protocol
© 2006 Syed Masud Mahmud92
Header Segment (40 bits)
Null Frame Indicator (1 bit): 0: The payload segment contains no valid data. All
bytes in the payload section are set to zero.1: The payload segment contains valid data.
47
Flexray: A Time-Triggered Protocol
© 2006 Syed Masud Mahmud93
Header Segment (40 bits)
Sync Frame Indicator (1 bit):0: No receiving node shall consider the frame for
any type of synchronization.1: All receiving nodes shall utilize the frame for
synchronization if it meets other acceptance criteria.
Flexray: A Time-Triggered Protocol
© 2006 Syed Masud Mahmud94
Header Segment (40 bits)
Startup Frame Indicator (1 bit):0: The frame is not a startup frame.1: The frame is a startup frame.This bit shall only be set in
the sync frames of coldstart nodes. Therefore, a frame with the startup frame indicator set to 1 shall also have the sync frame indicator set to 1.
48
Flexray: A Time-Triggered Protocol
© 2006 Syed Masud Mahmud95
Frame ID (11 bits)
• The frame ID defines the slot in which the frame should be transmitted. (Performs Arbitration)
• Each frame that may be transmitted in a cluster has a frame ID assigned to it.
• The frame ID ranges from 1 to 2047. The frame ID 0 is an invalid frame ID.
Flexray: A Time-Triggered Protocol
© 2006 Syed Masud Mahmud96
Payload Length (7 bits)
• The payload length indicates the number of 16-bit words in the payload segment.
• Thus, the payload segment can contain 0 to 127 words or 0 to 254 bytes.
49
Flexray: A Time-Triggered Protocol
© 2006 Syed Masud Mahmud97
Header CRC (11 bits)
• The Header CRC is computed over the Sync Frame Indicator, Startup Frame Indicator, Frame ID and Payload Length.
Flexray: A Time-Triggered Protocol
© 2006 Syed Masud Mahmud98
Cycle Count (6 bits)
• This field indicates the current cycle number.• A FlexRay communication cycle is similar to the
TTCAN basic cycle.
50
Flexray: A Time-Triggered Protocol
© 2006 Syed Masud Mahmud99
Payload in Static Segment
• For frames transmitted in the static segment the first 0 to 12 bytes of the payload segment may optionally be used as network management vector.
Flexray: A Time-Triggered Protocol
© 2006 Syed Masud Mahmud100
Payload in Dynamic Segment
• For frames transmitted in the dynamic segment the first two bytes of the payload segment may optionally be used as a message ID field, allowing receiving nodes to filter or steer data based on the contents of this field.
51
Flexray: A Time-Triggered Protocol
© 2006 Syed Masud Mahmud101
Trailer Segment: Frame CRC
• The Frame CRC field is computed over the header segment and the payload segment of the frame.
Flexray: A Time-Triggered Protocol
© 2006 Syed Masud Mahmud102
Trailer Segment: Frame CRC• The frame CRC has a Hamming distance
of six for payload lengths up to and including 248 bytes.
• For payload lengths greater than 248 bytes the CRC has a Hamming distance of four.
52
Flexray: A Time-Triggered Protocol
© 2006 Syed Masud Mahmud103
Communication Cycle
Flexray: A Time-Triggered Protocol
© 2006 Syed Masud Mahmud104
Communication Cycle
53
Flexray: A Time-Triggered Protocol
© 2006 Syed Masud Mahmud105
Timing Hierarchy
Flexray: A Time-Triggered Protocol
© 2006 Syed Masud Mahmud106
Microtick• Microticks are local time units of a node.• The granularity of a node’s local time is a
microtick.• Microticks may have different durations in
different nodes. (For example, in one node a mictrotick may be 10 ns and in another node it may be 5 ns.)
• The microtick is derived directly from the node’s oscillator clock tick, optionally making use of a prescaler.
54
Flexray: A Time-Triggered Protocol
© 2006 Syed Masud Mahmud107
Macrotick(Similar to the NTU of the TTCAN System)
• The duration of a macrotick is equal throughout all synchronized nodes in a cluster.
• Each local macrotick is an integer number of local microticks.
• The number of microticks per macrotick may vary within the same node due to rate corrections.
• The number of microticks per macrotick may also differ between nodes, and depends on the oscillator frequency and the prescaler.
Flexray: A Time-Triggered Protocol
© 2006 Syed Masud Mahmud108
Length of a Communication Cycle (Cycle)
• A cycle consists of an integer number ofmacroticks.
• The number of macroticks per cycle shall be identical in all nodes in a cluster, and remains the same from cycle to cycle.
• At any given time all nodes should have the same cycle number.
55
Flexray: A Time-Triggered Protocol
© 2006 Syed Masud Mahmud109
Timing Hierarchy in a Communication Cycle
An action point (AP) is a time instant at which a node performs a specific action, e.g. transmits a frame.
Flexray: A Time-Triggered Protocol
© 2006 Syed Masud Mahmud110
Structure of the Static Segment
• The static segment contains a number of static slots.• For a given system, the number of static slots in the static
segment is a global constant.• All static slots are of same length in terms of macroticks.
56
Flexray: A Time-Triggered Protocol
© 2006 Syed Masud Mahmud111
Structure of the Static Segment
• Every node maintains two slot counters: one for Channel A and one for Channel B.
• The node simultaneously increments both counters at the end of each static slot.
Flexray: A Time-Triggered Protocol
© 2006 Syed Masud Mahmud112
Arbitration in the Static Segment
• Static Slot “N” is reserved for Frame ID “N”.• If a node detects that its slot counters contain the same value
as the Frame ID of one of its queued messages, then it sends that message.
• Static Slot “N” of the current cycle will remain idle if the node that contains Frame ID “N” has no message to send now.
57
Flexray: A Time-Triggered Protocol
© 2006 Syed Masud Mahmud113
Fault-Tolerant Transmission in the Static Segment
• If a node is connected to both channels, then the node can simultaneously send a time-triggered message through both channels.
• However, if a node is connected to only one channel (say Channel A), then Channel B will remain idle when the node sends a time-triggered message through Channel A.
Flexray: A Time-Triggered Protocol
© 2006 Syed Masud Mahmud114
Timing within the Static Segment
58
Flexray: A Time-Triggered Protocol
© 2006 Syed Masud Mahmud115
Static Slot Length
• Appropriate configuration of the static slot length (gdStaticSlot) must assure that the frame and the channel idle delimiter and any potential safety margin fit within the static slot under worst-case assumptions.
Flexray: A Time-Triggered Protocol
© 2006 Syed Masud Mahmud116
Structure of the Dynamic Segment
• The dynamic segment contains a number ofminislots.
• For a given system, the number of minislots in the dynamic segment is a global constant.
59
Flexray: A Time-Triggered Protocol
© 2006 Syed Masud Mahmud117
Structure of the Dynamic Segment
• All minislots are of same length in terms ofmacroticks.
• In the dynamic segment the duration of a communication slot depends upon the frame length.
Flexray: A Time-Triggered Protocol
© 2006 Syed Masud Mahmud118
Arbitration in the Dynamic Segment
• Each node continues to maintain the two slot counters – one for each channel.
• The slot counters are incremented independently according to the arbitration scheme within the dynamic segment.
• The slot number of the first minislot in the dynamic segment is the last static slot number plus 1.
60
Flexray: A Time-Triggered Protocol
© 2006 Syed Masud Mahmud119
Timing within the Dynamic Segment
Flexray: A Time-Triggered Protocol
© 2006 Syed Masud Mahmud120
Timing within the symbol window.
Arbitration is not provided by the protocol for the symbol window. The arbitration has to be performed by means of a higher-level protocol.
61
Flexray: A Time-Triggered Protocol
© 2006 Syed Masud Mahmud121
Network Idle Time• During the network idle time a node calculates
and applies clock corrections. • The network idle time also serves as a phase
during which the node performs implementation specific housekeeping operations.
• The network idle time contains the remaining number of macroticks within the communication cycle not allocated to the static segment, dynamic segment, or symbol window.
Flexray: A Time-Triggered Protocol
© 2006 Syed Masud Mahmud122
Frame Encoding in the Static Segment
• The transmitting node generates a Transmission Start Sequence(TSS) that consists of a continuous LOW for a given period.
• The Frame Start Sequence (FSS) consists of one HIGH bit. The Byte Start Sequence (BSS) is used to provide timing information to the receiver. The BSS consists of one HIGH bit followed by one LOW bit.
• The BSS is followed by eight data bits.• The Frame End Sequence (FES) marks the last byte of a frame.
The FES consists of one LOW bit followed by one HIGH bit.
62
Flexray: A Time-Triggered Protocol
© 2006 Syed Masud Mahmud123
Frame Encoding in the Dynamic Segment
• The Dynamic Trailing Sequence (DTS) is used to indicate the exact point in time of the transmitter’s minislot action point.
• After sending the FES, the transmitter keeps the TxD line low until the next minislot action point.
• The transmitter then moves the line to the HIGH level. (DTS Variable number of LOW bits + one HIGH bit).
Flexray: A Time-Triggered Protocol
© 2006 Syed Masud Mahmud124
Sync Nodes and Sync Frames
• At least three nodes shall be configured to be sync nodes.
• Sync nodes must be connected to both channels.
• The sync frames shall be sent in the same static slot in each cycle.
• Non sync nodes must not transmit frames with the sync frame indicator set.
63
Flexray: A Time-Triggered Protocol
© 2006 Syed Masud Mahmud125
Rate Correction• The Rate Correction determines by how many microticks
the node’s cycle length should be increased or decreased.• A node determines the length of a communication cycle by
taking the difference between the arrival times of a pair of Sync Frames, with the same Frame ID, on consecutive cycles.
Flexray: A Time-Triggered Protocol
© 2006 Syed Masud Mahmud126
Rate Correction• If there are two pairs for a given Sync Frame ID (one pair
for channel A and another pair for channel B) the average of the differences is used.
• The process is repeated for all Sync Frames, and a fault-tolerant midpoint algorithm is executed for the correction.
64
Flexray: A Time-Triggered Protocol
© 2006 Syed Masud Mahmud127
Offset Correction• The offset correction value indicates how many microticks
the node should shift the start of its cycle. • Negative values mean the NIT should be shortened
(making the next cycle start earlier). Positive values mean the NIT should be lengthened (making the next cycle start later).
Example: NIT has been shortened
Flexray: A Time-Triggered Protocol
© 2006 Syed Masud Mahmud128
Offset Correction• A node determines the offset of a communication cycle by
taking the difference (deviation) between the actual arrival times of a given Sync Frame ID and its expected arrival time.
• If a given Sync Frame ID has two deviation values (one for channel A and one for channel B) the smaller value is selected.
• The process is repeated for all Sync Frames, and a fault-tolerant midpoint algorithm is executed for the correction.
65
Flexray: A Time-Triggered Protocol
© 2006 Syed Masud Mahmud129
Fault-Tolerant Midpoint Algorithm
• The algorithm determines the value of a parameter, k, based on the number of values in the sorted list.
Flexray: A Time-Triggered Protocol
© 2006 Syed Masud Mahmud130
Fault-Tolerant Midpoint Algorithm• The measured values are sorted and the k
largest and the k smallest values are discarded.• The largest and the smallest of the remaining
values are averaged for the calculation of the midpoint value
66
Flexray: A Time-Triggered Protocol
© 2006 Syed Masud Mahmud131
Clock Correction• The correction terms are used to adjust the
number of microticks in each macrotick
Flexray: A Time-Triggered Protocol
© 2006 Syed Masud Mahmud132
Wake-Up Signal
67
Flexray: A Time-Triggered Protocol
© 2006 Syed Masud Mahmud133
Wakeup of two Channels in aFault-Tolerant way by Coldstart Nodes
Flexray: A Time-Triggered Protocol
© 2006 Syed Masud Mahmud134
Startup• Wakeup procedure has to be completed
before startup can commence. The startup is performed on all channels synchronously.
• The action of initiating a startup process is called a coldstart. Only a limited number of nodes may initiate a startup, they are called the coldstart nodes.
68
Flexray: A Time-Triggered Protocol
© 2006 Syed Masud Mahmud135
Startup• When a coldstart node enters startup, it listens
to its attached channels and attempts to receiveFlexRay frames.
• If no communication is received, the node commences a coldstart attempt.
• A coldstart attempt begins with the transmission of a collision avoidance symbol (CAS).
• The CAS is succeeded by the first regular cycle (Cycle 0: a startup frame).
• From Cycle 0 on, the node transmits its startup frame.
Flexray: A Time-Triggered Protocol
© 2006 Syed Masud Mahmud136
Collision Avoidance Symbol (CAS)
• The Collision Avoidance Symbol (CAS) contains a long train of LOW bits.
69
Flexray: A Time-Triggered Protocol
© 2006 Syed Masud Mahmud137
Startup• Since each coldstart node is allowed to perform
a coldstart attempt, it may occur that several nodes simultaneously transmit the CAS symbol and enter the coldstart path.
• This situation is resolved during the first four cycles after CAS transmission.
• As soon as a node that initiates a coldstartattempt receives a CAS symbol or a frame header during these four cycles, it reenters the listen state.
• Consequently, only one node remains in this path.
Flexray: A Time-Triggered Protocol
© 2006 Syed Masud Mahmud138
Startup• In Cycle 4, other coldstart nodes begin to
transmit their startup frames. • The node that initiated the coldstart
collects all startup frames from Cycle 4and 5 and performs clock correction.
• Then the node leaves startup and enters operation.
70
Flexray: A Time-Triggered Protocol
© 2006 Syed Masud Mahmud139
Path of the Integrating Coldstart Nodes• When a coldstart node enters the startup,
it listens to its attached channels and attempts to receive FlexRay frames.
• If communication is received, it tries to integrate to a transmitting coldstart node.
• It tries to receive a valid pair of startup frames.
• If these frame receptions have been successful, it performs clock correction in the following double-cycle.
Flexray: A Time-Triggered Protocol
© 2006 Syed Masud Mahmud140
Path of the Integrating Coldstart Nodes• If clock correction does not signal any errors, it
begins to transmit its startup frame; otherwise it reenters the listen state.
• If for the following three cycles the clock correction does not signal any errors and at least one other coldstart node is visible, the node leaves startup and enters operation.
• Thereby, it leaves startup at least one cycle after the node that initiated the coldstart.
71
Flexray: A Time-Triggered Protocol
© 2006 Syed Masud Mahmud141
Path of a Non-Coldstart Node• When a non-coldstart node enters startup,
it listens to its attached channels and tries to receive FlexRay frames.
• If communication is received, it tries to integrate to a transmitting coldstart node.
• It tries to receive a valid pair of startup frames to derive its schedule and clock correction.
Flexray: A Time-Triggered Protocol
© 2006 Syed Masud Mahmud142
Path of a Non-Coldstart Node• In the following double-cycles, it tries to
find at least two coldstart nodes that transmit startup frames.
• If this fails or if clock correction signals an error, the node aborts the integration attempt and tries anew.
72
Flexray: A Time-Triggered Protocol
© 2006 Syed Masud Mahmud143
Path of a Non-Coldstart Node• After receiving valid startup frame pairs for
two consecutive double-cycles from at least two coldstart nodes, the node leaves startup and enters operation.
• Thereby, it leaves startup at least two cycles after the node that initiated thecoldstart.
• That means that all nodes of the cluster can leave startup at the end of cycle 7, just before entering cycle 8.
Flexray: A Time-Triggered Protocol
© 2006 Syed Masud Mahmud144
State Transitions for the Fault-Free Startup
73
Flexray: A Time-Triggered Protocol
© 2006 Syed Masud Mahmud145
Some System Parameters
Flexray: A Time-Triggered Protocol
© 2006 Syed Masud Mahmud146
Some System Parameters
74
Flexray: A Time-Triggered Protocol
© 2006 Syed Masud Mahmud147
Some System Parameters
Flexray: A Time-Triggered Protocol
© 2006 Syed Masud Mahmud148
Summary of TTCAN & FlexRay
75
Flexray: A Time-Triggered Protocol
© 2006 Syed Masud Mahmud149
THE END
Flexray: A Time-Triggered Protocol
© 2006 Syed Masud Mahmud150
References1. CAN Protocol Standard, Motorola, Document
Number: BCANPSV2.0.2. Overview of CAN, Motorola.3. Thomas Fuehrer, Bernd Mueller, Florian
Hartwich and Robert Hugel, “Time-Triggered CAN (TTCAN),” Proc. of the SAE 2001 World Congress, Detroit, Michigan, March 5-8, 2001, paper number: 2001-01-0073.
4. Holger Zeltwanger, “Time-Triggered Communication on CAN,” Proc. of the SAE 2002 World Congress, Detroit, Michigan, March 4-7, 2002, paper number: 2002-01-0437.
76
Flexray: A Time-Triggered Protocol
© 2006 Syed Masud Mahmud151
References5. FlexRay Communications System Protocol
Specification, Version 2.0, June 30, 2004.6. FlexRay Communications System Electrical
Physical Layer Specification, Version 2.0, June 30, 2004.
7. FlexRay Communications System Bus Guardian Specification, Version 2.0, June 30, 2004.
8. Philip Koopman, “The FlexRay Protocol,”Electrical and Computer Engineering, Carnegie Mellon University.