Multi-level caching method and system based on CAN bus communication

By using multi-level cache method and ring buffer technology in CAN bus communication, the data transmission strategy is dynamically adjusted, and the problem of low data transmission efficiency during the OTA upgrade of CAN bus is solved, achieving more efficient data transmission and faster flash time.

CN119788456AActive Publication Date: 2025-04-08SHENZHEN XIAOYUN INTELLIGENT CONTROL TECH CO LTD

Patent Information

Application Number
CN202510286821.4
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2025-03-12
Publication Date
2025-04-08
Estimated Expiration
2045-03-12

AI Technical Summary

Technical Problem

In the prior art, when a vehicle is upgraded through the CAN bus, the low-speed bus is less efficient during data transmission, resulting in wasted writing time.

Method used

The multi-level cache method based on CAN bus communication is adopted to obtain the impact coefficients of different baud rates, determine whether it is limited by hardware, activate the cache mechanism, use a ring buffer for data transmission, and dynamically adjust the transmission interval and data packaging strategy.

Benefits of technology

It improves the data transmission efficiency of the CAN bus, reduces the waste of brushing time, and optimizes the OTA upgrade process.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN119788456A_ABST
    Figure CN119788456A_ABST
Patent Text Reader

Abstract

The invention provides a multilevel caching method and system based on CAN bus communication, and is applied to the field of data transmission. According to the method, the influence coefficient of the CAN bus is obtained by presetting load scenes (idle, low load and high load), whether the influence coefficient is limited by hardware is judged, the optimization direction is ensured to be accurate, data cache management is performed by adopting an annular buffer area, and the data transmission interval is dynamically adjusted and the data packaging strategy is optimized (small data merging, data alignment and filling byte reduction), so that the data transmission efficiency is improved. The CAN ID priority is dynamically adjusted by collecting communication data category information, it is ensured that high-priority data (such as ECU control signals) are transmitted in time, bandwidth occupation of low-priority data is reduced, in addition, the processing response speed of data frames is monitored, and if the processing response speed does not reach the standard, the data sending frequency is optimized, and the real-time performance is improved.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present invention relates to the field of data transmission, and in particular to a multi-level cache method and system based on CAN bus communication. Background Art

[0002] With the rapid development of the new energy vehicle industry, vehicle automation procedures are becoming increasingly advanced, and multiple modules inside the vehicle require continuous OTA iterations.

[0003] Currently, most vehicles are upgraded through the CAN bus, which is usually communicated with the vehicle CAN bus through Bluetooth or other low-speed buses. The low-speed bus is limited by the frequency of the bus itself in the process of forwarding data, and the data generation efficiency is low. Taking the CAN bus as an example, the data packet sent from the computer to the CAN bus will pass through the low-speed bus, so the transmission time will cause a lot of waste of flashing time. Summary of the invention

[0004] The present invention aims to solve the problem of how to improve the utilization rate and transmission speed of a vehicle to a CAN bus, and provides a multi-level cache method and system based on CAN bus communication.

[0005] The present invention adopts the following technical means to solve the technical problem: The present invention provides a multi-level cache method based on CAN bus communication, comprising: Based on a preset load scenario, the influence coefficient of the CAN bus on different baud rates is obtained, wherein the load scenario specifically includes an idle state, a low load state, and a high load state; Determining whether the influence coefficient is limited by the hardware of the CAN bus; If not, activate the preset cache mechanism of the CAN bus, apply the ring buffer to transmit the communication data, dynamically adjust the sending interval of the communication data according to the pre-collected CAN bus load, detect the peak transmission period of the CAN bus for the communication data, and optimize the preset data packaging strategy in a single data frame according to the peak transmission period, wherein the data frame specifically includes a frame header, a control field and a check field, and the data packaging strategy specifically includes merging small data, data alignment and reducing padding bytes; Determining whether the data frame reaches a preset processing response speed; If not reached, the sending frequency of the communication data is obtained, and based on the sending frequency, the ID priority of the CAN bus is reset; according to the preset priority of the communication data, the category information of the communication data is collected; based on the category information, the message sending duration of the communication data is dynamically adjusted, wherein the ID priority specifically includes ECU control signals, sensor data and status logs.

[0006] Furthermore, the step of activating a preset cache mechanism of the CAN bus and applying a ring buffer to transmit communication data further includes: Constructing a capacity parameter of the ring buffer based on the maximum data flow of the communication data; Determining whether the capacity parameter is compatible with a preset data storage method; If so, the memory overhead of the circular buffer is dynamically allocated according to the data storage method, the frame length of the communication data is obtained, and based on the frame length, the index table data block is used to access the communication data, and the reading information of the circular buffer is recorded in real time, wherein the reading information specifically includes overflow or empty reading.

[0007] Furthermore, before the step of detecting the peak transmission period of the communication data by the CAN bus, the step further includes: Based on the preset test target of the CAN bus, dynamically adjust the bus utilization of the CAN bus, collect the concurrent communication capabilities of multiple communication nodes, and obtain the bit error rate of the CAN bus; Determining whether the bit error rate exceeds a preset threshold; If so, a preset high-frequency interference signal is injected within the preset transmission distance of the CAN bus to test the bit error change rate of the communication node, and the bus arbitration priority of the CAN bus is dynamically adjusted according to the bit error change rate, wherein the bus arbitration priority specifically includes reasonable allocation of IDs, reducing the sending frequency of high-priority data, and using time slice scheduling.

[0008] Furthermore, the step of collecting the category information of the communication data and dynamically adjusting the message sending duration of the communication data according to the category information further includes: Based on the real-time category data pre-collected by the vehicle, collecting the bandwidth load of the real-time category data on the CAN bus, wherein the real-time category data specifically includes high real-time data, medium real-time data and low real-time data; Determining whether the bandwidth load reaches a preset bus load; If so, the preset multicast sending mode is applied, the low priority data is merged into the same frame, a time slice scheduling mechanism is introduced, the sending time of the real-time category data is allocated, the corresponding number of sending failures is monitored, and the retransmission strategy of the real-time category data is constructed according to the number of sending failures.

[0009] Furthermore, the step of determining whether the influence coefficient is limited by the hardware of the CAN bus further includes: Based on the baud rate preset by the CAN bus, collecting communication parameters corresponding to the baud rate, wherein the communication parameters specifically include communication stability, data loss rate and number of error frames; Determining whether the communication parameters match a preset data throughput; If not, a data frame of a fixed size is sent, and the maximum data flow per unit time is calculated based on the data frame. Based on the maximum data flow, the bus load of the CAN bus is monitored, and the bus utilization under different baud rates is calculated through the bus load.

[0010] Furthermore, the step of determining whether the data frame reaches a preset processing response speed further includes: Based on the oscilloscope preset in the vehicle, detecting the signal waveform of the CAN bus; Determine whether the signal waveform has a preset fault content, wherein the fault content specifically includes distortion, reflection and noise interference; If so, the driving capability of the CAN bus is evaluated according to the preset transceiver of the CAN bus, the terminal resistance of the CAN bus is identified, and the bus impedance of the CAN bus is dynamically adjusted according to the terminal resistance.

[0011] Furthermore, the step of obtaining the influence coefficient of the CAN bus for different baud rates based on the preset load scenario also includes: Based on the data type preset by the vehicle, the number of frames successfully sent and received by the CAN bus is collected, wherein the data type specifically includes periodic data, burst data and burst-period combined data; Determining whether the number of frames matches a preset average delay; If not, an error frame on the CAN bus is acquired, and the cache depth of the CAN bus is dynamically adjusted according to the error frame, wherein the error frame specifically includes ACK loss, bit error and format error.

[0012] The present invention also provides a multi-level cache system based on CAN bus communication, comprising: An acquisition module, used to acquire the influence coefficient of the CAN bus on different baud rates based on a preset load scenario, wherein the load scenario specifically includes an idle state, a low load state, and a high load state; A judging module, used for judging whether the influence coefficient is limited by the hardware of the CAN bus; An execution module, for activating a preset cache mechanism of the CAN bus if no, applying a ring buffer to transmit the communication data, dynamically adjusting the sending interval of the communication data according to the pre-collected CAN bus load, detecting the peak transmission period of the CAN bus for the communication data, and optimizing the preset data packaging strategy in a single data frame according to the peak transmission period, wherein the data frame specifically includes a frame header, a control field and a check field, and the data packaging strategy specifically includes merging small data, data alignment and reducing padding bytes; A second judgment module is used to judge whether the data frame reaches a preset processing response speed; The second execution module is used to obtain the sending frequency of the communication data if it is not reached, reset the ID priority of the CAN bus based on the sending frequency, collect the category information of the communication data according to the preset priority of the communication data, and dynamically adjust the message sending duration of the communication data according to the category information, wherein the ID priority specifically includes ECU control signals, sensor data and status logs.

[0013] Furthermore, the execution module also includes: A construction unit, configured to construct a capacity parameter of the ring buffer based on a maximum data flow of the communication data; A judging unit, used to judge whether the capacity parameter is adapted to a preset data storage mode; An execution unit is used to dynamically allocate the memory overhead of the ring buffer according to the data storage method, obtain the frame length of the communication data, apply the index table data block to access the communication data based on the frame length, and record the reading information of the ring buffer in real time, wherein the reading information specifically includes overflow or empty reading.

