Ning Kailiang Electronics Blog 简体中文
FlexRay interface protocol settings

FlexRay interface protocol settings:What are the key protocol settings for configuring a FlexRay interface?

Author:Ning Kailiang Electronics Blog · Date:20261007

This page answers the following questions about“FlexRay interface protocol settings”:What are the key protocol settings for configuring a FlexRay interface?How do you set the communication cycle and segment lengths for a FlexRay interface?What are the recommended bit timing parameters for a 10 Mbit/s FlexRay interface?How do you configure the wakeup and startup settings for a FlexRay interface?

Q: What are the key protocol settings for configuring a FlexRay interface?

A: Configuring a FlexRay interface requires setting several critical protocol parameters. First, the communication cycle length and the static and dynamic segment lengths determine the timing structure. The static segment uses TDMA, while the dynamic segment uses mini-slotting. You must also define the number of static slots, the macroticks per cycle, and the microticks per macroticks. The baud rate, typically 10 Mbit/s, is set via the bit timing parameters. Additionally, the cluster's global time schedule, including the offset correction and rate correction, must be configured. The wakeup pattern and startup procedure also need specific settings. Finally, the interface must match the network's coldstart nodes and sync nodes. Incorrect settings can cause communication failures, so always validate against the FlexRay specification.

Q: How do you set the communication cycle and segment lengths for a FlexRay interface?

A: Setting the communication cycle and segment lengths for a FlexRay interface involves several steps. First, determine the total cycle length in macroticks (MT), which must be an integer multiple of the microtick duration. Then, divide the cycle into a static segment, a dynamic segment, and optionally a symbol window and network idle time. The static segment length is the number of static slots multiplied by the slot length. The dynamic segment length is the number of minislots multiplied by the minislot length. You configure these values in the interface's parameter set, typically via registers like CYCLE_LENGTH, STATIC_SLOTS, and MINISLOTS. Ensure that the sum of segments does not exceed the cycle length. Also, the static slot length must be identical for all nodes. Misconfiguration leads to synchronization errors.

Q: What are the recommended bit timing parameters for a 10 Mbit/s FlexRay interface?

A: For a 10 Mbit/s FlexRay interface, the bit timing parameters are defined by the microtick duration and the number of microticks per bit. Typically, a microtick is 0.1 microseconds (100 ns), and each bit consists of 8 microticks, giving a bit time of 0.8 microseconds, which corresponds to a baud rate of 1.25 Mbit/s? Wait, that is incorrect. Actually, 10 Mbit/s means 100 ns per bit, so with a microtick of 25 ns, you would have 4 microticks per bit. Common settings: microtick = 25 ns, samples per bit = 4, with sample point at 75%. The bit time is 100 ns. The protocol also requires a specified number of microticks per macroticks. For example, 1 macroticks = 40 microticks. The exact values depend on the oscillator tolerance and propagation delay. Always consult the FlexRay specification for the bit timing calculation, ensuring that the sum of propagation delay and clock deviation is within limits.

Q: How do you configure the wakeup and startup settings for a FlexRay interface?

A: Configuring wakeup and startup settings for a FlexRay interface requires defining the wakeup channel, the wakeup pattern, and the startup procedure. The wakeup pattern consists of a series of wakeup symbols sent on one or both channels. You set the number of wakeup repetitions (e.g., 2 to 63) and the wakeup symbol length (typically 5 to 15 bit times). For startup, each node must know whether it is a coldstart node or a non-coldstart node. Coldstart nodes transmit startup frames and listen for other coldstart nodes. You configure the startup attempt limit and the startup repetition count. Also, set the pKeySlotUsedForStartup and pKeySlotUsedForSync parameters. The interface must also handle the wakeup detection and the transition to the startup state. Incorrect settings can cause the network to fail to wake up or start properly.

FlexRay interface protocol settings

Dialogue about

Common scenarios of "FlexRay interface protocol settings"

【Engineer】 Hi, I'm trying to set up a FlexRay network for our new ECU. I've read the spec but I'm confused about the communication cycle parameters. Can you help me understand the key settings?

【Expert】 Sure! FlexRay communication cycle has several key parameters: gdCycle (cycle length), gdTSSTransmitter (transmission start sequence), gdTSSTransmitter, and gdSampleClockPeriod. Also, static and dynamic segments. What specifically are you struggling with?

【Engineer】 I'm not clear on the difference between the static segment and dynamic segment. How do I decide the length of each?

