Optimization system and method for processing CAN communication message based on FIFO

Through multi-level FIFO queues and dynamic management strategies, the problem of low message processing efficiency and data loss caused by unprioritized FIFO queues in the existing technology is solved, achieving efficient and reliable processing of CAN communication messages, and improving system response. Performance and adaptability.

CN118694725APending Publication Date: 2024-09-24ANHUI NORMAL UNIV
View PDF 0 Cites 3 Cited by

Patent Information

Application Number
CN202410722046.8
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2024-06-05
Publication Date
2024-09-24

AI Technical Summary

Technical Problem

The FIFO queue in the existing CAN communication system is not prioritized, resulting in mixed processing of messages of different priorities, resulting in high-priority message delays and data loss. Especially under high load conditions, fixed-size buffers are prone to overflow, affecting system response. performance.

Method used

Multi-level FIFO queues are used to store messages of different priorities, and memory allocation and priority processing are adjusted through dynamic management strategies. The capacity and processing priority of each level of FIFO queue are adjusted according to real-time monitoring data parameters to ensure efficient and reliable message processing.

Benefits of technology

It realizes efficient processing of messages of different priorities, improves the response performance and reliability of the system, avoids data loss and delay, and adapts to efficient operation under different load conditions.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN118694725A
    Figure CN118694725A
Patent Text Reader

Abstract

The invention discloses an optimization system and method for processing a CAN communication message based on FIFO. The method comprises the following steps: receiving a communication message transmitted by a CAN bus; according to the priorities of the communication messages, sequentially distributing different communication messages to FIFO queues with different priorities; the main control unit is used for sequentially reading communication messages from the FIFO queues according to communication message priority sequences corresponding to different FIFO queues, correspondingly processing the communication messages, returning processing results to the main control unit, monitoring states of the FIFO queues at all levels in real time, and dynamically adjusting memory allocation and management strategies of the FIFO queues at all levels according to monitoring results; the invention aims to efficiently and reliably process messages with different priorities when processing CAN communication receiving messages, so as to solve the problems of data loss, delay and the like in the existing CAN technology, and further improve the receiving efficiency and reliability of CAN communication.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present invention relates to the technical field of CAN message processing, and in particular to an optimization system and method for processing CAN communication messages based on FIFO. Background Art

[0002] CAN is a communication protocol widely used in automotive electronics, industrial automation and other fields. In existing CAN communication systems, FIFO queues are usually used to process received messages. However, there are some problems with existing systems when processing messages of different priorities. In the prior art, FIFO queues are usually not prioritized, resulting in messages of different priorities being mixed and assigned to the same FIFO queue. In this case, processing communication messages in order of priority becomes complicated and inefficient, especially under high load conditions, which may lead to delayed processing of high-priority messages and data loss. For example, for high-priority messages, due to long processing time or excessive system load, low-priority messages may be blocked, affecting the system's response performance, and due to the fixed size of the FIFO queue, it may not be able to effectively handle the load changes of messages of different priorities.

[0003] In order to solve the above problems, most of the current processing methods are to buffer the messages. For example, the invention patent with application number CN116074153A introduces a method for buffering the sending and receiving of automotive CAN messages, which aims to overcome the technical problems such as the large difference in the speed of receiving and sending messages in traditional technologies, as well as the device freeze and program freeze caused by the requirement for periodic message sending.

[0004] However, the above method has limitations, especially when it comes to high-rate or large-volume CAN messages. The fixed-size buffer may easily overflow, causing data loss. In addition, when the buffer is close to full, new messages must wait for processing, which poses a challenge to systems with strict requirements for instant response. Summary of the invention

[0005] The purpose of the present invention is to provide an optimization system and method for processing CAN communication messages based on FIFO to solve technical problems such as data loss and delay existing in the prior art.

[0006] In order to solve the above technical problems, the present invention specifically provides the following technical solutions:

[0007] An optimization system for processing CAN communication messages based on FIFO, comprising:

[0008] A CAN receiving module is used to receive CAN data after acceptance by a CAN controller and parse messages from the CAN data;

[0009] A priority processing module, filtering the message and setting the priority of the filtered communication message, the priority processing module automatically assigning the communication message to different FIFO queues in the multi-level FIFO module according to the priority of the received communication message;

[0010] A multi-level FIFO module, comprising a plurality of FIFO queues of different priority levels, wherein the plurality of FIFO queues are respectively used to store communication messages of different priorities;

[0011] A message processing module, used for reading communication messages from the multi-level FIFO modules in order of priority and processing the read communication messages in sequence;