[0014] Furthermore, it also includes: A collection module, used for dynamically adjusting the bus utilization of the CAN bus based on the preset test target of the CAN bus, collecting the concurrent communication capabilities of multiple communication nodes, and obtaining the bit error rate of the CAN bus; A third judgment module is used to judge whether the bit error rate exceeds a preset threshold; The third execution module is used to inject a preset high-frequency interference signal within the preset transmission distance of the CAN bus, test the bit error change rate of the communication node, and dynamically adjust the bus arbitration priority of the CAN bus according to the bit error change rate, wherein the bus arbitration priority specifically includes reasonable allocation of IDs, reducing the sending frequency of high-priority data and using time slice scheduling.

[0015] The present invention provides a multi-level cache method and system based on CAN bus communication, which has the following beneficial effects: The present invention obtains the influence coefficient of the CAN bus by presetting load scenarios (idle, low load, high load), and determines whether it is limited by hardware to ensure accurate optimization direction. A circular buffer is used for data cache management, combined with dynamic adjustment of data transmission interval and optimization of data packaging strategy (merging small data, data alignment, reducing padding bytes) to improve data transmission efficiency. By collecting communication data category information, the CAN ID priority is dynamically adjusted to ensure timely transmission of high-priority data (such as ECU control signals) and reduce bandwidth occupancy of low-priority data. In addition, the processing response speed of the data frame is monitored. If it does not meet the standard, the data transmission frequency is optimized to improve real-time performance. BRIEF DESCRIPTION OF THE DRAWINGS

[0016] Figure 1 A schematic flow chart of an embodiment of a multi-level cache method based on CAN bus communication of the present invention; Figure 2 This is a structural block diagram of an embodiment of a multi-level cache system based on CAN bus communication of the present invention. DETAILED DESCRIPTION

[0017] It should be understood that the specific embodiments described herein are only used to explain the present invention and are not intended to limit the present invention. The implementation of the objectives, functional features and advantages of the present invention will be further described in conjunction with the embodiments and with reference to the accompanying drawings.

[0018] The following will be combined with the drawings in the embodiments of the present invention to clearly and completely describe the technical solutions in the embodiments of the present invention. Obviously, the described embodiments are only part of the embodiments of the present invention, not all of the embodiments. Based on the embodiments of the present invention, all other embodiments obtained by ordinary technicians in this field without creative work are within the scope of protection of the present invention.

[0019] Reference Figure 1 , is a multi-level cache method based on CAN bus communication in one embodiment of the present invention, comprising: S1: Based on a preset load scenario, obtaining an influence coefficient of the CAN bus on different baud rates, wherein the load scenario specifically includes an idle state, a low load state, and a high load state; S2: Determine whether the influence coefficient is limited by the hardware of the CAN bus; S3: If not, activate the preset cache mechanism of the CAN bus, apply the ring buffer to transmit the communication data, dynamically adjust the sending interval of the communication data according to the pre-collected CAN bus load, detect the peak transmission period of the CAN bus for the communication data, and optimize the preset data packaging strategy in a single data frame according to the peak transmission period, wherein the data frame specifically includes a frame header, a control field and a check field, and the data packaging strategy specifically includes merging small data, data alignment and reducing padding bytes; S4: Determine whether the data frame reaches a preset processing response speed; S5: If not reached, obtain the sending frequency of the communication data, reset the ID priority of the CAN bus based on the sending frequency, collect the category information of the communication data according to the preset priority of the communication data, and dynamically adjust the message sending duration of the communication data according to the category information, wherein the ID priority specifically includes ECU control signals, sensor data and status logs.

[0020] In this embodiment, the system obtains the influence coefficients of the CAN bus for different baud rates based on the load scenarios pre-set for the vehicle, which specifically include an idle state, a low-load state, and a high-load state. The system then determines whether these influence coefficients are limited by the hardware of the CAN bus to execute corresponding steps. For example, when the system determines that the influence coefficients of the CAN bus for different baud rates are limited by the hardware of the CAN bus, the system will believe that the bottleneck is not caused by data scheduling or cache management, but is caused by the performance limitations of the physical layer or the controller itself. The system will reduce the length of the wiring harness to avoid excessively long branches to reduce signal attenuation and interference, and at the same time check the CAN controller processing capability of the MCU. If the CA The N controller has low processing power, which may cause data transmission delays. A high-performance MCU can be replaced or a more efficient CAN controller can be connected externally. It is also necessary to ensure that all ECU nodes support CAN-FD and perform compatibility testing to prevent communication failures between new and old devices. For example, when the system determines that the influence coefficient of the CAN bus on different baud rates is not limited by the hardware of the CAN bus, the system will consider that the bottleneck is caused by data scheduling or cache management. The system will activate the pre-set cache mechanism of the CAN bus, apply the ring buffer to transmit the communication data, and dynamically adjust the communication data transmission interval according to the pre-collected CAN bus load conditions to detect the peak transmission time of the CAN bus for communication data. According to different peak transmission periods, the pre-set data packaging strategy is optimized in a single data frame. The data frame specifically includes a frame header, a control field and a check field. The data packaging strategy specifically includes merging small data, data alignment and reducing padding bytes. The system manages data through a ring buffer to ensure the orderly transmission of data streams, avoid data loss or bus blocking caused by instantaneous data overload, improve data throughput, dynamically adjust the data transmission interval according to the real-time load of the CAN bus, ensure the balanced use of bus resources, reduce transmission conflicts, improve channel utilization, and make data transmission smoother. At the same time, it detects the peak transmission period and optimizes the data transmission strategy so that high-priority data can be received in time. It processes low-priority data in real time to reduce the impact of low-priority data on the overall system performance. It combines data packaging optimization strategies (merging small data, aligning data, reducing padding bytes) to reduce redundant data, increase the effective load ratio of a single frame, and reduce bus occupancy, thereby speeding up transmission. It also optimizes the data frame structure (frame header, control field, check field) to ensure data integrity and reliability, while reducing unnecessary overhead and improving data processing efficiency. It adjusts the data transmission interval according to the bus load to avoid excessive delays caused by burst data transmission, making the system response more stable and improving overall communication performance. The system then determines whether these data frames have reached the preset processing response speed to execute the corresponding steps.For example, when the system determines that the data frame can reach the preset processing response speed, the system will consider that the current data transmission strategy and cache management have been optimized, and the communication efficiency of the CAN bus has met the system requirements, and no further adjustment is required. The system will maintain the current optimization strategy and continue to operate according to the existing ring buffer management, dynamic data scheduling, and data packaging optimization scheme to ensure that the system can still maintain efficient communication under different load conditions. At the same time, the system load is monitored in real time, and the load status and communication delay of the CAN bus are continuously collected to establish a long-term data analysis model to ensure that the strategy can be quickly adjusted when the load fluctuates, and the power consumption is appropriately reduced. Under the premise of ensuring communication efficiency, data redundancy and unnecessary transmission frequency are reduced, the energy efficiency ratio is improved, and the overall operation efficiency of the CAN bus is optimized; for example, when the system determines that the data frame cannot reach the preset processing response speed, the system will consider that the current data transmission strategy and cache management have not been optimized, and the system will obtain the transmission frequency of the communication data based on different transmission frequencies, reset the ID priority of the CAN bus, and the ID priority specifically includes ECU control signals, sensor data, and status logs. According to the preset priority of the communication data, the category information of the communication data is collected, and different signals are obtained. The system can obtain the transmission frequency of communication data, accurately identify the root cause of the decrease in data frame response speed, avoid blind optimization, improve the accuracy of problem location, reset the ID priority of the CAN bus according to different transmission frequencies, ensure that high-priority data (such as ECU control signals) can be transmitted in time, rather than all data are processed equally, reduce the interference of low-priority data on data with high real-time requirements, and redistribute ID priorities to ensure that ECU control signals (such as braking, steering and other key signals) are always sent first, avoid control signal delays due to bus congestion, improve vehicle safety and response speed, and low-priority data such as sensor data and status logs can be appropriately delayed when the bus load is high to ensure the stability and reliability of core control signals. In addition, based on the category information of communication data (such as real-time control data, environmental monitoring data, historical logs, etc.), the system can dynamically adjust the data transmission time, reduce the occupancy of irrelevant data on the bus, and optimize the transmission strategy. For example, for high-real-time data (such as braking control), the system can shorten the transmission time and increase the refresh rate; for low-time data (such as vehicle status logs), the transmission cycle can be appropriately extended to reduce the bus load. ;

[0021] In this embodiment, the step S3 of activating the preset cache mechanism of the CAN bus and using the ring buffer to transmit the communication data further includes: S31: constructing a capacity parameter of the ring buffer based on the maximum data flow of the communication data; S32: Determine whether the capacity parameter is adapted to the preset data storage method; S33: If so, dynamically allocate the memory overhead of the circular buffer according to the data storage method, obtain the frame length of the communication data, apply the index table data block to access the communication data based on the frame length, and record the reading information of the circular buffer in real time, wherein the reading information specifically includes overflow or empty reading.

