Since the 1980s, CAN bus has been gradually applied in a wide range of industrial applications such as automotive electronics, rail transportation, medical electronics, and engineering machinery. The most "unpleasant" thing about this "old" bus is that it can only transmit eight bytes of data in one frame. If you want to transmit longer bytes at a time, you need to split the frame, and choosing a reliable splitting method is what users must pay attention to.
CAN bus, as a bus born for automotive electronics, proposed the control concepts of "automatic arbitration of priority" and "fast transmission of short frames" in order to achieve the fast control goal of "high real-time performance". Using a communication unit of eight bytes per frame has a series of advantages and disadvantages:
1. Advantages and disadvantages of CAN communication:
advantage
(1) 8 bytes are exactly the storage "container" for 8 bytes, 4 16-bit, 2 32-bit, and 1 64-bit variables. Then the user only needs to store the "register address" in the ID, and then "read" or "modify" the corresponding "value" through 1 frame, which is more convenient;
(2) Short frames improve bus sharing speed. Any CAN node needs to compete with other nodes for the bus again after sending a message. In this way, as long as the user designs an appropriate sending interval, it can ensure that all nodes "share" the bus, improve bus utilization, and ensure that the sending cycle of each node is roughly consistent.
shortcoming
(1) The data load is low during long data transmission. When sending multiple frames, since the CAN ID must be sent for each frame, the actual CAN data ratio is very low. For example, the CAN extended frame has a 29-bit ID and 64-bit data, resulting in a data load of only 60%. Therefore, when transmitting long data, CAN is not even as good as RS485/Modbus at the same baud rate;
(2) Frame loss during long data transmission will cause the entire packet to fail. When more than 8 bytes of data need to be transmitted at a time, it needs to be transmitted in multiple frames. If one of the frames is "lost", the entire packet will be invalid. This requires the receiving node to confirm each frame to ensure the arrival of each frame, which will greatly reduce efficiency;
(3) Poor synchronization when transmitting long data. For example, when outputting control commands with more than 8 bytes at the same time, since each frame arrives in a certain order, the first one to arrive will be acted on first, and the last one to arrive will be acted on later, which will cause output asynchrony.
It can be seen that the main contradiction of CAN bus in the current mainstream application is concentrated on its 8-byte short frame long data transmission. Therefore, the vast number of scientific and technological workers in the world have developed a series of improvement and reform methods to solve these shortcomings.
2. Reliable CAN long data communication:
Upgrade to CANFD protocol to increase data load rate
A few years ago, Mercedes-Benz engineers told the CAN bus developer CiA (CAN in Automatic) that Mercedes-Benz had exhausted CAN. Mercedes-Benz engineers have increased the CAN bus utilization rate to over 90% by continuously optimizing the communication mechanism. There is no bandwidth available, and the only way to expand the data channel is to continuously add new CAN networks through gateways. This has resulted in more and more bus areas in the entire vehicle.
Although in-vehicle Ethernet can solve the problem of data volume, its wiring changes are too large, the cost increases too much, and it is only suitable for communication between gateways. Therefore, the CiA protocol has joined forces with major car manufacturers to develop a new generation of CANFD protocol to quickly upgrade the existing CAN2.0B. Its main content is to increase the data segment of a frame from 8 bytes to 64 bytes, and at the same time increase the baud rate of the data segment to shorten the communication time. As shown in Figure 1.
Figure 1 CANFD message improves data load rate
In this way, there is no need to send CANID every 8 bytes. Even if the baud rate is not increased, the data load rate is increased by 8 times. If the baud rate is increased by 8 times, the data load rate can be increased by 64 times, which is equivalent to expanding the bandwidth by 64 times. The improvement effect is very obvious.
Use reliable framing protocol
Mature application layer protocols all have reliable framing protocols, such as CANopen, DeviceNET, J1939 protocol, etc. The general principle is the four-process cycle of "handshake", "transmission", "confirmation" and "end". Here we only introduce the SDO multi-frame transmission in the CANopen protocol.
The CAN-ID of the message sent by the sender (client) is 600h+Node-ID. After the receiver (server) successfully receives it, it responds with a message with CAN-ID 580h+Node-ID. The download protocol is shown in Figure 2.
Figure 2 Common SDO download protocol
The upload protocol is shown in Figure 3.
Figure 3 Common SDO upload protocol
Synchronous transmission protocol
Synchronous transmission is to achieve synchronous transmission of the entire network, as shown in Figure 4, just like the formation in a military parade, all the soldiers march in neat steps. Here we take the CANopen synchronous message as an example to explain.
Figure 4 Synchronization protocol and military parade
Each node uses the synchronization message as the trigger parameter of PDO (process data). In order to ensure time accuracy, the COB-ID of the synchronization message has a relatively high priority and the shortest transmission time. CANopen uses 80h as the CAN-ID of the synchronization message, as shown in Figure 5.
Figure 5 Synchronization message
Generally, the synchronization message is sent by the NMT (network management) host, and the data of the CAN message is 0 bytes. However, if there are two synchronization mechanisms in a network, different synchronization beats need to be set. For example, some nodes send one PDO per one synchronization frame, and other nodes send one PDO after receiving two synchronization frames.
In the synchronous protocol, there are two constraints:
Synchronization window time: Index 1007h constrains the time limit for the slave node to send PDO after the synchronization frame is sent. That is, the PDO sent within this time is valid, and the PDO that exceeds the time will be discarded. When the synchronization window ends, the actions are executed simultaneously.
Communication cycle: Index 1006h specifies the cycle of the synchronization frame, that is, the cycle of sending the synchronization packet.
Driven by many enthusiasts, CAN bus has been continuously improved and reformed, bringing vitality to this ancient bus. As an important promoter of CAN bus in China, Guangzhou Zhiyuan Electronics Co., Ltd. has provided CANPRO software as a free standard for CANScope bus comprehensive analyzer, which can analyze mainstream CANOpen, DeviceNet, and J1939 protocols.
Figure 6 Protocol analysis
Previous article:[Question Solved] How to calculate non-standard CAN baud rate
Next article:Understanding High-Speed Access Unit "ISO11898-2"
- Popular Resources
- Popular amplifiers
- A new chapter in Great Wall Motors R&D: solid-state battery technology leads the future
- Naxin Micro provides full-scenario GaN driver IC solutions
- Interpreting Huawei’s new solid-state battery patent, will it challenge CATL in 2030?
- Are pure electric/plug-in hybrid vehicles going crazy? A Chinese company has launched the world's first -40℃ dischargeable hybrid battery that is not afraid of cold
- How much do you know about intelligent driving domain control: low-end and mid-end models are accelerating their introduction, with integrated driving and parking solutions accounting for the majority
- Foresight Launches Six Advanced Stereo Sensor Suite to Revolutionize Industrial and Automotive 3D Perception
- OPTIMA launches new ORANGETOP QH6 lithium battery to adapt to extreme temperature conditions
- Allegro MicroSystems Introduces Advanced Magnetic and Inductive Position Sensing Solutions
- TDK launches second generation 6-axis IMU for automotive safety applications
- LED chemical incompatibility test to see which chemicals LEDs can be used with
- Application of ARM9 hardware coprocessor on WinCE embedded motherboard
- What are the key points for selecting rotor flowmeter?
- LM317 high power charger circuit
- A brief analysis of Embest's application and development of embedded medical devices
- Single-phase RC protection circuit
- stm32 PVD programmable voltage monitor
- Introduction and measurement of edge trigger and level trigger of 51 single chip microcomputer
- Improved design of Linux system software shell protection technology
- What to do if the ABB robot protection device stops
- Wi-Fi 8 specification is on the way: 2.4/5/6GHz triple-band operation
- Wi-Fi 8 specification is on the way: 2.4/5/6GHz triple-band operation
- Vietnam's chip packaging and testing business is growing, and supply-side fragmentation is splitting the market
- Vietnam's chip packaging and testing business is growing, and supply-side fragmentation is splitting the market
- Three steps to govern hybrid multicloud environments
- Three steps to govern hybrid multicloud environments
- Microchip Accelerates Real-Time Edge AI Deployment with NVIDIA Holoscan Platform
- Microchip Accelerates Real-Time Edge AI Deployment with NVIDIA Holoscan Platform
- Melexis launches ultra-low power automotive contactless micro-power switch chip
- Melexis launches ultra-low power automotive contactless micro-power switch chip
- Taking a “family-first” approach to op amp design
- How to use J-Link remote debugging?
- Design of digital anti-noise module for airborne communications
- AD19, same rules, automatic routing is ok, manual routing will be short circuit and un-roated, what is the reason?
- We are looking for candidates who are proficient in zigbee!
- 【MM32 eMiniBoard Review】2a. Found that the virtual serial port may have problems, and the serial port routines cannot receive
- Help! Does anyone know what sensor this is?
- Do you usually read e-books or paper books now?
- ADC12 single channel multiple conversion routine (MSP430F5529)
- Motor startup interferes with the microcontroller problem