CAN network real-time dynamic networking implementation method
By reporting publishing and subscription requests in real time by CAN nodes, the CAN gateway dynamically builds routing relationships, solving the problem that CAN nodes cannot automatically connect to the network in the existing technology, and realizing the real-time dynamic networking and efficient utilization of bandwidth of the CAN network.
Patent Information
- Application Number
- CN202411780719.1
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2024-12-05
- Publication Date
- 2025-03-07
AI Technical Summary
In the prior art, the routing table used by the CAN gateway is statically configured in advance, resulting in the CAN node dynamically accessing the CAN network and unable to automatically form the network, or the network bandwidth cannot be released after the CAN node exits the CAN network.
Each CAN node reports a request for publishing or subscribing a message to the CAN gateway in real time. The CAN gateway dynamically calculates and builds a CAN message routing relationship, updates the routing table in real time, and realizes automatic networking and dynamic routing adjustment of the CAN network.
Real-time dynamic networking of CAN network is realized, which avoids the waste of network bandwidth caused by static routing tables and improves network stability and flexibility.
Smart Images

Figure CN119583429A_ABST
Abstract
Description
Technical Field
[0001] The invention belongs to the technical field of industrial automation CAN network communication, and in particular relates to a method for realizing real-time dynamic networking of a CAN network. Background Art
[0002] The routing table used by the CAN gateway includes the CAN message ID, the source network sent, and the target network received. In the prior art, the routing table used by the CAN gateway is pre-configured and generally exists statically in the memory of the CAN gateway in the form of a configuration file or data segment. The routing table can be updated locally by manually flashing or remotely by OTA upgrade.
[0003] For a new CAN node to join the CAN network, the CAN gateway routing table must be updated so that the new CAN node can receive messages from other CAN networks or route the messages it sends from the current CAN network to another CAN network.
[0004] In addition, if a CAN node has exited the current CAN network, the current CAN network can still receive CAN messages from other CAN networks that are routed to this CAN node, thereby wasting the communication bandwidth of the current CAN network.
[0005] In summary, in the prior art, the routing table used by the CAN gateway is statically configured in advance during the development phase, which results in the inability to automatically form a network when the CAN node dynamically accesses the CAN network, or the inability to release network bandwidth after the CAN node exits the CAN network. Summary of the invention
[0006] In order to solve the above technical problems, the present invention provides a method for implementing real-time dynamic networking of a CAN network.
[0007] The specific plan is as follows: A method for implementing real-time dynamic networking of a CAN network, wherein the CAN network includes a CAN gateway and at least one CAN sub-network, each CAN sub-network is connected to the CAN gateway via a CAN wiring harness, each CAN sub-network includes at least one CAN node, and each CAN node is connected to the CAN sub-network via a CAN wiring harness, wherein the method for implementing real-time dynamic networking of a CAN network includes the following steps: S1): Each CAN node reports its own publish message request or subscription message request to the CAN gateway in real time; S2): The CAN gateway receives and parses the publish message request or the subscribe message request; S3): The CAN gateway dynamically calculates the mapping relationship between the published message and the subscribed message, constructs the CAN message routing relationship, and adds the routing relationship to the routing table; S4): Each CAN node reports its own request to cancel publishing message or cancel subscription message to the CAN gateway in real time; S5): The CAN gateway receives and parses the request to cancel the publishing message or the request to cancel the subscription message. The CAN gateway searches the routing table for the routing relationship between the publishing message and the subscription message, and deletes it from the routing table.
[0008] Different CAN nodes on the same network segment interact by sending and receiving messages through direct cable connection.
[0009] The CAN gateway includes a device management module, a publishing request parsing module, a subscription request parsing module, a routing relationship generation module and a message transceiver module. The device management module is used to broadcast notifications to each CAN node, notify each CAN node to report its own message publishing request and message subscription request, monitor the heartbeat status of the CAN node, automatically identify the normal exit or abnormal exit of the existing CAN node, and update the routing table; A publishing request parsing module is used to receive and parse a message publishing request reported by a CAN node or cancel a message publishing request; A subscription request parsing module is used to receive and parse message subscription requests reported by CAN nodes or cancel message subscription requests; The routing relationship generation module performs fusion calculation on the parsed CAN node requests, generates the routing mapping relationship between the published message and the subscribed message, and updates the message routing table at the same time; The message transceiver module is used to receive CAN messages, and then query whether there is a routing relationship for the message in the routing table. If there is a routing relationship, the message is sent to the target CAN subnet corresponding to the routing relationship.
[0010] The CAN node includes a heartbeat management module, a publishing request module, a subscription request module and a CAN node message transceiver module, wherein the heartbeat management module is used to broadcast a heartbeat status of the CAN network, wherein the heartbeat status includes being connected to the network, working normally and exiting the network; The publishing request module is used to report the message publishing request of the CAN node itself or cancel the message publishing request; The subscription request module is used to report the message subscription request of the CAN node itself or cancel the message subscription request.
[0011] The CAN node message transceiver module is used for sending CAN messages of the CAN node itself or receiving CAN messages from other CAN nodes.
[0012] The present invention discloses a method for realizing real-time dynamic networking of CAN network. It only needs CAN node to report CAN message ID that needs to be subscribed to CAN gateway, and there is no need to configure CAN gateway routing table in advance, including no need to configure source network for sending CAN message and target network for receiving. Routing relationship mapping can be carried out in real time and dynamically and routing table can be generated to realize automatic networking of CAN network. In addition, CAN gateway can dynamically adjust message routing relationship according to the existence of CAN node, so as to make full use of CAN network bandwidth and improve network stability. BRIEF DESCRIPTION OF THE DRAWINGS
[0013] Figure 1 This is a schematic diagram of the CAN network structure.
[0014] Figure 2 It is to add a schematic diagram of CAN message routing relationship.
[0015] Figure 3 It is a schematic diagram of deleting CAN message routing relations.
[0016] Figure 4 This is a schematic diagram of the automotive CAN network structure. DETAILED DESCRIPTION
[0017] The following will be combined with the accompanying drawings in 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 implementation of the present invention, not all of the implementations. 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.
[0018] CAN network, the full name of Controller Area Network, is a multi-host local network widely used in automotive control. It has high reliability, real-time and flexibility. Multiple CAN networks can be combined into a larger CAN network through a CAN gateway.
[0019] CAN message refers to the information transmitted on the CAN network, which follows a specific data transmission format, including standard format and extended format.
[0020] CAN message ID is a set of numbers used to identify the identity of the CAN message. The length of the standard format CAN message identifier is 11 bits, and the length of the extended format CAN message identifier is 29 bits.
[0021] A CAN node is a device mounted in a CAN network, usually composed of a CAN controller and a CAN transceiver, and has the function of receiving and sending CAN messages.
[0022] CAN gateway is a special CAN node with multiple CAN transceivers that can connect different CAN networks, thereby achieving bridging communication between different CAN networks.
[0023] CAN message routing, also known as message forwarding, is one of the basic functions of a CAN gateway. It receives CAN messages from one CAN network and sends them to another CAN network.
[0024] CAN gateway routing table is a configuration file or data segment used to describe the routing relationship of CAN messages for use by CAN gateways. The routing relationship of CAN messages includes CAN message ID, source network for sending, target network for receiving, etc.
[0025] like Figure 1 As shown, a method for implementing real-time dynamic networking of a CAN network is provided, wherein the CAN network includes a CAN gateway and at least one CAN sub-network, each CAN sub-network is connected to the CAN gateway via a CAN wiring harness, each CAN sub-network includes at least one CAN node, and each CAN node is connected to the CAN sub-network via a CAN wiring harness, wherein the method for implementing real-time dynamic networking of a CAN network includes the following steps: S1): Each CAN node reports its own publish message request or subscription message request to the CAN gateway in real time; S2): The CAN gateway receives and parses the publish message request or the subscribe message request; S3): The CAN gateway dynamically calculates the mapping relationship between the published message and the subscribed message, constructs the CAN message routing relationship, and adds the routing relationship to the routing table, such as Figure 2 As shown; In this embodiment, the automatically created routing table (referred to as the old routing table) can be stored in the CAN gateway storage device; when the CAN gateway is powered on again, the old routing table can be read from the storage device into the memory to quickly establish the message routing relationship; if the current automatically created routing table (referred to as the new routing table) is different from the saved old routing table, the new routing table is used to replace the old routing table.
[0026] S4): Each CAN node reports its own request to cancel publishing message or cancel subscription message to the CAN gateway in real time; S5): The CAN gateway receives and parses the request to cancel the publishing message or the request to cancel the subscription message. The CAN gateway searches the routing table for the routing relationship between the publishing message and the subscription message, and deletes it from the routing table. Figure 3 shown.
[0027] Different CAN nodes on the same network segment interact by sending and receiving messages through direct cable connection.
[0028] The CAN gateway includes a device management module, a publishing request parsing module, a subscription request parsing module, a routing relationship generation module and a message transceiver module. The device management module is used to broadcast notifications to each CAN node, notify each CAN node to report its own message publishing request and message subscription request, monitor the heartbeat status of the CAN node, automatically identify the normal exit or abnormal exit of the existing CAN node, and update the routing table; A publishing request parsing module is used to receive and parse a message publishing request reported by a CAN node or cancel a message publishing request; A subscription request parsing module is used to receive and parse message subscription requests reported by CAN nodes or cancel message subscription requests; The routing relationship generation module performs fusion calculation on the parsed CAN node requests, generates the routing mapping relationship between the published message and the subscribed message, and updates the message routing table at the same time; The message transceiver module is used to receive CAN messages, and then query whether there is a routing relationship for the message in the routing table. If there is a routing relationship, the message is sent to the target CAN subnet corresponding to the routing relationship.
[0029] In this embodiment, by retaining data of certain CAN messages in the memory of the CAN gateway, after a CAN node subscribes to a certain CAN message, it can immediately obtain the latest data of the subscribed CAN message.
[0030] The CAN node includes a heartbeat management module, a publishing request module, a subscription request module and a CAN node message transceiver module, wherein the heartbeat management module is used to broadcast a heartbeat status of the CAN network, wherein the heartbeat status includes being connected to the network, working normally and exiting the network; The publishing request module is used to report the message publishing request of the CAN node itself or cancel the message publishing request; A CAN node lists the messages it may send by reporting its own message publishing request, and these messages can be received by other CAN nodes; A CAN node lists the messages that it will no longer send out by reporting its own cancel message publishing request. These messages are no longer received by other CAN nodes.
[0031] The subscription request module is used to report the message subscription request of the CAN node itself or cancel the message subscription request.
[0032] A CAN node lists the messages it wants to receive from other CAN nodes by reporting its own message subscription request. A CAN node lists the messages from other CAN nodes that it no longer receives by reporting its own message subscription cancellation request.
[0033] The CAN node message transceiver module is used for sending CAN messages of the CAN node itself or receiving CAN messages from other CAN nodes.
[0034] In this embodiment, a C / S-based software architecture is adopted, each CAN node acts as a client, and the CAN gateway acts as a server to achieve communication decoupling between the sender and receiver of the CAN message. The specific interaction process between the CAN node and the CAN gateway is as follows: The CAN gateway broadcasts notifications to each CAN sub-network it manages through the device management module, notifying each CAN node to report its own message publishing request and message subscription request; After receiving the notification from the CAN gateway, each CAN node passively reports its own message publishing request to the CAN gateway through its own publishing request module; Or after receiving the notification from the CAN gateway, the CAN node passively reports its own message subscription request to the CAN gateway through its own subscription request module; According to its own needs, the CAN node actively reports its own message publishing request to the CAN gateway or cancels the message publishing request through its own publishing request module; Or the CAN node can proactively report its own message subscription request or cancel its message subscription request to the CAN gateway through its own subscription request module according to its own needs; The CAN gateway receives the publish message request, subscribe message request, cancel publish message request and cancel subscribe message request provided by each CAN node through its own message transceiver module; The CAN gateway parses the message publishing request reported by the CAN node through its own parsing publishing request module; the CAN gateway performs fusion calculations through the routing relationship generation module to generate the routing mapping relationship between the publishing message and the subscription message, and adds it to the routing table; The CAN gateway parses the cancel message publishing request reported by the CAN node through its own parsing publishing request module; the CAN gateway performs fusion calculations through the routing relationship generation module to search and delete the routing mapping relationship between the publishing message and the subscription message from the routing table; The CAN gateway parses the message subscription request reported by the CAN node through its own subscription request parsing module; the CAN gateway performs fusion calculations through the routing relationship generation module, and generates the routing mapping relationship between the published message and the subscription message, and adds it to the routing table; The CAN gateway parses the subscription cancellation request reported by the CAN node through its own subscription request parsing module; the CAN gateway performs fusion calculations through the routing relationship generation module to find and delete the routing mapping relationship between the published message and the subscription message from the routing table; The CAN gateway receives non-request messages from each CAN node through its own message transceiver module, and queries whether there is a routing relationship for this message in the routing table. If there is a routing relationship, it sends this message to the target CAN network corresponding to the routing relationship, otherwise it does not process it.
[0035] The CAN node broadcasts its heartbeat status to the CAN network through its own heartbeat management module. The heartbeat status includes connected to the network, working normally, and exiting the network.
[0036] The CAN gateway monitors the heartbeat status of the CAN node through its own device management module, automatically identifies the normal exit or abnormal exit of the existing CAN node, and actively deletes the corresponding message routing relationship based on the publish message request and subscribe message request of this CAN node.
[0037] Based on the CAN message publish-subscribe request mode, the sender provides a CAN message sending list and the receiver provides a CAN message subscription list, and the message routing relationship is dynamically constructed in real time to realize the functions of CAN node hot-swap and CAN network automatic networking.
[0038] The CAN network real-time dynamic networking implementation method of the present invention can be applied to the field of automobile control based on CAN network communication, such as Figure 4 As shown in the figure, it is a typical automotive CAN network diagram, which includes four subnetworks, namely CAN subnetwork 1, CAN subnetwork 2, CAN subnetwork 3 and CAN subnetwork 4, each of which includes 2 CAN nodes; for example, CAN subnetwork 1 includes smart cockpit CAN nodes and multi-function steering wheel CAN nodes, CAN subnetwork 2 includes engine system CAN nodes and transmission system CAN nodes, CAN subnetwork 3 includes brake system CAN nodes and parking system CAN nodes, and CAN subnetwork 4 includes OBD diagnosis CAN nodes and T-BOX CAN nodes; The four sub-networks are connected to the CAN gateway via CAN wiring harnesses to form a larger automotive CAN network.
[0039] The technical means disclosed in the scheme of the present invention are not limited to the technical means disclosed in the above-mentioned implementation mode, but also include technical schemes composed of any combination of the above-mentioned technical features. It should be pointed out that for ordinary technicians in this technical field, several improvements and modifications can be made without departing from the principle of the present invention, and these improvements and modifications are also regarded as the protection scope of the present invention.
Claims
1. A method for implementing real-time dynamic networking of a CAN network, characterized in that: The CAN network includes a CAN gateway and at least one CAN sub-network, each CAN sub-network is connected to the CAN gateway via a CAN wiring harness, each CAN sub-network includes at least one CAN node, and each CAN node is connected to the CAN sub-network via a CAN wiring harness, wherein the CAN network real-time dynamic networking implementation method includes the following steps: S1): Each CAN node reports its own publish message request or subscription message request to the CAN gateway in real time; S2): The CAN gateway receives and parses the publish message request or the subscribe message request; S3): The CAN gateway dynamically calculates the mapping relationship between the published message and the subscribed message, constructs the CAN message routing relationship, and adds the routing relationship to the routing table; S4): Each CAN node reports its own request to cancel publishing message or cancel subscription message to the CAN gateway in real time; S5): The CAN gateway receives and parses the request to cancel the publishing message or the request to cancel the subscription message. The CAN gateway searches the routing table for the routing relationship between the publishing message and the subscription message, and deletes it from the routing table.
2. The method for implementing real-time dynamic networking of a CAN network according to claim 1, characterized in that: Different CAN nodes on the same network segment interact by sending and receiving messages through direct cable connection.
3. The method for implementing real-time dynamic networking of a CAN network according to claim 1, characterized in that: The CAN gateway includes a device management module, a publishing request parsing module, a subscription request parsing module, a routing relationship generation module and a message transceiver module. The device management module is used to broadcast notifications to each CAN node, notify each CAN node to report its own message publishing request and message subscription request, monitor the heartbeat status of the CAN node, automatically identify the normal exit or abnormal exit of the existing CAN node, and update the routing table; A publishing request parsing module is used to receive and parse a message publishing request reported by a CAN node or cancel a message publishing request; A subscription request parsing module is used to receive and parse message subscription requests reported by CAN nodes or cancel message subscription requests; The routing relationship generation module performs fusion calculation on the parsed CAN node requests, generates the routing mapping relationship between the published message and the subscribed message, and updates the message routing table at the same time; The message transceiver module is used to receive CAN messages, and then query whether there is a routing relationship for the message in the routing table. If there is a routing relationship, the message is sent to the target CAN subnet corresponding to the routing relationship.
4. The method for implementing real-time dynamic networking of a CAN network according to claim 1, characterized in that: The CAN node includes a heartbeat management module, a publishing request module, a subscription request module and a CAN node message transceiver module, wherein the heartbeat management module is used to broadcast a heartbeat status of the CAN network, wherein the heartbeat status includes being connected to the network, working normally and exiting the network; The publishing request module is used to report the message publishing request of the CAN node itself or cancel the message publishing request; The subscription request module is used to report the CAN node's own message subscription request or cancel the message subscription request; The CAN node message transceiver module is used for sending CAN messages of the CAN node itself or receiving CAN messages from other CAN nodes.