[0022] In this embodiment, the system constructs the capacity parameters of the ring buffer based on the maximum data flow of the communication data, and then the system determines whether these capacity parameters are suitable for the pre-set data storage method to execute the corresponding steps; for example, when the system determines that the capacity parameters of the ring buffer are not suitable for the pre-set data storage method, the system will think that if the capacity is too small, it may cause the data write rate to be higher than the read rate, the buffer overflows, and then causes data loss or system processing delays, and if the capacity is too large, the data flow is relatively small, which will cause a waste of storage resources and reduce the efficiency of cache management. The system will dynamically adjust the capacity of the ring buffer according to the data flow to avoid the adaptability problems caused by the fixed capacity setting, and adopt an adaptive capacity adjustment algorithm. According to the trend of historical data flow, the buffer size is expanded or reduced in real time to ensure that there will be no overflow due to sudden data growth and no waste of resources due to excessive redundant space. At the same time, high-frequency data buffer and low-frequency data buffer are set. High-real-time data (such as ECU control signals) are stored in the high-speed buffer first, and a high-priority reading strategy is set. Low-priority data (such as status logs) are stored in the secondary buffer, allowing batch transmission under low load to reduce bus occupancy. If it is found that the buffer overflow is caused by the frequent sending of certain data, the data sending rhythm can be optimized, the data packet size can be adjusted, or duplicate data can be merged to reduce transmission pressure. The flow control mechanism is adopted. When the data flow is too large, the storage of low-priority data is briefly delayed to give priority to key The integrity and timeliness of data; for example, when the system determines that the capacity parameters of the ring buffer are adapted to the pre-set data storage method, the system will consider that the organization method of the buffer (such as FIFO, LIFO, etc.) matches the actual data flow pattern of the CAN bus and will not affect the data access efficiency. The system will dynamically adjust the memory overhead of the ring buffer according to different data storage methods, obtain the frame length of the communication data, and use the index table data block to access the communication data based on these frame lengths, and record the reading information of the ring buffer in real time. The reading information specifically includes overflow or empty reading; the system dynamically adjusts the memory overhead of the ring buffer to avoid allocating too much or too little memory, improve memory utilization, and store data in different data storage methods. (such as fixed-size data blocks or variable-length data blocks) allocate appropriate cache size to reduce resource waste caused by over-reservation or performance degradation caused by insufficient space. At the same time, by obtaining the frame length of the communication data, the system can allocate cache space more accurately to prevent storage fragmentation caused by frame size mismatch. The index table data block management mechanism ensures that data can be accessed along the optimal path, improves query and write speeds, and reduces CPU occupancy. Through dynamic matching of the index table and frame length, the buffer can adapt to different data communication modes to ensure that in high data traffic scenarios, there will be no delays or packet loss due to unreasonable cache mechanisms. Under low load conditions, the system can reduce unnecessary data access operations, reduce power consumption, and improve overall communication efficiency.

[0023] In this embodiment, before the step S3 of detecting the peak transmission period of the communication data by the CAN bus, the method further includes: S301: Based on the preset test target of the CAN bus, dynamically adjust the bus utilization of the CAN bus, collect the concurrent communication capabilities of multiple communication nodes, and obtain the bit error rate of the CAN bus; S302: Determine whether the bit error rate exceeds a preset threshold; S303: If so, then inject a preset high-frequency interference signal within the preset transmission distance of the CAN bus, test the bit error change rate of the communication node, and dynamically adjust the bus arbitration priority of the CAN bus according to the bit error change rate, wherein the bus arbitration priority specifically includes reasonable allocation of IDs, reducing the sending frequency of high-priority data, and using time slice scheduling.

[0024] In this embodiment, the system dynamically adjusts the bus utilization of the CAN bus based on the test target pre-set for the CAN bus, collects the concurrent communication capabilities of multiple communication nodes to obtain the bit error rate of the CAN bus, and then the system determines whether the bit error rate exceeds the pre-set threshold to execute the corresponding steps; for example, when the system determines that the bit error rate of the CAN bus does not exceed the pre-set threshold, the system will consider that the current bus communication quality is within an acceptable range, the stability and reliability of data transmission are high, and there is no serious signal interference or data loss. The system will dynamically adjust the sending timing of the data frame to reduce the bus idle time and improve the data transmission efficiency. According to the transmission efficiency, optimize the data flow scheduling, appropriately increase the sending frequency of low-priority messages, ensure that the CAN bus bandwidth is fully utilized without affecting the high-priority data transmission, and collect the concurrent communication capabilities of multiple communication nodes in real time. When the load increases, dynamically adjust the data transmission priority to prevent high load from causing data blocking, dynamically allocate the time slot resources of the CAN bus, ensure that under different load conditions, the communication of each node is not affected, and improve the overall throughput of the system. And under the premise of ensuring a low bit error rate, improve the bandwidth utilization and communication efficiency of the CAN bus, reduce data transmission delay, improve system response speed, reduce bus idle time, improve concurrent communication capabilities, and ensure that multiple nodes can exchange data stably and efficiently; for example, when the system determines that the bit error rate of the CAN bus exceeds the preset threshold, the system will consider that the current bus communication quality is abnormal. The system will inject a pre-set high-frequency interference signal within the preset transmission distance of the CAN bus to test the bit error change rate of the communication node. According to different bit error change rates, the bus arbitration priority of the CAN bus is dynamically adjusted. The bus arbitration priority specifically includes reasonable allocation of IDs, reducing the sending frequency of high-priority data, and using time slice scheduling; by adjusting the ID priority, the system can give priority to It ensures the transmission of important messages (such as security data, real-time control signals, etc.), reduces data loss due to bit errors, helps ensure that high-priority messages are not interfered with by low-priority data, and improves the reliability of key data transmission. At the same time, according to different bit error change rates, the system can adjust the bus working strategy in real time. If the system detects that the bit error rate of a certain area or a specific node is abnormally high, it can alleviate the interference by adjusting the communication strategy of the area or node. By simulating high-frequency interference signals and adjusting the transmission strategy according to the bit error rate changes, the system can better adapt to harsh environments and improve communication stability and reliability under high interference conditions.

[0025] In this embodiment, the step S5 of collecting the category information of the communication data and dynamically adjusting the message sending duration of the communication data according to the category information further includes: S51: Based on the real-time category data pre-collected by the vehicle, collecting the bandwidth load of the real-time category data on the CAN bus, wherein the real-time category data specifically includes high real-time data, medium real-time data and low real-time data; S52: Determine whether the bandwidth load reaches a preset bus load; S53: If so, apply the preset multicast sending mode, merge the low priority data into the same frame, introduce a time slice scheduling mechanism, allocate the sending time of the real-time category data, monitor the corresponding number of sending failures, and construct a retransmission strategy for the real-time category data based on the number of sending failures.

[0026] In this embodiment, the system collects the bandwidth load of the CAN bus on the real-time category data collected in advance by the vehicle, and the real-time category data specifically includes high real-time data, medium real-time data and low real-time data. The system then determines whether the bandwidth load reaches the preset bus load to execute the corresponding steps; for example, when the system determines that the bandwidth load of the CAN bus on the real-time category data does not reach the preset bus load, the system will believe that the utilization efficiency of the CAN bus has not yet been maximized, and there may be a situation where bandwidth resources are not fully utilized. For low real-time data, the system can increase its sending frequency, and make full use of bandwidth resources without affecting the transmission of high real-time data. By adjusting the sending interval of medium real-time data, its sending frequency is appropriately increased to better utilize the idle bandwidth. At the same time, if the bandwidth resources are sufficient, the priority of low real-time data can be appropriately increased to avoid the situation where low-priority data waits for transmission for a long time. If the load of real-time category data is light, the number can be appropriately increased. According to the size of the data frame, multiple small data packets are merged to improve the data packaging efficiency and reduce the bus occupancy time. By reasonably adjusting the timing and frequency of sending data, the bus can efficiently carry more data streams, improve its transmission capacity, and reduce invalid idle time. If the bandwidth is not fully occupied, you can consider using a ring buffer or other caching strategies to optimize data storage and reading to reduce data transmission delays. For example, when the system determines that the bandwidth load of the real-time category data on the CAN bus has reached the preset bus load, the system will consider that the utilization efficiency of the CAN bus has been maximized. The system will apply the preset multicast sending mode, merge low-priority data into the same frame, introduce a time scheduling mechanism, allocate the sending time of the real-time category data, monitor the corresponding number of sending failures, and build a retransmission strategy for the real-time category data according to different numbers of sending failures. The system merges low-priority data into the same frame to avoid the repeated overhead of sending multiple low-priority data separately, which can effectively reduce the number of data frames and improve the data transmission efficiency of the bus.Through the multicast mode, bandwidth can be used more efficiently, communication delays and transmission time slot waste can be reduced, and bandwidth occupancy can be reduced. By merging low-priority data, not only bandwidth is saved, but also the data transmission speed is improved, so that high-priority data can be transmitted faster. At the same time, by introducing a time scheduling mechanism, the sending time of each real-time category data can be accurately controlled to ensure that data is transmitted according to priority and preset time windows, thereby avoiding conflicts and congestion in data transmission. The system can reasonably allocate bandwidth, optimize the time allocation of the overall data flow, and further improve the efficiency of bus use. Reasonable scheduling timing avoids low-priority data occupying too much bandwidth, resulting in delays in high-priority data, ensuring that the real-time requirements of the system are met, and by monitoring the number of failed transmissions, the system can promptly discover problems in transmission and make adjustments. For example, if a data frame fails to be sent multiple times, the system can give priority to retransmitting the data to ensure the integrity and reliability of data transmission. According to the number of failed transmissions, the system can dynamically adjust the retransmission strategy to ensure that data can be reliably transmitted under network pressure. The retransmission strategy can decide whether to adjust the transmission frequency, priority or scheduling timing according to the number of failures, further optimizing the communication quality.

