Practical guide to CAN FD protocol

CAN FD introduction video

"Do you need a simple and practical CAN FD protocol guide?" -Greetings from Hong Ke. Something happened! bilibili.com

In this guide, we will introduce CAN FD(CAN Flexible Data-rate), including: CAN FD framework, overhead, efficiency, sample application, CSS CAN FD recorder case and its development trend.

CAN FD looks complicated, but this easy-to-understand guide will give you a comprehensive understanding of CAN FD.

CAN protocol has been very popular since 1986 came out: now almost any mobile machine uses CAN, whether it is cars, trucks, ships, planes or robots.

However, with the rise of modern science and technology, the requirements for the "traditional" CAN protocol (ISO 65438 official language+01898-1:2015) are getting higher and higher:

The rapid development of automobile functions is driving the explosion of big data.

The network is increasingly limited by the bandwidth of1mbit/s.

In order to deal with these situations, OEM has created complex and expensive solutions.

Specifically, the overhead of traditional CAN is very high (>: 50%) because each CAN data frame can only contain 8 data bytes. In addition, the network speed is limited to 1 Mbit/s, which limits the realization of data generation function.

Can FD solve these problems and make it forward-looking?

CAN FD protocol was developed by Bosch and industry experts in advance and released on 20 12. After standardization and improvement, it has been included in ISO11898-1:2015. The original version of Bosch CAN FD (non-ISO CAN FD) is not compatible with ISO CAN FD. CAN FD has the following four main advantages:

The picture comes from PCAN-View software, and a message of CAN FD protocol can reach 64 bytes of data.

1, increasing the data length.

CAN FD supports up to 64 data bytes per data frame, while traditional CAN supports up to 8 data bytes. This reduces the protocol overhead and improves the protocol efficiency.

2. Improve the transmission speed

CAN FD supports double bit rate: Like traditional CAN, the nominal (arbitration) bit rate is limited to 1 Mbit/s, while the data bit rate depends on the network topology/transceiver. In fact, data bit rates as high as 5 Mbit/s can be achieved.

3. Higher reliability

CAN FD uses an improved cyclic redundancy check (CRC) and a "protected padding bit counter" to reduce the risk of not detecting errors. This is very important in safety-critical applications such as automobiles and industrial automation.

4. Smooth transition

In some specific cases, CAN FD can be used in ECU that only uses traditional CAN, so that CAN FD nodes can be introduced step by step, thus simplifying procedures and reducing costs for OEM.

In fact, compared with the traditional CAN, CAN FD can increase the network bandwidth by 3 to 8 times, thus providing a simple solution for data growth.

Can FD look simple: speed up data transmission and increase the information content of each message, right? But it's not that simple. Below we outline two key challenges that CAN FD solutions must address. Before viewing the CAN FD data frame, we must understand two core parts of the traditional CAN that we want to maintain:

1 to avoid critical message delay.

Why not simply put 64 bytes of data into the traditional CAN?

Doing so can reduce overhead and simplify message interpretation. However, if the bit rate remains the same, it will also occupy the CAN bus for a longer time, which may delay higher priority data frames with critical tasks.

2. Keep the actual length of the CAN line.

It takes higher speed to send more data per message. Then why not speed up the whole CAN message (not just the data segment)? This is due to "arbitration": if more than two nodes send data at the same time, arbitration will decide which node has priority. The "winner" continues to send (without delay), while other nodes will quit the arbitration process and become recipients. In the arbitration process, "bit time" provides enough delay between each bit to allow each node on the network to react. In order to reach each node within the bit time, the maximum length of CAN network running at the speed of 1 Mbit/s should be 40m (actually 25m). Accelerating the arbitration segment will reduce the maximum length of the bus to an inappropriate length level.

On the other hand, there is an "empty highway" behind the arbitration section, which can realize high-speed data transmission (only one node is driving the bus). Before the ACK slot (when multiple nodes confirm the correct reception of data frames), the speed needs to be reduced to the nominal bit rate. Therefore, it is necessary to find a way to increase the speed only during data transmission.

CAN FD protocol introduces the adjusted CAN data frame to realize extra data bytes and flexible bit rate.

Let's compare the 1 1 bit traditional CAN frame with the 1 1 bit CAN FD frame (29 bits are also supported):

Let's discuss these differences step by step:

RTR and RRS: Remote Transmission Request (RTR) is used in traditional CAN to identify data frames and corresponding remote frames. In CAN FD, remote frames are not supported at all, and remote request replacement (RRS) always dominates (0).

