Engineering Autonomous Vehicles and Robots. Shaoshan Liu
Читать онлайн книгу.target="_blank" rel="nofollow" href="#ulink_b61f342d-1628-52fb-bdbd-afffd0a90da1">Figure 2.2 CAN protocol layers.
At a 500 kbps bit rate, a bit time is 2000 ns which does not allow much time for transceiver and cable delays. The result is that CAN networks are usually quite short and frequently less than 100 m at higher speeds. To increase this distance either the data rate is decreased or additional equipment is required.
CAN transmissions operate using the producer/consumer model. When data are transmitted by a CAN device, no other devices are addressed. Instead, the content of the message is designated by an identifier field. This identifier field, which must be unique within the network, not only provides content but the priority of the message as well. All other CAN devices listen to the sender and accept only those messages of interest.
This filtering of the data is accomplished using an acceptance filter which is an integral component of the CAN controller chip. Messages which fail the acceptance criteria are rejected. Therefore, receiving devices consume only the messages of interest from the producer. As Figure 2.3 shows, a CAN frame consists mainly of an identifier field, a control field, and a data field. The control field is 6 bits long, the data field is 0–8 bytes long and the identifier field is 11 bits long for standard frames (CAN specification 2.0A) or 29 bits long for extended frames (CAN specification 2.0B). Source and destination node addresses have no meaning using the CAN data link layer protocol.
Bus arbitration is accomplished using a nondestructive bit-wise arbitration scheme. It is possible that more than one device may begin transmitting a message at the same time. Using a “wired AND” mechanism, a dominant state (logic 0) overwrites the recessive state (logic 1). As the various transmitters send their data out on the bus, they simultaneously listen for the faithful transmission of their data on a bit-by-bit basis until it is discovered that someone's dominant bit overwrote their recessive bit. This indicates that a device with a higher priority message, one with an identifier of lower binary value, is present and the loser of the arbitration immediately reverts to receiving mode and completes the reception of the message. With this approach no data are destroyed and, therefore, throughput is enhanced. The losers simply try again during their next opportunity. The problem with this scheme is that all devices must assert their data within the same bit time and before the sampling point otherwise data will be falsely received or even destroyed. Therefore, a timing constraint has been introduced that impacts cabling distance.
Figure 2.3 CAN message format.
2.3 FlexRay
The FlexRay bus is a deterministic, fault-tolerant, and high-speed bus system developed in conjunction with automobile manufacturers and leading suppliers [3]. FlexRay delivers the error tolerance and time-determinism performance requirements for drive-by-wire applications.
Many aspects of FlexRay are designed to keep costs down while delivering top performance in a rugged environment. FlexRay uses unshielded twisted pair cabling to connect nodes together. FlexRay supports single- and dual-channel configurations which consist of one or two pairs of wires, respectively. Differential signaling on each pair of wires reduces the effects of external noise on the network without expensive shielding. Most FlexRay nodes typically also have power and ground wires available to power transceivers and microprocessors. Dual-channel configurations offer enhanced fault tolerance and/or increased bandwidth.
Most first-generation FlexRay networks only utilize one channel to keep wiring costs down but as applications increase in complexity and safety requirements, future networks will use both channels. FlexRay buses require termination at the ends, in the form of a resistor connected between the pair of signal wires. Only the end nodes on a multi-drop bus need termination. Too much or too little termination can break a FlexRay network. While specific network implementations vary, typical FlexRay networks have a cabling impedance between 80 Ω and 110 Ω, and the end nodes are terminated to match this impedance. Termination is one of the most frequent causes of frustration when connecting a FlexRay node to a test setup. Modern PC-based FlexRay interfaces may contain onboard termination resistors to simplify wiring.
2.3.1 FlexRay Topology
Unlike CAN, FlexRay supports multiple topologies, including simple multi-drop passive connections as well as active star connections for more complex networks. Depending on a vehicle's layout and level of FlexRay usage, selecting the right topology helps designers optimize cost, performance, and reliability for a given design.
Multi-drop bus: FlexRay is commonly used in a simple multi-drop bus topology that features a single network cable run that connects multiple ECUs together. This is the same topology used by CAN and is familiar to OEMs, making it a popular topology in first-generation FlexRay vehicles. In this topology, each ECU can “branch” up to a small distance from the core “trunk” of the bus. The ends of the network have termination resistors installed that eliminate problems with signal reflections. Because FlexRay operates at high frequencies, up to 10 Mbps compared with CAN's 1 Mbit, FlexRay designers must take care to correctly terminate and lay out networks to avoid signal integrity problems. The multi-drop format also fits nicely with vehicle harnesses that commonly share a similar type of layout, simplifying installation and reducing wiring throughout the vehicle.
Star network: The FlexRay standard supports “star” configurations which consist of individual links that connect to a central active node. This node is functionally similar to a hub found in PC ethernet networks. The active star configuration makes it possible to run FlexRay networks over longer distances or to segment the network in such a way that makes it more reliable should a portion of the network fail. If one of the branches of the star is cut or shorted, the other legs continue functioning. Since long runs of wires tend to conduct more environmental noise, such as electromagnetic emissions from large electric motors, using multiple legs reduces the amount of exposed wire for a segment and can help increase noise immunity.
Hybrid network: The bus and star topologies can be combined to form a hybrid topology. Future FlexRay networks will likely consist of hybrid networks to take advantage of the ease-of-use and cost advantages of the bus topology while applying the performance and reliability of star networks where needed in a vehicle.
2.3.2 The FlexRay Communication Protocol
The FlexRay communication protocol is a time-triggered protocol that provides options for deterministic data that arrive in a predictable time frame (down to the microsecond) as well as CAN-like dynamic event-driven data to handle a large variety of frames. FlexRay accomplishes this hybrid of core static frames and dynamic frames with a pre-set communication cycle that provides a predefined space for static and dynamic data. This space is configured with the network by the network designer.
While CAN nodes only need to know the correct baud rate to communicate, nodes on a FlexRay network must know how all the pieces of the network are configured in order to communicate. As with any multi-drop bus, only one node can electrically write data to the bus at a time. If two nodes were to write at the same time, you end up with contention on the bus and data become corrupt. There are a variety of schemes used to prevent contention on a bus. CAN, for example, used an arbitration scheme where nodes will yield to other nodes if they see a message with higher priority being sent on a bus. While flexible and easy to expand, this technique does not allow for very high data rates and cannot guarantee timely delivery of data.
FlexRay manages multiple nodes with a Time Division Multiple Access (TDMA) scheme. Every FlexRay node is synchronized to the same clock, and each node waits for its turn to write on the bus. Because the timing is consistent in a TDMA scheme, FlexRay is able to guarantee determinism or the consistency of data delivery to nodes on the network. This provides many