[0027] It should be noted that the preset multicast transmission mode is applied to merge low priority data into the same frame, introduce a time slice scheduling mechanism, allocate the transmission time of the real-time category data, monitor the corresponding number of transmission failures, and construct a retransmission strategy for the real-time category data according to the number of transmission failures. The specific examples are as follows: Assume that there is an on-board system in which multiple sensors (such as vehicle speed sensor, temperature sensor, and fuel level sensor) generate real-time data, which will be transmitted to the vehicle's ECU for processing via the CAN bus. Different types of data (such as sensor data and status log) have different real-time requirements: vehicle speed data has high real-time requirements, temperature data has medium real-time requirements, and fuel level data has low real-time requirements. Application scenarios, classification of real-time category data: High real-time data: Vehicle speed sensor data must be transmitted as quickly as possible; Medium real-time data: temperature sensor data, which has slightly lower real-time requirements; Low real-time data: Fuel level sensor data can be transmitted with a delay and will not affect system performance much; In the preset multicast transmission mode, when sending data, low-priority data (such as fuel quantity data) will be merged into one data frame, which can reduce the number of data frames and reduce transmission overhead; for example, temperature sensor data (medium real-time) and fuel quantity sensor data (low real-time) can be merged into the same frame to reduce the transmission frequency and reduce the bandwidth demand; Time-slice scheduling mechanism: Under the time-slice scheduling mechanism, the system will assign specific sending times to different types of data. For high-priority data (vehicle speed data), the sending time will be prioritized; medium-priority data (temperature data) will be sent after high-priority data; low-priority data (fuel volume data) will be sent during the system idle period. For example: Vehicle speed data: sent every 100ms, with the highest priority; Temperature data: sent every 500ms, with the second highest priority; Fuel volume data: sent every 1000ms, with the lowest priority; Monitor the number of transmission failures. If a data frame fails to be successfully transmitted at the scheduled time, the system will record the number of transmission failures. If the transmission of fuel volume data fails twice, the system will detect this failure. A retransmission strategy is built based on the number of failed transmissions. When the number of failed transmissions exceeds a predetermined threshold (for example, 3 times), the system considers that there is a network problem or bus congestion, resulting in data being unable to be transmitted normally. At this time, the system will adopt a retransmission strategy, for example: Prioritize retransmission of failed data: For example, retransmission of fuel quantity data will be performed in the interval between transmissions of high-real-time data; Adjust the sending frequency: If some data fails frequently, you can reduce its sending frequency to reduce the bus burden; Delayed retransmission: Low-priority data (such as fuel quantity data) that fails to be retransmitted can be delayed during off-peak or idle periods to avoid occupying too much bandwidth; To sum up, through the above content, the system merges low-priority data into one data frame (multicast transmission), reducing the number of data frames, thereby improving the efficiency of bus bandwidth utilization. At the same time, through the time slice scheduling mechanism, the system can reasonably allocate the sending time of each type of data, avoiding delayed transmission of high-priority data, and by monitoring sending failures and adjusting the transmission strategy based on the number of failures, the system can make timely adjustments when communication abnormalities occur to ensure efficient and reliable data transmission; this method can not only reduce bandwidth occupancy, but also ensure the timely transmission of high-priority data when bandwidth is limited, and improve the communication stability and reliability of the system by dynamically adjusting the retransmission strategy.

[0028] In this embodiment, the step S2 of determining whether the influence coefficient is limited by the hardware of the CAN bus further includes: S21: Based on the baud rate preset by the CAN bus, collecting communication parameters corresponding to the baud rate, wherein the communication parameters specifically include communication stability, data loss rate and number of error frames; S22: Determine whether the communication parameters match a preset data throughput; S23: If not, send a data frame of a fixed size, calculate the maximum data flow per unit time based on the data frame, monitor the bus load of the CAN bus based on the maximum data flow, and calculate the bus utilization under different baud rates through the bus load.

[0029] In this embodiment, the system collects communication parameters corresponding to the baud rates preset for the CAN bus based on the baud rates preset for the CAN bus. The communication parameters specifically include communication stability, data loss rate, and the number of error frames. The system then determines whether these communication parameters match the preset data throughput to execute the corresponding steps. For example, when the system determines that the communication parameters corresponding to the baud rate can match the preset data throughput, the system will consider that the CAN bus communication performance at the baud rate is good and can meet the data transmission requirements. The system will determine whether the baud rate can ensure the stability of communication through the collected communication parameters (such as the number of error frames, data loss rate, etc.). If these parameters meet the expected goals, the system confirms that the baud rate can be maintained. Communication quality. When the data throughput matches the baud rate, the system will consider that the transmission stability, throughput and bit error rate at the current baud rate are already in the best state, and there is no need to adjust the baud rate. When the communication parameters meet expectations, the system can allocate resources to other modules, such as optimizing buffer management, adjusting data packaging strategies, etc., to ensure that other operations on the bus are not affected, and further improve the overall performance. Although the baud rate has met the throughput requirements, the system should continue to monitor communication parameters, such as the number of error frames, the amount of lost data, etc., to ensure that there are no performance bottlenecks or communication problems on the bus in actual work; for example, when the system determines that the communication parameters corresponding to the baud rate cannot match the pre-set data throughput At this time, the system will think that the CAN bus communication performance at this baud rate is poor and cannot meet the data transmission requirements. The system will send a fixed-size data frame and calculate the maximum data flow per unit time according to different data frames. Based on different maximum data flows, the bus load of the CAN bus is monitored and the bus utilization at different baud rates is calculated through the bus load. By analyzing the situation where the baud rate cannot meet the data throughput, the system can identify the bottleneck of communication performance and clarify the shortcomings of the baud rate. It will no longer blindly rely on incompatible baud rates and can accurately locate performance problems to avoid wasting resources. At the same time, by sending fixed-size data frames, the system can accurately calculate the maximum data flow per unit time. The amount of data transmitted can help the system to optimize subsequent data transmission, ensure that the data transmission efficiency can be maximized at the current baud rate, thereby achieving better bandwidth utilization. By monitoring the bus load of the CAN bus in real time, the system can understand the actual usage of the bus at different baud rates, and further evaluate whether the current baud rate is too inefficient or causes bus congestion. Real-time load monitoring can help the system determine whether it needs to switch to a higher baud rate. By monitoring the bus load at different baud rates, the system can accurately calculate the utilization of the bus and help determine whether the transmission capacity of the current bus is fully utilized. If the bus utilization is too low, it may mean that the baud rate is improperly selected. The system can adjust the transmission strategy or baud rate based on this indicator.

[0030] In this embodiment, the step S4 of determining whether the data frame reaches a preset processing response speed further includes: S41: Detecting the signal waveform of the CAN bus based on an oscilloscope preset in the vehicle; S42: Determine whether the signal waveform has a preset fault content, wherein the fault content specifically includes distortion, reflection and noise interference; S43: If yes, then evaluating the driving capability of the CAN bus according to the preset transceiver of the CAN bus, identifying the terminal resistance of the CAN bus, and dynamically adjusting the bus impedance of the CAN bus according to the terminal resistance.

[0031] In this embodiment, the system detects the signal waveform of the CAN bus based on an oscilloscope pre-set in the vehicle, and then the system determines whether the signal waveform has a pre-set fault content, and the fault content specifically includes distortion, reflection and noise interference, so as to execute the corresponding steps; for example, when the system determines that the signal waveform of the CAN bus does not have a pre-set fault content, the system will consider that the signal transmission of the CAN bus is normal, without problems such as distortion, reflection or noise interference, and the system will regularly monitor the signal waveform to ensure that the signal quality remains stable during long-term use, which helps to timely discover potential problems and prevent future communication failures. At the same time, based on the current good signal quality, the efficiency of data transmission is further optimized, such as optimizing the baud rate, data frame structure or data scheduling strategy to improve communication efficiency and response speed, and by determining that there is no abnormality in the signal waveform, the system can confirm that the bus state is healthy and can maintain efficient and stable communication with other communication nodes, reducing failure or maintenance time; for example, when the system determines that the signal waveform of the CAN bus has a pre-set fault content, at this time the system will think that the signal transmission of the CAN bus is abnormal. The system will evaluate the driving capability of the CAN bus and identify the terminal resistance of the CAN bus according to the pre-set transceiver of the CAN bus, and dynamically adjust the bus impedance of the CAN bus based on these terminal resistances; by evaluating and adjusting the driving capability and bus impedance of the CAN bus, the system can effectively repair problems such as signal distortion, reflection or noise interference, which helps to improve the integrity and transmission quality of the signal and ensure accurate data transmission. At the same time, dynamic adjustment of the bus impedance and terminal resistance helps to maintain stable electrical matching between different nodes of the bus and prevent signal reflection and voltage fluctuations, which can enhance communication stability and reduce communication errors. Adjusting the terminal resistance and driving capability can reduce signal distortion and reflection, avoid bit errors caused by mismatched impedance, and reduce data loss or error frame generation during communication, thereby improving the reliability of the entire system. By dynamically adjusting the electrical parameters of the system, hardware damage or performance degradation caused by signal abnormalities can be prevented, and the service life of the CAN bus system and related equipment can be extended.

