Methods, devices, vehicles, and storage media for self-learning routing tables of vehicle gateways
By sending request messages to CAN and CANFD networks and building routing tables after powering on the vehicle gateway, the problem of insufficient dynamic adjustment capabilities of traditional vehicle gateways is solved, and dynamic routing table adjustment and intelligence is realized, reducing costs and increasing the Security.
Patent Information
- Application Number
- CN202411278866.9
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2024-09-12
- Publication Date
- 2025-01-14
- Estimated Expiration
- 2044-09-12
AI Technical Summary
Traditional vehicle gateways do not have the ability to adjust dynamically, are low in intelligence, require manual intervention or software upgrades to adapt to network changes, are inefficient and increase maintenance costs.
After powering on the vehicle gateway, the request message is sent to the connected CAN and CANFD networks, the reply information is received, and the routing table is built based on CRC verification, so that the self-learning of dynamically adjusting the routing table is realized.
It realizes dynamic adjustment of routing tables, reduces costs, improves security, and supports multiple communication protocols and interfaces, enhancing system compatibility and scalability.
Smart Images

Figure CN118802712B_ABST
Abstract
Description
Technical Field
[0001] The present invention relates to the field of vehicle-mounted communication technology, and in particular to a vehicle-mounted gateway routing table self-learning method, device, vehicle and storage medium. Background Art
[0002] As a core component of the vehicle's electronic and electrical architecture, the vehicle gateway is mainly responsible for multiple tasks such as data transmission, security control and remote diagnosis.
[0003] In the related technologies, the traditional vehicle gateway is mainly responsible for data communication between the internal devices and sensors of the vehicle. Its routing management is relatively fixed and does not have the ability to be dynamically adjusted. In addition, the traditional vehicle gateway has a low degree of intelligence and mainly performs preset communication tasks. When the network changes, it needs to adapt to the new network environment through manual intervention (re-integration compilation) or software upgrades. This is inefficient and increases maintenance costs, which urgently needs to be solved. Summary of the invention
[0004] The present invention provides a vehicle-mounted gateway routing table self-learning method, device, vehicle and storage medium to solve the problems that traditional vehicle-mounted gateways do not have dynamic adjustment capabilities and low intelligence. The routing table is dynamically adjusted through a self-learning mechanism, which reduces costs and improves safety.
[0005] A first aspect of the present invention provides a method for self-learning a vehicle gateway routing table, comprising the following steps:
[0006] After the current gateway is powered on, a request message is sent to multiple CAN (Controller Area Network) networks and multiple CANFD (CAN with Flexible Data-Rate) networks connected to the vehicle and the current gateway, and a response message is received from each node on each CAN network and each CANFD network.
[0007] Requesting each node on each CAN network and each CANFD network to send their own transmission message ID (Identity Document, unique identification), and receiving first response information based on the first target transmission mode, and verifying the first response information according to the response message;
[0008] Requesting each node on each CAN network and each CANFD network to send their respective received message IDs, receiving second response information based on a second target transmission mode, and verifying the second response information according to the response message;
[0009] If both the first response information and the second response information satisfy a preset verification condition, a routing table is constructed according to the first response information and the second response information.
[0010] According to an embodiment of the present invention, the step of constructing a routing table according to the first response information and the second response information includes:
[0011] Sort each gateway node of the current gateway in ascending order;
[0012] Match the received message ID in the second response information of each gateway node with the sent message ID in the first response information of each node on the local network. If the received message ID in the second response information of each gateway node is different from the sent message ID in the first response information of each node on the local network, compare the received message ID in the second response information of each gateway node with the sent message ID of each node on other network segments until the sent message ID that is the same as the received message ID in the second response information of the gateway node is found, determine the routing information of each network segment, and store the routing information in a non-volatile memory.
[0013] According to one embodiment of the present invention, before receiving the first response information based on the first target transmission mode, the method further includes:
[0014] If the number of message IDs sent in the first response information is less than a first preset threshold value and the current transmission network is a CANFD network, the first target transmission mode is single-frame transmission; if the number of message IDs sent in the first response information is greater than the first preset threshold value and the current transmission network is the CANFD network, the first target transmission mode is multi-frame transmission;
[0015] If the number of message IDs sent in the first response information is less than or equal to a second preset threshold, and the current transmission network is a CAN network, the first target transmission mode is the single-frame transmission; otherwise, the first target transmission mode is multi-frame transmission, wherein the first preset threshold is greater than the second preset threshold.
[0016] According to one embodiment of the present invention, before receiving the second response information based on the second target transmission mode, the method further includes:
[0017] If the number of message IDs sent in the second response information is less than the third preset threshold value and the current transmission network is the CANFD network, the second target transmission mode is single-frame transmission; if the number of message IDs sent in the second response information is greater than the third preset threshold value and the current transmission network is the CANFD network, the second target transmission mode is multi-frame transmission;
[0018] If the number of message IDs sent in the second response information is less than or equal to the fourth preset threshold, and the current transmission network is a CAN network, the second target transmission mode is the single-frame transmission; otherwise, the second target transmission mode is multi-frame transmission, wherein the third preset threshold is greater than the fourth preset threshold.
[0019] According to an embodiment of the present invention, the verifying the first response information according to the response message includes:
[0020] Calculate the first response information based on a preset CRC (Cyclic Redundancy Check) algorithm to obtain a first CRC value;
[0021] If the first CRC value is the same as the original CRC value in the response message, it is determined that the first response information meets the preset verification condition, and the first response information is associated with the established routing table; otherwise, each CAN network and each node on the CANFD network are re-requested to send their respective sending message IDs.
[0022] According to an embodiment of the present invention, the verifying the second response information according to the response message includes:
[0023] Calculate the second response information based on a preset CRC algorithm to obtain a second CRC value;
[0024] If the second CRC value is the same as the original CRC value in the response message, it is determined that the second response information meets the preset verification condition, and the second response information is associated with the established routing table; otherwise, each CAN network and each node on the CANFD network are re-requested to send their respective receive message IDs.
[0025] According to one embodiment of the present invention, after constructing a routing table according to the first response information and the second response information, the method further includes:
[0026] Exit the learning state, clear the related fault codes, send a reset request, and after restarting, perform message routing based on the constructed routing table.
[0027] According to the self-learning method for the vehicle gateway routing table provided by the embodiment of the present invention, after the current gateway is powered on, a request message is sent to the CAN network and CANFD network connected to the vehicle and the current gateway, and a response message returned by each node is received; each node on the request network is requested to send its own sending message ID, and receive the first response information, and verify the first response information; each node on the request network is requested to send its own receiving message ID, and receive the second response information, and verify the second response information; if the first response information and the second response information both meet the preset verification conditions, a routing table is constructed according to the first response information and the second response information. In this way, the problems that the traditional vehicle gateway does not have the dynamic adjustment capability and the low degree of intelligence are solved, and the dynamic adjustment of the routing table is realized through the self-learning mechanism, which reduces the cost and improves the safety.
[0028] A second aspect of the present invention provides a vehicle-mounted gateway routing table self-learning device, comprising:
[0029] The request and response module is used to send request messages to multiple CAN networks and multiple CANFD networks connected to the vehicle and the current gateway after the current gateway is powered on, and receive response messages returned by each node on each CAN network and each CANFD network;
[0030] A first processing module, used for requesting each node on each CAN network and each CANFD network to send their own transmission message ID, and receiving first response information based on a first target transmission mode, and verifying the first response information according to the response message;
[0031] A second processing module is used to request each node on each CAN network and each CANFD network to send their respective received message IDs, receive second response information based on a second target transmission mode, and verify the second response information according to the response message;
[0032] A construction module is used to construct a routing table according to the first response information and the second response information if both the first response information and the second response information meet a preset verification condition.
[0033] According to one embodiment of the present invention, the building module is used to:
[0034] Sort each gateway node of the current gateway in ascending order;
[0035] Match the received message ID in the second response information of each gateway node with the sent message ID in the first response information of each node on the local network. If the received message ID in the second response information of each gateway node is different from the sent message ID in the first response information of each node on the local network, compare the received message ID in the second response information of each gateway node with the sent message ID of each node on other network segments until the sent message ID that is the same as the received message ID in the second response information of the gateway node is found, determine the routing information of each network segment, and store the routing information in a non-volatile memory.
[0036] According to an embodiment of the present invention, before receiving the first response information based on the first target transmission mode, the first processing module is further configured to:
[0037] If the number of message IDs sent in the first response information is less than a first preset threshold value and the current transmission network is a CANFD network, the first target transmission mode is single-frame transmission; if the number of message IDs sent in the first response information is greater than the first preset threshold value and the current transmission network is the CANFD network, the first target transmission mode is multi-frame transmission;
[0038] If the number of message IDs sent in the first response information is less than or equal to a second preset threshold, and the current transmission network is a CAN network, the first target transmission mode is the single-frame transmission; otherwise, the first target transmission mode is multi-frame transmission, wherein the first preset threshold is greater than the second preset threshold.
[0039] According to an embodiment of the present invention, before receiving the second response information based on the second target transmission mode, the second processing module is further used to:
[0040] If the number of message IDs sent in the second response information is less than the third preset threshold value and the current transmission network is the CANFD network, the second target transmission mode is single-frame transmission; if the number of message IDs sent in the second response information is greater than the third preset threshold value and the current transmission network is the CANFD network, the second target transmission mode is multi-frame transmission;
[0041] If the number of message IDs sent in the second response information is less than or equal to the fourth preset threshold, and the current transmission network is a CAN network, the second target transmission mode is the single-frame transmission; otherwise, the second target transmission mode is multi-frame transmission, wherein the third preset threshold is greater than the fourth preset threshold.
[0042] According to one embodiment of the present invention, the first processing module includes:
[0043] Calculate the first response information based on a preset CRC algorithm to obtain a first CRC value;
[0044] If the first CRC value is the same as the original CRC value in the response message, it is determined that the first response information meets the preset verification condition, and the first response information is associated with the established routing table; otherwise, each CAN network and each node on the CANFD network are re-requested to send their respective sending message IDs.
[0045] According to one embodiment of the present invention, the second processing module includes:
[0046] Calculate the second response information based on a preset CRC algorithm to obtain a second CRC value;
[0047] If the second CRC value is the same as the original CRC value in the response message, it is determined that the second response information meets the preset verification condition, and the second response information is associated with the established routing table; otherwise, each CAN network and each node on the CANFD network are re-requested to send their respective receive message IDs.
[0048] According to an embodiment of the present invention, after constructing the routing table according to the first response information and the second response information, the construction module is further used to:
[0049] Exit the learning state, clear the related fault codes, send a reset request, and after restarting, perform message routing based on the constructed routing table.
[0050] According to the in-vehicle gateway routing table self-learning device provided by the embodiment of the present invention, after the current gateway is powered on, a request message is sent to the CAN network and CANFD network connected to the vehicle and the current gateway, and a response message returned by each node is received; each node on the request network is requested to send its own sending message ID, and receive the first response information, and verify the first response information; each node on the request network is requested to send its own receiving message ID, and receive the second response information, and verify the second response information; if the first response information and the second response information both meet the preset verification conditions, a routing table is constructed according to the first response information and the second response information. In this way, the problems that the traditional in-vehicle gateway does not have the dynamic adjustment capability and the low intelligence level are solved, and the routing table is dynamically adjusted through the self-learning mechanism, which reduces the cost and improves the safety.
[0051] A third aspect of the present invention provides a vehicle, comprising: a memory, a processor, and a computer program stored in the memory and executable on the processor, wherein the processor executes the program to implement the vehicle gateway routing table self-learning method as described in the above embodiment.
[0052] A fourth aspect of the present invention provides a computer-readable storage medium, wherein the computer-readable storage medium stores computer instructions, and the computer instructions are used to enable the computer to execute the vehicle gateway routing table self-learning method as described in the above embodiment.
[0053] Beneficial effects of the present invention:
[0054] (1) The vehicle manufacturer does not need to release the vehicle routing table to parts suppliers, thus avoiding the risk of leakage of key vehicle information;
[0055] (2) The gateway with routing self-learning function can be adapted to any vehicle model, which speeds up the vehicle development progress and reduces the development cost;
[0056] (3) The vehicle gateway supports multiple communication protocols and interfaces, and can convert and transmit data between different devices. The vehicle gateway with self-learning routing table of the present invention can further enhance this capability, allowing the vehicle to access more types of devices and sensors, thereby improving the compatibility and scalability of the system;
[0057] (4) With the continuous development of intelligent connected vehicle technology, new communication protocols and devices will continue to emerge. The vehicle gateway with a self-learning routing table proposed in the present invention can quickly adapt to new technologies and new devices through self-learning and updating, ensuring that the vehicle remains advanced and competitive in the future;
[0058] (5) The self-learning routing table vehicle gateway is an important part of the technological innovation of intelligent connected vehicles. Its emergence and development will promote the optimization and upgrading of the vehicle's internal network architecture and provide a more solid foundation for the development of intelligent connected vehicles.
[0059] (6) As ICV technology continues to mature and become more popular, the self-learning routing table on-board gateway will become one of the important standard equipment for vehicles, thereby further accelerating the market application and promotion of ICVs and promoting the development of the automotive industry towards intelligence and networking.
[0060] In summary, the self-learning routing table vehicle gateway has the advantages of improving network efficiency and flexibility, enhancing system compatibility and scalability, improving user experience and security, and promoting the development of intelligent connected vehicles in the field of intelligent connected vehicles, making the self-learning routing table vehicle gateway one of the important directions of the development of intelligent connected vehicle technology.
[0061] Additional aspects and advantages of the present invention will be given in part in the following description and in part will be obvious from the following description, or will be learned through practice of the present invention. BRIEF DESCRIPTION OF THE DRAWINGS
[0062] The above and / or additional aspects and advantages of the present invention will become apparent and easily understood from the following description of the embodiments in conjunction with the accompanying drawings, in which:
[0063] Figure 1 A flowchart of a vehicle gateway routing table self-learning method provided according to an embodiment of the present invention;
[0064] Figure 2 It is a flow chart of a gateway sending a request message to each CAN network and receiving a response message after power-on according to an embodiment of the present invention;
[0065] Figure 3 A flowchart of a gateway requesting each node to send its own Tx message ID and receive first response information according to an embodiment of the present invention;
[0066] Figure 4 This is a flow chart of a gateway requesting each node to send its own Rx message ID and receive first response information according to an embodiment of the present invention;
[0067] Figure 5 A flow chart of a gateway according to an embodiment of the present invention building a routing table by collecting message information of each node Rx and Tx;
[0068] Figure 6 A flowchart of gateway exit learning according to an embodiment of the present invention;
[0069] Figure 7 is an architecture diagram of a vehicle gateway according to an embodiment of the present invention;
[0070] Figure 8 2 is a block diagram of a vehicle gateway routing table self-learning device according to an embodiment of the present invention;
[0071] Fig. 9 A schematic structural diagram of a vehicle provided in an embodiment of the present invention.
[0072] Figure numerals: 10 - vehicle-mounted gateway routing table self-learning device, 100 - request and response module, 200 - first processing module, 300 - second processing module, 400 - construction module; 901 - memory, 902 - processor, 903 - communication interface. DETAILED DESCRIPTION
[0073] Embodiments of the present invention are described in detail below, examples of which are shown in the accompanying drawings, wherein the same or similar reference numerals throughout represent the same or similar elements or elements having the same or similar functions. The embodiments described below with reference to the accompanying drawings are exemplary and are intended to be used to explain the present invention, and should not be construed as limiting the present invention.
[0074] The following describes the vehicle gateway routing table self-learning method, device, vehicle and storage medium according to embodiments of the present invention with reference to the accompanying drawings.
[0075] Before introducing the in-vehicle gateway routing table self-learning method according to an embodiment of the present invention, the evolution process of the in-vehicle gateway and the existing in-vehicle gateway are first introduced.
[0076] Specifically, as a core component of the vehicle's electrical and electronic architecture, the vehicle gateway is responsible for multiple tasks such as data transmission, safety control, and remote diagnosis. As the electrical and electronic architecture evolves from a distributed to a centralized domain architecture, the gateway has also undergone significant changes, and its evolution path can be divided into three stages:
[0077] (1) Traditional CAN gateway under distributed architecture: In the early days of vehicle electronic systems, communication between various systems was mainly carried out through the CAN bus. At this time, the on-board gateway was mainly responsible for data forwarding and routing on the CAN bus.
[0078] (2) Centralized gateway under domain-based architecture: With the increase in vehicle functions and complexity, domain-based electronic and electrical architectures have emerged, such as body domain, chassis domain, power domain, etc. At this time, the vehicle gateway not only needs to process data on the CAN bus, but also needs to coordinate and manage communications between different domains.
[0079] (3) Distributed gateways under the Zonal architecture: In order to further improve the integration and response speed of the vehicle system, a Zonal-based architecture has emerged, which divides the vehicle into different zones. Each zone communicates through a high-speed bus, and the zones are connected through an on-board gateway. The on-board gateway under this architecture needs to have higher data processing capabilities and lower latency.
[0080] Technically, existing vehicle gateways mostly use high-performance processors and advanced communication protocols, such as Ethernet, SOME / IP, etc., to achieve efficient and reliable data transmission. At the same time, in order to ensure the security of vehicle networks, vehicle gateways are also equipped with a variety of security mechanisms, such as data encryption and access control.
[0081] However, existing vehicle gateway technologies face the following problems:
[0082] First, as vehicle functions increase and their complexity increases, the amount of data that the vehicle gateway needs to process is increasing and the complexity is also increasing. Therefore, the vehicle gateway is required to have higher processing capabilities and lower latency, which also increases the difficulty of development and maintenance.
[0083] Second, with the rapid development of Internet of Vehicles technology, the connection between vehicles and external networks is becoming closer and closer, which also brings more security challenges. As a bridge between vehicles and external networks, the vehicle gateway needs to deal with various network attacks and threats to ensure the security of the vehicle network.
[0084] Third, due to the differences in electronic and electrical architectures between different models and manufacturers, the vehicle gateway needs to have good compatibility to support data exchange and communication between different models and manufacturers. However, in actual applications, due to the influence of various factors, the compatibility problem of the vehicle gateway still exists.
[0085] Fourth, high-performance vehicle gateways require advanced processors and communication protocols, which increases manufacturing costs. At the same time, with the increase in vehicle functions and complexity, the software development and maintenance costs of vehicle gateways are also increasing. How to reduce costs while ensuring functionality and performance is an important issue that needs to be solved in the development of vehicle gateway technology.
[0086] Fifth, the degree of customization is high. Due to different car models and different configurations, the routing tables of the gateways are different, resulting in a long development cycle and high development costs. In addition, due to the uneven levels of different suppliers or developers, the degree of consistency is low.
[0087] Sixth, when requirements change, it involves coordination among multiple parties (OEM (Original Equipment Manufacturer) routing table changes - ECU (Electronic Control Unit) supplier evaluation of requirements - requirements negotiation - supplier development - testing - software release to OEM - OEM upgrades ECU software), which makes software maintenance difficult and inefficient.
[0088] Seventh, since the vehicle routing information needs to be released to parts suppliers, the vehicle model EEA architecture information is easily leaked and has poor confidentiality.
[0089] Based on the above problems, the present invention proposes a self-learning method for the on-board gateway routing table. After the current gateway is powered on, the method sends a request message to the CAN network and CANFD network connected to the vehicle and the current gateway, and receives the response message returned by each node; requests each node on the network to send its own sending message ID, and receives the first response information, and verifies the first response information; requests each node on the network to send its own receiving message ID, and receives the second response information, and verifies the second response information; if the first response information and the second response information both meet the preset verification conditions, then the routing table is constructed according to the first response information and the second response information. Thus, the routing table is dynamically adjusted through the self-learning mechanism, which reduces costs and improves safety.
[0090] The vehicle-mounted gateway routing table self-learning method proposed by the present invention is described in detail below.
[0091] Specifically, Figure 1 A schematic diagram of a process flow of a vehicle gateway routing table self-learning method provided by an embodiment of the present invention.
[0092] like Figure 1 As shown, the vehicle-mounted gateway routing table self-learning method includes the following steps:
[0093] In step S101, after the current gateway is powered on, a request message is sent to multiple CAN networks and multiple CANFD networks connected to the vehicle and the current gateway, and a response message returned by each node on each CAN network and each CANFD network is received.
[0094] Specifically, when the current gateway is powered on for the first time after being installed on the vehicle, the embodiment of the present invention defaults to an unlearned state. After the current gateway is powered on, the current gateway sends a request message to multiple CAN networks and multiple CANFD networks connected to the vehicle and the current gateway. The message format is as follows:
[0095] Table 1
[0096]
[0097] Among them, DLC is Data Length Code, and Data is the data field.
[0098] Furthermore, after the nodes on multiple CAN networks and multiple CANFD networks receive the request message sent by the current gateway, each node on each CAN network and each CANFD network returns a response message. Among them, each node on the CANFD network adopts a single-frame transmission mode, and the format of the returned response message is as follows:
[0099] Table 2
[0100]
[0101] Among them, Tx Items is the transmitted data item, Tx ID CRC is the cyclic redundancy check value of the transmitted identifier, RxItems is the received data item, and Rx ID CRC is the cyclic redundancy check value of the received identifier.
[0102] Each node in the CAN network uses TP (Transport Protocol) multi-frame transmission, and the format of the returned response message is as follows:
[0103] Table 3
[0104]
[0105] Among them, Padding is the padding byte.
[0106] In order to facilitate those skilled in the art to understand the process of sending request messages to multiple CAN networks and multiple CANFD networks connected to the vehicle and the current gateway after the current gateway is powered on, and receiving response messages returned by each node on each CAN network and each CANFD network, the following is combined with Figure 3 Provide explanation.
[0107] like Figure 2 As shown, the request and response process includes the following steps:
[0108] S201, start.
[0109] S202, check whether the learning completion flag is true, if so, execute S206, otherwise, execute S202.
[0110] S203: The gateway sends a learning request frame using the functional addressing ID.
[0111] S204, each ECU returns a response frame.
[0112] S205: The gateway creates a data table according to the received response data.
[0113] S206, end.
[0114] In step S102, each node on each CAN network and each CANFD network is requested to send its own transmission message ID, and receive first response information based on the first target transmission mode, and verify the first response information according to the response message.
[0115] Specifically, the current gateway requests each node on each CAN network and each CANFD network to send its own transmit message ID (Tx message ID), the format of which is as follows:
[0116] Table 4
[0117]
[0118] Among them, ReqID (Request IDentifier) is the request identifier.
[0119] Further, each requested node on the CAN network and each CAN FD network returns a first response message.
[0120] Furthermore, in some embodiments, before receiving the first response information based on the first target transmission mode, it also includes: if the number of message IDs sent in the first response information is less than the first preset threshold, and the current transmission network is a CANFD network, then the first target transmission mode is single-frame transmission; if the number of message IDs sent in the first response information is greater than the first preset threshold, and the current transmission network is a CANFD network, then the first target transmission mode is multi-frame transmission; if the number of message IDs sent in the first response information is less than or equal to the second preset threshold, and the current transmission network is a CAN network, then the first target transmission mode is single-frame transmission; otherwise, the first target transmission mode is multi-frame transmission, wherein the first preset threshold is greater than the second preset threshold.
[0121] Among them, the first preset threshold value may be 29, and the second preset threshold value may be 3, which are not specifically limited here.
[0122] Specifically, if the number of message IDs sent in the first response information is less than the first preset threshold (such as 29), and the current transmission network is a CANFD network, it means that all data can be sent in one message, and no additional frames are required for data transmission, that is, the first target transmission mode is single-frame transmission, and the message format is as follows:
[0123] Table 5
[0124]
[0125] Furthermore, if the number of message IDs sent in the first response information is greater than a first preset threshold, and the current transmission network is a CANFD network, the data needs to be divided into multiple frames for transmission, that is, the first target transmission mode is multi-frame transmission.
[0126] Furthermore, if the number of message IDs sent in the first response information is less than or equal to a second preset threshold (such as 3), and the current transmission network is a CAN network, the first target transmission mode is single-frame transmission, otherwise, the first target transmission mode is multi-frame transmission.
[0127] Furthermore, in some embodiments, the first response information is verified according to the response message, including: calculating the first response information based on a preset CRC algorithm to obtain a first CRC value; if the first CRC value is the same as the original CRC value in the response message, it is determined that the first response information meets the preset verification condition, and the first response information is associated with the established routing table, otherwise, each node on each CAN network and each CANFD network is re-requested to send its own sending message ID.
[0128] Among them, the CRC algorithm is a verification method used to detect errors in the data transmission process. The CRC value of the original data is calculated and sent out together with the data transmission. The receiver recalculates the CRC value after receiving the data and compares it with the received CRC value. If the two CRC values match, it is determined that there is no error in the data transmission process; if the two CRC values do not match, it means that the data may be damaged or some errors have occurred.
[0129] Specifically, as described above, when the current gateway is installed and powered on for the first time, a request message is sent to each CAN network, the requesting node returns a response message, and the requested node returns a response message, wherein the returned response message includes a CRC check code (i.e., the original CRC value). In an embodiment of the present invention, the current gateway calculates the first response information to obtain a first CRC value, and compares the calculated first CRC value with the original CRC value in the response message. If the first CRC value is the same as the original CRC value in the response message, it means that no error occurs in the transmission of the first response information data, and it is determined that the first response information meets the preset check condition, i.e., the check is successful, and the first response information is associated with the established routing table.
[0130] Furthermore, if the first CRC value is different from the original CRC value in the response message, it means that an error occurred in the transmission of the first response information data, that is, the verification failed, and each node on each CAN network and each CANFD network is re-requested to send its own sending message ID.
[0131] Therefore, by performing CRC check on the first response information, the integrity of the data is ensured.
[0132] In order to facilitate those skilled in the art to understand the process of the gateway requesting each node to send its own Tx message ID and receiving the first response information in the embodiment of the present invention, the following is combined with Figure 4 Provide explanation.
[0133] like Figure 3 As shown, the request and response process includes the following steps:
[0134] S301, start.
[0135] S302: The gateway sends diagnostic request frames in sequence according to the data table.
[0136] S303, the diagnosed ECU returns a diagnosis response frame.
[0137] S304, calculate whether the TxID CRC is the same as the response message, if yes, execute S306, otherwise, execute S305.
[0138] S305: The gateway resends the diagnosis request frame according to the data table.
[0139] S306: The gateway establishes a data table according to the received response data.
[0140] S307, check whether all network nodes have been traversed, if yes, execute S308, otherwise, execute S302.
[0141] S308, end.
[0142] In step S103, each node on each CAN network and each CANFD network is requested to send its own receiving message ID, and receive the second response information based on the second target transmission mode, and verify the second response information according to the response message.
[0143] Specifically, the current gateway requests each node on each CAN network and each CANFD network to send its own receive message ID (Rx message ID), the format of which is as follows:
[0144] Table 6
[0145]
[0146] Further, each requested node on the CAN network and each CAN FD network returns a second response message.
[0147] Furthermore, in some embodiments, before receiving the second response information based on the second target transmission mode, it also includes: if the number of message IDs sent in the second response information is less than the third preset threshold, and the current transmission network is a CANFD network, then the second target transmission mode is single-frame transmission; if the number of message IDs sent in the second response information is greater than the third preset threshold, and the current transmission network is a CANFD network, then the second target transmission mode is multi-frame transmission; if the number of message IDs sent in the second response information is less than or equal to the fourth preset threshold, and the current transmission network is a CAN network, then the second target transmission mode is single-frame transmission; otherwise, the second target transmission mode is multi-frame transmission, wherein the third preset threshold is greater than the fourth preset threshold.
[0148] Among them, the third preset threshold value may be 19, and the fourth preset threshold value may be 2, which are not specifically limited here.
[0149] Specifically, if the number of received message IDs in the second response information is less than the third preset threshold (such as 19), and the current transmission network is a CANFD network, it means that all data can be sent in one message, and no additional frames are required for data transmission, that is, the second target transmission mode is single-frame transmission, that is, a single-frame CANFD message can contain all Rx ID information:
[0150] Table 7
[0151]
[0152] Among them, Rx DLC (Received Data Length Code) is the received data length code, and CC (Check Code) is the check code.
[0153] Furthermore, if the number of received message IDs in the second response information is greater than the third preset threshold, and the current transmission network is a CANFD network, the data needs to be divided into multiple frames for transmission, that is, the second target transmission mode is multi-frame transmission.
[0154] Furthermore, if the number of received message IDs in the second response information is less than or equal to a fourth preset threshold (such as 2), and the current transmission network is a CAN network, the second target transmission mode is single-frame transmission, otherwise, the second target transmission mode is multi-frame transmission.
[0155] Furthermore, in some embodiments, the second response information is verified according to the response message, including: calculating the second response information based on a preset CRC algorithm to obtain a second CRC value; if the second CRC value is the same as the original CRC value in the response message, it is determined that the second response information meets the preset verification condition, and the second response information is associated with the established routing table, otherwise, each node on each CAN network and each CANFD network is re-requested to send its own receive message ID.
[0156] Specifically, similar to the above-mentioned method of verifying the first response information according to the response message, in an embodiment of the present invention, the current gateway calculates the second response information to obtain a second CRC value, and compares the calculated second CRC value with the original CRC value in the response message. If the second CRC value is the same as the original CRC value in the response message, it means that no error occurs in the transmission process of the second response information data, and it is determined that the second response information meets the preset verification conditions, that is, the verification is successful, and the first response information is associated with the established routing table.
[0157] Furthermore, if the second CRC value is different from the original CRC value in the response message, it means that an error occurred in the transmission of the second response information data, that is, the verification failed, and each node on each CAN network and each CANFD network is re-requested to send its own receive message ID.
[0158] Therefore, by performing CRC check on the second response information, the integrity of the data is ensured.
[0159] In order to facilitate those skilled in the art to understand the process of the gateway requesting each node to send its own Rx message ID and receiving the second response information in the embodiment of the present invention, the following is combined with Figure 4 Provide explanation.
[0160] like Figure 4 As shown, the request and response process includes the following steps:
[0161] S401, start.
[0162] S402, the gateway sends diagnostic request frames in sequence according to the data table.
[0163] S403, the diagnosed ECU returns a diagnosis response frame.
[0164] S404, calculate whether the RxID CRC is the same as the response message, if yes, execute S406, otherwise, execute S405.
[0165] S405: The gateway resends the diagnosis request frame according to the data table.
[0166] S406: The gateway establishes a data table according to the received response data.
[0167] S407, check whether all network nodes have been traversed, if yes, execute S408, otherwise, execute S402.
[0168] S408, end.
[0169] In step S104, if both the first response information and the second response information satisfy the preset verification condition, a routing table is constructed according to the first response information and the second response information.
[0170] Specifically, if both the first response information and the second response information meet the preset verification conditions, that is, the first response information and the second response information are CRC-verified by the preset CRC algorithm and both are successfully verified, then a routing table is constructed according to the first response information and the second response information.
[0171] Furthermore, in some embodiments, a routing table is constructed based on the first response information and the second response information, including: sorting each gateway node of the current gateway in ascending order; matching the received message ID in the second response information of each gateway node with the sent message ID in the first response information of each node on the local network; if the received message ID in the second response information of each gateway node is different from the sent message ID in the first response information of each node on the local network, then comparing the received message ID in the second response information of each gateway node with the sent message ID of each node on other network segments until the sent message ID that is the same as the received message ID in the second response information of the gateway node is found, and determining the routing information of each network segment, and storing the routing information in a non-volatile memory.
[0172] The non-volatile memory may be a non-volatile Flash.
[0173] Specifically, the current gateway first sorts each gateway node in ascending order according to the network management ID, where the network management ID is an identifier used to identify different nodes in the network. Sorting each gateway node ensures that the organization of the routing table is orderly, which is convenient for comparison and search operations.
[0174] Furthermore, the current gateway checks in turn whether the Rx message of each gateway node is a routing message or a local network message. The Rx message is a message received by the gateway node, which may come from other nodes in the same network segment, or may be a message from other network segments that needs to be forwarded through the gateway. For each node's Rx message, the current gateway first compares its Rx ID with the Tx ID (i.e., the identifier of the message sent by the node) of other nodes in the same network segment (i.e., the local network). If the Rx ID matches the Tx ID of a node in the local network, that is, the Rx ID is the same as the Tx ID of a node in the local network, then the Rx message is a local message and does not need to be routed and forwarded through the current gateway; if the Rx ID does not have a matching Tx ID in the local network, then the Rx message is a routing message and needs to be forwarded by the current gateway.
[0175] For messages that need to be routed and forwarded, the current gateway will search for Tx messages with the same ID in nodes in other network segments, and when a matching Tx message is found, it will record the routing information of each network segment, including the source node, destination node, and the routing path between them.
[0176] Furthermore, the current gateway stores the learned routing information in a non-volatile memory (such as Flash) to ensure that the routing information is not lost after the gateway is restarted, thereby ensuring the persistence of the routing table.
[0177] In order to facilitate those skilled in the art to understand the process of constructing a routing table according to the first response information and the second response information in the embodiment of the present invention, the following is a flowchart of the present invention. Figure 5 Provide explanation.
[0178] like Figure 5 As shown, the request and response process includes the following steps:
[0179] S501, start.
[0180] S502, the gateway checks in sequence whether the RxID of each Channel data table is the same as the TxID of each Channel data table. If yes, execute S503, otherwise, execute S502 again.
[0181] S503, determine whether the Channel of RxID is the same as that of TxID, if yes, execute S504, otherwise, execute S505.
[0182] S504, record the ID routing information into the routing table.
[0183] S505: Record as no routing message required.
[0184] S506, determine whether the traversal of each Channel RxID is completed, if yes, execute S507, otherwise, execute S502.
[0185] S507: The gateway stores the routing table in the local non-volatile Flash.
[0186] S508, end.
[0187] Furthermore, in some embodiments, after constructing a routing table according to the first response information and the second response information, it also includes: exiting the learning state, clearing related fault codes, and sending a reset request, and after restarting, performing message routing based on the constructed routing table.
[0188] Specifically, after the current gateway stores the learned routing information, the current gateway exits the learning mode and clears any related fault codes (DTC, Diagnostic Trouble Code). The message is as follows:
[0189] Table 8
[0190]
[0191] Furthermore, the gateway requests to be reset and restarted, the message is as follows:
[0192] Table 9
[0193]
[0194] Furthermore, after restarting, the current gateway implements message routing according to the learned routing table.
[0195] In order to facilitate those skilled in the art to understand the process of exiting the self-learning of the routing table in the embodiment of the present invention, Figure 6 Provide explanation.
[0196] like Figure 6 As shown, the request and response process includes the following steps:
[0197] S601, start.
[0198] S602, the gateway exits the learning state.
[0199] S603, the gateway uses the diagnostic function to address and clear the DTC.
[0200] S604: The gateway uses the diagnostic function addressing to request a reset.
[0201] S605, end.
[0202] Therefore, the gateway determines the routing forwarding relationship in the routing table through self-learning, thereby realizing the mutual routing of information between CAN and CANFD.
[0203] In order to help those skilled in the art to more clearly understand the vehicle gateway routing table self-learning method according to an embodiment of the present invention, the architecture diagram of the vehicle gateway and an example of vehicle gateway self-learning are described in detail below.
[0204] First, the architecture diagram of the vehicle gateway of the present invention is introduced.
[0205] Specifically, if Figure 7 As shown, Figure 7 GW in it is the gateway, CANIF is the CAN driver interface layer, Driver is the gateway driver layer, A line is CANH, B line is CANL, Figure 7 The bus connection and the layered architecture of the gateway's internal software are shown.
[0206] Figure 7 In the process, the gateway driver layer receives the Rx message from the bus, and the CANIF layer looks up the table according to the received message ID. If a message with the same ID is found, the corresponding routing rule can be found, thereby realizing the routing function.
[0207] Furthermore, after the gateway learning is completed, the routing relationship table of each network segment is obtained and stored, as shown in the following table: Example 2 Channels, each Channel has a corresponding routing table.
[0208] Table 10
[0209]
[0210] Among them, SRC Channel (Source Channel) is the source channel, SRC ID (Source Identifier) is the source identifier, GateWay Number is the gateway number, GateWay Channels is the channel set connected to the gateway, and Function is the task performed by the gateway.
[0211] Table 11
[0212]
[0213] Furthermore, after receiving the bus message, the gateway searches the corresponding routing table. After finding the routing rules, it first determines whether the received message DLC is consistent with the defined DLC. If the received message DLC is consistent with the defined DLC, the sending interface function is called to complete the routing forwarding; otherwise, the message is discarded.
[0214] The following is another specific example to introduce the self-learning method of the vehicle gateway routing table.
[0215] Specifically, the gateway is connected to the diagnostic instrument through the OBD (On-Board Diagnostics) port, and the diagnostic instrument sends the learned routing table to the gateway. The process includes the following steps:
[0216] (1) The diagnostic instrument sends a series of requests to make the gateway enter the learning mode. The instructions are as follows:
[0217] Table 12
[0218]
[0219] Wherein, DiagReqID is a diagnostic request identifier.
[0220] (2) The gateway is connected to the diagnostic instrument through the OBD port. The diagnostic instrument sends the learned routing table to the gateway. The specific process is as follows:
[0221] The diagnostic instrument sends a certain network segment to the gateway to receive Rx message information and routing rules, that is, the self-learning routing table.
[0222] Table 13
[0223]
[0224] (3) After receiving the Rx message, the gateway searches the corresponding routing table. After finding the routing rule, it first determines whether the DLC of the received message is consistent with the defined DLC. If they are consistent, it calls the sending interface function to complete the routing forwarding; otherwise, it discards the message.
[0225] Therefore, the self-learning routing vehicle gateway of the embodiment of the present invention has the function of self-learning routing table, can dynamically select the transmission path according to the actual situation of the network, improve the network flexibility, and the self-learning routing vehicle gateway of the embodiment of the present invention also has a higher level of intelligence, can self-learn and optimize the routing table, and adapt to the complex and changeable network environment. In addition, it can also automatically sense and adapt to changes in the network environment without manual intervention.
[0226] According to the self-learning method of the vehicle gateway routing table proposed in the embodiment of the present invention, after the current gateway is powered on, a request message is sent to the CAN network and CANFD network connected to the vehicle and the current gateway, and a response message returned by each node is received; each node on the request network is requested to send its own sending message ID, and receive the first response information, and verify the first response information; each node on the request network is requested to send its own receiving message ID, and receive the second response information, and verify the second response information; if the first response information and the second response information both meet the preset verification conditions, a routing table is constructed according to the first response information and the second response information. In this way, the problems that the traditional vehicle gateway does not have the dynamic adjustment capability and the low intelligence level are solved, and the dynamic adjustment of the routing table is realized through the self-learning mechanism, which reduces the cost and improves the safety.
[0227] Next, the vehicle-mounted gateway routing table self-learning device proposed according to an embodiment of the present invention is described with reference to the accompanying drawings.
[0228] Figure 8 It is a block diagram of a vehicle gateway routing table self-learning device according to an embodiment of the present invention.
[0229] like Figure 8 As shown, the vehicle-mounted gateway routing table self-learning device 10 includes: a request and response module 100 , a first processing module 200 , a second processing module 300 and a construction module 400 .
[0230] Among them, the request and response module 100 is used to send request messages to multiple CAN networks and multiple CANFD networks connected to the vehicle and the current gateway after the current gateway is powered on, and receive response messages returned by each CAN network and each node on each CANFD network; the first processing module 200 is used to request each CAN network and each node on each CANFD network to send their own sending message ID, and receive the first response information based on the first target transmission mode, and verify the first response information according to the response message; the second processing module 300 is used to request each CAN network and each node on each CANFD network to send their own receiving message ID, and receive the second response information based on the second target transmission mode, and verify the second response information according to the response message; the construction module 400 is used to construct a routing table according to the first response information and the second response information if both the first response information and the second response information meet the preset verification conditions.
[0231] Furthermore, in some embodiments, the construction module 400 is used to: sort each gateway node of the current gateway in ascending order; match the received message ID in the second response information of each gateway node with the sent message ID in the first response information of each node on the local network; if the received message ID in the second response information of each gateway node is different from the sent message ID in the first response information of each node on the local network, then compare the received message ID in the second response information of each gateway node with the sent message ID of each node on other network segments until the sent message ID that is the same as the received message ID in the second response information of the gateway node is found, and determine the routing information of each network segment, and store the routing information in a non-volatile memory.
[0232] Further, in some embodiments, before receiving the first response information based on the first target transmission mode, the first processing module 200 is also used to: if the number of message IDs sent in the first response information is less than the first preset threshold and the current transmission network is a CANFD network, the first target transmission mode is single-frame transmission; if the number of message IDs sent in the first response information is greater than the first preset threshold and the current transmission network is a CANFD network, the first target transmission mode is multi-frame transmission; if the number of message IDs sent in the first response information is less than or equal to the second preset threshold and the current transmission network is a CAN network, the first target transmission mode is single-frame transmission; otherwise, the first target transmission mode is multi-frame transmission, wherein the first preset threshold is greater than the second preset threshold.
[0233] Further, in some embodiments, before receiving the second response information based on the second target transmission mode, the second processing module 300 is also used to: if the number of message IDs sent in the second response information is less than the third preset threshold and the current transmission network is the CANFD network, the second target transmission mode is single-frame transmission; if the number of message IDs sent in the second response information is greater than the third preset threshold and the current transmission network is the CANFD network, the second target transmission mode is multi-frame transmission; if the number of message IDs sent in the second response information is less than or equal to the fourth preset threshold and the current transmission network is the CAN network, the second target transmission mode is single-frame transmission; otherwise, the second target transmission mode is multi-frame transmission, wherein the third preset threshold is greater than the fourth preset threshold.
[0234] Further, in some embodiments, the first processing module 200 includes: calculating the first response information based on a preset CRC algorithm to obtain a first CRC value; if the first CRC value is the same as the original CRC value in the response message, determining that the first response information meets the preset verification condition, and associating the first response information with the established routing table, otherwise, re-requesting each CAN network and each node on each CANFD network to send their respective sending message IDs.
[0235] Further, in some embodiments, the second processing module 300 includes: calculating the second response information based on a preset CRC algorithm to obtain a second CRC value; if the second CRC value is the same as the original CRC value in the response message, determining that the second response information meets the preset verification condition, and associating the second response information with the established routing table, otherwise, re-requesting each CAN network and each node on each CANFD network to send their respective receive message IDs.
[0236] Further, in some embodiments, after constructing a routing table based on the first response information and the second response information, the construction module 400 is also used to: exit the learning state, clear related fault codes, and send a reset request, and after restarting, perform message routing based on the constructed routing table.
[0237] It should be noted that the aforementioned explanation of the embodiment of the vehicle gateway routing table self-learning method is also applicable to the vehicle gateway routing table self-learning device of this embodiment, and will not be repeated here.
[0238] According to the vehicle gateway routing table self-learning device proposed in the embodiment of the present invention, after the current gateway is powered on, a request message is sent to the CAN network and CANFD network connected to the vehicle and the current gateway, and a response message returned by each node is received; each node on the request network is requested to send its own sending message ID, and receive the first response information, and verify the first response information; each node on the request network is requested to send its own receiving message ID, and receive the second response information, and verify the second response information; if the first response information and the second response information both meet the preset verification conditions, a routing table is constructed according to the first response information and the second response information. In this way, the problems that the traditional vehicle gateway does not have the dynamic adjustment capability and the low intelligence level are solved, and the dynamic adjustment of the routing table is realized through the self-learning mechanism, which reduces the cost and improves the safety.
[0239] Fig. 9 A schematic diagram of the structure of a vehicle provided in an embodiment of the present invention. The vehicle may include:
[0240] A memory 901 , a processor 902 , and a computer program stored in the memory 901 and executable on the processor 902 .
[0241] When the processor 902 executes the program, the vehicle gateway routing table self-learning method provided in the above embodiment is implemented.
[0242] Furthermore, the vehicle also includes:
[0243] The communication interface 903 is used for communication between the memory 901 and the processor 902 .
[0244] The memory 901 is used to store computer programs that can be executed on the processor 902 .
[0245] The memory 901 may include a high-speed RAM memory, and may also include a non-volatile memory (non-volatile memory), such as at least one disk memory.
[0246] If the memory 901, the processor 902 and the communication interface 903 are implemented independently, the communication interface 903, the memory 901 and the processor 902 can be connected to each other through a bus and communicate with each other. The bus can be an Industry Standard Architecture (ISA) bus, a Peripheral Component Interconnect (PCI) bus or an Extended Industry Standard Architecture (EISA) bus. The bus can be divided into an address bus, a data bus, a control bus, etc. For ease of representation, Fig. 9 Only one thick line is used in the diagram, but this does not mean that there is only one bus or only one type of bus.
[0247] Optionally, in a specific implementation, if the memory 901, the processor 902 and the communication interface 903 are integrated on a chip, the memory 901, the processor 902 and the communication interface 903 can communicate with each other through an internal interface.
[0248] The processor 902 may be a central processing unit (CPU), or an application specific integrated circuit (ASIC), or one or more integrated circuits configured to implement the embodiments of the present invention.
[0249] An embodiment of the present invention further provides a computer-readable storage medium having a computer program stored thereon, which, when executed by a processor, implements the above-mentioned vehicle-mounted gateway routing table self-learning method.
[0250] In the description of this specification, the description with reference to the terms "one embodiment", "some embodiments", "example", "specific example", or "some examples" etc. means that the specific features, structures, materials or characteristics described in conjunction with the embodiment or example are included in at least one embodiment or example of the present invention. In this specification, the schematic representations of the above terms do not necessarily refer to the same embodiment or example. Moreover, the specific features, structures, materials or characteristics described may be combined in any one or N embodiments or examples in a suitable manner. In addition, those skilled in the art may combine and combine the different embodiments or examples described in this specification and the features of the different embodiments or examples, without contradiction.
[0251] In addition, the terms "first" and "second" are used for descriptive purposes only and should not be understood as indicating or implying relative importance or implicitly indicating the number of the indicated technical features. Therefore, the features defined as "first" and "second" may explicitly or implicitly include at least one of the features. In the description of the present invention, the meaning of "N" is at least two, such as two, three, etc., unless otherwise clearly and specifically defined.
[0252] Any process or method description in a flowchart or otherwise described herein may be understood to represent a module, fragment or portion of code comprising one or more executable instructions for implementing the steps of a custom logical function or process, and the scope of the preferred embodiments of the present invention includes alternative implementations in which functions may not be performed in the order shown or discussed, including performing functions in a substantially simultaneous manner or in reverse order depending on the functions involved, which should be understood by technicians in the technical field to which the embodiments of the present invention belong.
[0253] The logic and / or steps represented in the flowchart or otherwise described herein, for example, can be considered as an ordered list of executable instructions for implementing logical functions, and can be embodied in any computer-readable medium for use by an instruction execution system, device or apparatus (such as a computer-based system, a system including a processor, or other system that can fetch instructions from an instruction execution system, device or apparatus and execute instructions), or in combination with these instruction execution systems, devices or apparatuses. For the purposes of this specification, "computer-readable medium" can be any device that can contain, store, communicate, propagate or transmit a program for use by an instruction execution system, device or apparatus, or in combination with these instruction execution systems, devices or apparatuses. More specific examples (non-exhaustive list) of computer-readable media include the following: an electrical connection with one or N wirings (electronic device), a portable computer disk box (magnetic device), a random access memory (RAM), a read-only memory (ROM), an erasable and programmable read-only memory (EPROM or flash memory), an optical fiber device, and a portable compact disk read-only memory (CDROM). In addition, the computer-readable medium may even be paper or other suitable medium on which the program is printed, since the program may be obtained electronically, for example, by optically scanning the paper or other medium and then editing, interpreting or processing in other suitable ways if necessary, and then stored in a computer memory.
[0254] It should be understood that the various parts of the present invention can be implemented by hardware, software, firmware or a combination thereof. In the above embodiment, the N steps or methods can be implemented by software or firmware stored in a memory and executed by a suitable instruction execution system. For example, if implemented by hardware, as in another embodiment, it can be implemented by any one of the following technologies known in the art or their combination: a discrete logic circuit having a logic gate circuit for implementing a logic function for a data signal, a dedicated integrated circuit having a suitable combination of logic gate circuits, a programmable gate array (PGA), a field programmable gate array (FPGA), etc.
[0255] A person skilled in the art may understand that all or part of the steps in the method for implementing the above-mentioned embodiment may be completed by instructing related hardware through a program, and the program may be stored in a computer-readable storage medium, which, when executed, includes one or a combination of the steps of the method embodiment.
[0256] In addition, each functional unit in each embodiment of the present invention may be integrated into a processing module, or each unit may exist physically separately, or two or more units may be integrated into one module. The above-mentioned integrated module may be implemented in the form of hardware or in the form of a software functional module. If the integrated module is implemented in the form of a software functional module and sold or used as an independent product, it may also be stored in a computer-readable storage medium.
[0257] The storage medium mentioned above may be a read-only memory, a magnetic disk or an optical disk, etc. Although the embodiments of the present invention have been shown and described above, it can be understood that the above embodiments are exemplary and cannot be understood as limiting the present invention. A person of ordinary skill in the art may change, modify, replace and modify the above embodiments within the scope of the present invention.
Claims
1. A vehicle gateway routing table self-learning method, characterized in that: The following steps are involved: After the current gateway is powered on, a request message is sent to multiple CAN networks and multiple CANFD networks connected to the vehicle and the current gateway, and a response message is received from each node on each CAN network and each CANFD network; Requesting each node on each CAN network and each CANFD network to send their own transmission message ID, and receiving first response information based on the first target transmission mode, and verifying the first response information according to the response message; Requesting each node on each CAN network and each CANFD network to send their respective received message IDs, receiving second response information based on a second target transmission mode, and verifying the second response information according to the response message; If both the first response information and the second response information meet the preset verification condition, constructing a routing table according to the first response information and the second response information; Among them, the construction of a routing table based on the first response information and the second response information includes: sorting each gateway node of the current gateway in ascending order; matching the received message ID in the second response information of each gateway node with the sent message ID in the first response information of each node on the local network; if the received message ID in the second response information of each gateway node is different from the sent message ID in the first response information of each node on the local network, then comparing the received message ID in the second response information of each gateway node with the sent message ID of each node on other network segments until the sent message ID that is the same as the received message ID in the second response information of the gateway node is found, and determining the routing information of each network segment, and storing the routing information in a non-volatile memory.
2. The vehicle gateway routing table self-learning method according to claim 1, characterized in that: Before receiving the first response information based on the first target transmission mode, the method further includes: If the number of message IDs sent in the first response information is less than a first preset threshold value and the current transmission network is a CANFD network, the first target transmission mode is single-frame transmission; if the number of message IDs sent in the first response information is greater than the first preset threshold value and the current transmission network is the CANFD network, the first target transmission mode is multi-frame transmission; If the number of message IDs sent in the first response information is less than or equal to a second preset threshold, and the current transmission network is a CAN network, the first target transmission mode is the single-frame transmission; otherwise, the first target transmission mode is multi-frame transmission, wherein the first preset threshold is greater than the second preset threshold.
3. The vehicle gateway routing table self-learning method according to claim 1, characterized in that: Before receiving the second response information based on the second target transmission mode, the method further includes: If the number of message IDs sent in the second response information is less than the third preset threshold value and the current transmission network is the CANFD network, the second target transmission mode is single-frame transmission; if the number of message IDs sent in the second response information is greater than the third preset threshold value and the current transmission network is the CANFD network, the second target transmission mode is multi-frame transmission; If the number of message IDs sent in the second response information is less than or equal to the fourth preset threshold, and the current transmission network is a CAN network, the second target transmission mode is the single-frame transmission; otherwise, the second target transmission mode is multi-frame transmission, wherein the third preset threshold is greater than the fourth preset threshold.
4. The vehicle gateway routing table self-learning method according to claim 1, characterized in that: The verifying the first response information according to the response message includes: Calculate the first response information based on a preset CRC algorithm to obtain a first CRC value; If the first CRC value is the same as the original CRC value in the response message, it is determined that the first response information meets the preset verification condition, and the first response information is associated with the established routing table; otherwise, each CAN network and each node on the CANFD network are re-requested to send their respective sending message IDs.
5. The vehicle gateway routing table self-learning method according to claim 1, characterized in that: The verifying the second response information according to the response message includes: Calculate the second response information based on a preset CRC algorithm to obtain a second CRC value; If the second CRC value is the same as the original CRC value in the response message, it is determined that the second response information meets the preset verification condition, and the second response information is associated with the established routing table; otherwise, each CAN network and each node on the CANFD network are re-requested to send their respective receive message IDs.
6. The vehicle gateway routing table self-learning method according to claim 1, characterized in that: After constructing a routing table according to the first response information and the second response information, the method further includes: Exit the learning state, clear the related fault codes, send a reset request, and after restarting, perform message routing based on the constructed routing table.
7. A vehicle-mounted gateway routing table self-learning device, characterized in that: include: The request and response module is used to send request messages to multiple CAN networks and multiple CANFD networks connected to the vehicle and the current gateway after the current gateway is powered on, and receive response messages returned by each node on each CAN network and each CANFD network; A first processing module, used for requesting each node on each CAN network and each CANFD network to send their own transmission message ID, and receiving first response information based on a first target transmission mode, and verifying the first response information according to the response message; A second processing module is used to request each node on each CAN network and each CANFD network to send their respective received message IDs, receive second response information based on a second target transmission mode, and verify the second response information according to the response message; A construction module, configured to construct a routing table according to the first response information and the second response information if both the first response information and the second response information meet a preset verification condition; Among them, the construction module is used to: sort each gateway node of the current gateway in ascending order; match the received message ID in the second response information of each gateway node with the sent message ID in the first response information of each node on the local network; if the received message ID in the second response information of each gateway node is different from the sent message ID in the first response information of each node on the local network, then compare the received message ID in the second response information of each gateway node with the sent message ID of each node on other network segments until the sent message ID that is the same as the received message ID in the second response information of the gateway node is found, and determine the routing information of each network segment, and store the routing information in a non-volatile memory.
8. A vehicle, characterized in that: include: A memory, a processor, and a computer program stored in the memory and executable on the processor, wherein the processor executes the program to implement the vehicle gateway routing table self-learning method as described in any one of claims 1 to 6.
9. A computer-readable storage medium having a computer program stored thereon, characterized in that: The computer program is executed by a processor to implement the vehicle gateway routing table self-learning method as described in any one of claims 1 to 6.
Citation Information
Patent Citations
Communication method of network node and related device
CN115834464A
Data transmission method and device, equipment and storage medium
CN117014361A