CAN message routing method, system and device based on AutoSar and medium
By designing the CAN routing intermediate module and dynamically adjusting the routing table in the AutoSar architecture, the problem of cumbersome configuration of CAN packet routing and inability to cope with dynamic network topology is solved, and the support for intelligent routing and customized transmission needs is achieved.
Patent Information
- Application Number
- CN202510030844.9
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2025-01-08
- Publication Date
- 2025-04-18
AI Technical Summary
Under the AutoSar architecture, CAN packet routing has problems such as cumbersome configuration, difficulty in modifying, and lack of customized interfaces, and cannot cope with dynamic network topology.
Design the CAN routing intermediate module, add the initial routing table, define the user interface, and add it to the CAN interface module of the AutoSar topology and the PDU routing module, establish the connection between the user interface and the application module, and dynamically adjust the routing table through the user interface.
It realizes intelligent routing of CAN packets, can flexibly adapt to network changes, simplifies the configuration process, improves routing efficiency and flexibility, and supports customized modification of transmission requirements.
Smart Images

Figure CN119854195A_ABST
Abstract
Description
Technical Field
[0001] The present invention belongs to the technical field of vehicle control system communication, and in particular relates to a CAN message routing method, system, device and medium based on AutoSar. Background Art
[0002] AutoSar, short for Automotive Open System Architecture, is an automotive open architecture system.
[0003] With the development of automotive electronic technology, the electronic control system inside the vehicle is becoming more and more complex, and the communication demand is also increasing. As the core communication control part of the automotive electronic control system, the CAN bus plays a very important role in vehicle communication. The AutoSar architecture currently used by mainstream vehicles consists of the CAN driver module, CAN interface module, PDU routing module, COM communication service module, and application module from bottom to top.
[0004] The current routing of CAN messages under the AutoSar architecture has the following problems: First, CAN message forwarding is completed through the PDU routing module, but the configuration method needs to be done manually, the configuration process is cumbersome, and the routing path and routing ID are difficult to modify once they are determined; if the routing information in the CAN network changes, it needs to be reconfigured, which wastes a lot of time. Secondly, although there are currently routing strategies for CAN messages, there is no special interface for the processing of CAN messages under the AutoSar architecture, resulting in the inability to quickly and effectively customize the transmission requirements of CAN messages. Finally, the current routing strategy for CAN messages is based on a priori routing table, focusing on the routing implementation of CAN messages and the mutual conversion of data between CAN and Ethernet. In fact, it is still the function of the PDU routing module under the AutoSar architecture, that is, the existing CAN message routing strategy is still a static routing table that cannot cope with dynamic network topology. Summary of the invention
[0005] In a first aspect, an embodiment of the present application provides a CAN message routing method based on AutoSar, comprising the following steps: S1. Design the CAN routing intermediate module, add the initial routing table, define the user interface, and add the CAN routing intermediate module between the CAN interface module and the PDU routing module of the original AutoSar topology, and establish the connection between the user interface and the application module; S2. Identify routing rule adjustment requirements through the user interface and dynamically adjust the initial routing table; S3. The CAN routing intermediate module determines the routing path and target message of the original CAN message received through the CAN interface module according to the routing table, and provides the target message to the CAN interface module for forwarding according to the routing path, and transmits the original CAN message to the PDU routing module for transmission within the CAN node.
[0006] Furthermore, the specific steps of step S1 are as follows: S11. Design the CAN routing intermediate module and add the initial routing table; the fields of the initial routing table include the original message ID, the target message ID, the routing priority, the routing node, the message length, and whether to route; S12. Define the user interface in the CAN routing intermediate module; S13. Obtain the original AutoSar topology; S14. Add the designed CAN routing intermediate module between the CAN interface module and the PDU routing module; S15. Establish a connection between the application module and the user interface.
[0007] Furthermore, the specific steps of step S2 are as follows: S21. Determine whether the user's routing rule adjustment needs are recognized through the user interface; If yes, go to step S22; If not, proceed to step S3; S22. Analyze the routing rule adjustment requirements, adjust the initial routing table saved by the CAN routing intermediate module, and obtain the current routing table.
[0008] Furthermore, the specific steps of step S3 are as follows: S31. The CAN interface module receives the original CAN message and provides it to the CAN routing intermediate module; S32. The CAN routing intermediate module matches the original message with the routing field in the initial routing table or the current routing table; If the required route is matched, go to step S33; If no routing is required, go to step S34; S33. The CAN routing intermediate module encapsulates the target message and searches for the routing path according to the initial routing table or the current routing table, and provides the encapsulated target message to the CAN interface module for forwarding according to the found routing path; S34.CAN routing intermediate module transmits the original message to PDU routing module, COM communication service module and application module in sequence for message processing.
[0009] Furthermore, the specific steps of step S31 are as follows: S311. When the CAN controller detects that there is message communication on the CAN bus, it stores the original message in the buffer and triggers a receive interrupt; S312. The CAN driver module responds to the interrupt and provides the original message in the buffer to the CAN interface module; S313. The CAN interface module provides the original message to the CAN routing intermediate module.
[0010] Furthermore, the specific steps of step S32 are as follows: S321 CAN routing intermediate module extracts the target message ID from the original message and compares it with the ID of the CAN terminal device; If there is a consistent item, go to step S322; If there is no consistent item, the original message is discarded and the process returns to step S2; S322. Determine whether the initial routing table has been adjusted; If so, the CAN routing intermediate module matches the original message ID in the original message with the routing field in the current routing table; If not, the CAN routing intermediate module matches the original message ID in the original message with the routing field in the initial routing table; S323. Determine whether the matching result requires routing; If yes, go to step S33; If not, proceed to step S34; The specific steps of step S33 are as follows: S331. Determine whether the initial routing table has been adjusted; If so, the CAN routing intermediate module matches the original message ID in the original message with the target message ID, routing priority, routing node, and message length in the current routing table; If not, the CAN routing intermediate module matches the original message ID in the original message with the target message ID, routing priority, routing node and message length in the initial routing table; S332. The CAN routing intermediate module encapsulates the target message according to the found target message ID, routing priority, routing node and message length, and determines the routing path according to the routing node; S333. The CAN routing intermediate module provides the encapsulated target message and routing path to the CAN interface module for sending the target message.
[0011] Furthermore, the specific steps of step S34 are as follows: S341. The CAN routing intermediate module provides the original message to the COM communication service module; The S342.COM communication service module unpacks and processes the original message, and then notifies the application module; S343. The application module executes corresponding business logic according to the unpacking and processing results of the original message.
[0012] In a second aspect, the embodiment of the present application further provides a CAN message routing system based on AutoSar, comprising: CAN routing intermediate module design unit, used to design the CAN routing intermediate module, add the initial routing table, define the user interface, add the CAN interface module between the CAN interface module and the PDU routing module of the original AutoSar topology, and establish the connection between the user interface and the application module; A routing table adjustment unit, used to identify routing rule adjustment requirements through a user interface and dynamically adjust the initial routing table; The CAN message routing unit is used to enable the CAN routing intermediate module to determine the routing path and target message of the original CAN message received through the CAN interface module according to the routing table, and provide the target message to the CAN interface module for forwarding according to the routing path, and transmit the original CAN message to the PDU routing module for transmission inside the CAN node.
[0013] In a third aspect, an embodiment of the present application further provides an electronic device, comprising a memory, a processor, and a computer program stored in the memory and executable on the processor, wherein when the processor executes the program, the steps of the CAN message routing method based on AutoSar as described in the first aspect are implemented.
[0014] In a fourth aspect, an embodiment of the present application further provides a storage medium having a computer program stored thereon, and when the computer program is executed by a processor, the steps of the CAN message routing method based on AutoSar as described in the first aspect are implemented.
[0015] It can be seen from the above technical solutions that the present invention has the following advantages: In the AutoSar-based CAN message routing method, system, device and medium provided in the present application, intelligent routing of CAN messages is achieved by introducing a CAN routing intermediate module and adding an initial routing table therein. Not only is routing achieved based on a priori routing tables, but routing strategies can also be dynamically adjusted according to changes in network topology. A special interface is provided for the routing strategy under the AutoSar architecture, so that users can quickly and effectively customize the transmission requirements of CAN messages, thereby achieving dynamic adjustment of the initial routing table, simplifying the configuration process, and avoiding the tedious manual configuration. At the same time, it also makes the adjustment of routing paths and routing IDs more flexible, which can adapt to real-time changes in routing information in the CAN network and reduce the time and resources required for reconfiguration. BRIEF DESCRIPTION OF THE DRAWINGS
[0016] In order to more clearly illustrate the technical solution of the present invention, the accompanying drawings required for use in the description will be briefly introduced below. Obviously, the accompanying drawings in the following description are only some embodiments of the present invention. For ordinary technicians in this field, other accompanying drawings can be obtained based on these accompanying drawings without paying creative work.
[0017] Figure 1 It is a flow chart of the CAN message routing method based on AutoSar of the present invention.
[0018] Figure 2 It is a schematic diagram of the CAN message routing system based on AutoSar of the present invention.
[0019] Figure 3 Schematic diagram of a routing table of the present invention. DETAILED DESCRIPTION
[0020] In the specific steps of the CAN message routing method based on AutoSar, which will be described in detail below, various embodiments of the present disclosure will be described more fully. The present disclosure may have various embodiments, and adjustments and changes may be made therein. However, it should be understood that there is no intention to limit the various embodiments of the present disclosure to the specific embodiments disclosed herein, but rather the present disclosure should be understood to cover all adjustments, equivalents and / or alternatives that fall within the spirit and scope of the various embodiments of the present disclosure.
[0021] For example, with the development of automotive electronic technology, the electronic control system inside the vehicle is becoming increasingly complex, and the communication demand is growing. As the core communication control part of the automotive electronic control system, the CAN bus plays a vital role in vehicle communication. The AutoSar architecture currently used by mainstream vehicles is CAN driver module, CAN interface module, PDU routing module, COM communication service module and application module from bottom to top.
[0022] Under the AutoSar architecture, there are some problems with CAN message routing. First, CAN message forwarding is completed by the PDU routing module, and the configuration requires manual operation, which is a cumbersome process, and the routing path and routing ID are difficult to change once they are determined. If the CAN network routing information changes, it needs to be reconfigured, which takes a lot of time. Second, although there is a CAN message routing strategy, there is a lack of a dedicated interface for CAN message processing under the AutoSar architecture, and it is impossible to quickly and effectively customize the CAN message transmission requirements. Third, the CAN message routing strategy is based on a priori routing tables, and the focus is on the routing implementation of CAN messages and the data conversion between CAN and Ethernet. It is actually still the function of the PDU routing module under the AutoSar architecture, that is, the existing CAN message routing strategy cannot cope with dynamic network topology.
[0023] In view of the above problems, this embodiment provides a CAN message routing method based on AutoSar, which provides an operational and dynamically adaptable method for CAN message routing in automotive electronic control systems, and effectively solves the problems of cumbersome configuration, difficult modification and lack of customized interface of existing CAN message routing.
[0024] The following will be combined with the drawings in the embodiments of the present invention to clearly and completely describe the technical solutions in the embodiments of the present invention. Obviously, the described embodiments are only part of the embodiments of the present invention, not all of the embodiments. Based on the embodiments of the present invention, all other embodiments obtained by ordinary technicians in this field without creative work are within the scope of protection of the present invention.
[0025] See also Figure 1 The figure is a flow chart of a CAN message routing method based on AutoSar in a specific embodiment, and the method comprises the following steps: S1. Design the CAN routing intermediate module, add the initial routing table, define the user interface, and add the CAN routing intermediate module between the CAN interface module and the PDU routing module of the original AutoSar topology, and establish the connection between the user interface and the application module; S2. Identify routing rule adjustment requirements through the user interface and dynamically adjust the initial routing table; S3. The CAN routing intermediate module determines the routing path and target message of the original CAN message received through the CAN interface module according to the routing table, and provides the target message to the CAN interface module for forwarding according to the routing path, and transmits the original CAN message to the PDU routing module for transmission within the CAN node.
[0026] This embodiment provides a CAN message routing solution by adding a CAN routing interface module to the original AutoSar topology and establishing a connection between the user interface and the application module, making the routing configuration more flexible, being able to dynamically adjust the routing table to meet different user needs, and improving the efficiency and flexibility of CAN message routing.
[0027] Further, as a refinement and extension of the specific implementation of the above embodiment, in order to fully illustrate the specific implementation process in this embodiment, another CAN message routing method based on AutoSar is provided, and the method includes the following steps: S1. Design the CAN routing intermediate module, add the initial routing table, define the user interface, and add the CAN routing intermediate module between the CAN interface module and the PDU routing module of the original AutoSar topology, and establish the connection between the user interface and the application module; the specific steps of step S1 are as follows: S11. Design the CAN routing intermediate module and add the initial routing table; the fields of the initial routing table include the original message ID, the target message ID, the routing priority, the routing node, the message length, and whether to route; For example, a routing table containing three CAN channels is used as an example. The CAN nodes are 0, 1, and 2 respectively. For the convenience of description, the message to be routed is called the original message, and the message after routing is called the target message. The routing table is as follows: Figure 3 As shown in the figure, it mainly includes 6 parts, namely the original message ID received on the CAN bus, the target message ID corresponding to the original message, the routing priority of the target message corresponding to the original message, the routing node of the target message, the routing length of the target message, and whether the original message needs to be routed; the construction of the routing table is equivalent to building a CAN routing intermediate module between the CAN interface module and the PDU routing module to replace the routing function of the original PDU routing module; S12. Define the user interface in the CAN routing intermediate module; S13. Obtain the original AutoSar topology; S14. Add the designed CAN routing intermediate module between the CAN interface module and the PDU routing module; S15. Establish a connection between the application module and the user interface; It should be noted that the design of the CAN routing intermediate module and the setting of the initial routing table provide a basis for the dynamic adjustment of the subsequent routing table; and the routing rules are clarified by determining the routing table fields, which facilitates subsequent operations and management; S2. Identify the routing rule adjustment requirements through the user interface and dynamically adjust the initial routing table; the specific steps of step S2 are as follows: S21. Determine whether the user's routing rule adjustment needs are recognized through the user interface; If yes, go to step S22; If not, proceed to step S3; S22. Analyze the routing rule adjustment requirements, adjust the initial routing table saved by the CAN routing intermediate module, and obtain the current routing table; It should be noted that by judging the user's routing rule adjustment needs, the routing table can be adjusted in time to ensure that the routing table always meets the actual needs. This dynamic adjustment mechanism improves the adaptability and flexibility of CAN message routing and can quickly respond to network changes; S3. The CAN routing intermediate module determines the routing path and target message of the original CAN message received by the CAN interface module according to the routing table, and provides the target message to the CAN interface module for forwarding according to the routing path, and transmits the original CAN message to the PDU routing module for transmission inside the CAN node; the specific steps of step S3 are as follows: S31. The CAN interface module receives the original CAN message and provides it to the CAN routing intermediate module; S32. The CAN routing intermediate module matches the original message with the routing field in the initial routing table or the current routing table; If the required route is matched, go to step S33; If no routing is required, go to step S34; S33. The CAN routing intermediate module encapsulates the target message and searches for the routing path according to the initial routing table or the current routing table, and provides the encapsulated target message to the CAN interface module for forwarding according to the found routing path; S34. The CAN routing intermediate module transmits the original message to the PDU routing module, the COM communication service module and the application module in sequence for message processing; It should be noted that the specific steps of CAN message routing through message matching, routing path search and message processing ensure that the CAN message can be correctly routed and processed according to the routing table.
[0028] In an embodiment of the present invention, based on step S31, step S32, step S33, and step S34, a possible embodiment is given below to illustrate its specific implementation scheme in a non-limiting manner.
[0029] The specific steps of step S31 are as follows: S311. When the CAN controller detects that there is message communication on the CAN bus, it stores the original message in the buffer and triggers a receive interrupt; S312. The CAN driver module responds to the interrupt and provides the original message in the buffer to the CAN interface module; S313. The CAN interface module provides the original message to the CAN routing intermediate module; It should be noted that by triggering the receiving interrupt, the timely acquisition and processing of the message is ensured, the process of the CAN interface module receiving the original message is clarified, the efficiency and reliability of CAN message reception are improved, and the CAN message can be processed in time. The specific steps of step S32 are as follows: S321 CAN routing intermediate module extracts the target message ID from the original message and compares it with the ID of the CAN terminal device; If there is a consistent item, go to step S322; If there is no consistent item, the original message is discarded and the process returns to step S2; S322. Determine whether the initial routing table has been adjusted; If so, the CAN routing intermediate module matches the original message ID in the original message with the routing field in the current routing table; If not, the CAN routing intermediate module matches the original message ID in the original message with the routing field in the initial routing table; S323. Determine whether the matching result requires routing; If yes, go to step S33; If not, proceed to step S34; The specific steps of step S33 are as follows: S331. Determine whether the initial routing table has been adjusted; If so, the CAN routing intermediate module matches the original message ID in the original message with the target message ID, routing priority, routing node, and message length in the current routing table; If not, the CAN routing intermediate module matches the original message ID in the original message with the target message ID, routing priority, routing node and message length in the initial routing table; S332. The CAN routing intermediate module encapsulates the target message according to the found target message ID, routing priority, routing node and message length, and determines the routing path according to the routing node; S333. The CAN routing intermediate module provides the encapsulated target message and routing path to the CAN interface module for sending the target message; It should be noted that the steps of message matching, routing path determination and message encapsulation ensure that messages can be accurately routed according to the routing table, improving the accuracy and reliability of routing and enabling the system to better adapt to complex network environments; The specific steps of step S34 are as follows: S341. The CAN routing intermediate module provides the original message to the COM communication service module; The S342.COM communication service module unpacks and processes the original message, and then notifies the application module; S343. The application module executes the corresponding business logic according to the unpacking and processing results of the original message; It should be noted that, through the processing of the original message by the application module, the corresponding business logic can be executed according to the processing result of the message, thereby realizing the practical application of the CAN message.
[0030] It should be understood that the order of execution of the steps in the above embodiment does not necessarily mean the order of execution. The execution order of each process should be determined by its function and internal logic, and should not constitute any limitation on the implementation process of the embodiment of the present invention.
[0031] like Figure 2 As shown, the following is an embodiment of the AutoSar-based CAN message routing system provided in an embodiment of the present disclosure. This system and the AutoSar-based CAN message routing method in the above-mentioned embodiments belong to the same inventive concept. For details not described in detail in the embodiment of the AutoSar-based CAN message routing system, please refer to the above-mentioned embodiment of the AutoSar-based CAN message routing method.
[0032] The system includes: CAN routing intermediate module design unit, used to design the CAN routing intermediate module, add the initial routing table, define the user interface, and add the CAN routing intermediate module between the CAN interface module and the PDU routing module of the original AutoSar topology, and establish the connection between the user interface and the application module; A routing table adjustment unit, used to identify routing rule adjustment requirements through a user interface and dynamically adjust the initial routing table; The CAN message routing unit is used to enable the CAN routing intermediate module to determine the routing path and target message of the original CAN message received through the CAN interface module according to the routing table, and provide the target message to the CAN interface module for forwarding according to the routing path, and transmit the original CAN message to the PDU routing module for transmission inside the CAN node.
[0033] This embodiment can effectively realize the CAN message routing function by designing the routing module, adjusting the routing table and executing the message routing through the CAN routing intermediate module design unit, the routing table adjustment unit and the CAN message routing unit.
[0034] The CAN message routing method based on AutoSar provided in the embodiment of the present application can be applied to electronic devices. Those skilled in the art will appreciate that the electronic device structure involved in the embodiment of the present invention does not constitute a limitation on the electronic device, and the electronic device may include more or fewer components than shown, or combine certain components, or arrange different components. In an embodiment of the present invention, the electronic device includes but is not limited to a laptop computer, a desktop computer, a workbench, a personal digital assistant, a server, a blade server, a mainframe computer, and other suitable computers. The electronic device may also represent various forms of mobile devices, such as personal digital processing, cellular phones, smart phones, wearable devices, and other similar computing devices. The components shown herein, their connections and relationships, and their functions are merely examples and are not intended to limit the implementation of the embodiments of the present application described and / or required herein.
[0035] The electronic device may include a processor, an external memory interface, an internal memory, a universal serial bus (USB) interface, a charging management module, a power management module, a battery, a wireless communication module, an audio module, a speaker, a microphone, a sensor module, buttons, a camera, a display, and a SIM card interface, etc.
[0036] It is to be understood that the structure illustrated in the embodiments of the present application does not constitute a specific limitation on the electronic device. In other embodiments of the present application, the electronic device may include more or fewer components than shown in the figure, or combine certain components, or split certain components, or arrange the components differently. The components shown in the figure may be implemented in hardware, software, or a combination of software and hardware.
[0037] The processor may include one or more processing units, for example, the processor may include a central processing unit (CPU), an application processor (AP), a modem processor, a graphics processing unit (GPU), an image signal processor (ISP), a controller, a memory, a video codec, a digital signal processor (DSP), a baseband processor, and / or a neural-network processing unit (NPU), etc. Among them, different processing units may be independent devices or integrated into one or more processors.
[0038] The processor can be the nerve center and command center of the electronic device. The controller can generate an operation control signal according to the instruction operation code and timing signal to complete the control of fetching and executing instructions.
[0039] A memory may also be provided in the processor for storing instructions and data. In some embodiments, the memory in the processor is a cache memory. The memory may store instructions or data that the processor has just used or is cyclically used. If the processor needs to use the instruction or data again, it may be directly called from the memory. This avoids repeated access, reduces the waiting time of the processor, and thus improves system efficiency.
[0040] The above-mentioned electronic device implements the design of a CAN routing intermediate module of the CAN message routing method based on AutoSar of this application, adds an initial routing table, defines a user interface, and adds the CAN routing intermediate module between the CAN interface module and the PDU routing module of the original AutoSar topology, and establishes a connection between the user interface and the application module; identifies the routing rule adjustment requirements through the user interface, and dynamically adjusts the initial routing table; the CAN routing intermediate module determines the routing path and target message of the original CAN message received through the CAN interface module according to the routing table, and provides the target message to the CAN interface module for forwarding according to the routing path, as well as transmits the original CAN message to the PDU routing module for transmission within the CAN node. The technical solution achieves the beneficial effects of simplifying the CAN message configuration under the AutoSar architecture, realizing intelligent routing and customization requirements, and flexibly adapting to network changes.
[0041] The storage medium provided in the present application stores a program product capable of implementing a CAN message routing method based on AutoSar.
[0042] The CAN message routing method based on AutoSar includes: designing a CAN routing intermediate module, adding an initial routing table, defining a user interface, and adding the CAN routing intermediate module between the CAN interface module and the PDU routing module of the original AutoSar topology, and establishing a connection between the user interface and the application module; identifying the routing rule adjustment requirements through the user interface, and dynamically adjusting the initial routing table; the CAN routing intermediate module determines the routing path and target message of the original CAN message received through the CAN interface module according to the routing table, and provides the target message to the CAN interface module for forwarding according to the routing path, and transmits the original CAN message to the PDU routing module for transmission inside the CAN node.
[0043] In some possible implementations, the AutoSar-based CAN message routing method disclosed herein can be implemented in the form of a program product, which includes a program code. When the program product is run on a terminal device, the program code is used to enable the terminal device to execute the steps described in the above “Exemplary Method” section of this specification according to various exemplary implementations of the present disclosure.
[0044] The storage medium of the present disclosure can adopt any combination of one or more readable media. The readable medium can be a readable signal medium or a readable storage medium. The readable storage medium can be, for example, but not limited to, a system, device or device of electricity, magnetism, light, electromagnetic, infrared, or semiconductor, or any combination of the above. More specific examples (non-exhaustive list) of readable storage media include: an electrical connection with one or more wires, a portable disk, a hard disk, a random access memory (RAM), a read-only memory (ROM), an erasable programmable read-only memory (EPROM or flash memory), an optical fiber, a portable compact disk read-only memory (CD-ROM), an optical storage device, a magnetic storage device, or any suitable combination of the above.
[0045] The above description of the disclosed embodiments enables one skilled in the art to implement or use the present invention. Various modifications to these embodiments will be apparent to one skilled in the art, and the general principles defined herein may be implemented in other embodiments without departing from the spirit or scope of the present invention. Therefore, the present invention will not be limited to the embodiments shown herein, but rather to the widest scope consistent with the principles and novel features disclosed herein.
Claims
1. A CAN message routing method based on AutoSar, characterized in that: The steps include: S1. Design the CAN routing intermediate module, add the initial routing table, define the user interface, and add the CAN routing intermediate module between the CAN interface module and the PDU routing module of the original AutoSar topology, and establish the connection between the user interface and the application module; S2. Identify routing rule adjustment requirements through the user interface and dynamically adjust the initial routing table; S3. The CAN routing intermediate module determines the routing path and target message of the original CAN message received through the CAN interface module according to the routing table, and provides the target message to the CAN interface module for forwarding according to the routing path, and transmits the original CAN message to the PDU routing module for transmission within the CAN node.
2. The CAN message routing method based on AutoSar according to claim 1, characterized in that: The specific steps of step S1 are as follows: S11. Design the CAN routing intermediate module and add the initial routing table; the fields of the initial routing table include the original message ID, the target message ID, the routing priority, the routing node, the message length, and whether to route; S12. Define the user interface in the CAN routing intermediate module; S13. Obtain the original AutoSar topology; S14. Add the designed CAN routing intermediate module between the CAN interface module and the PDU routing module; S15. Establish a connection between the application module and the user interface.
3. The CAN message routing method based on AutoSar according to claim 2, characterized in that: The specific steps of step S2 are as follows: S21. Determine whether the user's routing rule adjustment needs are recognized through the user interface; If yes, go to step S22; If not, proceed to step S3; S22. Analyze the routing rule adjustment requirements, adjust the initial routing table saved by the CAN routing intermediate module, and obtain the current routing table.
4. The CAN message routing method based on AutoSar according to claim 3, characterized in that: The specific steps of step S3 are as follows: S31. The CAN interface module receives the original CAN message and provides it to the CAN routing intermediate module; S32. The CAN routing intermediate module matches the original message with the routing field in the initial routing table or the current routing table; If the required route is matched, go to step S33; If no routing is required, go to step S34; S33. The CAN routing intermediate module encapsulates the target message and searches for the routing path according to the initial routing table or the current routing table, and provides the encapsulated target message to the CAN interface module for forwarding according to the found routing path; S34.CAN routing intermediate module transmits the original message to PDU routing module, COM communication service module and application module in sequence for message processing.
5. The CAN message routing method based on AutoStar according to claim 4, characterized in that: The specific steps of step S31 are as follows: S311. When the CAN controller detects that there is message communication on the CAN bus, it stores the original message in the buffer and triggers a receive interrupt; S312. The CAN driver module responds to the interrupt and provides the original message in the buffer to the CAN interface module; S313. The CAN interface module provides the original message to the CAN routing intermediate module.
6. The CAN message routing method based on AutoSar according to claim 5, characterized in that: The specific steps of step S32 are as follows: S321 CAN routing intermediate module extracts the target message ID from the original message and compares it with the ID of the CAN terminal device; If there is a consistent item, go to step S322; If there is no consistent item, the original message is discarded and the process returns to step S2; S322. Determine whether the initial routing table has been adjusted; If so, the CAN routing intermediate module matches the original message ID in the original message with the routing field in the current routing table; If not, the CAN routing intermediate module matches the original message ID in the original message with the routing field in the initial routing table; S323. Determine whether the matching result requires routing; If yes, go to step S33; If not, proceed to step S34; The specific steps of step S33 are as follows: S331. Determine whether the initial routing table has been adjusted; If so, the CAN routing intermediate module matches the original message ID in the original message with the target message ID, routing priority, routing node, and message length in the current routing table; If not, the CAN routing intermediate module matches the original message ID in the original message with the target message ID, routing priority, routing node and message length in the initial routing table; S332. The CAN routing intermediate module encapsulates the target message according to the found target message ID, routing priority, routing node and message length, and determines the routing path according to the routing node; S333. The CAN routing intermediate module provides the encapsulated target message and routing path to the CAN interface module for sending the target message.
7. The CAN message routing method based on AutoSar according to claim 6, characterized in that: The specific steps of step S34 are as follows: S341. The CAN routing intermediate module provides the original message to the COM communication service module; The S342.COM communication service module unpacks and processes the original message, and then notifies the application module; S343. The application module executes corresponding business logic according to the unpacking and processing results of the original message.
8. A CAN message routing system based on AutoSar, characterized in that: include: CAN routing intermediate module design unit, used to design the CAN routing intermediate module, add the initial routing table, define the user interface, and add the CAN routing intermediate module between the CAN interface module and the PDU routing module of the original AutoSar topology, and establish the connection between the user interface and the application module; A routing table adjustment unit, used to identify routing rule adjustment requirements through a user interface and dynamically adjust the initial routing table; The CAN message routing unit is used to enable the CAN routing intermediate module to determine the routing path and target message of the original CAN message received through the CAN interface module according to the routing table, and provide the target message to the CAN interface module for forwarding according to the routing path, and transmit the original CAN message to the PDU routing module for transmission inside the CAN node.
9. An electronic device, characterized in that: It includes a memory, a processor and a computer program stored in the memory and executable on the processor, wherein when the processor executes the program, the steps of the CAN message routing method based on AutoSar as claimed in any one of claims 1 to 7 are implemented.
10. A storage medium having a computer program stored thereon, characterized in that: When the computer program is executed by a processor, the steps of the CAN message routing method based on AutoSar as described in any one of claims 1 to 7 are implemented.
Citation Information
Cited By
Routing architecture and routing method based on AUTOSAR architecture cross-chip CAN data and vehicle
CN120896897A