[0032] In this embodiment, based on the preset load scenario, the step S1 of obtaining the influence coefficient of the CAN bus for different baud rates also includes: S11: Based on the data type preset by the vehicle, the number of frames successfully sent and received by the CAN bus is collected, wherein the data type specifically includes periodic data, burst data and burst-period combined data; S12: Determine whether the number of frames matches a preset average delay; S13: If not, then obtain an error frame on the CAN bus, and dynamically adjust the cache depth of the CAN bus according to the error frame, wherein the error frame specifically includes ACK loss, bit error and format error.

[0033] In this embodiment, the system collects the number of frames successfully sent and received by the CAN bus based on the data types pre-set by the vehicle, which specifically include periodic data, burst data, and burst-period combination data. The system then determines whether the number of frames matches the pre-set average delay to execute the corresponding steps. For example, when the system determines that the number of frames successfully sent and received by the CAN bus matches the pre-set average delay, the system will consider that the communication efficiency and delay performance of the CAN bus are normal and that data can be transmitted as expected. The system will further optimize the scheduling and bandwidth allocation of communication data. For example, it can start scheduling other tasks or data types without adding additional load to maintain efficient communication operations. At the same time, since the current settings of the system have achieved the expected results, the current CAN bus configuration and data scheduling strategy can be maintained, which reduces unnecessary adjustments. and resource waste, ensuring stable operation of the system, and when the number of frames matches the delay, the system can predict that under similar loads in the future, the CAN bus can continue to provide the required performance, which helps to expand more devices or nodes without affecting communication efficiency, and if the system can successfully match the expected delay and number of frames, it means that the working status of the CAN bus is healthy, reducing the cost of troubleshooting and repair, and simplifying maintenance work; for example, when the system determines that the number of frames successfully sent and received by the CAN bus cannot match the preset average delay, the system will consider that the communication efficiency and delay of the CAN bus are abnormal, and the system will obtain error frames on the CAN bus. According to different error frames, the error frames specifically include ACK loss, bit error and format error, and dynamically adjust the cache depth of the CAN bus; by identifying and analyzing the error frame types, the system can promptly discover potential problems in communication. Dynamically adjusting the cache depth can help alleviate the impact of errors and improve the stability of communication. Especially when encountering format errors, ACK loss or bit errors, adjusting the cache depth can ensure that data is better stored and retransmitted to avoid information loss. At the same time, when delay anomalies are detected, appropriately adjusting the cache depth can better manage the data flow on the CAN bus, reduce data conflicts and buffer overflows, thereby improving bus utilization. By dynamically adjusting the cache depth, the system can flexibly allocate resources according to the current load and data transmission requirements to ensure effective bandwidth utilization. When error frames occur during communication, it usually leads to data loss or transmission failure. Dynamically adjusting the cache depth can provide sufficient buffer space when errors occur so that data can be retransmitted after the system returns to normal, which can significantly reduce the data loss rate caused by delay anomalies. Timely adjustment of the cache depth helps alleviate the load pressure caused by a large number of error frames and delay problems. When the system encounters communication problems, by increasing the cache capacity, the system can have more space to handle sudden error frames and avoid frequent retransmission requests and bus congestion.

[0034] Reference Figure 2 , is a multi-level cache system based on CAN bus communication in one embodiment of the present invention, comprising: An acquisition module 10 is used to acquire the influence coefficient of the CAN bus on different baud rates based on a preset load scenario, wherein the load scenario specifically includes an idle state, a low load state, and a high load state; A judging module 20, configured to judge whether the influence coefficient is limited by the hardware of the CAN bus; The execution module 30 is used to activate the preset cache mechanism of the CAN bus if no, apply the ring buffer to transmit the communication data, dynamically adjust the sending interval of the communication data according to the pre-collected CAN bus load, detect the peak transmission period of the CAN bus for the communication data, and optimize the preset data packaging strategy in a single data frame according to the peak transmission period, wherein the data frame specifically includes a frame header, a control field and a check field, and the data packaging strategy specifically includes merging small data, data alignment and reducing padding bytes; A second judgment module 40 is used to judge whether the data frame reaches a preset processing response speed; The second execution module 50 is used to obtain the sending frequency of the communication data if it is not reached, reset the ID priority of the CAN bus based on the sending frequency, collect the category information of the communication data according to the preset priority of the communication data, and dynamically adjust the message sending duration of the communication data according to the category information, wherein the ID priority specifically includes ECU control signals, sensor data and status logs.

[0035] In this embodiment, the acquisition module 10 acquires the influence coefficient of the CAN bus for different baud rates based on the load scenarios pre-set by the vehicle, which specifically include an idle state, a low-load state, and a high-load state, and then the judgment module 20 judges whether these influence coefficients are limited by the hardware of the CAN bus to execute the corresponding steps; for example, when the system determines that the influence coefficient of the CAN bus for different baud rates is limited by the hardware of the CAN bus, the system will believe that the bottleneck is not caused by data scheduling or cache management, but is caused by the performance limitation of the physical layer or the controller itself. The system will reduce the length of the wiring harness to avoid excessively long branches to reduce signal attenuation and interference, and at the same time check the CAN controller processing capability of the MCU, such as If the CAN controller has low processing power, data transmission delay may occur. A high-performance MCU may be replaced or a more efficient CAN controller may be connected externally. In addition, it is necessary to ensure that all ECU nodes support CAN-FD and perform compatibility testing to prevent communication failure between new and old devices. For example, when the system determines that the influence coefficient of the CAN bus on different baud rates is not limited by the hardware of the CAN bus, the execution module 30 will consider that the bottleneck is caused by data scheduling or cache management. The system will activate the cache mechanism pre-set by the CAN bus, apply the ring buffer to transmit the communication data, dynamically adjust the communication data transmission interval according to the pre-collected CAN bus load conditions, and detect the peak of the CAN bus for communication data. During the transmission period, according to different peak transmission periods, the pre-set data packaging strategy is optimized in a single data frame. The data frame specifically includes a frame header, a control field and a check field. The data packaging strategy specifically includes merging small data, data alignment and reducing padding bytes. The system manages data through a ring buffer to ensure the orderly transmission of data streams, avoid data loss or bus blocking due to instantaneous data overload, improve data throughput, dynamically adjust the data transmission interval according to the real-time load of the CAN bus, ensure the balanced use of bus resources, reduce transmission conflicts, improve channel utilization, and make data transmission smoother. At the same time, it detects the peak transmission period and optimizes the data transmission strategy so that high-priority data can be received in a timely manner. Processing, reducing the impact of low-priority data on the overall performance of the system, combining data packaging optimization strategies (merging small data, data alignment, reducing padding bytes), reducing redundant data, increasing the effective load ratio of a single frame, reducing bus occupancy, thereby speeding up transmission speed, and by optimizing the data frame structure (frame header, control field, check field), ensuring data integrity and reliability, while reducing unnecessary overhead, improving data processing efficiency, adjusting the data transmission interval according to the bus load, avoiding excessive delays caused by burst data transmission, making the system response more stable, and improving overall communication performance; then the second judgment module 40 determines whether these data frames reach a preset processing response speed to execute the corresponding steps;For example, when the system determines that the data frame can reach the preset processing response speed, the system will consider that the current data transmission strategy and cache management have been optimized, and the communication efficiency of the CAN bus has met the system requirements, and no further adjustment is required. The system will maintain the current optimization strategy and continue to operate according to the existing ring buffer management, dynamic data scheduling and data packaging optimization scheme to ensure that the system can still maintain efficient communication under different load conditions, while monitoring the system load in real time, continuing to collect the load status and communication delay of the CAN bus, and establishing a long-term data analysis model to ensure that the strategy can be quickly adjusted when the load fluctuates, and appropriately reduce power consumption, reduce data redundancy and unnecessary transmission frequency while ensuring communication efficiency, improve energy efficiency, and optimize the overall operation efficiency of the CAN bus; for example, when the system determines that the data frame cannot reach the preset processing response speed, the second execution module 50 will consider that the current data transmission strategy and cache management have not been optimized, and the system will obtain the transmission frequency of the communication data based on different transmission frequencies, reset the ID priority of the CAN bus, and the ID priority specifically includes ECU control signals, sensor data and status logs, and collect the category information of the communication data according to the preset priority of the communication data, and obtain the category information according to different priorities. The system obtains the sending frequency of communication data, accurately identifies the root cause of the decrease in data frame response speed, avoids blind optimization, improves the accuracy of problem location, and resets the ID priority of the CAN bus according to different sending frequencies to ensure that high-priority data (such as ECU control signals) can be transmitted in time, rather than all data being processed equally, reducing the interference of low-priority data on data with high real-time requirements. At the same time, through the redistribution of ID priorities, it ensures that ECU control signals (such as braking, steering and other key signals) are always sent first, avoiding control jams caused by bus congestion. Control signal delay, improve vehicle safety and response speed, low-priority data such as sensor data and status logs can be appropriately delayed when the bus load is high to ensure the stability and reliability of the core control signal, and according to the category information of the communication data (such as real-time control data, environmental monitoring data, historical logs, etc.), the system can dynamically adjust the data transmission time, reduce the occupancy of irrelevant data on the bus, and optimize the transmission strategy. For example, for high-real-time data (such as brake control), the system can shorten the transmission time and increase the refresh rate; for low-timeliness data (such as vehicle status logs), the transmission cycle can be appropriately extended to reduce the bus load. ;