[0012] A data monitoring module, used for monitoring the status of the multi-stage FIFO module in real time;

[0013] A dynamic FIFO management module is used to adjust the memory allocation and management strategy of the multi-level FIFO module according to the result of real-time monitoring of data parameters.

[0014] As a preferred solution of the present invention, the data monitoring module performs data monitoring on each level of FIFO queue, and the data monitoring module forms a load condition of each level of FIFO queue according to the data monitoring result;

[0015] The dynamic FIFO management module regulates the memory allocation and management strategy of each level of FIFO queue according to the load situation;

[0016] The data monitoring module monitors the data parameters of each level of FIFO queue, including:

[0017] Data overflow situation, determining whether each of the FIFO queues overflows;

[0018] Data volume, which is the amount of data currently being transmitted and stored in the FIFO queue;

[0019] Data type, the type of data currently being transmitted in the FIFO queue;

[0020] Data frequency, the rate at which data is stored to the FIFO queue.

[0021] As a preferred solution of the present invention, when the data monitoring module forms the load condition of each level of FIFO queue according to the data monitoring result, the load value formed by each data monitoring parameter is integrated by weight and threshold, and the load calculation formula of each FIFO queue is:

[0022] The load value is L, the amount of data being transmitted is D, the data frequency is F, the data type is T, and the overflow is O, then the load value can be expressed as:

[0023] L=w1×D+w2×F+w3×T+w4×O;

[0024] Among them, w1, w2, w3, and w4 are the weights of each data monitoring parameter;

[0025] When the load value of a certain FIFO queue exceeds a set threshold, the dynamic FIFO management module increases the capacity of the FIFO queue FIFO;

[0026] When the load value of a certain FIFO queue is lower than a set threshold, the dynamic FIFO management module reduces the capacity of the FIFO queue FIFO to ensure that the system can operate efficiently and reliably under different load conditions.

[0027] As a preferred solution of the present invention, the data monitoring module monitors the data monitoring parameters of each of the FIFO queues in real time, and compares each of the data monitoring parameters with its set independent threshold. When a single data monitoring parameter exceeds its corresponding independent threshold, the dynamic FIFO management module adjusts the memory allocation and management strategy of the multi-level FIFO module according to the results of the real-time monitoring status.

[0028] As a preferred solution of the present invention, the message processing module reads and processes the communication messages from different FIFO queues in turn according to the message priority order in different FIFO queues in the multi-level FIFO module, and the message processing module returns the processed communication messages to the main control unit;

[0029] The main control unit is responsible for the scheduling management of the system. The main control unit adjusts the work of multiple modules according to the real-time status and requirements of the system. The module includes the priority processing module, the dynamic FIFO management module and the data monitoring module.

[0030] In addition, the present invention also provides an optimization method for processing CAN communication messages based on FIFO, comprising the following steps:

[0031] Step 100: receiving a communication message transmitted by the CAN bus;

[0032] Step 200: Allocate different communication messages to FIFO queues of different priorities in sequence according to the priorities of the communication messages;

[0033] Step 300: Read communication messages from the FIFO queues in order according to the priority order of the communication messages corresponding to different FIFO queues, process the communication messages accordingly, and return the processing results to the main control unit.

[0034] As a preferred solution of the present invention, in step 300, the status of the FIFO queues at each level is monitored in real time, and the memory allocation and management strategy of the FIFO queues at each level are dynamically adjusted according to the monitoring results;

[0035] The dynamically adjusting the memory allocation and management strategy of each level of the FIFO queue includes adjusting the memory capacity of each level of the FIFO queue, or adjusting the message processing priority of each level of the FIFO queue.

[0036] As a preferred solution of the present invention, real-time monitoring of the status of FIFO queues at all levels includes:

[0037] Data overflow situation, determining whether each of the FIFO queues overflows;

[0038] Data volume, which is the amount of data currently being transmitted and stored in the FIFO queue;

[0039] Data type, the type of data currently being transmitted in the FIFO queue;

[0040] Data frequency, the rate at which data is stored to the FIFO queue.

[0041] As a preferred solution of the present invention, the usage of the FIFO queue at each level is determined based on the status monitoring result of the FIFO queue at that level, and the load of the FIFO queue at each level is determined according to the usage of the FIFO queue at that level;

[0042] Dynamically adjust the memory allocation and management strategy of each level of FIFO queue according to the load of each level of FIFO queue

[0043] As a preferred solution of the present invention, the implementation method of determining the priority of the communication message is:

[0044] Parsing a message ID from the communication message, and comparing the message ID with the white list of the current CAN node, if the message ID is not in the white list of the current CAN node, filtering the communication message;

[0045] If the message ID is in the whitelist of the current CAN node, the priority of the communication message is determined according to the current message ID;

[0046] The communication messages are stored in the FIFO queue corresponding to the priority in sequence according to the priority.

[0047] Compared with the prior art, the present invention has the following beneficial effects:

[0048] The present invention introduces a multi-level FIFO queue to store messages of different priorities respectively, and combines dynamic management strategies (such as memory capacity adjustment and priority weight adjustment) to achieve efficient processing of messages of different priorities, ensure the responsiveness and real-time performance of the system, effectively solve the problem of mixed priorities of FIFO queues in the prior art, and significantly improve the processing efficiency and reliability of the system. BRIEF DESCRIPTION OF THE DRAWINGS

[0049] In order to more clearly illustrate the implementation methods of the present invention or the technical solutions in the prior art, the following briefly introduces the drawings required for the implementation methods or the description of the prior art. Obviously, the drawings in the following description are only exemplary, and for ordinary technicians in this field, other implementation drawings can be derived from the provided drawings without creative work.

[0050] Figure 1 It is a schematic diagram of the overall structure of the system for optimizing the processing of CAN communication messages according to an embodiment of the present invention;

[0051] Figure 2 A schematic diagram of a process flow of a method for optimizing CAN communication message processing according to an embodiment of the present invention;

[0052] Figure 3 A schematic diagram of a control method of a dynamic FIFO management module according to an embodiment of the present invention;

[0053] In the figure:

[0054] 1-CAN receiving module; 2-priority processing module; 3-multi-level FIFO module; 4-message processing module; 5-data monitoring module; 6-dynamic FIFO management module; 7-main control unit. DETAILED DESCRIPTION

[0055] 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.

[0056] like Figures 1 to 3 As shown, the present invention provides an optimization system for processing CAN communication messages based on FIFO, including: a CAN receiving module 1, a priority processing module 2, a multi-level FIFO module 3, a message processing module 4, a data monitoring module 5, a dynamic FIFO management module 6 and a main control unit 7.

[0057] The CAN receiving module 1 is used to receive CAN data accepted by the CAN controller through acceptance filtering technology, and parse messages from the CAN data.

[0058] The priority processing module 2 filters the messages in the communication messages received by the CAN receiving module 1 based on the CAN node whitelist, and distributes the filtered communication messages to the multi-stage FIFO modules 3 according to their priorities.

[0059] The multi-level FIFO module 3 is used to store communication messages of different priorities. Different FIFO queues in the multi-level FIFO module 3 are respectively used to store communication messages of different priority levels. The priority processing module 2 automatically distributes the communication messages to different FIFO queues matching the priorities in the multi-level FIFO module 3 according to the priorities of the received communication messages.

[0060] For example, the multi-level FIFO module 3 includes three data buffers of different priorities, wherein the first-level FIFO queue is used to cache received high-priority messages, the second-level FIFO queue is used to cache received medium-priority messages, and the third-level FIFO queue is used to cache received low-priority messages.

[0061] The message processing module 4 is used to read the communication messages from the multi-stage FIFO module 3 according to the priority order and process the read communication messages in sequence.

[0062] The message processing module 4 reads and processes the communication messages from different FIFO queues in turn according to the message priority order in different FIFO queues in the multi-level FIFO module 3 , and the message processing module 4 returns the processed communication messages to the main control unit 7 .

[0063] Among them, the data monitoring module 5 is used to monitor the status of the multi-level FIFO module 3 in real time, specifically to monitor the status of each level of FIFO queue in real time, such as detecting and warning of abnormal situations such as overflow of each level of FIFO queue, and monitoring the network data traffic of each level of FIFO queue in real time, including information such as the amount of data being transmitted, data type, and data frequency.

[0064] The dynamic FIFO management module 6 is used to monitor and adjust the memory allocation and management strategy of the multi-stage FIFO module 3 in real time. Specifically, the dynamic FIFO management module 6 dynamically adjusts the memory allocation and management strategy of the multi-stage FIFO module 3 according to the real-time status information provided by the data monitoring module 5.