【Expert】 The static segment uses TDMA (Time Division Multiple Access) with fixed slots for each node. The dynamic segment uses FTDMA (Flexible TDMA) where slots are allocated based on priority. The lengths depend on your application: if you have deterministic, periodic data, allocate more to static; for event-driven or sporadic data, use dynamic.

【Engineer】 Okay, so for safety-critical messages like braking, I should put them in static segment. But how many static slots do I need? Is there a formula?

【Expert】 The number of static slots is configurable, typically a power of 2, up to 1023. Each static slot has a fixed length. You need to ensure the total static segment length (number of slots * slot length) fits within your cycle. Also consider the slot ID assignment; each node gets one or more slots.

【Engineer】 I see. What about the cycle length? How do I choose gdCycle?

【Expert】 gdCycle is the total length of one communication cycle, consisting of static segment, dynamic segment, symbol window, and network idle time. It must be a multiple of the microtick (gdMacrotick). Typical values are 1ms, 2ms, 5ms. Choose based on your required message periods and latency constraints.

【Engineer】 Our control loop runs at 1ms, so I guess 1ms cycle? But then can I fit all messages?

【Expert】 Possibly, but you need to calculate. Each static slot has a payload of up to 254 bits (or 127 bits? Actually up to 254 bits for 16-bit CRC? Wait, FlexRay static slot payload is up to 254 bits (32 bytes) for 16-bit CRC? Let me clarify: FlexRay frame has up to 254 bits payload (about 31.75 bytes). So you need to sum up all static frames and ensure they fit in the static segment. If not, you might need to increase cycle length or reduce data.

【Engineer】 Okay, so I need to sum the frame lengths. What about the dynamic segment? How do I set its length?

【Expert】 The dynamic segment length is determined by the number of minislots. Each dynamic frame consumes a number of minislots based on its length. The total dynamic segment length is the sum of all minislots that are actually used (including idle minislots). You configure gdMinislot and the number of minislots. The dynamic segment ends when the cycle reaches the symbol window or when all pending frames are sent, whichever comes first.

【Engineer】 So if I have many event-driven messages, I might need a longer dynamic segment. But that eats into the cycle time. Any tips on balancing?

【Expert】 Yes, you can use the dynamic segment for lower-priority or non-critical data. If you have a lot of sporadic data, you might increase the cycle length or reduce the static segment if possible. Also, you can use the symbol window for things like wakeup or coldstart. Network idle time is fixed and used for clock correction.

【Engineer】 What about the communication controller settings? Like baud rate and clock correction?

【Expert】 FlexRay supports bit rates of 10 Mbps, 5 Mbps, 2.5 Mbps. You set the bit rate via gdBitTime and gdSampleClockPeriod. Clock correction is done using the sync frames in the static segment. You need to configure the number of sync frames and the rate correction and offset correction parameters. Typically, you have at least 2 sync frames per cycle, and the controller adjusts its clock based on the measured deviation.

【Engineer】 I've heard about coldstart and wakeup. How do those work in terms of protocol settings?

【Expert】 Coldstart is the process of starting the network from a powered-off state. At least two coldstart nodes send wakeup patterns and then start the communication. You need to configure the coldstart attempts and the wakeup channel. The wakeup pattern is a specific signal on the bus. Settings include gdWakeupSymbolTxLow, gdWakeupSymbolTxIdle, etc. Also, you need to set the coldstart node's slot ID and the number of coldstart repetitions.

【Engineer】 This is a lot. Do you have a recommended configuration for a typical automotive powertrain application?

【Expert】 Common settings: cycle length 5ms, static segment 3ms, dynamic segment 1.5ms, symbol window 0.1ms, NIT 0.4ms. Bit rate 10Mbps. Number of static slots 64, slot length 100 bits. Sync frames: 4. Coldstart nodes: 2. But you must tailor to your needs. Always simulate or test with a tool like CANoe or FlexRay conformance test.

【Engineer】 Great, I'll start with those and adjust. One last thing: how do I handle the network management and error handling?

【Expert】 FlexRay has built-in error detection via CRC and cycle count. Network management is often done via the payload, e.g., using a NM vector. You can configure the communication controller to report errors and to enter a safe state. Also, consider the use of the sync frame and the startup procedure. For detailed settings, refer to the FlexRay specification and your controller's user manual.

This article was published byNing Kailiang Electronics Blog, For more knowledge about“interface” please followNing Kailiang Electronics Blog。

Recent Articles