[0036] In this embodiment, the execution module further includes: A construction unit, configured to construct a capacity parameter of the ring buffer based on a maximum data flow of the communication data; A judging unit, used to judge whether the capacity parameter is adapted to a preset data storage mode; An execution unit is used to dynamically allocate the memory overhead of the ring buffer according to the data storage method, obtain the frame length of the communication data, apply the index table data block to access the communication data based on the frame length, and record the reading information of the ring buffer in real time, wherein the reading information specifically includes overflow or empty reading.

[0037] In this embodiment, the system constructs the capacity parameters of the ring buffer based on the maximum data flow of the communication data, and then the system determines whether these capacity parameters are suitable for the pre-set data storage method to execute the corresponding steps; for example, when the system determines that the capacity parameters of the ring buffer are not suitable for the pre-set data storage method, the system will think that if the capacity is too small, it may cause the data write rate to be higher than the read rate, the buffer overflows, and then causes data loss or system processing delays, and if the capacity is too large, the data flow is relatively small, which will cause a waste of storage resources and reduce the efficiency of cache management. The system will dynamically adjust the capacity of the ring buffer according to the data flow to avoid the adaptability problems caused by the fixed capacity setting, and adopt an adaptive capacity adjustment algorithm. According to the trend of historical data flow, the buffer size is expanded or reduced in real time to ensure that there will be no overflow due to sudden data growth and no waste of resources due to excessive redundant space. At the same time, high-frequency data buffer and low-frequency data buffer are set. High-real-time data (such as ECU control signals) are stored in the high-speed buffer first, and a high-priority reading strategy is set. Low-priority data (such as status logs) are stored in the secondary buffer, allowing batch transmission under low load to reduce bus occupancy. If it is found that the buffer overflow is caused by the frequent sending of certain data, the data sending rhythm can be optimized, the data packet size can be adjusted, or duplicate data can be merged to reduce transmission pressure. The flow control mechanism is adopted. When the data flow is too large, the storage of low-priority data is briefly delayed to give priority to key The integrity and timeliness of data; for example, when the system determines that the capacity parameters of the ring buffer are adapted to the pre-set data storage method, the system will consider that the organization method of the buffer (such as FIFO, LIFO, etc.) matches the actual data flow pattern of the CAN bus and will not affect the data access efficiency. The system will dynamically adjust the memory overhead of the ring buffer according to different data storage methods, obtain the frame length of the communication data, and use the index table data block to access the communication data based on these frame lengths, and record the reading information of the ring buffer in real time. The reading information specifically includes overflow or empty reading; the system dynamically adjusts the memory overhead of the ring buffer to avoid allocating too much or too little memory, improve memory utilization, and store data in different data storage methods. (such as fixed-size data blocks or variable-length data blocks) allocate appropriate cache size to reduce resource waste caused by over-reservation or performance degradation caused by insufficient space. At the same time, by obtaining the frame length of the communication data, the system can allocate cache space more accurately to prevent storage fragmentation caused by frame size mismatch. The index table data block management mechanism ensures that data can be accessed along the optimal path, improves query and write speeds, and reduces CPU occupancy. Through dynamic matching of the index table and frame length, the buffer can adapt to different data communication modes to ensure that in high data traffic scenarios, there will be no delays or packet loss due to unreasonable cache mechanisms. Under low load conditions, the system can reduce unnecessary data access operations, reduce power consumption, and improve overall communication efficiency.

[0038] In this embodiment, it also includes: A collection module, used for dynamically adjusting the bus utilization of the CAN bus based on the preset test target of the CAN bus, collecting the concurrent communication capabilities of multiple communication nodes, and obtaining the bit error rate of the CAN bus; A third judgment module is used to judge whether the bit error rate exceeds a preset threshold; The third execution module is used to inject a preset high-frequency interference signal within the preset transmission distance of the CAN bus, test the bit error change rate of the communication node, and dynamically adjust the bus arbitration priority of the CAN bus according to the bit error change rate, wherein the bus arbitration priority specifically includes reasonable allocation of IDs, reducing the sending frequency of high-priority data and using time slice scheduling.

[0039] In this embodiment, the system dynamically adjusts the bus utilization of the CAN bus based on the test target pre-set for the CAN bus, collects the concurrent communication capabilities of multiple communication nodes to obtain the bit error rate of the CAN bus, and then the system determines whether the bit error rate exceeds the pre-set threshold to execute the corresponding steps; for example, when the system determines that the bit error rate of the CAN bus does not exceed the pre-set threshold, the system will consider that the current bus communication quality is within an acceptable range, the stability and reliability of data transmission are high, and there is no serious signal interference or data loss. The system will dynamically adjust the sending timing of the data frame to reduce the bus idle time and improve the data transmission efficiency. According to the transmission efficiency, optimize the data flow scheduling, appropriately increase the sending frequency of low-priority messages, ensure that the CAN bus bandwidth is fully utilized without affecting the high-priority data transmission, and collect the concurrent communication capabilities of multiple communication nodes in real time. When the load increases, dynamically adjust the data transmission priority to prevent high load from causing data blocking, dynamically allocate the time slot resources of the CAN bus, ensure that under different load conditions, the communication of each node is not affected, and improve the overall throughput of the system. And under the premise of ensuring a low bit error rate, improve the bandwidth utilization and communication efficiency of the CAN bus, reduce data transmission delay, improve system response speed, reduce bus idle time, improve concurrent communication capabilities, and ensure that multiple nodes can exchange data stably and efficiently; for example, when the system determines that the bit error rate of the CAN bus exceeds the preset threshold, the system will consider that the current bus communication quality is abnormal. The system will inject a pre-set high-frequency interference signal within the preset transmission distance of the CAN bus to test the bit error change rate of the communication node. According to different bit error change rates, the bus arbitration priority of the CAN bus is dynamically adjusted. The bus arbitration priority specifically includes reasonable allocation of IDs, reducing the sending frequency of high-priority data, and using time slice scheduling; by adjusting the ID priority, the system can give priority to It ensures the transmission of important messages (such as security data, real-time control signals, etc.), reduces data loss due to bit errors, helps ensure that high-priority messages are not interfered with by low-priority data, and improves the reliability of key data transmission. At the same time, according to different bit error change rates, the system can adjust the bus working strategy in real time. If the system detects that the bit error rate of a certain area or a specific node is abnormally high, it can alleviate the interference by adjusting the communication strategy of the area or node. By simulating high-frequency interference signals and adjusting the transmission strategy according to the bit error rate changes, the system can better adapt to harsh environments and improve communication stability and reliability under high interference conditions.

[0040] In this embodiment, the second execution module further includes: A collection unit, configured to collect the bandwidth load of the real-time category data on the CAN bus based on the real-time category data pre-collected by the vehicle, wherein the real-time category data specifically includes high real-time data, medium real-time data and low real-time data; A second determination unit, configured to determine whether the bandwidth load reaches a preset bus load; The second execution unit is used to apply the preset multicast sending mode, merge the low priority data into the same frame, introduce the time slice scheduling mechanism, allocate the sending time of the real-time category data, monitor the corresponding number of sending failures, and construct a retransmission strategy for the real-time category data according to the number of sending failures.

[0041] In this embodiment, the system collects the bandwidth load of the CAN bus on the real-time category data collected in advance by the vehicle, and the real-time category data specifically includes high real-time data, medium real-time data and low real-time data. The system then determines whether the bandwidth load reaches the preset bus load to execute the corresponding steps; for example, when the system determines that the bandwidth load of the CAN bus on the real-time category data does not reach the preset bus load, the system will believe that the utilization efficiency of the CAN bus has not yet been maximized, and there may be a situation where bandwidth resources are not fully utilized. For low real-time data, the system can increase its sending frequency, and make full use of bandwidth resources without affecting the transmission of high real-time data. By adjusting the sending interval of medium real-time data, its sending frequency is appropriately increased to better utilize the idle bandwidth. At the same time, if the bandwidth resources are sufficient, the priority of low real-time data can be appropriately increased to avoid the situation where low-priority data waits for transmission for a long time. If the load of real-time category data is light, the number can be appropriately increased. According to the size of the data frame, multiple small data packets are merged to improve the data packaging efficiency and reduce the bus occupancy time. By reasonably adjusting the timing and frequency of sending data, the bus can efficiently carry more data streams, improve its transmission capacity, and reduce invalid idle time. If the bandwidth is not fully occupied, you can consider using a ring buffer or other caching strategies to optimize data storage and reading to reduce data transmission delays. For example, when the system determines that the bandwidth load of the real-time category data on the CAN bus has reached the preset bus load, the system will consider that the utilization efficiency of the CAN bus has been maximized. The system will apply the preset multicast sending mode, merge low-priority data into the same frame, introduce a time scheduling mechanism, allocate the sending time of the real-time category data, monitor the corresponding number of sending failures, and build a retransmission strategy for the real-time category data according to different numbers of sending failures. The system merges low-priority data into the same frame to avoid the repeated overhead of sending multiple low-priority data separately, which can effectively reduce the number of data frames and improve the data transmission efficiency of the bus.Through the multicast mode, bandwidth can be used more efficiently, communication delays and transmission time slot waste can be reduced, and bandwidth occupancy can be reduced. By merging low-priority data, not only bandwidth is saved, but also the data transmission speed is improved, so that high-priority data can be transmitted faster. At the same time, by introducing a time scheduling mechanism, the sending time of each real-time category data can be accurately controlled to ensure that data is transmitted according to priority and preset time windows, thereby avoiding conflicts and congestion in data transmission. The system can reasonably allocate bandwidth, optimize the time allocation of the overall data flow, and further improve the efficiency of bus use. Reasonable scheduling timing avoids low-priority data occupying too much bandwidth, resulting in delays in high-priority data, ensuring that the real-time requirements of the system are met, and by monitoring the number of failed transmissions, the system can promptly discover problems in transmission and make adjustments. For example, if a data frame fails to be sent multiple times, the system can give priority to retransmitting the data to ensure the integrity and reliability of data transmission. According to the number of failed transmissions, the system can dynamically adjust the retransmission strategy to ensure that data can be reliably transmitted under network pressure. The retransmission strategy can decide whether to adjust the transmission frequency, priority or scheduling timing according to the number of failures, further optimizing the communication quality.