[0065] This embodiment divides the multi-level FIFO module 3 used to cache data into queues of different levels. According to the priority of the communication message, the message is cached in the FIFO queues of different levels in order of priority. In this way, when processing the data in the later stage, the messages in different FIFO queues are processed in order of priority, and data monitoring is performed on each level of FIFO queue to monitor the queue length and read and write speed of the FIFO queue. The load situation of each level of FIFO queue is formed according to the monitoring results, and the memory allocation and management strategy of each level of FIFO queue is adjusted according to the load situation, so as to ensure the data security in each level of FIFO queue and adjust the speed of message processing.

[0066] Specifically, by dividing the multi-level FIFO queue, it is ensured that messages of different priorities can be processed preferentially according to their importance. High-priority messages are assigned to the first-level FIFO queue, medium-priority messages are assigned to the second-level FIFO queue, and low-priority messages are assigned to the third-level FIFO queue. The message processing module 4 processes the messages in sequence according to the priority order of the FIFO queue to ensure that high-priority messages are processed in a timely manner.

[0067] Data monitoring is performed on each level of FIFO queue, and the monitoring content includes parameters such as queue length, read and write speed, etc. Based on the monitoring results, the load situation of each level of FIFO queue is formed. The dynamic FIFO management module 6 adjusts the memory allocation and management strategy of each level of FIFO queue according to the load situation. For example, when the current FIFO queue is under high load, the memory capacity of the FIFO queue is increased or the processing speed is accelerated; when the current FIFO queue is under low load, the memory capacity of the FIFO queue is reduced. Through these measures, the data security in each level of FIFO queue is guaranteed, and the speed of message processing is optimized.

[0068] In this embodiment, the data monitoring module 5 is used to monitor the status of the multi-level FIFO module 3 in real time, including data overflow, the amount of data being transmitted, the data type, the data frequency, and the processing efficiency of the message processing module 4. The usage of each level of the FIFO queue is specifically reflected in the amount of remaining capacity. The less the remaining capacity, the higher the load; the more the remaining capacity, the lower the load, and further, the less the remaining capacity, the more tense the usage and the higher the load; the more the remaining capacity, the more relaxed the usage and the lower the load.

[0069] By establishing a relationship between the data monitoring results of each level of FIFO queue and the load conditions of the FIFO queue, the data monitoring module 5 monitors the status of the multi-level FIFO module 3 in real time, including the following specific information: ① Data overflow situation: whether the FIFO queue overflows; ② The amount of data being transmitted: the amount of data stored in the current FIFO queue; ③ Data type: the type of data being transmitted (for example, sensor data, control commands, etc.); ④ Data frequency: the rate at which data arrives at the FIFO queue.

[0070] System load can be defined as the degree to which system resources (such as processing power and memory) are occupied. The level of load will affect the response speed and stability of the system. Based on the monitoring information, the load situation can be determined in the following ways: First, analyze the four data monitoring parameters separately to determine whether it is high load or low load:

[0071] The high load for the data overflow parameter is determined as follows: if data overflow occurs frequently, it means that the FIFO queue cannot process all received data in time and the system is in a high load state. If the overflow frequency is high (such as more than 10 times per minute), it is considered to be high load.

[0072] The low load determination for the data overflow parameter is: if there is almost no data overflow, it means that the system can process the received data in time and the system is in a low load state.

[0073] The high load for the data volume parameter is defined as: when the data volume is large, more FIFO capacity and processing power are required; the low load for the data volume parameter is defined as: when the data volume is small, the system load is low. If the data volume of each level of FIFO queue is close to full load (such as more than 80%), it is considered to be high load.

[0074] A high load for a data type parameter means that some data types may require more processing resources. For example, video data or large data packets may increase the system load. A low load for a data type parameter means that simple data types (such as sensor data) have less impact on the system load. Different weights are set for different data types. For example, video data has a high weight, while sensor data has a low weight.

[0075] A high load for the data frequency parameter is defined as follows: high-frequency data traffic will increase the system load and require more processing power and memory; a low load for the data frequency parameter is defined as follows: low-frequency data traffic has little impact on the system load. If the data arrival frequency exceeds a certain threshold (such as 100 times per second), it is considered a high load.

[0076] Second, the four data monitoring parameters are analyzed uniformly to determine whether they are high load or low load. The load calculation formula is:

[0077] Assuming the load value is L, the data volume is D, the data frequency is F, the data type is T, and the overflow is O, the load value can be expressed as:

[0078] L=w1×D+w2×F+w3×T+w4×O

[0079] Among them, w1, w2, w3, and w4 are the weights of each parameter, which can be adjusted according to the actual application scenario.