R0 vs FDF: In traditional CAN, R0 is reserved dominant (0), and in CAFD it is called FDF, which is recessive (1). After the r0/FDF bit, "3 new bits" are added to the CAN FD protocol. Note that nodes without CAN FD function will generate an error frame after the FDF bit.

Res: This new reserved bit plays the same role as r0-that is, it can be set as implicit (1) to indicate the new protocol in the future.

BRS: Bit Rate Switching (BRS) can be explicit (0), which means that CAN FD data frames are sent at the arbitration rate (i.e. up to 1 Mbit/s). Setting it to stealth (1) means that the rest of the data frame is sent at a higher bit rate (up to 5 Mbit/s).

ESI: The error status indication (ESI) bit is dominant (0) by default, that is, "Error is valid". If the transmitter becomes "passive error", it will be implicit (1), indicating that it is in passive error mode.

DLC: Like the traditional CAN, CAN FD DLC is 4 bits, indicating the number of data bytes in a frame. The above table shows how these two protocols always use DLC of up to 8 data bytes. To maintain a 4-bit DLC, CAN FD uses the remaining 7 values from 9 to 15 to represent the number of data bytes used (12, 16, 20, 24, 32, 48, 64).

SBC: The padding bit count (SBC) consists of three Gray code bits and a parity bit before CRC. Subsequent fixed padding bits can be regarded as the second parity bit. SBC is added to improve communication reliability.

CRC: The CRC in traditional CAN is 15 bits, but in CAFD it is 17 bits (at most 16 data bytes) or 2 1 bit (20-64 data bytes). In traditional CAN, CRC can contain 0 to 3 padding bits, while in CAN FD, there are always 4 fixed padding bits to improve communication reliability.

ACK: The data segment (also called payload) of the CANFD data frame stops at the ACK bit, which also marks the end of variable bit rate.

Compared with the traditional CAN, the new function of CAN FD adds many extra bits. How can FD effectively reduce overhead?

The answer is: no. Please look at the visualization of traditional CAN and CAN FD in the following three data bytes. In fact, the efficiency of CAN FD will not exceed that of traditional CAN until it exceeds 8 data bytes. However, when the data length is close to 64 data bytes, the efficiency is improved from 50% to 90% (the efficiency calculator of CAN FD will be mentioned later).

Speed requirement: Open bit rate conversion (BRS) is adopted.

As CAN be seen from the above figure, sending 64 data bytes at normal speed by CAN FD will block the CAN bus and reduce the real-time performance.

To solve this problem, bit rate switching can be enabled to allow a higher rate (for example, compare the baud rate of a data segment of 5 Mbit/s with that of an arbitration segment of 1 Mbit/s) to send the payload. Above, we visually demonstrated the effects of the 3-data byte and 64-data byte schemes with graphics.

Note that the higher speed applies to the part of the data frame that starts with the BRS bit and ends with the CRC delimiter.

In addition, most vehicles today use 0.25-0.5 Mbit/s, which means that at the speed of 5 Mbit/s, CAN FD will be 10 times of the payload transmission speed.

Combination of traditional CAN and CAN field bus nodes

As mentioned earlier, traditional CAN and CAN FD nodes can be mixed in some cases. In this way, you can gradually migrate to CAN FD without switching each ECU at once. There are two situations:

100% CANfd system: here, CAN FD controller CAN freely mix traditional can and CAN FD data frames.

Some legacy nodes are traditional CAN: Here, the CAN FD controller CAN switch to traditional CAN communication to avoid participating in wrong frames when communicating with traditional CAN nodes. In addition, when writing into ECU, the traditional CAN node may be turned off to allow temporary conversion to CAN FD communication.

The simplest way to solve the problem of * * * storage in CAN and CAN FD networks is to add a gateway supporting CAN FD, such as PCN-Router FD.

What is the maximum bit rate of CAN FD?

One puzzling aspect of CAN FD is the maximum bit rate in the payload phase, because different articles mention different levels.

It has been pointed out that it can reach 8 Mbit/s in practical application and 15 Mbit/s in theory. Other regulations are the highest12mbit/s. In addition, Daimler points out that the speed exceeding 5 Mbit/s is questionable, because there is no standard and low-cost automobile Ethernet (10 BASE-T 1) which is expected to limit the higher demand for CAN FD. So what is right?

