CAN routing module, CAN routing management method and gateway
By designing the CAN routing module and dividing it into a transceiver submodule, a routing management submodule and multiple message processing modules, the problem of low module decoupling in the existing technology is solved, and the system stability and development efficiency are improved.
Patent Information
- Application Number
- CN202510161271.3
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2025-02-13
- Publication Date
- 2025-05-09
AI Technical Summary
In the current CAN routing management, the decoupling of each module is not high, resulting in the confusion of CAN-related functions and data such as network management, LIN management, DCM module and DEM module in the CAN routing module, and the modules affect each other, reducing the stability of the system and increasing the development cycle.
A CAN routing module is designed, including a submodule for sending and receiving, a submodule for routing management and multiple packet processing modules. The received CAN packets are parsed through the routing management submodule, and forwarded to the corresponding packet processing module according to the message type for forwarding, monitoring or service processing.
By dividing the CAN routing module into multiple submodules and modules, the interaction between different submodules and corresponding modules will not interfere with the operation of other modules, improving the stability and development efficiency of the system and reducing the development cycle.
Smart Images

Figure CN119966889A_ABST
Abstract
Description
Technical Field
[0001] The present invention relates to the field of vehicle technology, and in particular to a CAN routing module, a CAN routing management method and a gateway. Background Art
[0002] As a vehicle component, the gateway has functions such as routing, diagnosis and Ethernet. In the vehicle system, the most important thing for the gateway is to receive CAN messages and classify and process them according to the functions of different CAN messages. In the current CAN routing management, the decoupling degree of each module is not high. For example, the functions and data related to CAN such as network management, LIN management, DCM module and DEM module are mixed in the CAN routing module. The modules will affect each other, which reduces the stability of the system and increases the development cycle. Summary of the invention
[0003] A brief summary of one or more aspects is given below to provide a basic understanding of these aspects. This summary is not an exhaustive overview of all conceived aspects, and is neither intended to identify the key or critical elements of all aspects nor to define the scope of any or all aspects. Its only purpose is to give some concepts of one or more aspects in a simplified form as a prelude to a more detailed description that will be given later.
[0004] The present invention provides a CAN routing module, a CAN routing management method and a gateway, which improve the stability of the system and shorten the development cycle.
[0005] In a first aspect, the present invention provides a CAN routing module, comprising: a transceiver submodule, a routing management submodule and a plurality of message processing modules; The routing management submodule is connected to the transceiver submodule and the message processing module respectively; Wherein, the transceiver submodule is used to receive or send CAN messages; The routing management submodule is used to parse the received CAN message to obtain the type of the CAN message, and forward the CAN message to the corresponding message processing module according to the type; The message processing module is used to forward, monitor or process the received CAN messages.
[0006] Furthermore, the message processing module includes a signal routing submodule, and the signal routing submodule is specifically used for: Receive multiple CAN messages; Parsing signals from all the CAN messages; The parsed signals are combined into new signals; Convert the new signal into a new CAN message; When the signal has not timed out, the new CAN message is sent to the transceiver submodule.
[0007] Furthermore, the message processing module includes a message routing submodule, and the message routing submodule is specifically used for: Receive CAN messages; According to the routing table, obtain the destination address of the CAN message; When the period of the CAN message is 0, the CAN message is sent to the transceiver submodule; When the period of the CAN message is not 0, the CAN message is cached, and when the CAN message has not timed out, the CAN message is sent to the transceiver submodule.
[0008] Furthermore, the message processing module includes a message monitoring submodule, and the message monitoring submodule is specifically used for: Receive messages from the source network segment; Perform timeout monitoring on the messages of the source network segment.
[0009] Furthermore, the message processing module includes a local processing submodule, and the local processing submodule is specifically used for: Receive messages that the application needs to process; Perform node loss failure detection on the messages that need to be processed by the application.
[0010] Furthermore, the CAN routing module also includes a routing table submodule, and the routing table submodule is specifically used for: Parse the routing table; Divide the parsed routing table according to routing purpose.
[0011] Furthermore, the routing management submodule includes at least one external interface, and at least part of the external interfaces are connected to preset external modules in a one-to-one correspondence.
[0012] Further, the preset external module includes at least one of a network management module, a CAN transmission protocol module, a LIN module and a unified diagnostic service module; When the routing management submodule receives a network management message, the routing management submodule is used to forward the network management message to the network management module; When the routing management submodule receives the first diagnostic message of the diagnostic channel, the routing management submodule is used to forward the first diagnostic message to the CAN transmission protocol module; wherein the first diagnostic message only needs to be transmitted from the source node to the destination node; When the routing management submodule receives a CAN-to-LIN message, the routing management submodule is used to forward the CAN-to-LIN message to the LIN module; When the routing management submodule receives the second diagnostic message of the diagnostic channel, the routing management submodule is used to forward the second diagnostic message to the unified diagnostic service module; wherein the second diagnostic message includes a specific diagnostic service request or response.
[0013] In a second aspect, the present invention further provides a CAN routing management method, which is applied to the CAN routing module as described above, and the method comprises: The transceiver submodule receives or sends CAN messages; The routing management submodule parses the received CAN message to obtain the type of the CAN message, and forwards the CAN message to the corresponding message processing module according to the type; The message processing module forwards, monitors or processes the received CAN messages.
[0014] In a third aspect, the present invention further provides a gateway, comprising the CAN routing module as described above.
[0015] The CAN routing module disclosed in the present invention includes a transceiver submodule, a routing management submodule and a plurality of message processing modules; the routing management submodule is respectively connected to the transceiver submodule and the message processing module; wherein the transceiver submodule is used to receive or send CAN messages; the routing management submodule is used to parse the received CAN messages to obtain the type of the CAN messages, and forward the CAN messages to the corresponding message processing modules according to the types; the message processing modules are used to forward, monitor or process the received CAN messages. In this way, by dividing the CAN routing module into a plurality of submodules and modules, different submodules interact with the corresponding modules without interfering with the operation of other modules. Moreover, the codes of each submodule and each module are highly maintainable, highly testable and highly reusable, and the system is highly scalable and highly stable, which greatly reduces the development cycle of the project. BRIEF DESCRIPTION OF THE DRAWINGS
[0016] In order to more clearly illustrate the technical solutions of the embodiments of the present invention, the accompanying drawings required for describing the embodiments will be briefly introduced below. Obviously, the accompanying drawings described below 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 A structural block diagram of a CAN routing module provided by an embodiment of the present invention; Figure 2A specific structural block diagram of a CAN routing module provided by an embodiment of the present invention; Figure 3 A schematic diagram of a flow chart of a transceiver submodule sending a message provided in an embodiment of the present invention; Figure 4 A schematic diagram of a flow chart of another transceiver submodule sending a message provided in an embodiment of the present invention; Figure 5 is an interaction diagram for processing signal routing in an embodiment of the present invention; Figure 6 An interactive diagram for processing message routing in an embodiment of the present invention; Figure 7 is another interactive diagram for processing message routing in an embodiment of the present invention; Figure 8 A schematic diagram of a process of performing timeout monitoring on a message in an embodiment of the present invention; Fig. 9 The figure is a flow chart of a CAN routing management method in an embodiment of the present invention. DETAILED DESCRIPTION
[0018] The present invention will be further described in detail below in conjunction with the accompanying drawings and embodiments. It is to be understood that the specific embodiments described herein are only used to explain the relevant invention, rather than to limit the invention. It should also be noted that, for ease of description, only the parts related to the invention are shown in the accompanying drawings.
[0019] It should be noted that, in the absence of conflict, the embodiments of the present invention and the features in the embodiments can be combined with each other. The present invention will be described in detail below with reference to the accompanying drawings and in combination with the embodiments.
[0020] Figure 1 The structural block diagram of a CAN routing module provided by an embodiment of the present invention is shown in FIG. Figure 1 As shown, the CAN routing module includes: a transceiver submodule 10, a routing management submodule 20 and multiple message processing modules 30; the routing management submodule 20 is connected to the transceiver submodule 10 and the message processing module 30 respectively; wherein, the transceiver submodule 10 is used to receive or send CAN messages; the routing management submodule 20 is used to parse the received CAN messages to obtain the type of the CAN message, and forward the CAN message to the corresponding message processing module 30 according to the type; the message processing module 30 is used to forward, monitor or process the received CAN messages.
[0021] In the above solution, the transceiver submodule 10 can receive the CAN message sent by the CAN driver module by interruption. In addition, the transceiver submodule 10 can also send the CAN message to the CAN driver module.
[0022] Among them, the CAN driver module is the core part of realizing CAN bus communication. As a bridge between software and hardware, it is responsible for processing message transmission on the CAN bus, including receiving, sending, error handling and interaction with upper-level applications or other modules.
[0023] For the signal routing process, the CAN driver module receives the differential signal from the CAN bus and converts it into a digital logic level signal. The local clock and bus signal are synchronized by detecting the starting edge of the signal, and the bit stream on the bus is decoded according to the bit time specified by the CAN protocol (including the synchronization segment, propagation segment, phase buffer segment, etc.) to determine the value of each bit (such as logic 0 or logic 1). The signal related to the signal routing is extracted from the decoded bit stream; the target path to which the signal should be forwarded is determined based on the signal content, source, target, and the system pre-configured routing table or rules. In order to transmit in the target network or device, the signal is repackaged into a message that conforms to the target network protocol; the repackaged message is sent to the target path.
[0024] For the message routing process, the CAN driver module receives the complete message from the CAN bus and stores the received message in the receive buffer. Check whether the message format meets the CAN protocol requirements and verify the message integrity and correctness. Determine the type and target of the message based on the message identifier, data content or other preset rules. For example, determine whether it is a diagnostic message, control message or data acquisition message by the message identifier, and then determine the target network segment, node or device to which it should be forwarded based on the system's routing strategy. Use a pre-configured routing table or routing algorithm to find the target path of the message. After determining the forwarding target, copy the message from the receive buffer to the send buffer, and send the prepared message to the target path according to the communication protocol and electrical characteristics of the target network segment.
[0025] In some embodiments, the transceiver submodule 10 can send the CAN message to the CAN driver module by interruption or function call.
[0026] Specifically, in one example, the transceiver submodule 10 sends the CAN message to the CAN driver module by interruption, referring to Figure 3 , the specific steps are as follows: Step 1: Set the number of traversals to zero; Step 2: When the number of traversals is less than N1 (for example, 6), execute step 3; when the number of traversals is greater than or equal to N1, return to step 1; Step 3: Determine whether the mailbox is empty. If the mailbox is not empty, perform the operation of taking out the message from the head of the queue in the buffer area and go to step 3. If the mailbox is empty, go to step 7. Step 4: If there is no message in the buffer, go to step 2; if there is a message in the buffer, send the message taken out from the buffer and go to step 5; Step 5: When sending, if the sending fails, insert the message header into the buffer area and go to step 7; if the sending is successful, go to step 6; Step 6: Make a specific function judgment. Here, judge whether the CAN mirror is turned on. If not, go to step 7; if it is turned on, the CAN mirror data will be sent. If the sending is successful, go to step 7; if the sending fails, insert the message header into the buffer area and go to step 7; Step 7: Accumulate the number of traversals and proceed to step 2.
[0027] In another example, the transceiver submodule 10 sends the message to the CAN driver module by a function call method, referring to Figure 4 , the specific steps are as follows: Step 1: When receiving message A, determine whether the mailbox is empty. If the mailbox is not empty, insert the tail of the received message A into the buffer and return. If the mailbox is empty, take out the message from the head of the buffer and go to step 2; Step 2: If there is no message in the buffer, send message A and go to step 3; if there is a message in the buffer, send the message taken out from the buffer and go to step 3; Step 3: When sending, if the sending fails, insert the message header into the buffer area and return to step 1. If the sending is successful, go to step 4; Step 4: Perform specific function judgment. Here, determine whether the CAN mirror is turned on. If not, return to step 1; if it is turned on, CAN mirror data will be sent. If the sending is successful, return to step 1; if the sending fails, insert the message header into the buffer area and return to step 1.
[0028] In the above steps, the mailbox is a data structure or storage area used to temporarily store received messages. It can be implemented in the program through specific programming structures or data types, such as arrays, linked lists, structures, etc., and is used to temporarily store messages received from the outside during data transmission and processing, so as to perform subsequent unified processing, analysis or forwarding operations.
[0029] In addition, in one example, the routing management submodule 20 has multiple internal interfaces, and at least some of the internal interfaces (the number of internal interfaces is greater than or equal to the number of message processing modules 30, which is set according to actual conditions) are connected one-to-one with the above-mentioned multiple message processing modules 30. The routing management submodule 20 transmits the CAN message to the corresponding message processing module 30 through the internal interface according to the type of the CAN message. The routing management submodule 20 is associated with multiple message processing modules 30 through the internal interface, so that the interaction between the routing management submodule 20 and different message processing modules 30 has a fixed interface, which can avoid direct reading of private data.
[0030] The message processing module 30 may be used to forward received CAN messages, the message processing module 30 may be used to monitor received CAN messages, and the message processing module 30 may be used to perform service processing on received CAN messages.
[0031] In the embodiment of the present invention, refer to Figure 2 The multiple message processing modules 30 may include at least one of a signal routing submodule 31, a message routing submodule 32, a message monitoring submodule 33 and a local processing submodule 34. The signal routing submodule 31 is used to forward CAN messages in the signal routing; the message routing submodule 32 is used to forward CAN messages in the message routing; the message monitoring submodule 33 is used to monitor the timeout of the CAN messages; and the local processing submodule 34 is used to detect node loss faults for CAN messages that need to be processed by the application.
[0032] The signal routing submodule, the message routing submodule, the message monitoring submodule and the local processing submodule are described below in conjunction with the accompanying drawings.
[0033] Prior to this, in some embodiments, reference Figure 2 , the CAN routing module also includes a routing table submodule 40; the routing table submodule 40 is used to parse the routing table (for example, a hexadecimal routing table) and divide the routing table according to the routing purpose. Exemplarily, it can be divided into a direct forwarding routing table, a signal source routing table, and a signal sending routing table. Correspondingly, the signal routing submodule is used to forward the message in the signal routing by looking up the routing table; the message routing submodule is used to forward the message in the message routing by looking up the routing table.
[0034] In some embodiments, the message processing module 30 includes a signal routing submodule 31, which is specifically used to: receive multiple CAN messages; parse signals from all CAN messages; compose new signals from the parsed signals; convert the new signals into new CAN messages; and send the new CAN message to the transceiver submodule 10 when the signal has not timed out.
[0035] For the signal routing process, the signal routing submodule 31 can extract the signal value in the source message and form a new signal message to be sent periodically. To show this process, Figure 5 It shows the process of extracting signals from two different received messages and recombining them into a new signal message to send. Figure 5 As shown in the figure, after the CAN driver module is initialized (initialized through the CAN communication initialization function), it receives messages from the hardware driver. The signal routing submodule receives messages from the hardware abstraction layer (HAL layer) through the CAN receiving callback function interrupt callback registered in the HAL layer, searches the signal source routing table in the data access layer (DAL layer), and stores the signal in the buffer area; the CAN routing timer task determines whether the signal has timed out. If it has timed out, the routing table signal value is changed to the timeout value, and if it has not timed out, it is changed to the received signal value; if the corresponding signal is not received and it has not timed out, the signal value is changed to the initial value. When the sending count is greater than or equal to the sending cycle (see below), the message is sent to the transceiver submodule by directly calling the CAN data sending function in the DAL layer, and at the same time, through a sending interrupt function (such as the CAN sending callback function), the message is taken from the buffer area and sent to the transceiver submodule, and the transceiver submodule then sends the message to the HAL layer through the CAN sending function in the HAL layer.
[0036] In some embodiments, the message processing module 30 includes a message routing submodule 32, which is specifically used to: receive CAN messages; obtain the destination address of the CAN message according to the routing table; when the cycle of the CAN message is 0, send the CAN message to the transceiver submodule 10; when the cycle of the CAN message is not 0, cache the CAN message, and when the CAN message has not timed out, send the CAN message to the transceiver submodule 10.
[0037] The message routing process is divided into the following two cases.
[0038] Case 1: Processing of direct and periodic message routing. Figure 6 As shown in the figure, after the CAN driver module is initialized (initialized through the CAN communication initialization function), it receives the message from the hardware driver, and the message routing submodule receives the message from the HAL layer through the CAN receive callback function interrupt callback registered in the HAL layer, searches the routing table in the DAL layer, obtains the destination address of the CAN message, and determines that the message cycle is 0, then directly calls the CAN data sending function in the DAL layer to send the message to the transceiver submodule, and at the same time, through a sending interrupt function (such as the CAN sending callback function), takes the message from the buffer area and sends it to the transceiver submodule, and the transceiver submodule then sends the message to the HAL through the CAN sending function in the HAL layer.
[0039] The second case: processing of variable period message routing. Figure 7 As shown in the figure, after the CAN driver module is initialized (initialized by the CAN communication initialization function), it receives the message from the hardware driver, and the message routing submodule receives the message from the HAL layer through the CAN receiving callback function interrupt callback registered in the HAL layer, searches the routing table in the DAL layer, obtains the destination address of the CAN message, and determines that the message period is not 0, and stores the message in the periodic sending message buffer area; the CAN routing timer task determines whether the sending count is greater than or equal to the sending period. When it is established, the message is sent to the transceiver submodule by directly calling the CAN data sending function in the DAL layer, and at the same time, through a sending interrupt function (such as the CAN sending callback function), the message is taken from the buffer area and sent to the transceiver submodule, and the transceiver submodule then sends the message to the HAL through the CAN sending function in the HAL layer.
[0040] In the above implementation, in order to realize timeout monitoring, the message processing module 30 includes a message monitoring submodule 33, and the routing management submodule 20 is connected to the message monitoring submodule 33 through an interface; when the routing management submodule 20 receives the signal route of the source routing table, the routing management submodule 20 is used to forward the signal route of the source routing table to the message monitoring submodule 33; the message monitoring submodule 33 is used to perform timeout monitoring on the signal route of the source routing table.
[0041] The variable period message routing method requires timeout monitoring of the source network segment. If the gateway does not receive the message from the source network segment after the timeout period expires, it needs to send the timeout value of the signal to the target network segment (if there is no timeout value, send an invalid value or an initial value).
[0042] For example, refer to Figure 8The message monitoring submodule 33 includes a 10ms timer, which accumulates the timeout count of each signal. When it is greater than or equal to its sending cycle, it is judged as a timeout, the flag bit of the timed signal route is modified, and the timeout message object is assigned a value. Specifically, the pre-set timeout message object is looped through, wherein the timeout message object can be an array of timeout messages set according to requirements. If no message is received in 10ms (frame cycle), the timeout number of the timeout message object is accumulated. It is determined whether the message in the timeout message object is received within N times the frame cycle (i.e., the above-mentioned sending cycle, N can be set according to actual conditions, for example, N is 10). If the message in the timeout message object is received within N times the frame cycle, it means that the message has not timed out, the timeout number of the timeout message object is cleared, the counting is restarted, and the step of looping through the pre-set timeout message object is returned to monitor the timeout of the message received next time. If no message in the timeout message object is received within N times the frame period, it means that the message has timed out, and a value is assigned to the timeout message object. The timeout attribute of the timeout message object is timeout, and then the timeout count of the timeout message object is cleared, and the count is restarted. The process returns to the step of looping through the pre-set timeout message objects to monitor the timeout of the next received message.
[0043] In addition, in some embodiments, the message processing module 30 includes a local processing sub-module 34, and the routing management sub-module 20 is connected to the local processing sub-module 34 through an interface; when the routing management sub-module 20 receives a message that needs to be processed by the application, the routing management sub-module 20 is used to forward the message that needs to be processed by the application to the local processing sub-module 34; the local processing sub-module 34 is used to perform node loss fault detection on the message that needs to be processed by the application.
[0044] Specifically, the configuration word is initialized: the node loss fault code to be registered is written into the UDS module, and is written into the configuration word through the UDS protocol. The local processing submodule 34 receives the message that needs to be processed by the application sent by the routing management submodule 20, and updates the node loss status and loss count of the node loss fault code according to the filtering conditions of the node loss fault code and the configuration word. Exemplarily, the local processing submodule 34 traverses the node loss fault code to determine whether the received message exists in the node loss fault code. If so, it can be considered that the message is not lost, and the number of node losses is cleared, and the flag of whether the node is lost is set to no loss; if the received message does not exist in the node loss fault code, it will not be processed. In addition, the local processing submodule 34 may include a 10ms timer, through which the loss count is performed. Exemplarily, the local processing submodule 34 traverses the node loss fault code. If the node loss fault code has not been traversed, it determines whether the configuration word is 1. If the configuration word is 1, the node loss fault code loss count is increased by 1; when the node loss fault code loss count is greater than or equal to N2 (for example, 10), the node loss count is cleared and the flag indicating whether the node is lost is set to lost.
[0045] It should be noted that the local processing submodule 34 can also perform calibration message processing and acquisition of vehicle speed signal, gear position signal and OBD diagnostic channel signal, etc. In addition, the function can be developed according to actual needs, and the present invention does not limit this.
[0046] The CAN routing module disclosed in the present invention includes a transceiver submodule, a routing management submodule and a plurality of message processing modules; the routing management submodule is respectively connected to the transceiver submodule and the message processing module; wherein the transceiver submodule is used to receive or send CAN messages; the routing management submodule is used to parse the received CAN messages to obtain the type of the CAN messages, and forward the CAN messages to the corresponding message processing modules according to the types; the message processing modules are used to forward, monitor or process the received CAN messages. In this way, by dividing the CAN routing module into a plurality of submodules and modules, different submodules and corresponding modules interact, and will not interfere with the operation of other modules. Moreover, the codes of each submodule and each module are highly maintainable, strongly testable and highly reusable, and the system is highly scalable and stable, which greatly reduces the development cycle of the project.
[0047] Continue to refer to Figure 2, the routing management submodule 20 is also connected to at least one preset external module 100 respectively. Exemplarily, the routing management submodule 20 includes at least one external interface, and at least some of the external interfaces (the number of external interfaces is greater than or equal to the number of preset external modules 100, which is set according to actual conditions) are connected to the preset external modules 100 in a one-to-one correspondence. The routing management submodule 20 is associated with at least one preset external module 100 through the external interface, so that the interaction between the routing management submodule 20 and different preset external modules 100 has a fixed interface, which can avoid direct reading of private data. The preset external module 100 may include at least one of a network management module (NM module), a CAN transmission protocol module (CANTP module), a LIN module, and a unified diagnostic service module (UDS module). Accordingly, the CAN message received by the transceiver submodule 10 may include at least one of a network management message, a first diagnostic message from a diagnostic channel, a CAN to LIN message, and a second diagnostic message from a diagnostic channel.
[0048] At this time, when the routing management submodule 20 receives the network management message, the routing management submodule 20 is used to forward the network management message to the network management module; When the routing management submodule 20 receives the first diagnostic message of the diagnostic channel, the routing management submodule 20 is used to forward the first diagnostic message to the CAN transmission protocol module; When the routing management submodule 20 receives a CAN-to-LIN message, the routing management submodule 20 is used to forward the CAN-to-LIN message to the LIN module; When the routing management submodule 20 receives the second diagnostic message of the diagnostic channel, the routing management submodule 20 is used to forward the second diagnostic message to the unified diagnostic service module.
[0049] In the above example, the CAN transmission protocol module is mainly responsible for realizing the correct transmission of diagnostic messages on the CAN bus at the physical level. It handles the underlying communication-related matters such as message packaging, unpacking, transmission rate control, error detection and correction. Accordingly, the first diagnostic message only needs to be transmitted from the source node to the destination node. The first diagnostic message is mainly used for basic communication between devices, such as confirming whether the device is online, checking whether the communication link is normal, etc. For example, a simple "heartbeat" message is sent from one ECU to another ECU regularly to indicate that the sender is still in normal working state and the communication link is unobstructed. At this time, the first diagnostic message will be transmitted to the CAN transmission protocol module to ensure that the first diagnostic message can be correctly transmitted on the CAN bus. The unified diagnostic service module focuses on the standardization and logical processing of diagnostic services. It understands the specific meaning of various diagnostic services, such as reading fault codes, writing configuration parameters, and controlling diagnostic sessions. Accordingly, the second diagnostic message contains specific diagnostic service requests or responses, such as querying the configuration information of the vehicle system, executing software updates, and clearing fault codes, which need to be processed according to the unified diagnostic service standards. At this time, the second diagnostic message will be transmitted to the unified diagnostic service module. For example, the content of the second diagnostic message is a request to read the fault code of the automobile engine control unit. This request needs to be parsed according to the UDS standard to determine the service type (read fault code) and parameters (such as the range of fault codes, storage location, etc.). At this time, the second diagnostic message needs to be transmitted to the unified diagnostic service module so that the unified diagnostic service module can interpret the diagnostic request and provide corresponding services. The first diagnostic message and the second diagnostic message can be determined by a custom message identifier. For example, the message identifier of the first diagnostic message can be 0x71E, and the message identifier of the second diagnostic message can be 0x7DF or 0x70E.
[0050] The network management message includes node status information (such as online, offline, fault, etc.), network connection request (such as request to establish a new connection or reconnect) and network configuration parameters (such as baud rate adjustment, IP address update, etc.). The message format usually follows a specific network management protocol. For example, in this embodiment, the network management message is a message based on the CAN protocol. The network management module will perform corresponding processing according to the identifier and content of the message: if it is a node status message, the network management module will update the internal node status record; if it is a network connection request, the network management module will start the process of connection establishment or reconnection; if it is a network configuration parameter message, the network management module will configure the network interface or related parameters as required.
[0051] In addition, in the CAN message, only specific types of messages need to be converted and transmitted to the LIN module. These messages may be control instructions, status queries or data acquisition messages related to devices in the LIN network. For example, in an automotive electronic system, if the CAN message contains a control instruction sent by the body control unit to the door actuator (connected via the LIN network), such as a door unlocking or locking instruction, it needs to be converted. In this embodiment, the CAN message can be converted into a LIN message by performing identifier conversion and data format conversion on the CAN message, thereby obtaining a CAN-to-LIN message. Accordingly, when the LIN module receives the CAN-to-LIN message, the LIN module processes it according to the LIN protocol. First, the LIN module performs a synchronization operation to synchronize the receiving clock by detecting the synchronization interval segment and the synchronization segment. Then the LIN module receives and parses the PID segment of the CAN-to-LIN message to determine the message type. Then, the data segment and the checksum segment are received to verify the data. If the verification passes, the LIN module will pass the parsed message data to the upper-layer application (such as the door control application in the car) for processing, completing the message transmission process from CAN to LIN.
[0052] In this way, the routing management submodule 20 can send the message to the corresponding module through the corresponding interface according to the type of the received message. Therefore, when the interactive function with a certain module or submodule needs to be updated, it can be isolated without interfering with the functions of other modules. It should be noted that the preset external module 100 includes but is not limited to the above-mentioned functional modules, which can be set according to actual needs, as long as each module in the preset external module 100 is connected to the external interface on the routing management submodule 20 in a one-to-one correspondence.
[0053] An embodiment of the present invention further provides a CAN routing management method, which is applied to the CAN routing module provided by any embodiment of the present invention. Fig. 9 A flowchart of a CAN routing management method provided by an embodiment of the present invention is shown in FIG. Fig. 9 As shown, the method includes: S110, the transceiver submodule receives or sends a CAN message.
[0054] S120. The routing management submodule parses the received CAN message to obtain the type of the CAN message, and forwards the CAN message to the corresponding message processing module according to the type.
[0055] S130: The message processing module forwards, monitors or processes the received CAN message.
[0056] For the contents not described in detail in the embodiment of the CAN routing management method of the present invention, reference can be made to the above-mentioned CAN routing module embodiment, which will not be repeated here.
[0057] An embodiment of the present invention further provides a gateway, which includes the CAN routing module provided by any embodiment of the present invention.
[0058] In addition, an embodiment of the present invention further provides a vehicle, which includes the gateway provided by an embodiment of the present invention.
[0059] The above description is only a preferred embodiment of the present disclosure and an explanation of the technical principles used. Those skilled in the art should understand that the scope of disclosure involved in the present disclosure is not limited to the technical solutions formed by a specific combination of the above technical features, but should also cover other technical solutions formed by any combination of the above technical features or their equivalent features without departing from the above disclosed concept. For example, the above features are replaced with the technical features with similar functions disclosed in the present disclosure (but not limited to) by each other to form a technical solution.
[0060] This article uses specific examples to illustrate the principles and implementation methods of the present invention. The description of the above embodiments is only used to help understand the method of the present invention and its core ideas. The above is only a preferred implementation method of the present invention. It should be pointed out that due to the limitations of textual expression, there are objectively infinite specific structures. For ordinary technicians in this technical field, without departing from the principles of the present invention, several improvements, modifications or changes can be made, and the above technical features can be combined in an appropriate manner; these improvements, modifications, changes or combinations, or the direct application of the inventive concept and technical solution to other occasions without improvement, should be regarded as the protection scope of the present invention.
Claims
1. A CAN routing module, characterized in that: include: Transceiver submodule, routing management submodule and multiple message processing modules; The routing management submodule is connected to the transceiver submodule and the message processing module respectively; Wherein, the transceiver submodule is used to receive or send CAN messages; The routing management submodule is used to parse the received CAN message to obtain the type of the CAN message, and forward the CAN message to the corresponding message processing module according to the type; The message processing module is used to forward, monitor or process the received CAN messages.
2. The CAN routing module according to claim 1, characterized in that: The message processing module includes a signal routing submodule, and the signal routing submodule is specifically used for: Receive multiple CAN messages; Parsing signals from all the CAN messages; The parsed signals are combined into new signals; Convert the new signal into a new CAN message; When the signal has not timed out, the new CAN message is sent to the transceiver submodule.
3. The CAN routing module according to claim 1, characterized in that: The message processing module includes a message routing submodule, and the message routing submodule is specifically used for: Receive CAN messages; According to the routing table, obtain the destination address of the CAN message; When the period of the CAN message is 0, the CAN message is sent to the transceiver submodule; When the period of the CAN message is not 0, the CAN message is cached, and when the CAN message has not timed out, the CAN message is sent to the transceiver submodule.
4. The CAN routing module according to claim 1, characterized in that: The message processing module includes a message monitoring submodule, and the message monitoring submodule is specifically used for: Receive messages from the source network segment; Perform timeout monitoring on the messages of the source network segment.
5. The CAN routing module according to claim 1, characterized in that: The message processing module includes a local processing submodule, and the local processing submodule is specifically used for: Receive messages that the application needs to process; Perform node loss failure detection on the messages that need to be processed by the application.
6. The CAN routing module according to claim 1, characterized in that: The CAN routing module also includes a routing table submodule, which is specifically used for: Parse the routing table; Divide the parsed routing table according to routing purpose.
7. The CAN routing module according to claim 1, characterized in that: The routing management submodule includes at least one external interface, and at least part of the external interfaces are connected to preset external modules in a one-to-one correspondence.
8. The CAN routing module according to claim 7, characterized in that: The preset external module includes at least one of a network management module, a CAN transmission protocol module, a LIN module and a unified diagnostic service module; When the routing management submodule receives a network management message, the routing management submodule is used to forward the network management message to the network management module; When the routing management submodule receives the first diagnostic message of the diagnostic channel, the routing management submodule is used to forward the first diagnostic message to the CAN transmission protocol module; wherein the first diagnostic message only needs to be transmitted from the source node to the destination node; When the routing management submodule receives a CAN-to-LIN message, the routing management submodule is used to forward the CAN-to-LIN message to the LIN module; When the routing management submodule receives the second diagnostic message of the diagnostic channel, the routing management submodule is used to forward the second diagnostic message to the unified diagnostic service module; wherein the second diagnostic message includes a specific diagnostic service request or response.
9. A CAN routing management method, applied to the CAN routing module according to any one of claims 1 to 8, characterized in that: The method comprises: The transceiver submodule receives or sends CAN messages; The routing management submodule parses the received CAN message to obtain the type of the CAN message, and forwards the CAN message to the corresponding message processing module according to the type; The message processing module forwards, monitors or processes the received CAN messages.
10. A gateway, characterized in that: Comprising a CAN routing module as described in any one of claims 1-8.