Vehicle bus series - FlexRay VII

Vehicle bus series - FlexRay VII

I'm a man in slippers, a long-term car electronics engineer in Shanghai.

Old rules, share a piece of text you like, and avoid becoming an engineer with high knowledge and low culture:

No one follows you. No one needs to follow you either. You have to acknowledge your own worth, you can't stand against yourself by putting yourself in someone else's shoes. In life, the most fearful thing is to take other people's eyes as the only standard of your own life. In the end, I neither lived the way others liked, nor lived the way I wanted.
Only by accepting our true selves, without inferiority or pride, can we have a stronger heart; only by finding our own core values, can we live out our own wonderful life.

1. FlexRay dynamic time slot

The design requirements for dynamic time slots are basically the same as for static time slots. The layout of dynamic slots is similar to that of static slots. Each dynamic slot starts with an action point offset. The end of this offset is the action point, which is the starting point of dynamic message transmission. This action point corresponds to the action point of the mini-slot.

After the action point offset is the action point and the dynamic message. In the dynamic segment, the transmitted dynamic message may have payload segments of different lengths. The channel idle delimiter follows the dynamic message, and the delimiter is the same as the static time slot, consisting of 11 recessive bits.

According to the FlexRay specification, a dynamic message must end with the next possible action point. To ensure this, the telegram transmission is extended with a dynamic tail sequence. Theoretically, this sequence can be as long as a mini-slot.

To further illustrate the hybrid bus access method and corresponding data transmission, define a FlexRay cluster consisting of five FlexRay nodes (FlexRay nodes A to E), as shown in the "Demo Cluster" diagram, all FlexRay nodes are connected through the bus. To minimize the risk of failure, the communication channels are designed redundantly. Therefore, both channel A and channel B can be used to transfer data.

The communication schedule used as the basis for data transmission is divided into static and dynamic segments. Both segments consist of five time slots. The dispatch table lists static packets for static segments and dynamic packets for dynamic segments.

During communication, all static messages defined in the static section are always transmitted according to the communication schedule, and dynamic messages defined in the dynamic section are only transmitted when corresponding events occur.

You can learn about data communication in a FlexRay cluster through interactive diagrams and animations. The interactive diagrams detail the communication in the dynamic segment, and the animations describe the communication in the static and dynamic segments. Please read the instructions to take full advantage of the full functionality.

The data in the FlexRay cluster is transmitted using the unified telegram structure (FlexRay telegram). A FlexRay message consists of three parts: frame header, payload and frame trailer. The frame header consists of 40 bits, 11 of which represent ID (identifier). The ID identifies the message and corresponds to the time slot. All IDs can be used freely except 0x00, and 0x00 means invalid message.

The ID is preceded by a reserved bit and four indicator bits. Indicator bits are used to more precisely indicate the message. The payload indicator bit indicates whether the network management vector is being transmitted in the payload of the static message, or whether the message identifier is being transmitted in the payload of the dynamic message.

The empty frame indicator bit is used to indicate whether the load is normal or invalid. In the case of sending an empty frame, the payload is invalid data, and the sender can set all the data in the payload segment to 0. The sync frame indicator bit indicates whether the message transmitted in the static segment is a sync frame. The start-up frame indicator indicates whether the message transmitted in the static segment is a start-up frame.

Following the identifier is the payload length. The payload length consists of 7 bits, indicating the size of the payload (in word). A message can transmit up to 254 bytes (127 words). Following the payload length is an 11-bit header CRC sequence calculated based on the identifier, payload length, sync frame indicator and start frame indicator, and a generator polynomial defined by the FlexRay specification.

At the end of the frame header is the cycle counter, which is composed of 6 bits and represents the cycle number of message sending. The range of the cycle counter is 0 to 63.

A telegram can transmit up to 254 data bytes (payload). The payload length parameter indicates the size of the payload in word. All telegrams transmitted in the static segment have the same value for the payload length. The system designer must define this value during the configuration phase. Since dynamic messages are not limited to a fixed payload size, the value of the payload length may be different for such messages.

In the message transmitted in the static segment, by setting the payload indicator bit in the frame header, the first 0 to 12 bytes of the payload segment can be used to transmit the network management vector. Network management vectors can be used to implement network management in a FlexRay cluster.

If the payload indicator bit is set for a dynamic FlexRay message, it means that the first two bytes of the payload segment are the message identifier. System designers use message identifiers to more precisely indicate payloads. Packet identifiers can be used in acceptance filters to implement finer discrimination criteria.

In certain cases, the sender can set all the data in the payload to 0. This happens if the FlexRay controller needs to send a static message according to the communication schedule, and the buffer corresponding to this message is temporarily inaccessible. This could happen, for example, if the host itself accesses this buffer at this time. Since the FlexRay controller cannot access the data in the buffer, it automatically transmits static telegrams as empty frames. In this case, the empty frame indicator in the frame header is 0.

The payload is protected using a CRC (Cyclic Redundancy Check). CRC is a very powerful error detection method. Calculate the CRC sequence according to the frame header, payload, and the generator polynomial defined by the FlexRay specification, and append it to the frame header and payload as a frame trailer.

The CRC sequence of the message corresponds to a multiple of the frame header and payload. The receiver of the message can reliably detect any transmission errors. Errors can be detected by modulo division by a generator polynomial. The CRC method guarantees a Hamming distance of 6 for payloads up to 248 bytes. For longer payloads, the Hamming distance is 4, which results in lower error detection capabilities.

The physical transmission of the message does not start from the first bit of the frame header, but from the transmission start sequence (TSS). When the FlexRay cluster uses the active star topology, it can prevent the active star node from being unable to transmit the first bit of the message from the RX branch to the TX branch.