[0080] The load condition can be determined by comprehensively considering various monitoring parameters. When the load value of the current FIFO queue exceeds the set threshold, the dynamic FIFO management module 6 will increase the capacity of the FIFO queue of the corresponding level; when the load value of the current FIFO queue is lower than the set threshold, the dynamic FIFO management module 6 will reduce the capacity of the FIFO queue of the corresponding level to ensure that the system can operate efficiently and reliably under different load conditions.

[0081] Specifically, according to the calculated load value L of each level of FIFO queue, the dynamic FIFO management module 6 can adjust the capacity of each level of FIFO queue:

[0082] High load (L> set threshold): Increase the capacity of the FIFO queue, especially the high-priority FIFO queue, to ensure timely processing of critical data.

[0083] Medium load (L is within a certain range): Maintain the existing capacity of the FIFO queue.

[0084] Low load (L < set threshold): Reduce the capacity of the FIFO queue to save system resources.

[0085] The dynamic FIFO management module 6 adjusts the memory allocation and management strategy of the multi-level FIFO module 3 according to the real-time monitoring status result, specifically including:

[0086] (1) Memory capacity adjustment: Under high load conditions, the memory capacity of the high-priority FIFO queue is increased; under low load conditions, the memory capacity of the low-priority FIFO queue is reduced.

[0087] (2) Priority adjustment: In emergency situations, temporarily increase the processing priority of low-priority messages; in low-load situations, reduce the priority of non-urgent high-priority tasks.

[0088] (3) Processing rate adjustment: Under high load conditions, speed up message processing; under low load conditions, slow down processing to save resources.

[0089] (4) Queue allocation strategy adjustment: Dynamically allocate messages to different FIFO queues based on data type and priority, and reallocate FIFO queue priorities and memory resources when necessary.

[0090] (5) Overflow handling strategy: prevent overflow and avoid data loss by increasing capacity or speeding up processing; dynamically adjust resource allocation of other FIFO queues after overflow.

[0091] (6) Memory recovery and reallocation: Recover excess memory from long-term low-load FIFO queues and reallocate it to high-load FIFO queues to ensure efficient use of resources.

[0092] Furthermore, in this embodiment, the main control unit 7 is responsible for the scheduling management of the system, including the coordination of the priority processing module 2, the dynamic FIFO management module 6 and the data monitoring module 5. The main control unit 7 adjusts the working mode and parameters of each module according to the real-time status and requirements of the system.

[0093] The main control unit 7 is also responsible for the error handling and exception handling of the system. It can monitor the operating status of the system, find errors and abnormal situations in time, and take corresponding measures to ensure the stability and reliability of the system.

[0094] Specifically, the main control unit 7 determines the real-time status and requirements of the system in the following ways:

[0095] (1) Obtaining information through the data monitoring module: The data monitoring module 7 monitors the status of the multi-level FIFO module 3 in real time, including data overflow, data volume, data type, data frequency and the remaining capacity of each level of the FIFO queue, and transmits this information to the main control unit 7.

[0096] (2) Obtaining information through the message processing module 4: The message processing module 4 provides information on the efficiency and speed of current message processing, including the number of messages processed per second and the type of message currently being processed, and feeds this information back to the main control unit 7.

[0097] (3) Obtaining information through the dynamic FIFO management module 6: The dynamic FIFO management module 6 feeds back the memory allocation and management policy execution status of the current FIFO queue, such as memory usage and priority allocation strategy, and feeds back this information to the main control unit 7.

[0098] The main control unit 7 integrates and analyzes this information to determine the real-time status and needs of the system. For example, under high load conditions, the main control unit can decide to increase the memory capacity of the high-priority FIFO queue, speed up message processing, and adjust the priority strategy. Under low load conditions, the main control unit can reduce the memory capacity of the low-priority FIFO queue and reduce the processing speed to save system resources.

[0099] The main control unit 7 dynamically adjusts the working mode and parameters of the priority processing module 2, the dynamic FIFO management module 6 and the data monitoring module 7 according to the real-time status and requirements of the system. The specific adjustment method is:

[0100] Adjust the operation of the dynamic FIFO management module 6 so that the dynamic FIFO management module 6 can regulate the memory capacity of each level of FIFO queue, that is, increase or decrease the memory capacity of each level of FIFO queue according to the load conditions, and optimize the priority allocation strategy, and dynamically adjust the priority weight and allocation strategy of the message.

[0101] Adjust the work of the message processing module 4: adjust its processing speed by increasing or decreasing processing threads and optimizing the processing algorithm to adjust the processing speed; adjust its processing order by dynamically adjusting the order of message processing according to the current system requirements.