[0042] In this embodiment, the judgment module further includes: A second acquisition unit is used to acquire communication parameters corresponding to the baud rate based on the baud rate preset by the CAN bus, wherein the communication parameters specifically include communication stability, data loss rate and number of error frames; A third determination unit, configured to determine whether the communication parameters match a preset data throughput; The third execution unit is used for sending a data frame of a fixed size if not, calculating the maximum data flow per unit time according to the data frame, monitoring the bus load of the CAN bus according to the maximum data flow, and calculating the bus utilization under different baud rates through the bus load.

[0043] In this embodiment, the system collects communication parameters corresponding to the baud rates preset for the CAN bus based on the baud rates preset for the CAN bus. The communication parameters specifically include communication stability, data loss rate, and the number of error frames. The system then determines whether these communication parameters match the preset data throughput to execute the corresponding steps. For example, when the system determines that the communication parameters corresponding to the baud rate can match the preset data throughput, the system will consider that the CAN bus communication performance at the baud rate is good and can meet the data transmission requirements. The system will determine whether the baud rate can ensure the stability of communication through the collected communication parameters (such as the number of error frames, data loss rate, etc.). If these parameters meet the expected goals, the system confirms that the baud rate can be maintained. Communication quality. When the data throughput matches the baud rate, the system will consider that the transmission stability, throughput and bit error rate at the current baud rate are already in the best state, and there is no need to adjust the baud rate. When the communication parameters meet expectations, the system can allocate resources to other modules, such as optimizing buffer management, adjusting data packaging strategies, etc., to ensure that other operations on the bus are not affected, and further improve the overall performance. Although the baud rate has met the throughput requirements, the system should continue to monitor communication parameters, such as the number of error frames, the amount of lost data, etc., to ensure that there are no performance bottlenecks or communication problems on the bus in actual work; for example, when the system determines that the communication parameters corresponding to the baud rate cannot match the pre-set data throughput At this time, the system will think that the CAN bus communication performance at this baud rate is poor and cannot meet the data transmission requirements. The system will send a fixed-size data frame and calculate the maximum data flow per unit time according to different data frames. Based on different maximum data flows, the bus load of the CAN bus is monitored and the bus utilization at different baud rates is calculated through the bus load. By analyzing the situation where the baud rate cannot meet the data throughput, the system can identify the bottleneck of communication performance and clarify the shortcomings of the baud rate. It will no longer blindly rely on incompatible baud rates and can accurately locate performance problems to avoid wasting resources. At the same time, by sending fixed-size data frames, the system can accurately calculate the maximum data flow per unit time. The amount of data transmitted can help the system to optimize subsequent data transmission, ensure that the data transmission efficiency can be maximized at the current baud rate, thereby achieving better bandwidth utilization. By monitoring the bus load of the CAN bus in real time, the system can understand the actual usage of the bus at different baud rates, and further evaluate whether the current baud rate is too inefficient or causes bus congestion. Real-time load monitoring can help the system determine whether it needs to switch to a higher baud rate. By monitoring the bus load at different baud rates, the system can accurately calculate the utilization of the bus and help determine whether the transmission capacity of the current bus is fully utilized. If the bus utilization is too low, it may mean that the baud rate is improperly selected. The system can adjust the transmission strategy or baud rate based on this indicator.

[0044] In this embodiment, the second determination module further includes: A detection unit, used for detecting the signal waveform of the CAN bus based on an oscilloscope preset in the vehicle; A fourth judgment unit, used to judge whether the signal waveform has a preset fault content, wherein the fault content specifically includes distortion, reflection and noise interference; The fourth execution unit is used to evaluate the driving capability of the CAN bus according to the preset transceiver of the CAN bus, identify the terminal resistance of the CAN bus, and dynamically adjust the bus impedance of the CAN bus according to the terminal resistance.

[0045] In this embodiment, the system detects the signal waveform of the CAN bus based on an oscilloscope pre-set in the vehicle, and then the system determines whether the signal waveform has a pre-set fault content, and the fault content specifically includes distortion, reflection and noise interference, so as to execute the corresponding steps; for example, when the system determines that the signal waveform of the CAN bus does not have a pre-set fault content, the system will consider that the signal transmission of the CAN bus is normal, without problems such as distortion, reflection or noise interference, and the system will regularly monitor the signal waveform to ensure that the signal quality remains stable during long-term use, which helps to timely discover potential problems and prevent future communication failures. At the same time, based on the current good signal quality, the efficiency of data transmission is further optimized, such as optimizing the baud rate, data frame structure or data scheduling strategy to improve communication efficiency and response speed, and by determining that there is no abnormality in the signal waveform, the system can confirm that the bus state is healthy and can maintain efficient and stable communication with other communication nodes, reducing failure or maintenance time; for example, when the system determines that the signal waveform of the CAN bus has a pre-set fault content, at this time the system will think that the signal transmission of the CAN bus is abnormal. The system will evaluate the driving capability of the CAN bus and identify the terminal resistance of the CAN bus according to the pre-set transceiver of the CAN bus, and dynamically adjust the bus impedance of the CAN bus based on these terminal resistances; by evaluating and adjusting the driving capability and bus impedance of the CAN bus, the system can effectively repair problems such as signal distortion, reflection or noise interference, which helps to improve the integrity and transmission quality of the signal and ensure accurate data transmission. At the same time, dynamic adjustment of the bus impedance and terminal resistance helps to maintain stable electrical matching between different nodes of the bus and prevent signal reflection and voltage fluctuations, which can enhance communication stability and reduce communication errors. Adjusting the terminal resistance and driving capability can reduce signal distortion and reflection, avoid bit errors caused by mismatched impedance, and reduce data loss or error frame generation during communication, thereby improving the reliability of the entire system. By dynamically adjusting the electrical parameters of the system, hardware damage or performance degradation caused by signal abnormalities can be prevented, and the service life of the CAN bus system and related equipment can be extended.

[0046] In this embodiment, the acquisition module further includes: A third collection unit is used to collect the number of frames successfully sent and received by the CAN bus based on a data type preset by the vehicle, wherein the data type specifically includes periodic data, burst data, and burst-period combined data; A fifth determination unit, configured to determine whether the number of frames matches a preset average delay; The fifth execution unit is used to obtain an error frame on the CAN bus if not, and dynamically adjust the cache depth of the CAN bus according to the error frame, wherein the error frame specifically includes ACK loss, bit error and format error.

[0047] In this embodiment, the system collects the number of frames successfully sent and received by the CAN bus based on the data types pre-set by the vehicle, which specifically include periodic data, burst data, and burst-period combination data. The system then determines whether the number of frames matches the pre-set average delay to execute the corresponding steps. For example, when the system determines that the number of frames successfully sent and received by the CAN bus matches the pre-set average delay, the system will consider that the communication efficiency and delay performance of the CAN bus are normal and that data can be transmitted as expected. The system will further optimize the scheduling and bandwidth allocation of communication data. For example, it can start scheduling other tasks or data types without adding additional load to maintain efficient communication operations. At the same time, since the current settings of the system have achieved the expected results, the current CAN bus configuration and data scheduling strategy can be maintained, which reduces unnecessary adjustments. and resource waste, ensuring stable operation of the system, and when the number of frames matches the delay, the system can predict that under similar loads in the future, the CAN bus can continue to provide the required performance, which helps to expand more devices or nodes without affecting communication efficiency, and if the system can successfully match the expected delay and number of frames, it means that the working status of the CAN bus is healthy, reducing the cost of troubleshooting and repair, and simplifying maintenance work; for example, when the system determines that the number of frames successfully sent and received by the CAN bus cannot match the preset average delay, the system will consider that the communication efficiency and delay of the CAN bus are abnormal, and the system will obtain error frames on the CAN bus. According to different error frames, the error frames specifically include ACK loss, bit error and format error, and dynamically adjust the cache depth of the CAN bus; by identifying and analyzing the error frame types, the system can promptly discover potential problems in communication. Dynamically adjusting the cache depth can help alleviate the impact of errors and improve the stability of communication. Especially when encountering format errors, ACK loss or bit errors, adjusting the cache depth can ensure that data is better stored and retransmitted to avoid information loss. At the same time, when delay anomalies are detected, appropriately adjusting the cache depth can better manage the data flow on the CAN bus, reduce data conflicts and buffer overflows, thereby improving bus utilization. By dynamically adjusting the cache depth, the system can flexibly allocate resources according to the current load and data transmission requirements to ensure effective bandwidth utilization. When error frames occur during communication, it usually leads to data loss or transmission failure. Dynamically adjusting the cache depth can provide sufficient buffer space when errors occur so that data can be retransmitted after the system returns to normal, which can significantly reduce the data loss rate caused by delay anomalies. Timely adjustment of the cache depth helps alleviate the load pressure caused by a large number of error frames and delay problems. When the system encounters communication problems, by increasing the cache capacity, the system can have more space to handle sudden error frames and avoid frequent retransmission requests and bus congestion.