It depends. According to ISO 1 1898-2 (transceiver chip standard), it specifies two symmetrical parameter sets. It is recommended to use a transceiver with improved symmetry parameters, which is usually advertised as 5 mbit/s. The achievable data phase bit rate depends on many factors. The most important thing is the required temperature range. There is no need to keep the temperature low when writing ECU. This means that it may reach 12 mbit/s for a brushed ECU, and another important bit rate limit is caused by the selected topology. Compared with the mixed topology with long branches or even stars, the bus topology with short branches can significantly improve the bit rate. For the temperature range of -40℃ to+125℃, most multipoint bus networks are limited to 2 mbit/s ... The CIA provided appropriate rules of thumb in the network design proposal of CiA 60 1-3. This includes suggestions for setting sampling points in the data phase.

The picture comes from the interface of setting the baud rate of CAN FD in PCN software.

CAN FD calculator tool: efficiency and bit rate

To learn more about the efficiency and average bit rate of CAN FD, we suggest you check our CAN FD calculator (you can get it from Hong Ke).

This CAN FD calculator is an online editable form, which CAN compare the efficiency of CAN and CAN FD according to different message contents input by users, and provide corresponding intuitive efficiency curves.

In short, CAN FD processes more data at a faster speed. This is crucial for some increasingly relevant use cases:

electric vehicle

Electric vehicles and hybrid vehicles use new power system concepts and need higher bit rates. The new control unit involves DC/DC inverter, battery, charger and range extender, which increases the complexity. By 2025, it is estimated that the required bit rate will exceed CAN. With the explosive growth of electric vehicles, this may be the first field to apply CAN FD.

Writing with ECU brush

In-vehicle software is becoming more and more complex. Therefore, it takes several hours to perform ECU firmware update through, for example, OBD2 port. Using CAN FD, the speed of this kind of process can be increased by more than 4 times. This use case has always been one of the original drivers of automobile OEM's demand for CAN FD.

robot

Some applications rely on time synchronization behavior. Such as a multi-axis robot arm. This kind of equipment usually uses CANopen, and each controller needs to send multiple time-synchronized CAN frames (PDO) (without interference from higher priority frames). Converted to CAN FD, the original multi-frame data can be sent through a single frame, which improves efficiency.

ADAS and safe driving

Advanced Driver Assistance System (ADAS) is increasingly used in passenger cars and commercial vehicles. This puts pressure on the bus load of traditional CAN, and ADAS is the key to improve the safety. Here, in the near future, CAN FD will become the key to enhance safe driving.

Passenger cars and trucks

Bus and truck use long CAN bus (10-20m). Therefore, they are usually based on low bit rates (according to j1939-14,250 kbit/s or 500 kbit/s). Here, the upcoming J 1939 FD protocol is expected to achieve significant improvements in the functions of commercial vehicles, including ADAS, for example.

Encrypted CAN bus

As the recent CAN hacking shows, the traditional CAN is vulnerable to attacks. If the hacker CAN access the CAN bus (e.g. wireless), the key functions can be turned off. It may be the key to derive the key by passing the CAN FD authentication of the Secure Vehicle Communication (SecOC) module.

With the rise of CAN FD, there will be several uses for recording CAN FD data:

Record car data

With the launch of new cars, CAN FD data recorder will become the key to record OBD2 data of automobiles.

Remote information processing of heavy fleet

The Internet of Things CAN FD recorder compatible with J 1939 flexible data rate will be the key to long-distance information processing in the future.

Predictive maintenance

With the introduction of CANopen FD, new industrial machinery will need CANopen FD IOT recorder to help predict and avoid faults.

The "black box" of a vehicle or machine

A CAN FD recorder can be used as a "black box", such as a new prototype, to provide data for diagnosis and research and development.

CAN FD is expected to replace the traditional CAN in the next few years:

The first batch of vehicles supporting CAN FD will be launched on 20 19/20.

Initially, it may use 2 megabits per second, and then gradually transition to a data bit rate of 5 megabits per second.

Canopenfd has been modified by CIA13011.0.

J 1939-22 uses CAN FD data frames.

Can is still a growing technology, which is mainly attributed to CAN FD recently.

It is expected that most new development projects in the future will use CAN FD.

Can FD compare with other products?

Of course, traditional applications without bandwidth and payload requirements will still use traditional CAN. In addition, the CAN community has been developing the next generation CAN data link layer, which supports a payload of up to 2048 bytes. This method can be used as an alternative to 10 Mbit/s Ethernet. So what role CAN FD play in the future needs to be determined, but it will certainly continue to grow and develop, and I also believe that the future of CAN FD is bright.