The reason is that the active star node takes a certain amount of time to reach its working state. In a FlexRay cluster with an active star node, the TSS must contain 3 to 15 bits low.

Following the TSS is the Frame Start Sequence (FSS). After the FSS, the headers can be sent. It should be noted here that each byte to be sent is preceded by a Byte Start Sequence (BSS). The receiver is resynchronized by an edge generated by BSS. The end of the telegram is marked by the Frame End Sequence (FES).

In both static and dynamic slots, eleven recessive bits (channel idle delimiter) indicate that the communication medium is available. Since according to the FlexRay specification a dynamic telegram must end exactly at the next possible action point, the telegram transmission is extended by a so-called dynamic tail sequence. This ensures that each receiver can determine in which mini-slot a dynamic message terminates.

There are two diagrams below to represent the encoding of the message. The figure "Static Message" shows a static message describing the encoding elements required for its physical transmission. Figure "Dynamic Message" is the same.

The prerequisite for the smooth communication of the FlexRay cluster is that all FlexRay nodes have a consistent time cognition, because all activities of the communication system will be triggered when certain time points are reached according to the time sequence.

In a FlexRay cluster, it must be ensured for all nodes that all communication cycles start at the same point in time and are of equal length. Furthermore, it must be ensured that all static time slots of a FlexRay node always start at the same point in time within the cycle.

The prerequisite for realizing these is the global time consensus. Since the FlexRay cluster is based on a multi-master node architecture, this global time consensus can only be achieved cooperatively based on the time base of the FlexRay nodes themselves. This is a huge challenge, because frequency deviation in crystal oscillator circuits and the accuracy of the components themselves can produce different frequencies and phases at the same nominal frequency.

In addition, changing environmental conditions and aging (assuming 10 years of use, the frequency deviation of the crystal oscillator is about 250ppm) will produce frequency deviation. Typically, we consider a frequency deviation of at most 1500ppm over the lifetime of the car.

Obviously, if the local time base is not adjusted regularly, the whole network time base cannot be established. FlexRay nodes use a special algorithm to correct local clocks, ensuring that all local clocks in a FlexRay cluster are synchronized with the global clock to a specified deviation. There are two methods available: Phase Correction (also known as Offset Correction) and Frequency Correction (also known as Rate Correction).

Phase correction ensures that the local clocks of the FlexRay nodes have the same phase and that communication cycles always start at the same time. Without other correction mechanisms, the system layout must always be based on the maximum skew of the local clock.

This means that if any two local clocks have a maximum deviation of 3000ppm, and a cycle time of 10ms, a drift of 30 microseconds will accumulate at the end of the cycle, which will significantly reduce the maximum data transfer rate allowed.

Frequency correction can be used as a complement to phase correction to improve the bandwidth efficiency of time-triggered communication systems. Phase correction only deals with the manifestation of frequency deviation, while frequency correction can address the cause of frequency deviation.

But this is not easy, because the crystal frequency cannot be directly modified. To do this, a frequency divider can be used to convert the frequency of the crystal oscillator to the local time base of the FlexRay node. By modifying the divider ratio, the local clock can be sped up or slowed down, ultimately ensuring that the communication cycles of all FlexRay nodes are of equal length.

Despite the transient disturbances caused by the synchronization messages required for synchronization over multiple communication cycles, with frequency correction almost all local clocks run at the same speed, so the deviation of the local clocks is within specification. Using frequency correction makes clock synchronization in a FlexRay cluster extremely robust against transient disturbances, tolerant of clock synchronization failures over multiple communication cycles.

The synchronization of the local clocks in a FlexRay cluster is based on the fact that each FlexRay node knows from the start the sending and receiving time points of all static telegrams. This ensures that all nodes of the FlexRay cluster are able to correct phase and frequency. After several cycles of calibration, all FlexRay nodes start all communication cycles at the same point in time and at the same rate.

In the FlexRay cluster, it is necessary to ensure that 2 to 15 FlexRay nodes are synchronous nodes, and these nodes transmit synchronous messages in the static time slots specified in each cycle. These synchronization packets are not additional packets, but static packets with a sync frame indicator set.

All FlexRay nodes will compare the known time point with the actual arrival time point of the synchronization message, and measure the time deviation with multiple synchronization nodes. The FlexRay node then creates an ordered list of time differences and uses the FTM (fault tolerant midpoint) algorithm to calculate offset correction values ​​from this list.

The FTM algorithm eliminates extreme values ​​in the list, ensuring that a local clock with a large deviation will not cause the communication in the FlexRay cluster to fall into an out-of-tuning state. If the number of synchronization nodes does not exceed 7, just remove the minimum and maximum values. If there are more than seven sync nodes, the next largest and next smallest measurements are also discarded.

The remaining measured values ​​are summed and averaged, and the result is the phase correction value. The method of calculating the frequency correction value is the same as above, the only difference is that the FlexRay node will measure the period length of the synchronization message.

Both phase correction and frequency correction are performed based on the local clock with Microtick as the smallest unit. Phase correction adjusts the timing by adding or removing a certain number of Microticks (corresponding to the offset) from the NIT at the end of each odd cycle. In this way, a FlexRay node can change the start time of its next cycle to make itself consistent with other FlexRay nodes.

To ensure that the frequency correction will not be the same as the phase correction, the FlexRay node will divide the frequency correction value equally between the next even cycle and the next odd cycle. Therefore, all FlexRay nodes can shorten or extend their cycle.

End of writing and sharing!

May you and I believe in the power of time

Be a long-termist!

Guess you like

Origin blog.csdn.net/Soly_kun/article/details/131885454