[0102] Adjust the work of the data monitoring module 7: adjust its monitoring frequency, dynamically adjust the collection frequency of monitoring data according to the system load; adjust its alarm threshold, dynamically adjust the alarm threshold of data monitoring according to system requirements.

[0103] For example, under high load conditions, the main control unit 7 can increase the memory capacity of the high-priority FIFO queue, increase the number of message processing threads, and increase the monitoring frequency; under low load conditions, the main control unit 7 can reduce the memory capacity of the low-priority FIFO queue, reduce the number of message processing threads, and reduce the monitoring frequency.

[0104] In addition, the present invention also provides an optimization method for processing CAN communication messages based on FIFO, comprising the following steps:

[0105] Step 100: receiving a communication message transmitted by the CAN bus;

[0106] Step 200: According to the priorities of the communication messages, different communication messages are sequentially allocated to FIFO queues of different priorities.

[0107] The priority of communication messages is determined as follows:

[0108] Parse the message ID from the communication message and compare the message ID with the whitelist of the current CAN node. If the message ID is not in the whitelist of the current CAN node, filter the communication message.

[0109] If the message ID is in the whitelist of the current CAN node, the priority of the communication message is determined according to the current message ID;

[0110] The communication messages are stored in the FIFO queue corresponding to the priority in sequence.

[0111] Step 300 : Read the communication messages from the FIFO queues in order of priority of the communication messages corresponding to different FIFO queues, process the communication messages accordingly, and return the processing results to the main control unit 7 .

[0112] The message processing module reads and processes the messages starting from the first-level FIFO in order of priority. If the first-level FIFO is empty, the second-level FIFO is read, and so on.

[0113] Among them, in the process of performing corresponding processing on the communication message in step 300, the status of FIFO queues at each level is monitored in real time, and the memory allocation and management strategy of each level of FIFO queue is dynamically adjusted according to the monitoring results. For example, the dynamic FIFO management module adjusts the capacity of FIFO queues at each level according to the current load of the system and the usage of each level of FIFO queue. Under high load conditions, the capacity of the first level FIFO queue can be temporarily increased to ensure timely processing of high-priority messages.

[0114] The dynamically adjusting memory allocation and management strategy of each level of FIFO queue includes adjusting the memory capacity of each level of FIFO queue, or adjusting the message processing priority of each level of FIFO queue.

[0115] Real-time monitoring of the status of each level of FIFO queues includes monitoring the queue length, read / write speed, and overflow of each level of FIFO queues.

[0116] It should be noted that adjusting the message processing priority of each level of FIFO queue is not simply adjusting the low-priority FIFO queue to a high priority, but optimizing system performance by dynamically adjusting the priority weight and resource allocation strategy. This process involves fine-grained management of FIFO queues at different levels to ensure that the system can operate efficiently and reliably under different load conditions.

[0117] When the dynamic FIFO management module adjusts the management strategy according to the monitoring results of each level of FIFO queue, it understands and implements the message processing priority adjustment of each level of FIFO queue in the following ways:

[0118] (1) Adjust the priority weight:

[0119] Dynamic adjustment: Dynamically adjust the weights of messages of different priorities based on the real-time load and demand of the system. Temporarily increase the priority weights of certain critical tasks to ensure that they are processed first.

[0120] Example: If some low-priority messages become urgent, their priority weights can be temporarily increased so that they are processed with higher priority.

[0121] (2) Dynamic resource allocation:

[0122] Memory capacity adjustment: Dynamically increase or decrease the memory capacity of each level of FIFO queue according to its load, to ensure that high-load queues can process data in a timely manner and the resources of low-load queues are optimally utilized.

[0123] Example: Under high load conditions, increase the memory capacity of the high priority FIFO; under low load conditions, reduce the memory capacity of the low priority FIFO.

[0124] (3) Adjust the processing order:

[0125] Processing order optimization: Under high load or emergency conditions, the processing order of message processing modules can be temporarily adjusted so that certain low-priority but urgent messages can be processed first.

[0126] Example: In an emergency, the main control unit can instruct the message processing module to give priority to emergency messages in the low priority queue.

[0127] Therefore, the message processing priority of each level of FIFO queue is adjusted mainly by dynamically adjusting the priority weight, resource allocation strategy and processing order. These adjustments are not simply changing the priority of the FIFO queue, but through flexible management strategies, ensuring that the system can process messages efficiently and reliably under different load conditions.

[0128] Based on the above, the present invention also provides a specific application process of the above-mentioned optimization system for processing CAN communication messages based on FIFO:

[0129] First, you need to select a suitable FPGA chip as the central control unit. Common choices include Xilinx series and Altera series. When selecting FPGA, you need to consider factors such as performance, resource utilization and cost. This embodiment selects the Altera series development board.

[0130] Then we start to implement each module. For the multi-level FIFO module, we use the internal block RAM of FPGA or the external SRAM as the storage unit. The internal block RAM is faster and suitable for implementing the first-level FIFO queue, while the external SRAM can be used to implement the second-level FIFO queue and the third-level FIFO queue. The memory capacity of the first-level FIFO queue is 64 bytes, and the read and write speed is 100MHz; the memory capacity of the second-level FIFO queue is 128 bytes, and the read and write speed is 50MHz; the memory capacity of the third-level FIFO queue is 256 bytes, and the read and write speed is 25MHz.

[0131] Design the read-write control logic. For each level of FIFO queue, the corresponding read-write control logic needs to be designed to ensure that data can be read and written according to the FIFO principle and to ensure the order and speed of reading and writing.

[0132] For the priority processing module, a priority encoder module is designed to convert the received CAN communication message into the corresponding FIFO selection signal according to the priority of the message. This can be achieved through a lookup table, an encoder or a state machine, so that communication messages of different priority levels are sent to the FIFO queues corresponding to the FIFO selection signals.

[0133] For the dynamic FIFO management module, we first design the monitoring logic and design a FIFO manager module to monitor the status of each level of FIFO queues, including queue length, read and write speed, etc. This can be achieved by using the counters, state machines, and logic resources inside the FPGA. Then we design the adjustment strategy and design the corresponding adjustment strategy based on the monitoring results, including memory allocation adjustment, read and write control adjustment, etc., to ensure the stability and performance of the system.

[0134] For the message processing module, we first design the reading logic and design a message processor module, which is responsible for reading messages from FIFO queues at all levels in order of priority and performing corresponding processing operations. This can be achieved through appropriate state machine design and control logic, and then design the processing logic. According to the specific processing requirements, we design the corresponding processing algorithms and logic to ensure that the processing process can meet the system requirements.

[0135] The data monitoring module is used to monitor the status of FIFO queues at all levels in real time and send out early warning signals when abnormal conditions are detected. This can be achieved by designing appropriate monitoring logic and alarm mechanisms.

[0136] This implementation improves the efficiency of data reception. Through the multi-level FIFO module and dynamic management mechanism, it effectively improves the efficiency and real-time performance of message processing, enhances reliability, and ensures stable operation under high load conditions through real-time monitoring and early warning mechanisms, reducing data loss. In addition, the FIFO strategy can be dynamically adjusted according to actual needs, which has strong flexibility and can adapt to the needs of different application scenarios.

[0137] The above embodiments are only exemplary embodiments of the present application and are not intended to limit the present application. The protection scope of the present application is defined by the claims. Those skilled in the art may make various modifications or equivalent substitutions to the present application within the essence and protection scope of the present application, and such modifications or equivalent substitutions shall also be deemed to fall within the protection scope of the present application.

Claims

1. An optimization system for processing CAN communication messages based on FIFO, characterized in that: include: A CAN receiving module (1) is used to receive CAN data after acceptance by a CAN controller and parse messages from the CAN data; A priority processing module (2) filters the message and sets the priority of the filtered communication message. The priority processing module (2) automatically distributes the communication message to different FIFO queues in the multi-level FIFO module (3) according to the priority of the received communication message. A multi-level FIFO module (3) includes a plurality of FIFO queues of different priority levels, wherein the plurality of FIFO queues are respectively used to store communication messages of different priorities; A message processing module (4) is used to read communication messages from the multi-level FIFO module (3) in order of priority and process the read communication messages in sequence; A data monitoring module (5) for monitoring the status of the multi-stage FIFO module (3) in real time; A dynamic FIFO management module (6) is provided, wherein the dynamic FIFO management module (6) adjusts the memory allocation and management strategy of the multi-stage FIFO module (3) according to the result of real-time monitoring of data parameters.

2. The optimization system for processing CAN communication messages based on FIFO according to claim 1, characterized in that: The data monitoring module (5) performs data monitoring on each level of FIFO queue, and the data monitoring module (5) forms a load condition of each level of FIFO queue based on the data monitoring result; The dynamic FIFO management module (6) regulates the memory allocation and management strategy of each level of FIFO queue according to the load situation; The data monitoring module (5) monitors the data parameters of each level of FIFO queue, including: Data overflow situation, determining whether each of the FIFO queues overflows; Data volume, which is the amount of data currently being transmitted and stored in the FIFO queue; Data type, the type of data currently being transmitted in the FIFO queue; Data frequency, the rate at which data is stored to the FIFO queue.