[0048] Although embodiments of the present invention have been shown and described, it will be appreciated by those skilled in the art that various changes, modifications, substitutions and variations may be made to the embodiments without departing from the principles and spirit of the present invention, and that the scope of the present invention is defined by the appended claims and their equivalents.

Claims

1. A multi-level cache method based on CAN bus communication, characterized in that: The following steps are involved: Based on a preset load scenario, the influence coefficient of the CAN bus on different baud rates is obtained, wherein the load scenario specifically includes an idle state, a low load state, and a high load state; Determining whether the influence coefficient is limited by the hardware of the CAN bus; If not, activate the preset cache mechanism of the CAN bus, apply the ring buffer to transmit the communication data, dynamically adjust the sending interval of the communication data according to the pre-collected CAN bus load, detect the peak transmission period of the CAN bus for the communication data, and optimize the preset data packaging strategy in a single data frame according to the peak transmission period, wherein the data frame specifically includes a frame header, a control field and a check field, and the data packaging strategy specifically includes merging small data, data alignment and reducing padding bytes; Determining whether the data frame reaches a preset processing response speed; If not reached, the sending frequency of the communication data is obtained, and based on the sending frequency, the ID priority of the CAN bus is reset; according to the preset priority of the communication data, the category information of the communication data is collected; based on the category information, the message sending duration of the communication data is dynamically adjusted, wherein the ID priority specifically includes ECU control signals, sensor data and status logs.

2. The multi-level cache method based on CAN bus communication according to claim 1, characterized in that: The step of activating a preset cache mechanism of the CAN bus and using a ring buffer to transmit communication data further includes: Constructing a capacity parameter of the ring buffer based on the maximum data flow of the communication data; Determining whether the capacity parameter is compatible with a preset data storage method; If so, the memory overhead of the circular buffer is dynamically allocated according to the data storage method, the frame length of the communication data is obtained, and based on the frame length, the index table data block is used to access the communication data, and the reading information of the circular buffer is recorded in real time, wherein the reading information specifically includes overflow or empty reading.

3. The multi-level cache method based on CAN bus communication according to claim 1, characterized in that: Before the step of detecting the peak transmission period of the communication data by the CAN bus, the method further comprises: Based on the preset test target of the CAN bus, dynamically adjust the bus utilization of the CAN bus, collect the concurrent communication capabilities of multiple communication nodes, and obtain the bit error rate of the CAN bus; Determining whether the bit error rate exceeds a preset threshold; If so, a preset high-frequency interference signal is injected within the preset transmission distance of the CAN bus to test the bit error change rate of the communication node, and the bus arbitration priority of the CAN bus is dynamically adjusted according to the bit error change rate, wherein the bus arbitration priority specifically includes reasonable allocation of IDs, reducing the sending frequency of high-priority data, and using time slice scheduling.

4. The multi-level cache method based on CAN bus communication according to claim 1, characterized in that: The step of collecting the category information of the communication data and dynamically adjusting the message sending duration of the communication data according to the category information further includes: Based on the real-time category data pre-collected by the vehicle, collecting the bandwidth load of the real-time category data on the CAN bus, wherein the real-time category data specifically includes high real-time data, medium real-time data and low real-time data; Determining whether the bandwidth load reaches a preset bus load; If so, the preset multicast sending mode is applied, the low priority data is merged into the same frame, a time slice scheduling mechanism is introduced, the sending time of the real-time category data is allocated, the corresponding number of sending failures is monitored, and the retransmission strategy of the real-time category data is constructed according to the number of sending failures.

5. The multi-level cache method based on CAN bus communication according to claim 1, characterized in that: The step of determining whether the influence coefficient is limited by the hardware of the CAN bus further includes: Based on the baud rate preset by the CAN bus, collecting communication parameters corresponding to the baud rate, wherein the communication parameters specifically include communication stability, data loss rate and number of error frames; Determining whether the communication parameters match a preset data throughput; If not, a data frame of a fixed size is sent, and the maximum data flow per unit time is calculated based on the data frame. Based on the maximum data flow, the bus load of the CAN bus is monitored, and the bus utilization under different baud rates is calculated through the bus load.

6. The multi-level cache method based on CAN bus communication according to claim 1, characterized in that: The step of determining whether the data frame reaches a preset processing response speed further includes: Based on the oscilloscope preset in the vehicle, detecting the signal waveform of the CAN bus; Determine whether the signal waveform has a preset fault content, wherein the fault content specifically includes distortion, reflection and noise interference; If so, the driving capability of the CAN bus is evaluated according to the preset transceiver of the CAN bus, the terminal resistance of the CAN bus is identified, and the bus impedance of the CAN bus is dynamically adjusted according to the terminal resistance.

7. The multi-level cache method based on CAN bus communication according to claim 1, characterized in that: The step of obtaining the influence coefficient of the CAN bus on different baud rates based on the preset load scenario also includes: Based on the data type preset by the vehicle, the number of frames successfully sent and received by the CAN bus is collected, wherein the data type specifically includes periodic data, burst data and burst-period combined data; Determining whether the number of frames matches a preset average delay; If not, an error frame on the CAN bus is acquired, and the cache depth of the CAN bus is dynamically adjusted according to the error frame, wherein the error frame specifically includes ACK loss, bit error and format error.

8. A multi-level cache system based on CAN bus communication, characterized in that: include: An acquisition module, used to acquire the influence coefficient of the CAN bus on different baud rates based on a preset load scenario, wherein the load scenario specifically includes an idle state, a low load state, and a high load state; A judging module, used for judging whether the influence coefficient is limited by the hardware of the CAN bus; An execution module, for activating a preset cache mechanism of the CAN bus if no, applying a ring buffer to transmit the communication data, dynamically adjusting the sending interval of the communication data according to the pre-collected CAN bus load, detecting the peak transmission period of the CAN bus for the communication data, and optimizing the preset data packaging strategy in a single data frame according to the peak transmission period, wherein the data frame specifically includes a frame header, a control field and a check field, and the data packaging strategy specifically includes merging small data, data alignment and reducing padding bytes; A second judgment module is used to judge whether the data frame reaches a preset processing response speed; The second execution module is used to obtain the sending frequency of the communication data if it is not reached, reset the ID priority of the CAN bus based on the sending frequency, collect the category information of the communication data according to the preset priority of the communication data, and dynamically adjust the message sending duration of the communication data according to the category information, wherein the ID priority specifically includes ECU control signals, sensor data and status logs.

9. The multi-level cache system based on CAN bus communication according to claim 8, characterized in that: The execution module also includes: A construction unit, configured to construct a capacity parameter of the ring buffer based on a maximum data flow of the communication data; A judging unit, used to judge whether the capacity parameter is adapted to a preset data storage mode; An execution unit is used to dynamically allocate the memory overhead of the ring buffer according to the data storage method, obtain the frame length of the communication data, apply the index table data block to access the communication data based on the frame length, and record the reading information of the ring buffer in real time, wherein the reading information specifically includes overflow or empty reading.

10. The multi-level cache system based on CAN bus communication according to claim 8, characterized in that: Also includes: A collection module, used for dynamically adjusting the bus utilization of the CAN bus based on the preset test target of the CAN bus, collecting the concurrent communication capabilities of multiple communication nodes, and obtaining the bit error rate of the CAN bus; A third judgment module is used to judge whether the bit error rate exceeds a preset threshold; The third execution module is used to inject a preset high-frequency interference signal within the preset transmission distance of the CAN bus, test the bit error change rate of the communication node, and dynamically adjust the bus arbitration priority of the CAN bus according to the bit error change rate, wherein the bus arbitration priority specifically includes reasonable allocation of IDs, reducing the sending frequency of high-priority data and using time slice scheduling.

Citation Information

Patent Citations

  • CAN bus data processing method and control system

    CN109960177A

  • Information reporting method, device and equipment in electricity utilization information acquisition network

    CN115102580A

  • Processing method and device for realizing dynamic adaptation of terminal based on annular buffer mechanism in receiver system, processor and storage medium thereof

    CN118041413A

  • High-frequency data remote transmission method and system

    CN119520639A

Cited By

  • Data processing method and system for centralized management platform

    CN120067199A

  • Vehicle-mounted controller network communication control system

    CN120151294A

  • Intelligent textile workshop management and control platform and method based on big data driving

    CN120525296A

  • Multi-compartment NVR (Network Video Recorder) state reporting and cooperative control system based on multicast communication

    CN120768928A

  • CAN communication anti-interference method and device based on BMS architecture and electronic equipment

    CN120785676A