Data message transmission method and device, gateway equipment and vehicle
By determining the back-up waiting time of data packets in the domain control gateway and resend it, the frame drop problem caused by low priority data packets in data packet transmission is solved and network congestion is caused, and the normal transmission of data packets and the improvement of vehicle performance is achieved.
Patent Information
- Application Number
- CN202411858579.5
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2024-12-16
- Publication Date
- 2025-04-29
AI Technical Summary
In the prior art, when the domain control gateway processes a large number of sensors and audio and video node data, the CPU and cache load is increased, resulting in data packets with low priority that are easily unable to be sent during data packet transmission, and the frame loss caused by network congestion is serious, affecting the normal driving of the vehicle.
By determining the back-up waiting time for failed data packets to the target data channel and resend the data packets after this time is reached, ensuring normal transmission of data packets of each priority level is avoided from blocking and frame drops.
It effectively avoids data packet blocking and frame drop problems, optimizes the problems of actual vehicles such as high delay and high frame drop rates due to communication network congestion, and improves the overall performance of the vehicle.
Smart Images

Figure CN119906602A_ABST
Abstract
Description
Technical Field
[0001] The present application belongs to the field of vehicle technology, and specifically relates to a data message transmission method, device, gateway device and vehicle, as well as a gateway system, a computer-readable storage medium and a computer program product. Background Art
[0002] With the development of vehicle intelligence and networking, a large number of sensors and audio and video nodes have been added to the vehicle network to meet the needs of advanced driving assistance and entertainment. This has greatly increased the workload of the domain control gateway, increased the CPU and cache load, and the average load of the controller area network (Controller Area Network, referred to as: CAN) and the CPU is close to saturation. In related technologies, a priority-based competition mechanism can be used, but this mechanism easily causes low-priority data messages to fail to be sent. Summary of the invention
[0003] The present application aims to solve at least one of the technical problems existing in the prior art. To this end, the present application proposes a data message sending method, device, gateway device and vehicle, as well as a gateway system, a computer-readable storage medium and a computer program product, which can effectively avoid the occurrence of frame loss while ensuring the normal transmission of data messages of various priorities.
[0004] In a first aspect, an embodiment of the present application provides a data message transmission method, including:
[0005] Determine the backoff waiting time for a data message that fails to be sent to a target data channel;
[0006] After the backoff waiting time is reached, the data message is sent to the target data channel.
[0007] In some embodiments, the above-mentioned determination of the backoff waiting time for the data message that fails to be sent to the target data channel includes:
[0008] Obtain characteristic information of data packets that failed to be sent to the target data channel;
[0009] Based on the characteristic information of the data message and the preset time rule, the backoff waiting time of the data message is determined.
[0010] In some embodiments, the backoff waiting time of the data message includes a maximum backoff waiting time and a minimum backoff waiting time. Based on the characteristic information of the data message and the preset time rule, determining the backoff waiting time of the data message includes:
[0011] Based on the characteristic information of the data message and the preset time rule, the maximum backoff waiting time and the minimum backoff waiting time are determined.
[0012] In some embodiments, it also includes:
[0013] Get the number of failed datagram sending attempts;
[0014] The above-mentioned determining the backoff waiting time of the data message based on the characteristic information of the data message includes:
[0015] The backoff waiting time of the data message is determined based on the characteristic information of the data message, the number of transmission failures of the data message and the preset time rule.
[0016] In some embodiments, the characteristic information of the data message includes at least one of the following:
[0017] The priority of the data message;
[0018] The message length of the data message;
[0019] The message type of the data message;
[0020] Destination device of the data packet.
[0021] In some embodiments, the backoff waiting time is an integer multiple of a time slot, where the time slot is one Nth of the time required to send a frame of data message, where N is an integer greater than or equal to 2.
[0022] In some embodiments, the above method includes:
[0023] When sending a data message to the target data channel fails, the data message that fails to be sent is stored in the first cache.
[0024] In some embodiments, sending a data message to a target data channel includes:
[0025] The data message that failed to be sent is read from the first buffer, and the data message is sent to the target data channel.
[0026] In some embodiments, the first cache is a software cache.
[0027] In some embodiments, the above method further comprises:
[0028] The data message is read from the second buffer and sent to the target data channel.
[0029] In some embodiments, the second cache is a hardware cache.
[0030] In some embodiments, the above method includes:
[0031] Record the cumulative time of data packets that failed to be sent;
[0032] After the accumulated time reaches the backoff waiting time, the data message is sent to the target data channel.
[0033] In some embodiments, sending a data message to a target data channel includes:
[0034] The data message is sent to the target data channel through the driver module.
[0035] In some embodiments, the above-mentioned driving modules are arranged in one-to-one correspondence with the data channels; or,
[0036] The priority of the driver module and the data message is set one by one; or,
[0037] The driver module and the message type of the data message are set in a one-to-one correspondence.
[0038] In some embodiments, the gateway device is provided with a first cache and a second cache.
[0039] In some embodiments, the driver modules correspond to the first cache in a one-to-one manner, and / or the driver modules correspond to the second cache in a one-to-one manner.
[0040] In some embodiments, the above data message is a CAN bus data message.
[0041] In a second aspect, an embodiment of the present application provides a data message transmission device, including:
[0042] A time determination module, used to determine a backoff waiting time for a data message that fails to be sent to a target data channel;
[0043] The sending module is used to send a data message to a target data channel after the backoff waiting time is reached.
[0044] In a third aspect, an embodiment of the present application provides a gateway device, including a processor and a memory, wherein the memory is used to store program code, and the processor is used to call the program code in the memory to execute the method of the first aspect.
[0045] In a fourth aspect, an embodiment of the present application provides a gateway system, the system comprising a gateway device connected to at least one electronic device, the gateway device being used to execute the method described in the first aspect above.
[0046] In some embodiments, it also includes: a driving module, which is connected to the gateway device and the electronic device respectively, and is used to send the message data received from the gateway device to the electronic device according to a preset sending rule.
[0047] In a fifth aspect, an embodiment of the present application provides a vehicle, comprising the gateway device described in the third aspect, or the gateway system described in the fourth aspect.
[0048] In a sixth aspect, an embodiment of the present application provides a computer-readable storage medium, on which a program or instruction is stored, and when the program or instruction is executed by a processor, the method described in the first aspect is implemented.
[0049] In a seventh aspect, an embodiment of the present application provides a computer program product, which, when executed by a processor of an electronic device, implements the method described in the first aspect.
[0050] The technical solution provided by the present application determines the backoff waiting time of the data message that fails to be sent to the target data channel, and sends the data message to the target data channel after the backoff waiting time is reached. Since the above technical solution sets a backoff waiting time mechanism in the process of transmitting the data message, the data can be re-sent according to the backoff waiting time, which can effectively avoid the data message blocking the transmission of subsequent data messages and the transmission of frame loss while ensuring the normal transmission of data messages of various priorities. Thereby, the actual vehicle problems such as high gateway forwarding delay and high frame loss rate caused by communication network congestion can be optimized, thereby improving the overall performance of the vehicle.
[0051] Additional aspects and advantages of the present application will be given in part in the description below, and in part will become apparent from the description below, or will be learned through the practice of the present application. BRIEF DESCRIPTION OF THE DRAWINGS
[0052] The above and / or additional aspects and advantages of the present application will become apparent and easily understood from the description of the embodiments in conjunction with the following drawings, in which:
[0053] Figure 1 A schematic diagram of a data message transmission method in an embodiment of the present application;
[0054] Figure 2 A schematic diagram of a process for obtaining a backoff waiting time in an embodiment of the present application;
[0055] Figure 3 for Figure 1 A schematic diagram of a specific execution flow of step 102 in the illustrated embodiment;
[0056] Figure 4 A schematic diagram of the corresponding relationship between a driver module and a cache in an embodiment of the present application;
[0057] Figure 5 A schematic diagram of a flow chart of another data message transmission method in an embodiment of the present application;
[0058] Figure 6 This is a structural diagram of a data message transmission device in an example of this application;
[0059] Figure 7This is a schematic diagram of the structure of a gateway device in an example of this application;
[0060] Figure 8 This is a schematic diagram of the structure of another gateway device in the present application example;
[0061] Fig. 9 This is a schematic diagram of the structure of a transmitter in an example of this application;
[0062] Fig.10 This is a schematic diagram of another data message transmission process in the example of this application;
[0063] Fig.11 A schematic diagram of the structure of a gateway system in an example of this application;
[0064] Fig.12 This is a schematic diagram of the structure of another gateway system in this application example;
[0065] Fig.13 A schematic diagram of the structure of a vehicle in an example of this application;
[0066] Fig.14 This is a schematic diagram of the structure of another vehicle in this application example. DETAILED DESCRIPTION
[0067] The embodiments of the present application will be described in more detail below with reference to the accompanying drawings. Although certain embodiments of the present application are shown in the accompanying drawings, it should be understood that the present application can be implemented in various forms and should not be construed as being limited to the embodiments described herein. Instead, these embodiments are provided to provide a more thorough and complete understanding of the present application. It should be understood that the drawings and embodiments of the present application are only for exemplary purposes and are not intended to limit the scope of protection of the present application.
[0068] It should be understood that the various steps described in the method implementation of the present application can be performed in different orders and / or performed in parallel. In addition, the method implementation may include additional steps and / or omit the steps shown. The scope of the present application is not limited in this respect.
[0069] As described in the background technology section, in order to solve the data congestion problem that often occurs on the CAN bus, the CAN bus adopts a unique Carrier Sense Multiple Access with Collision Avoidance (CSMA / CA) arbitration mechanism, and each data message competes for the right to use the CAN bus based on its priority. The existing data message transmission conflict arbitration mechanism for the CAN bus has many shortcomings in the execution process. For example, data messages with lower priority often need to wait until higher priority messages are sent before they can be sent, and sometimes they cannot be sent at all. In addition, once a data message fails to be sent, it will not only interfere with the normal sending process of other messages, but also affect the message transmission on other data channels, thereby exacerbating the overflow frame loss risk and forwarding delay problems of the vehicle domain control gateway device.
[0070] In addition, the number of retransmissions of data packets is limited. Once the number of transmissions exceeds this limit, frame loss or data loss will occur. Since most of the data in the vehicle network is directly related to the vehicle's power system, steering control and safety performance, the frame loss problem will directly affect the normal driving of the vehicle, and in serious cases may even cause traffic accidents.
[0071] Therefore, the technical solution provided by the present application determines the backoff waiting time of the data message that fails to be sent to the target data channel when the data message fails to be sent, and sends the data message to the target data channel after the backoff waiting time is reached. Since the above technical solution sets a backoff waiting time mechanism in the process of transmitting data messages, it can resend data according to the backoff waiting time, and can effectively avoid data messages blocking the transmission of subsequent data messages and frame loss while ensuring the normal transmission of data messages of various priorities. Thereby, the actual vehicle problems such as high gateway forwarding delay and high frame loss rate caused by communication network congestion can be optimized, thereby improving the overall performance of the vehicle.
[0072] Figure 1 Schematic diagram of a data message transmission method in an embodiment of the present application, such as Figure 1 As shown, the following steps are included:
[0073] Step 101, determining a backoff waiting time for a data message that fails to be sent to a target data channel;
[0074] This step is to obtain the backoff waiting time of the data message after determining that the data message has failed to be sent. Specifically, when it is determined that the data message has not been successfully sent to the target data channel by checking the sending process of the data message, verifying the data message, checking the target data channel, and using debugging tools, the backoff waiting time of the data message is obtained. For example, during the process of sending the data message, when it is detected that the data channel is occupied, it is determined that the sending of the data message has failed. At this time, it is necessary to obtain the backoff waiting time of the data message for subsequent operations. The data message is a data unit transmitted in network communication, which contains the data to be transmitted and the necessary control information to ensure that the data can be correctly and reliably sent from one device to another. Specifically, the above-mentioned data message usually includes: a start frame, a destination address, a source address, a control field, a data field, a check field and a tail frame, etc., wherein the destination address is used to determine the receiving device of the data message, and in a broadcast network, the data message may contain multiple destination addresses; the source address is used to determine the sending device of the data message; the control field contains bits used to control the format and interpretation of the message, such as data length, protocol type, etc.; the data field contains the data actually to be transmitted by the data message; and the check field is used for error detection. Common check algorithms include cyclic redundancy check (CRC), etc. In different network protocols, the specific structure and fields of the data message will be different.
[0075] The above-mentioned data channel usually refers to a logical segment or part of a communication network, such as the CAN segment of a CAN bus, which is used to transmit data messages between various devices, and different data channels may have different communication characteristics, such as different baud rates, different node sets, different data types, etc. The target data channel refers to the data channel to which the data message needs to be sent, and which data channels are the target data channels of the data message can be determined based on the data channel number. The above-mentioned data channel number can be used to identify the data channel, which is stored in the destination address field of the data message.
[0076] The backoff waiting time of data packets is a conflict avoidance mechanism in network communication. This mechanism is mainly used to allow the sender to suspend sending and wait for a period of time before retrying when network congestion or conflict is detected during data packet transmission. This strategy helps to reduce data packet collisions in the network, improve transmission efficiency and network stability, and by reasonably setting and adjusting the backoff waiting time, network performance can be further optimized and user experience can be improved.
[0077] Step 102: After the backoff waiting time is reached, send a data message to the target data channel.
[0078] On the basis of step 101, further operations are performed according to the backoff waiting time of the acquired data message, that is, after determining that the accumulated waiting time of the above data message reaches the backoff waiting time, the data message is sent to the target data channel again. Specifically, after determining the specific value of the backoff waiting time of the above data message, relevant equipment, such as a vehicle domain gateway device, is used to start its built-in timer to start timing. When the count value of the timer is equal to the value of the backoff waiting time, the gateway device sends the above data message to the target data channel; but if the count value of the timer does not match the value of the backoff waiting time, or an error occurs during the timing process, resulting in a timing failure, then corresponding error handling is performed, such as resetting the timer, or waiting for the next sending opportunity to send the above data message again.
[0079] As described above, by transmitting data messages through this method, data can be resent according to the backoff waiting time, which can effectively avoid data messages blocking the transmission of subsequent data messages and frame loss while ensuring the normal transmission of data messages of various priorities. This can optimize actual vehicle problems such as high gateway forwarding delay and high frame loss rate caused by communication network congestion, thereby improving the overall performance of the vehicle.
[0080] In some embodiments, the characteristic information of the data message can be used to determine the backoff waiting time for sending a data message that fails to be sent to the target data channel. Specifically, Figure 2 As shown, the following steps are included:
[0081] Step 201, obtaining characteristic information of a data message that fails to be sent to a target data channel;
[0082] This step is to further obtain the characteristic information of the data message after determining in step 101 that the data message fails to be sent to the target data channel. Specifically, when it is determined that the data message fails to be successfully sent to the target data channel by checking the sending process of the data message, verifying the data message, checking the target data channel, and using debugging tools, the characteristic information of the data message is obtained. For example, when it is detected that the target data channel is occupied during the data message sending process, it is determined that the data message fails to be sent. At this time, it is necessary to obtain the characteristic information of the data message for subsequent use. The above characteristic information generally refers to information that can describe the basic attributes of the data message, the transmission status, and the information associated with other data messages, thereby helping the system or application to correctly classify, identify, process and transmit the data message.
[0083] In an embodiment of the present application, the characteristic information of the above-mentioned data packet is used to determine the initial value of the backoff waiting time of the data packet, which includes various types of data information, such as the priority of the data packet, the message length of the data packet, the message type of the data packet, and the destination device of the data packet, etc., so as to manage and process the data packet more comprehensively and meticulously. The priority of a data message indicates its relative importance in the transmission or processing process. Priorities can be reasonably assigned to each data message according to a variety of methods, for example, based on the identifier of the data message, based on the length of the message, and other principles. When the data message is assigned a priority K based on the identifier of the data message, the first digit of the data message identifier value can be selected as the value of its priority K, for example, K∈[0,1,2,…,7], where 0 represents the highest priority and 7 represents the lowest priority. When the priority of a data message is determined by other principles, the priority can be flexibly assigned according to different application scenarios and requirements. For example, in real-time communication applications, higher priorities are assigned to voice or video data messages to ensure a smooth communication experience. In non-real-time applications, such as file transfer, a slight delay will not have much impact on the user experience, so the priority assigned to its data message can be relatively low, so as to better utilize system resources and improve overall processing efficiency and performance.
[0084] The message length of the above data message refers to the overall byte size of the data message. Different network protocols and data transmission methods have different requirements and restrictions on the length of the data message. For example, in the IP protocol, the total length of the data message is represented by a 16-bit field, and its maximum length is 65535 bytes. The message type of the data message refers to the type of data transmission unit defined according to different application scenarios and transmission requirements in network communication. These message types usually have a specific format and structure, which are used to encapsulate and transmit different types of data to ensure that data can be correctly and efficiently transmitted between different network devices or nodes. Common message types include IP messages, TCP messages, UDP messages, and CAN data messages. The destination device of the data message refers to the receiving device where the data message is expected to arrive. Based on the characteristic information of the data message, the data message can be managed and processed more effectively, and the reliability and efficiency of data transmission can be improved.
[0085] Step 202: Determine the backoff waiting time of the data message based on the characteristic information of the data message and the preset time rule.
[0086] On the basis of step 201, the characteristic information of the acquired data message can be used in combination with the preset time rule to further obtain the backoff waiting time of the above data message. Specifically, the priority, length, type and destination device of the data message can be used to determine the initial value of the backoff waiting time of the data message, and then, based on the preset time rule, the corresponding calculation is performed to determine the backoff waiting time of the data message. The above preset time rule is a pre-set rule for calculating the backoff waiting time of the data message that fails to be sent, so as to be better applicable to the calculation of the backoff waiting time based on the characteristic information of multiple data messages, for example, after determining the characteristic information of the data message, which algorithm is used to calculate the backoff waiting time. Specifically, refer to the following embodiment. In this way, the backoff waiting time is determined by using the characteristic information of the data message and the preset time rule, which can not only effectively avoid the collision of data packets in the network, but also optimize the network transmission efficiency and improve the overall network performance.
[0087] In an embodiment of the present application, the backoff waiting time of the above-mentioned data message generally includes a maximum backoff waiting time and a minimum backoff waiting time, wherein the maximum backoff waiting time refers to the longest time limit that the data message may wait during a backoff process; the minimum backoff waiting time refers to the shortest time limit that the data message must wait during a backoff process, and the initial values of the maximum backoff time and the minimum backoff waiting time are pre-set and determined. The initial values of the maximum backoff waiting time and the minimum backoff waiting time of data messages with different characteristic information are also different. For example, for data message A with a priority of 0, the initial values of its maximum backoff waiting time and the minimum backoff waiting time are both smaller than those of data message B with a priority of 5.
[0088] In the embodiment of the present application, when determining the backoff waiting time of the data message according to the characteristic information of the data message and the preset time rule, specifically, using any one of the characteristic information of the data message that failed to be sent, combined with the above-mentioned preset time rule, the maximum backoff waiting time and the minimum backoff waiting time of the above-mentioned data message are determined, for example and That is, the above two types of time are updated so that the data message can be retransmitted according to a reasonable backoff strategy, thereby more effectively utilizing network resources and increasing the probability of successful transmission of the data message.
[0089] In some embodiments, when the priority in the above-mentioned characteristic information is used to determine the backoff waiting time of the data message, it is also necessary to ensure that a certain correlation is maintained between the priority of the data message and the backoff waiting time, that is, the value of the backoff waiting time decreases as the priority of the data message increases, so as to ensure that the above-mentioned higher priority data messages can have a shorter waiting time and are easier to be sent out, thereby speeding up their transmission process and reducing the occupancy of cache space, thereby improving the transmission efficiency of data messages and ensuring that key information can be processed and transmitted faster. For example, for a data message with a priority of K, if the K value is 0, the maximum backoff waiting time with the smallest initial value should be selected. and minimum backoff waiting time As the backoff waiting time of the above-mentioned data message, so as to facilitate its faster transmission; when the message length of the data message is used to determine its backoff waiting time, the initial values of the backoff waiting time determined by the data messages of different lengths are different. For example, for a data message with a length of 256 bytes, the initial values of its maximum backoff waiting time and minimum backoff waiting time may be 6ms and 4ms respectively, while for a data message with a length of 128 bytes, the initial values of its maximum backoff waiting time and minimum backoff waiting time may be 5ms and 3ms respectively; when the message type of the data message is used to determine its backoff waiting time, the initial values of the backoff waiting time determined by different types of data messages are different. For example, for TC For a P data message, the initial values of its maximum backoff waiting time and minimum backoff waiting time may be 2ms and 1ms respectively, while for a CAN data message, the initial values of its maximum backoff waiting time and minimum backoff waiting time may be 3ms and 1ms respectively; when the destination device information of the data message is used to determine its backoff waiting time, the initial value of the backoff waiting time can be determined based on factors such as the real-time requirements, processing capabilities, and network bandwidth of the destination device. Since the real-time requirements and processing capabilities of each destination device are different, the initial values of the backoff time determined by them will also be different. For example, the backoff waiting time for a device with high real-time requirements is smaller than that for a destination device with low real-time requirements. In this way, the characteristic information such as the priority, message length, and message type of the data message is used to determine its backoff waiting time, which can reduce the overall network delay, improve the network throughput and response time, thereby significantly improving the flexibility and efficiency of network communication, and thus improving the overall user experience.
[0090] In some embodiments, in the process of determining the backoff waiting time based on the acquired characteristic information and preset time rules of the data message, it is also necessary to obtain the number of failed transmissions of the above data message, and then use the above characteristic information, preset time rules and the number of failed transmissions to jointly determine the backoff waiting time of the data message. By jointly determining the backoff waiting time based on the above characteristic information, preset time and the number of failed transmissions, the corresponding backoff waiting time can be determined more accurately for different data messages, so as to avoid the situation where the data message waiting time is too long and the data channel is idle, thereby improving the efficiency of data message transmission. Specifically, the backoff waiting time of the data message can be determined in the following ways:
[0091] First, after a data message fails to be sent to the target data channel, the initial value of its backoff waiting time is determined based on the characteristic information, and the number of sending failures is counted. Then, based on the number of sending failures and the initial value of the backoff waiting time, the backoff waiting time is doubled to obtain the corresponding backoff waiting time. For example, for a data message with a priority of K, the initial values of its maximum backoff waiting time and minimum backoff waiting time are determined based on the priority. and And determine that after sending fails i times, the maximum backoff waiting time is The minimum backoff waiting time is Where D max and D min The maximum backoff waiting time and minimum backoff waiting time required to resend a data message after the i-th transmission failure.
[0092] Second, after a data message fails to be sent to the target data channel, the initial value of its backoff waiting time is determined based on the characteristic information, and the number of sending failures is counted. Then, the initial value of the backoff waiting time is multiplied by twice the number of sending failures to obtain the corresponding backoff waiting time. For example, for a data message with a priority of K, the initial values of its maximum backoff waiting time and minimum backoff waiting time are determined based on the priority as follows: and And determine that after sending fails i times, the maximum backoff waiting time is The minimum backoff waiting time is Where D max and D min The maximum backoff waiting time and minimum backoff waiting time required to resend a data message after the i-th transmission failure.
[0093] Third, after a data message fails to be sent to the target data channel, the initial value of its backoff waiting time is determined based on the characteristic information, and the number of its sending failures is counted. Then, the backoff waiting time is calculated based on the number of sending failures, the initial value of the backoff waiting time, and other algorithms to obtain the corresponding backoff waiting time. For example, for a data message with a priority of K, the initial values of its maximum backoff waiting time and minimum backoff waiting time are determined based on the priority as follows: and After determining that the transmission fails i times, the maximum backoff waiting time and the minimum backoff waiting time are accumulated i times, and the accumulated result is the maximum backoff waiting time required for the above data message. and minimum backoff waiting time In the embodiment of the present application, the data message backoff waiting time is an integer multiple of the frame sending time. Since the data message is transmitted in the form of a data frame, each transmission will generate a corresponding frame sending time. Setting the backoff waiting time to an integer multiple of the frame sending time can align the time to ensure that the data channel is idle when the data message is sent from the first cache. In order to adapt to data messages of different priorities, destination devices, etc., it is necessary to further set the backoff waiting time to an integer multiple of the time slot. The time slot must also meet certain restrictions, that is, its value should be one Nth of the time required to send a frame of data message, where N is an integer greater than or equal to 2. This setting can not only meet the situation where the backoff waiting time of the data message is an integer multiple of the frame sending time, but also adapt to the sending requirements of data messages of different priorities. The above-mentioned time slot refers to a fixed time interval, which is used as the basic unit for measuring the backoff waiting time of the data message. The frame sending time of the data message is different, and the corresponding time slot is also different.
[0094] Specifically, for data messages with high priority, they need to be sent to the target data channel in a timely manner. At this time, the calculated backoff waiting time should not be too long, and may even be less than its frame sending time. In this case, a smaller time unit is required to represent the backoff waiting time. At this time, the corresponding time slot is set to one Nth of its frame sending time. This can better and orderly express the backoff waiting time of the data messages with the above priority. For example, the data message with a priority of 0 has high real-time requirements and needs to be sent in a timely manner. At this time, the backoff waiting time of the data message should be small enough, even less than its frame sending time. It is more appropriate to use the time slot determined based on its frame sending time to represent the backoff waiting time.
[0095] In addition, when a high-priority data message is stored in the first cache and waiting for the next transmission, and the next data message stored in the second cache is also being sent, it is necessary to continuously detect the transmission process of the above-mentioned next data message. At this time, if the backoff waiting time of the above-mentioned high-priority data message is too long, it will cause a waste of data channel resources and affect the efficiency of data transmission. Therefore, a smaller time unit is required to represent the backoff waiting time, so that the high-priority data message is ready when the next data message is about to be sent. It can be sent immediately. This setting can not only improve the efficiency of data transmission, but also avoid the waste of data channel resources, thereby improving the overall performance of the vehicle. For example, for a vehicle domain control gateway, it needs to process a variety of different types of CAN bus data forwarding work with bandwidths of 250Kbps, 500Kbps, etc., and the priority, real-time requirements, etc. of each CAN bus data message are different. At this time, the time slot corresponding to the gateway should be one Nth of the minimum time required to send a frame of data message, so as to ensure that it can meet the needs of data transmission and adapt to CAN bus environments with different bandwidths. The above time slot refers to a fixed time interval, which is used as a basic unit for measuring the backoff waiting time of a data message. It can be calculated in many ways, for example, using the typical value calculation method:
[0096]
[0097] Among them, S represents the time slot set for transmitting data messages, and C represents the time required to send a frame of data messages.
[0098] Typically, devices used for data message transmission, such as vehicle domain control gateway devices, will have a certain number and type of built-in caches to temporarily store data messages during data transmission, thereby improving transmission efficiency and reliability. The number and type of these caches are not only closely related to the conflict mechanism for resolving network congestion within the device, but also to the actual needs of users. For example, in high-concurrency, large-data-volume application scenarios, it may be necessary to increase the number of caches to ensure that data messages can be transmitted smoothly and in a timely manner to meet the strict requirements of the vehicle control system for data real-time and accuracy; in the case of network congestion, increase the type of software cache to improve data processing capabilities and reduce direct competition for network resources.
[0099] In an embodiment of the present application, when a data message is sent to a target data channel and it is determined that the data message fails to be sent, a corresponding countermeasure will be triggered, that is, the above data message is stored, for example, it is stored in a first cache, the above first cache is a software cache, which is used to temporarily store data messages that have not been successfully sent, and is managed and controlled by a software algorithm. At this time, if you want to send the above data message to the target data channel again, you need to first determine whether it has reached the corresponding backoff waiting time. When it is determined that it has reached the backoff waiting time, first access the first cache, read the data message from the first cache, and then send the data message to a certain target data channel. If it is successfully sent again, continue to try to send the data message to other target data channels; if it fails to send again, record the number and number of failed transmissions of the above data message, store it in the first cache again, and update the backoff waiting time at the same time, waiting for the next transmission attempt. The above process will be repeated until the above data message is successfully sent to all target data channels. This setting not only ensures that the system can process data messages in an orderly and efficient manner even in the face of transmission failures, but also effectively avoids the problem of data messages being discarded due to continuous retransmission failures, thereby greatly improving the reliability and integrity of data transmission.
[0100] In the embodiment of the present application, it is possible to determine whether the data message has reached its backoff waiting time based on the accumulated time of the data messages that failed to be sent, so that after the backoff waiting time is reached, the data message is sent to the target data channel. Specifically, Figure 3 As shown, the following steps are included:
[0101] Step 301, record the cumulative time of data messages that failed to be sent;
[0102] This step is to record the waiting time of the data message in the first cache by using a built-in time tool of the device, such as a timer, after determining that the data message fails to be sent and is stored in the first cache. The above-mentioned cumulative time refers to the total waiting time of the data message that fails to be sent in the first cache.
[0103] Step 302: After the accumulated time reaches the backoff waiting time, a data message is sent to the target data channel.
[0104] On the basis of step 301, according to the accumulated time of the recorded data messages that failed to be sent, it is determined whether the backoff waiting time has been reached, that is, the accumulated time is compared with the backoff waiting time. When the accumulated time reaches the backoff waiting time, that is, the accumulated time is equal to the backoff waiting time, the data message that failed to be sent is read from the first cache and sent to the target data channel; when the accumulated time does not reach the backoff waiting time, that is, the accumulated time is less than the backoff waiting time, the data message that failed to be sent still needs to wait in the first cache until its accumulated time reaches the backoff waiting time. This can effectively avoid network congestion and resource waste caused by frequent sending failures, while improving the reliability and efficiency of data transmission.
[0105] In an embodiment of the present application, when sending a data message to a target data channel, it is necessary to first read the data message to be sent from the corresponding storage device, for example, read the above data message from the second cache, and then send the data message to the target data channel. The above second cache is a hardware cache, which is used to temporarily store the data message to be sent to improve data access speed and transmission efficiency. After successfully reading the data message at the front of the queue from the second cache and sending it to a target data channel, it is also necessary to determine whether the above data message is sent successfully. If it is sent successfully, continue to try to send the data message to other target data channels; if it fails to send, record its number, and immediately start the corresponding countermeasures, that is, store the data message that failed to send in the first cache, and wait for the next sending. The process can refer to the above embodiment and will not be repeated here. When the above data message has been successfully sent to all target data channels, the next data message is then read from the second cache, and the above data message is sent to the corresponding target data channel.
[0106] In an embodiment of the present application, when sending a data message to a target data channel, if there are data messages in the first cache that are within the backoff waiting time, the gateway will give priority to processing these messages. Even if the next data message to be sent has been read from the second cache at this time, the gateway will first try to send the data message that failed to be sent in the first cache to all target data channels. Only when all these messages are successfully sent, the gateway will consider sending the next data message to be sent read from the second cache.
[0107] In an embodiment of the present application, the first cache and the second cache implement different access mechanisms for storing and retrieving data, wherein the access mechanism of the first cache is defined by a software algorithm, which can be flexibly designed and adjusted according to specific application scenarios and requirements. For example, data packets with higher access frequencies can be read first according to the access frequency of the data; the access mechanism of the second cache is relatively fixed, which includes a first-in-first-out strategy, which sets the data that enters the cache earliest to be removed first, so as to ensure the effective use of the cache space and allow new data to enter. And there is a corresponding relationship between the first cache and the second cache, such as a one-to-one corresponding relationship, and they can both be in a one-to-one corresponding relationship with the drive module, that is, one drive module corresponds to one first cache and one second cache. Setting two types of caches in this way for the transmission of data packets can ensure the normal transmission of data packets of various priorities while effectively avoiding the occurrence of frame loss, thereby improving the overall performance of the vehicle.
[0108] In some embodiments, the above data message can be sent to the target data channel through the driver module, and after determining that the data message fails to be sent to the target data channel through the driver module, the backoff waiting time of the above data message is obtained, and after reaching the backoff waiting time, the data message is read from the first cache, and the above data message is sent to the target data channel through the driver module. Specifically, after determining the specific value of the backoff waiting time of the above data message, a related device, such as a vehicle domain gateway device, is used to start its built-in timer to start timing. When the count value of the timer is equal to the value of the backoff waiting time, the gateway sends the above data message to the target data channel; but if the count value of the timer does not match the value of the backoff waiting time, or an error occurs during the timing process, resulting in a timing failure, then corresponding error processing is performed, such as resetting the timer, or waiting for the next sending opportunity to send the above data message. In this way, the transmission of data messages is completed with the help of the driver module, which can improve the efficiency and reliability of data transmission. The above-mentioned driver module is a data transmission control mechanism, which is used to help complete the transmission of data messages in complex communication networks. That is, when the data message is sent from one device to another device according to the information stored in the source address field and the destination address field, the driver module is required to complete the transmission. The transmission of data messages is realized with the help of the driver module, which can improve the efficiency and reliability of data transmission. In the present application, the above-mentioned driver module includes a sending window.
[0109] In an embodiment of the present application, the above-mentioned data message can be a CAN bus data message, that is, a basic unit of data transmission on a controller area network (CAN) bus, consisting of a frame start, an arbitration segment, a control segment, a data segment, a cyclic redundancy check field, a response field and a frame end, wherein the frame start is composed of a single dominant bit, marking the start of the data frame; the arbitration segment is used to determine the priority of the message, which includes an identifier and a remote transmission request bit, the above-mentioned identifier is used to determine the priority of the message, and the remote transmission request bit is used to indicate whether the data message is a data frame or a request frame; the control segment contains information such as the data length and type of the control data message, which includes a data length code, which is usually composed of 4 data bits, indicating the number of bytes of data in the data segment; the data segment contains the actual data to be transmitted, and its length is controlled by the data length code; the cyclic redundancy check field is used to detect data errors; the response field is used to confirm the normal reception of the data message; the frame end is used to identify the end of the data message. The above-mentioned CAN bus data messages usually include multiple frame types such as data frames, remote frames, error frames and overload frames, and each frame type has its specific purpose and structure to ensure effective communication and error handling on the CAN bus.
[0110] In the embodiments of the present application, there are multiple corresponding relationships between the above-mentioned data message and the driver module, for example, one-to-one, one-to-many, etc., and the corresponding relationship between the data message and the driver module can be determined based on the priority of the data message, the message type of the data message, etc. For example, when the corresponding relationship between the two is determined based on the priority information of the data message, the data message needs to correspond to the driver module one-to-one. For specific content, please refer to the following embodiments. There are also multiple corresponding relationships between the above-mentioned driver module and the data channel, for example, one-to-one, one-to-many, and many-to-many. In this way, setting the driver module to have multiple corresponding relationships with the data message and the data channel can more flexibly adapt to different network communication needs and scenarios.
[0111] In some embodiments, since the above-mentioned driver modules have multiple corresponding relationships with data messages and data channels, the driver modules can be set according to the data channel, the priority of the data message, the message type and other information. For example, when the driver module has a one-to-one relationship with both the data message and the data channel, the driver module is set in the following three cases:
[0112] The first is that if the driver modules are set according to the data channels, it is necessary to ensure that each data channel has a corresponding driver module, that is, the driver modules correspond to the data channels one by one, and the number of driver modules is equal to the number of data channels. For example, if there are n data channels, then n driver modules are set.
[0113] The second is that if the driver module is set according to the priority of the data message, it is necessary to ensure that each priority level has a corresponding driver module, that is, the driver module corresponds to the priority level of the data message one by one, and the number of driver modules is equal to the number of priority levels. For example, if the CAN bus data message includes a level of priority, a driver module is set.
[0114] The third is that if the driver module is set according to the message type of the data message, it is also necessary to ensure that each message type has a corresponding driver module, that is, the driver module corresponds to the message type of the data message one by one, and the number of driver modules is equal to the number of message types. For example, if the CAN bus data message includes m message types, then m driver modules are set.
[0115] In the embodiment of the present application, the above-mentioned gateway device is provided with a first cache and a second cache. The application of the first cache and the second cache can refer to the above-mentioned embodiment and will not be repeated here. Such a setting can not only ensure that the data can be effectively temporarily stored and orderly managed during the transmission process, but also manage the data flow more efficiently, reduce waiting time and potential frame loss risks.
[0116] In the embodiment of the present application, the above-mentioned driver module also has a corresponding correspondence with the first cache and the second cache. For example, the driver module corresponds to the first cache one-to-one; the driver module corresponds to the second cache one-to-one; or the driver module corresponds to the above-mentioned two caches one-to-one at the same time. When the driver module corresponds to the first cache and the second cache one-to-one at the same time, Figure 4 As shown, each driver module independently sets the first cache and / or the second cache, so that the data packets that fail to be sent can be stored in the independent cache of each driver module, thereby better avoiding the problem of affecting the normal transmission of data packets of other driver channels due to the failure of one data packet to be sent, and at the same time avoiding the occurrence of frame loss.
[0117] In an embodiment of the present application, when the driving module is set according to different information, the way in which the second cache stores data will be different. For example, if the driving module is set based on the data channel, then the second cache will store data packets of multiple priorities. This setting can not only effectively avoid blocking the sending of subsequent data packets when the above-mentioned data packets fail to be sent, but also ensure that the data packets can be sent normally to other target data channels, and also avoid the occurrence of frame loss; and if the driving module is set based on the priority of the data packet, then the second cache only stores data packets of a single priority level. For example, when the driving module P is set according to the priority, the second cache only stores data packets with a priority level of P. This setting can not only effectively avoid blocking the sending of subsequent data packets when the above-mentioned data packets fail to be sent, but also ensure that other priority data packets can be sent normally, and also avoid the sending of frame loss.
[0118] In the embodiment of the present application, when the backoff waiting time of the data message and the driving module are determined according to the priority of the data message, and there is a one-to-one correspondence between the driving module and the data message and the data channel, the specific process of sending the data message to the target data channel through the above-mentioned driving module is as follows: Figure 5 As shown, the following steps are included:
[0119] Step 501: a data message that needs to be forwarded arrives at the gateway;
[0120] The data message in this step may be generated by the gateway and needs to be sent to the target data channel, or the gateway receives data from the network protocol and needs to send to the target data channel, for example, a CAN data message received from the CAN bus. At this time, the received CAN will be sent to the corresponding target data channel, that is, the CAN channel. The above-mentioned gateway is a network device or node that converts and transmits data between different network communication protocols, data formats or architectures. In this application, it can be a vehicle domain control gateway.
[0121] Step 502: Determine the priority of the data message and the number of the target data channel;
[0122] After determining in step 501 that a data message that needs to be forwarded has arrived at the gateway, the priority value of the data message and the number of the target data channel to which it needs to be sent are read for subsequent processing. For example, the priority P of data message Y and the number L of the target data channel are read. i The number of the target data channel is stored in the destination address field of the data message and is used to identify the data channel to ensure that the data message can be accurately sent to the corresponding data channel.
[0123] Step 503: store the data message in the second cache P2;
[0124] On the basis of step 502, data packets with the same priority are stored in the second cache corresponding to the priority. For example, data packets Y1, Y2, Y3, ..., Y i All are stored in the same second cache P2.
[0125] Step 504: Send the data message to the driver module;
[0126] This step is to send the data message stored in the second cache in step 503 to the corresponding driver module, such as the sending window, in preparation for sending it to the target data channel later. Specifically, the data message at the front of the second cache queue needs to be sent to the corresponding driver module, and the above data message is read in the second cache according to the first-in-first-out access mechanism; the driver module corresponds to the second cache one by one. For example, data message Y1 is last stored in the second cache P2, that is, it is at the front of the second cache P2 queue, then the data message is read first and sent to the driver module P0.
[0127] Step 505: The driver module attempts to send the data message to the target data channel;
[0128] After the data message is sent to the corresponding driver module in step 504, it is attempted to be sent to all target data channels. For example, after the data message Y1 is sent to the driver module P0, it is sent to all target data channels according to the target data channel number.
[0129] Step 506: Determine whether the data message is sent successfully;
[0130] On the basis of step 505 , it is determined whether the data message is sent successfully. If the data message is sent successfully, step 514 is executed; otherwise, step 507 is executed.
[0131] Step 507: store the data message in the first cache P1;
[0132] After it is determined in the above step 506 that the data message fails to be sent, the number of the target data channel sent this time is recorded, and the above data message is stored in the corresponding first cache P1, and the first cache, the driver module and the second cache correspond to each other. For example, if the data message Y1 fails to be sent to the target data channel P001 through the driver module P0, the number P001 of the above target data channel is recorded, and the data message Y1 is stored in the first cache P1.
[0133] Step 508: The data message waits for a backoff waiting time;
[0134] On the basis of step 507, an initial backoff waiting time is determined based on the priority of the data message, and the timer built into the domain control gateway is used to time the data message so that the data message waits in the first cache for the determined backoff waiting time. The backoff waiting time is pre-set. The higher the priority of the data message, the shorter its backoff waiting time. For example, based on the priority P of the data message Y1, its backoff waiting time D is determined to be The timer starts to count down D, during which the data message Y1 needs to wait in the first buffer P1.
[0135] Step 509: read the data message and send it to the driver module;
[0136] When the timer countdown in step 508 reaches 0, the data message that failed to be sent is read from the first cache P1 and sent to the corresponding driver module. For example, when the timer counts to 0, the data message Y1 is read from the first cache P1 and sent to the driver module P0. At this time, if the next data message Y2 in the second cache P2 also needs to be sent, the data message Y1 stored in the first cache P1 is sent first.
[0137] Step 510: Try again to send the data message to the target data channel through the driver module;
[0138] Based on step 509, the data message sent to the driver module is sent again to the target data channel, which is the data channel when the data message fails to be sent. For example, the data message Y1 in the driver module P0 will be sent again to the target data channel P001.
[0139] Step 511: determine whether the data message is sent successfully;
[0140] After the driver module attempts to send the data message to the target data channel again in step 510, it is determined whether the data message is sent successfully. If it is sent successfully, step 514 is executed, otherwise step 512 is executed.
[0141] Step 512: record the number of times the data message is sent;
[0142] After it is determined in the above step 511 that the data message fails to be sent, the number of times it is sent is recorded for subsequent query and update of the backoff waiting time. For example, after the data message Y1 fails to be sent, the number of times it is sent i is recorded.
[0143] Step 513: Update the backoff waiting time;
[0144] On the basis of step 512, the new backoff waiting time is calculated by using the recorded number of times the data message is sent, the characteristic information of the data message and the preset time rule, so as to achieve the purpose of updating the backoff waiting time. The above-mentioned method of calculating the backoff waiting time can refer to the above-mentioned embodiment and will not be repeated here. For example, if the new backoff waiting time is calculated by doubling the backoff waiting time and the minimum backoff time, and the number of times the data message is sent i=2, the original backoff waiting time The new backoff waiting time Then, step 508 to step 512 are repeated until the data message Y1 is successfully sent to all target data channels.
[0145] Step 514: End data message transmission.
[0146] In this step, after it is determined in step 506 or step 511 that the data message is sent successfully, the transmission of the data message is terminated. At this time, the next data message in the second buffer P2, for example, data message Y2, can be transmitted.
[0147] With the above Figure 1-Figure 5 Corresponding to the provided data message transmission method, the embodiment of the present application provides a corresponding device. Figure 6 This is a structural diagram of a data message transmission device in an example of this application, such as Figure 6 As shown, the data transmission device includes a time determination module 11 and a sending module 12, wherein the time determination module 11 is used to determine the backoff waiting time for a data message that fails to be sent to a target data channel; the sending module 12 is used to send a data message to the target data channel after the backoff waiting time is reached.
[0148] In some embodiments, the above-mentioned determination of the backoff waiting time for the data message that fails to be sent to the target data channel includes:
[0149] Obtain characteristic information of data packets that failed to be sent to the target data channel;
[0150] Based on the characteristic information of the data message and the preset time rule, the backoff waiting time of the data message is determined.
[0151] In some embodiments, the backoff waiting time of the data message includes a maximum backoff waiting time and a minimum backoff waiting time. Based on the characteristic information of the data message and the preset time rule, determining the backoff waiting time of the data message includes:
[0152] Based on the characteristic information of the data message and the preset time rule, the maximum backoff waiting time and the minimum backoff waiting time are determined.
[0153] In some embodiments, it also includes:
[0154] Get the number of failed datagram sending attempts;
[0155] The above-mentioned determining the backoff waiting time of the data message based on the characteristic information of the data message includes:
[0156] The backoff waiting time of the data message is determined based on the characteristic information of the data message, the number of transmission failures of the data message and the preset time rule.
[0157] In some embodiments, the characteristic information of the data message includes at least one of the following:
[0158] The priority of the data message;
[0159] The message length of the data message;
[0160] The message type of the data message;
[0161] Destination device of the data packet.
[0162] In some embodiments, the backoff waiting time is an integer multiple of a time slot, where the time slot is one Nth of the time required to send a frame of data message, where N is an integer greater than or equal to 2.
[0163] In some embodiments, the above method includes:
[0164] When sending a data message to the target data channel fails, the data message that fails to be sent is stored in the first cache.
[0165] In some embodiments, sending a data message to a target data channel includes:
[0166] The data message that failed to be sent is read from the first buffer, and the data message is sent to the target data channel.
[0167] In some embodiments, the first cache is a software cache.
[0168] In some embodiments, the above method includes:
[0169] The data message is read from the second buffer and sent to the target data channel.
[0170] In some embodiments, the second cache is a hardware cache.
[0171] In some embodiments, the above method includes:
[0172] Record the cumulative time of data packets that failed to be sent;
[0173] After the accumulated time reaches the backoff waiting time, the data message is sent to the target data channel.
[0174] In some embodiments, sending a data message to a target data channel includes:
[0175] The data message is sent to the target data channel through the driver module.
[0176] In some embodiments, the above-mentioned driving modules are arranged in one-to-one correspondence with the data channels; or,
[0177] The priority of the driver module and the data message is set one by one; or,
[0178] The driver module and the message type of the data message are set in a one-to-one correspondence.
[0179] In some embodiments, the gateway device is provided with a first cache and a second cache.
[0180] In some embodiments, the driver modules correspond to the first cache in a one-to-one manner, and / or the driver modules correspond to the second cache in a one-to-one manner.
[0181] In some embodiments, the above data message is a CAN bus data message.
[0182] As described above, by using the above-mentioned device to transmit data messages, data can be resent according to the backoff waiting time. While ensuring the normal transmission of data messages of various priorities, it can effectively avoid data messages blocking the transmission of subsequent data messages and the transmission of frame loss situations, thereby optimizing actual vehicle problems such as high gateway forwarding latency and high frame loss rate caused by network congestion, thereby improving the overall performance of the vehicle.
[0183] The present application also provides a gateway device, such as Figure 7 As shown, the gateway device includes a processor 21 and a memory 22, the memory is used to store program codes, and the processor is used to call the program codes in the memory to execute the following Figure 1-Figure 5 Any of the above methods for transmitting data packets.
[0184] In other embodiments, Figure 8 As shown, the embodiment of the present application further provides a gateway device, which may include a receiver 31, a protocol converter 32 and a transmitter 33, and each of the above parts can operate independently. The transmitter 33 may include the processor 21 and the memory 22 in the above embodiment, and execute the program code in the memory 22 to implement the above message transmission method.
[0185] The receiver 31 is used to receive data messages, specifically, to receive data messages from all data channels connected to the vehicle gateway, such as CAN bus, LIN bus, Ethernet, wireless network, diagnostic port and vehicle wireless communication, and transmit these data messages to the protocol converter 32 for further processing. The receiver also needs to have the corresponding functions of receiving data messages of various network protocols, unpacking and decoding data messages, and verifying data integrity.
[0186] The protocol converter 32 is used to perform protocol conversion on data messages. Specifically, it can process and convert data messages from different network protocols such as CAN bus, LIN bus, Ethernet, wireless network, diagnostic interface and vehicle wireless communication network, so as to achieve communication between different network protocols.
[0187] Transmitter 33, such as Fig. 9 As shown, it includes a timer 331, a timer algorithm program 332, N first caches 333, N second caches 334 and N driver modules 335, which are used to send data messages using the above-mentioned data message transmission method. Specifically, the above-mentioned data message transmission method is used to send data messages to data channels such as CAN bus, LIN bus, Ethernet, wireless network, diagnostic interface and vehicle wireless communication network. The above-mentioned timer 331 is mainly used for clock synchronization and records the time information on the network protocol, such as the time information on the CAN bus, and its timing method uses the time slot as the basic time unit; the timing algorithm program 332 is mainly used to store the algorithm for calculating the backoff waiting time; the first cache is used to store data packets that failed to be sent; the second cache is used to store data packets to be sent; the above-mentioned driver module is a data transmission control mechanism, which is used to help data packets complete the sending in a complex communication network, that is, when the data packet is sent from one device to another according to the information stored in the source address field and the destination address field, it is necessary to use the driver module to complete the sending. The transmission of data packets is realized with the help of the driver module, which can improve the efficiency and reliability of data transmission. In the present application, the above-mentioned driver module includes a sending window.
[0188] As described above, the transmission of data messages based on the above-mentioned gateway device can effectively avoid data messages blocking subsequent data messages, and ensure the normal transmission of data messages of other priorities, while also ensuring that data messages will not be discarded due to continuous retransmission failures, thereby optimizing actual vehicle problems such as high gateway forwarding latency and high frame loss rate caused by CAN bus congestion, thereby improving the overall performance of the vehicle.
[0189] In the embodiment of the present application, the above-mentioned gateway device can use Figure 1-Figure 5The data message transmission method completes the transmission of the data message, and if the backoff waiting time of the data message and the driving module are determined according to the priority of the data message, and there is a one-to-one correspondence between the driving module and the data message and the data channel, the data message transmission process is as follows: Fig.10 As shown, the following steps are included:
[0190] Step 1001: A data message that needs to be forwarded arrives at the vehicle gateway;
[0191] The data message in this step may be generated by the vehicle gateway and needs to be sent to the target data channel, or the gateway receives data messages from the network protocol and needs to send to the target data channel, for example, a CAN data message received from the CAN bus. At this time, the received CAN will be sent to the corresponding target data channel, i.e., the CAN channel. The above-mentioned gateway is a network device or node that converts and transmits data between different network communication protocols, data formats or architectures.
[0192] Step 1002: The receiver receives the data message and transmits it to the protocol converter;
[0193] On the basis of step 1001, the data message is received by a receiver in the vehicle gateway, and then the data message is sent from the receiver to the processor.
[0194] Step 1003, the protocol converter determines the priority of the data message and the number of the target data channel;
[0195] In step 1002, after the data message is transmitted to the protocol converter, the priority value of the data message and the number of the target data channel to which it needs to be sent are read for subsequent processing. For example, the priority P of data message Y and the number L of the target data channel are read. i The number of the target data channel is stored in the destination address field of the data message and is used to identify the data channel to ensure that the data message can be accurately sent to the corresponding data channel.
[0196] Step 1004: The protocol converter sends the data message to the second buffer P2 in the transmitter for storage;
[0197] Based on step 1003, the processor sends the data message to the transmitter and stores the data messages with the same priority in the second cache corresponding to the priority, for example, storing the data messages Y1, Y2, Y3, ..., Y i All are stored in the same second cache P2.
[0198] Step 1005: Send the data message to the driver module;
[0199] This step is to send the data message stored in the second cache in step 1004 to the corresponding driver module, in preparation for sending it to the target data channel later. Specifically, the data message at the front of the second cache queue needs to be sent to the corresponding driver module, and the above data message is read in the second cache according to the first-in-first-out access mechanism; the driver module corresponds to the second cache one by one. For example, data message Y1 is stored in the second cache P2 last, that is, it is at the front of the second cache P2 queue, then the data message is read first and sent to the driver module P0.
[0200] Step 1006: The driver module attempts to send the data message to the target data channel;
[0201] After sending the data message to the corresponding driver module in step 1005, an attempt is made to send it to all target data channels. For example, after sending the data message Y1 to the driver module P0, it is sent to all target data channels according to the target data channel number.
[0202] Step 1007: determine whether the data message is sent successfully;
[0203] On the basis of step 1006, it is determined whether the data message is sent successfully. If the data message is sent successfully, step 1015 is executed, otherwise step 1008 is executed.
[0204] Step 1008: store the data message in the first cache P1;
[0205] After it is determined in the above step 1007 that the data message fails to be sent, the number of the target data channel sent this time is recorded, and the above data message is stored in the corresponding first cache, and the first cache, the driver module and the second cache correspond one to one. For example, if the data message Y1 fails to be sent to the target data channel P001 through the driver module P0, the number P001 of the above target data channel is recorded, and the data message Y1 is stored in the first cache P1.
[0206] Step 1009: The data message waits for a backoff waiting time;
[0207] On the basis of step 1008, an initial value of the backoff waiting time is first determined according to the priority of the data message, and the timer built in the domain control gateway is used to time the data message so that the data message waits in the first cache for the determined backoff waiting time. The backoff waiting time is pre-set. The higher the priority of the data message, the shorter its backoff waiting time. For example, according to the priority P of the data message Y1, its backoff waiting time D is determined to be The timer starts to count down D, during which the data message Y1 needs to wait in the first buffer P1.
[0208] Step 1010, read the data message and send it to the driver module;
[0209] When the timer countdown in step 1009 reaches 0, the data message that failed to be sent is read from the first cache and sent to the corresponding driver module. For example, when the timer counts to 0, the data message Y1 is read from the first cache P1 and sent to the driver module P0. At this time, if the next data message Y2 in the second cache P2 also needs to be sent, the data message Y1 stored in the first cache P1 is sent first.
[0210] Step 1011, try again to send the data message to the target data channel through the driver module;
[0211] Based on step 1010, the data message in the driving module is sent again to the target data channel, which is the data channel when the data message fails to be sent. For example, the data message Y1 in the driving module P0 will be sent again to the target data channel P001.
[0212] Step 1012: determine whether the data message is sent successfully;
[0213] After the driver module attempts to send the data message to the target data channel again in step 1011, it is determined whether the data message is sent successfully. If it is sent successfully, step 1015 is executed, otherwise step 1013 is executed.
[0214] Step 1013, record the number of times the data message is sent;
[0215] After it is determined in the above step 1012 that the data message fails to be sent, the number of times it is sent is recorded for subsequent query and update of the backoff waiting time. For example, after the data message Y1 fails to be sent, the number of times it is sent i is recorded.
[0216] Step 1014: Update the backoff waiting time according to the timer algorithm;
[0217] On the basis of step 1013, the new backoff waiting time is calculated by using the recorded number of times the data message is sent and the characteristic information of the data message, so as to achieve the purpose of updating the backoff waiting time. The above timer algorithm is the method for calculating the backoff waiting time. You can refer to the above embodiment and will not repeat it here. For example, if the new backoff waiting time is calculated by doubling the backoff waiting time, and the number of times the data message is sent i=2, the original backoff waiting time The new backoff waiting time Then, repeat steps 1009 to 813 until the data message Y1 is successfully sent to all target data channels. Step 915: End the data message transmission.
[0218] In this step, after it is determined in step 1007 or step 1012 that the data message is sent successfully, the transmission of the data message is terminated. At this time, the next data message in the second cache may be transmitted, for example, data message Y2.
[0219] The present application also provides a gateway system, such as Fig.11 As shown, the system includes a gateway device 41 and an electronic device 42. The gateway device is connected to a plurality of electronic devices for executing the following Figure 1-Figure 5 The data message transmission method.
[0220] In some embodiments, Fig.12 As shown, the above-mentioned gateway system also includes a driver module 43, which is connected to the gateway device and the electronic device respectively, and is used to send the message data received from the gateway device to the electronic device according to the preset sending rules. The above-mentioned preset sending rules are pre-set and provide criteria for sending data messages from the first cache or the second cache to the electronic device through the driving model, so as to better complete the transmission of data messages. Setting a driver module in the gateway system and sending data messages based on the preset sending rules can further improve the efficiency and reliability of data transmission.
[0221] As described above, using the above-mentioned gateway system to realize the transmission of data packets can effectively avoid the occurrence of frame loss while ensuring the normal transmission of data packets of various priorities to cope with potential problems such as network congestion or equipment failure, thereby ensuring the integrity and continuity of data packets from the source to the terminal.
[0222] The present application also provides a vehicle, the vehicle comprising Figure 7-10 The gateway device 51, such as Fig.13 As shown, or as Figure 11-Figure 12 Any of the gateway systems 52, such as Fig.14 As shown, the gateway device can use Figure 1-Figure 5 The data message transmission method is used to realize the transmission of data messages; the gateway system can use Figure 7-10 The gateway device completes the transmission of data messages.
[0223] The present application also provides a computer-readable storage medium, wherein a program or instruction is stored on the computer-readable storage medium, and when the program or instruction is executed by a processor, the following is implemented: Figure 1-Figure 5 The data message transmission method.
[0224] The present application also provides a computer program product, which, when executed by a processor of a vehicle, implements the following Figure 1-Figure 5 The data message transmission method.
[0225] It should be noted that, in this article, the terms "comprise", "include" or any other variant thereof are intended to cover non-exclusive inclusion, so that a process, method, article or device including a series of elements includes not only those elements, but also other elements not explicitly listed, or also includes elements inherent to such process, method, article or device. In the absence of further restrictions, an element defined by the sentence "comprises one..." does not exclude the presence of other identical elements in the process, method, article or device including the element. In addition, it should be pointed out that the scope of the method and device in the embodiment of the present application is not limited to performing functions in the order shown or discussed, and may also include performing functions in a substantially simultaneous manner or in reverse order according to the functions involved, for example, the described method may be performed in an order different from that described, and various steps may also be added, omitted or combined. In addition, the features described with reference to certain examples may be combined in other examples.
[0226] Through the description of the above implementation methods, those skilled in the art can clearly understand that the above-mentioned embodiment methods can be implemented by means of a computer software product plus a necessary general hardware platform, and of course, can also be implemented by hardware. The computer software product is stored in a storage medium (such as ROM, RAM, disk, CD, etc.), including several instructions to enable a terminal or a network-side device to execute the methods described in each embodiment of the present application.
[0227] The embodiments of the present application are described above in conjunction with the accompanying drawings, but the present application is not limited to the above-mentioned specific implementation methods. The above-mentioned specific implementation methods are merely illustrative and not restrictive. Under the guidance of the present application, ordinary technicians in this field can also make many forms of implementation methods without departing from the purpose of the present application and the scope of protection of the claims, and these implementation methods are all within the protection of the present application.
Claims
1. A data message transmission method, characterized in that: Applicable to gateway devices, including: Determine the backoff waiting time for a data message that fails to be sent to a target data channel; After the backoff waiting time is reached, the data message is sent to the target data channel.
2. The method according to claim 1, characterized in that The step of determining a backoff waiting time for a data message that fails to be sent to a target data channel comprises: Obtain characteristic information of data packets that failed to be sent to the target data channel; Based on the characteristic information of the data message and the preset time rule, a backoff waiting time of the data message is determined.
3. The method according to claim 2, characterized in that The backoff waiting time of the data message includes a maximum backoff waiting time and a minimum backoff waiting time, and determining the backoff waiting time of the data message based on the characteristic information of the data message and a preset time rule includes: The maximum backoff waiting time and the minimum backoff waiting time are determined based on the characteristic information of the data message and the preset time rule.
4. The method according to claim 2, characterized in that: Also includes: Obtaining the number of failed transmissions of the data message; The determining the backoff waiting time of the data message based on the characteristic information of the data message and the preset time rule includes: The backoff waiting time of the data message is determined based on the characteristic information of the data message, the number of transmission failures of the data message and a preset time rule.
5. The method according to any one of claims 2 to 4, characterized in that: The characteristic information of the data message includes at least one of the following: The priority of the data message; The message length of the data message; The message type of the data message; The destination device of the data message.
6. The method according to claim 1, characterized in that The backoff waiting time is an integer multiple of a time slot, where the time slot is one Nth of the time required to send a frame of data message, where N is an integer greater than or equal to 2.
7. The method according to claim 1, characterized in that The method comprises: When sending a data message to a target data channel fails, the data message that fails to be sent is stored in a first cache.
8. The method according to claim 7, characterized in that The sending the data message to the target data channel includes: The data message that fails to be sent is read from the first buffer, and the data message is sent to the target data channel.
9. The method according to claim 7 or 8, characterized in that: The first cache is a software cache.
10. The method according to claim 1, characterized in that The method further comprises: The data message is read from the second buffer, and the data message is sent to the target data channel.
11. The method according to claim 10, characterized in that The second cache is a hardware cache.
12. The method according to claim 1, characterized in that The sending the data message to the target data channel after the backoff waiting time is reached includes: Record the cumulative time of data packets that failed to be sent; After determining according to the accumulated time that the backoff waiting time has been reached, the data message is sent to the target data channel.
13. The method according to any one of claims 1 to 12, characterized in that: The sending the data message to the target data channel includes: The data message is sent to the target data channel through a driver module.
14. The method according to claim 13, characterized in that The driving modules are arranged in one-to-one correspondence with the data channels; or, The driver modules are set in one-to-one correspondence with the priorities of the data messages; or, The driving modules are arranged in a one-to-one correspondence with the message types of the data messages.
15. The method according to claim 13, characterized in that The gateway device is provided with a first cache and a second cache.
16. The method according to claim 15, characterized in that The driver module corresponds to the first cache in a one-to-one manner, and / or the driver module corresponds to the second cache in a one-to-one manner.
17. The method according to claim 1, characterized in that The data message is a CAN bus data message.
18. A data message transmission device, characterized in that: include: A time determination module, used to determine a backoff waiting time for a data message that fails to be sent to a target data channel; A sending module is used to send the data message to the target data channel after the backoff waiting time is reached.
19. A gateway device, characterized in that: include: A processor and a memory, wherein the memory is used to store program codes, and the processor is used to call the program codes in the memory to execute the method according to any one of claims 1 to 17.
20. A gateway system, characterized in that: The system includes: a gateway device connected to at least one electronic device, and the gateway device is used to execute the method according to any one of claims 1-17.
21. The gateway system according to claim 20, characterized in that: Also includes: A driving module, wherein the driving modules are connected to the gateway device and the electronic device respectively, and are used to send the message data received from the gateway device to the electronic device according to a preset sending rule.
22. A vehicle, characterized in that: Includes the gateway device described in claim 19, or the gateway system of claim 20 or 21.
23. A computer-readable storage medium, characterized in that: The readable storage medium stores a program or instruction, and when the program or instruction is executed by a processor, the method according to any one of claims 1 to 17 is implemented.
24. A computer program product, characterized in that The method comprises executable instructions for executing the method according to any one of claims 1 to 17 when the executable instructions are executed on a computer.
Citation Information
Patent Citations
Dual-mode communication apparatus, dual-mode communication method, and storage medium
CN114915394A
Multi-source data transmission method and device for drive-by-wire electric automobile, automobile and storage medium
CN115801193A
Message sending method and device, electronic equipment and storage medium
CN117221037A
System and method for radio communication and device
JP2005333360A
Communication devices and methods
US20230231664A1