3. The optimization system for processing CAN communication messages based on FIFO according to claim 2, characterized in that: When the data monitoring module (5) forms the load condition of each level of FIFO queue according to the data monitoring result, the load value formed by each data monitoring parameter is integrated by weight and threshold. The load calculation formula of each FIFO queue is: If the load value is L, the amount of data being transmitted is D, the data frequency is F, the data type is T, and the overflow condition is O, then the load value can be expressed as: L=w1×D+w2×F+w3×T+w4×O; Among them, w1, w2, w3, and w4 are the weights of each data monitoring parameter; When the load value of a certain FIFO queue exceeds a set threshold, the dynamic FIFO management module (6) increases the capacity of the FIFO queue FIFO; When the load value of a certain FIFO queue is lower than a set threshold, the dynamic FIFO management module (6) reduces the capacity of the FIFO queue FIFO to ensure that the system can operate efficiently and reliably under different load conditions.

4. The optimization system for processing CAN communication messages based on FIFO according to claim 2, characterized in that: The data monitoring module (5) monitors the data monitoring parameters of each FIFO queue in real time, and compares each data monitoring parameter with its set independent threshold value. When a single data monitoring parameter exceeds its corresponding independent threshold value, the dynamic FIFO management module (6) adjusts the memory allocation and management strategy of the multi-level FIFO module (3) according to the result of the real-time monitoring status.

5. The optimization system for processing CAN communication messages based on FIFO according to claim 1, characterized in that: The message processing module (4) reads and processes communication messages from different FIFO queues in sequence according to the message priority order in different FIFO queues in the multi-level FIFO module (3), and the message processing module (4) returns the processed communication messages to the main control unit (7); The main control unit (7) is responsible for the scheduling management of the system. The main control unit (7) adjusts the work of multiple modules according to the real-time status and needs of the system, and the modules include the priority processing module (2), the dynamic FIFO management module (6) and the data monitoring module (5).

6. An optimization method for processing CAN communication messages based on FIFO, characterized in that: The following steps are involved: Step 100: receiving a communication message transmitted by the CAN bus; Step 200: Allocate different communication messages to FIFO queues of different priorities in sequence according to the priorities of the communication messages; Step 300: Read communication messages from the FIFO queues in sequence according to the priority order of the communication messages corresponding to different FIFO queues, process the communication messages accordingly, and return the processing results to the main control unit.

7. The optimization method for processing CAN communication messages based on FIFO according to claim 6, characterized in that: In step 300, the status of the FIFO queues at each level is monitored in real time, and the memory allocation and management strategy of the FIFO queues at each level are dynamically adjusted according to the monitoring results; The dynamically adjusting the memory allocation and management strategy of each level of the FIFO queue includes adjusting the memory capacity of each level of the FIFO queue, or adjusting the message processing priority of each level of the FIFO queue.

8. The optimization method for processing CAN communication messages based on FIFO according to claim 7, characterized in that: Real-time monitoring of the status of FIFO queues at all levels includes: Data overflow situation, determining whether each of the FIFO queues overflows; Data volume, which is the amount of data currently being transmitted and stored in the FIFO queue; Data type, the type of data currently being transmitted in the FIFO queue; Data frequency, the rate at which data is stored to the FIFO queue.

9. The optimization method for processing CAN communication messages based on FIFO according to claim 8, characterized in that: Determine the usage of each level of FIFO queue based on the status monitoring results of the FIFO queue, and determine the load of the FIFO queue based on the usage of each level of FIFO queue; The memory allocation and management strategy of each level of FIFO queue is dynamically adjusted according to the load of each level of FIFO queue.

10. The optimization method for processing CAN communication messages based on FIFO according to claim 6, characterized in that: The priority of the communication message is determined as follows: Parsing a message ID from the communication message, and comparing the message ID with a whitelist of the current CAN node; if the message ID is not in the whitelist of the current CAN node, filtering the communication message; If the message ID is in the whitelist of the current CAN node, the priority of the communication message is determined according to the current message ID; The communication messages are stored in the FIFO queue corresponding to the priority in sequence according to the priority.

Citation Information

Cited By

  • Message processing method and electronic equipment

    CN121050905A

  • Information issuing method and system capable of dynamically adjusting priority

    CN121217690A

  • Method implemented by an electronic control unit in a vehicle controller area network

    EP4761188A1