CAN bus enhancement engine, CAN bus communication method and chip

By designing the enhancement engine of the CAN bus, including CAN reception tasks, routing modules, cache modules and CAN transmission tasks, the problem of inflexible communication across ECUs of the existing CAN bus is solved, and more flexible communication methods and more efficient ECU integration are achieved.

CN119766590APending Publication Date: 2025-04-04BEIJING SEMIDRIVE TECHNOLOGY LTD
View PDF 2 Cites 0 Cited by

Patent Information

Application Number
CN202411898854.6
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2024-12-23
Publication Date
2025-04-04

AI Technical Summary

Technical Problem

The cross-ECU communication of existing CAN buses is inflexible, resulting in increased forwarding delay and CPU overhead, making it difficult to achieve the integration of multiple ECUs.

Method used

An enhancement engine for CAN bus is designed, including CAN reception tasks, routing modules, cache modules and CAN transmission tasks. The forwarding and caching of CAN messages is carried out through the routing table, and communication between the physical CAN interface and the physical CAN interface, the physical CAN interface and the virtual CAN interface, the virtual CAN interface and the virtual CAN interface, the virtual CAN interface and the virtual CAN interface.

Benefits of technology

It improves the flexibility of CAN communication across ECUs, reduces the number of wire harnesses and wiring complexity, facilitates the integration of ECUs, and avoids forwarding delays and CPU overhead.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN119766590A_ABST
    Figure CN119766590A_ABST
Patent Text Reader

Abstract

The invention discloses an enhancement engine of a CAN bus, a communication method of the CAN bus and a chip, and belongs to the technical field of chips. The physical CAN receiving task receives a CAN message sent by the first physical CAN interface, and the virtual CAN receiving task receives a CAN message sent by the first virtual CAN interface and forwards the CAN message to the routing module; the routing module searches destination information matched with the source information of the CAN message in a routing table, and sends the CAN message to a cache module according to the destination information; the cache module caches the CAN message to a sending queue corresponding to the destination information, and the sending queue sends the CAN message to a corresponding CAN sending task; the physical CAN sending task sends the CAN message to a second physical CAN interface; and the virtual CAN sending task sends the CAN message to the second virtual CAN interface. According to the invention, the communication flexibility can be improved, and forwarding delay and CPU overhead are not introduced.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present application relates to the field of chip technology, and in particular to an enhancement engine of a CAN bus, a communication method of the CAN bus, and a chip. Background Art

[0002] The Controller Area Network (CAN) bus is the most common on-board bus in a car. It consists of a pair of cross-wiring harnesses and has strong anti-interference capabilities.

[0003] At present, the resources of the CAN bus are bound to the Electronic Control Unit (ECU). When forwarding CAN messages between different CAN interfaces, the corresponding ECUs are required to perform additional processing in their respective upper-layer software, which makes cross-ECU CAN communication very inflexible and also introduces certain forwarding delays and central processing unit (CPU) overhead.

[0004] At present, the electronic and electrical architecture of the whole vehicle is gradually evolving from distributed to centralized. In this architecture, ECUs of multiple functional domains are integrated into a single high-performance real-time microcontroller unit (MCU). In this integration process, the integration of CAN buses of different ECUs has become a difficult problem that urgently needs to be optimized. Summary of the invention

[0005] The present application provides a CAN bus enhancement engine, a CAN bus communication method and a chip, which are used to solve the problems of inflexible CAN communication across ECUs, introduction of forwarding delay and CPU overhead. The technical solution is as follows:

[0006] According to a first aspect of the present application, a CAN bus communication method is provided, wherein the enhancement engine comprises m CAN receiving tasks, a routing module, a cache module and n CAN sending tasks, where m and n are both positive integers;

[0007] When the CAN receiving task is a physical CAN receiving task, the physical CAN receiving task is used to receive a CAN message sent by a corresponding first physical CAN interface, and forward the CAN message to the routing module; when the CAN receiving task is a virtual CAN receiving task, the virtual CAN receiving task is used to receive a CAN message sent by a corresponding first virtual CAN interface, and forward the CAN message to the routing module;

[0008] The routing module is used to receive the CAN message sent by the CAN receiving task, search for destination information matching the source information of the CAN message in a preset routing table, and send the CAN message to the cache module according to the destination information;

[0009] The cache module is used to determine a sending queue corresponding to the destination information, cache the CAN message into the sending queue, and the sending queue sends the CAN message to the corresponding CAN sending task;

[0010] When the CAN sending task is a physical CAN sending task, the physical CAN sending task is used to send the CAN message to a corresponding second physical CAN interface; when the CAN sending task is a virtual CAN sending task, the virtual CAN sending task is used to send the CAN message to a corresponding second virtual CAN interface.

[0011] In a possible implementation, the routing module includes an acquisition task, a message pool, a routing task and a routing table;

[0012] The acquisition task is used to receive the CAN message sent by the CAN receiving task, and obtain the source channel of the CAN message, and store the CAN message and the source channel in the message pool, wherein the source channel is used to identify the first physical CAN interface or the first virtual CAN interface that sends the CAN message;

[0013] The routing task is used to read the CAN message and the source channel from the message pool, form the source information of the CAN message with the source channel and the source identifier extracted from the CAN message, search the routing table for destination information matching the source information, and send the CAN message to the cache module according to the destination information, wherein the destination information includes the destination identifier and the destination channel.

[0014] In a possible implementation, when there is a destination information matching the source information in the routing table,

[0015] The routing task is also used to replace the source identifier in the CAN message with the destination identifier, and send the CAN message to the cache module according to the destination channel.

[0016] In a possible implementation, when there are k pieces of destination information matching the source information in the routing table and k≥2,

[0017] The routing task is also used to copy the CAN message into k CAN messages;

[0018] For each entry of information, the routing task is further used to replace a source identifier in a CAN message with a destination identifier in the destination information, and send the CAN message to the cache module according to a destination channel in the destination information.

[0019] In a possible implementation, the cache module is also used to determine a sending queue corresponding to the destination channel, cache the CAN message in the sending queue, and the sending queue determines the priority according to the destination identifier of the CAN message, and sends the CAN message to the corresponding CAN sending task according to the priority.

[0020] According to a second aspect of the present application, a CAN bus communication method is provided, which is used in the enhancement engine as described above, and the method comprises:

[0021] When the CAN receiving task is a physical CAN receiving task, the physical CAN receiving task receives a CAN message sent by a corresponding first physical CAN interface, and forwards the CAN message to the routing module; when the CAN receiving task is a virtual CAN receiving task, the virtual CAN receiving task receives a CAN message sent by a corresponding first virtual CAN interface, and forwards the CAN message to the routing module;

[0022] The routing module receives the CAN message sent by the CAN receiving task, searches for destination information matching the source information of the CAN message in a preset routing table, and sends the CAN message to the cache module according to the destination information;

[0023] The cache module determines a sending queue corresponding to the destination information, caches the CAN message into the sending queue, and the sending queue sends the CAN message to a corresponding CAN sending task;

[0024] When the CAN sending task is a physical CAN sending task, the physical CAN sending task sends the CAN message to a corresponding second physical CAN interface; when the CAN sending task is a virtual CAN sending task, the virtual CAN sending task sends the CAN message to a corresponding second virtual CAN interface.

[0025] In a possible implementation, the routing module includes an acquisition task, a message pool, a routing task, and a routing table; the routing module receives the CAN message sent by the CAN receiving task, searches for destination information matching the source information of the CAN message in a preset routing table, and sends the CAN message to the cache module according to the destination information, including:

[0026] The acquisition task receives the CAN message sent by the CAN receiving task, and obtains the source channel of the CAN message, and stores the CAN message and the source channel in the message pool, wherein the source channel is used to identify the first physical CAN interface or the first virtual CAN interface that sends the CAN message;

[0027] The routing task reads the CAN message and the source channel from the message pool, forms the source information of the CAN message with the source channel and the source identifier extracted from the CAN message, searches the routing table for destination information matching the source information, and sends the CAN message to the cache module according to the destination information, wherein the destination information includes the destination identifier and the destination channel.

[0028] In a possible implementation manner, sending the CAN message to the cache module according to the destination information includes:

[0029] When there is a destination information matching the source information in the routing table, the routing task replaces the source identifier in the CAN message with the destination identifier, and sends the CAN message to the cache module according to the destination channel;

[0030] When there are k destination information matching the source information in the routing table and k≥2, the routing task copies the CAN message into k CAN messages; for each entry of information, the source identifier in a CAN message is replaced with the destination identifier in the destination information, and the CAN message is sent to the cache module according to the destination channel in the destination information.

[0031] In a possible implementation, the cache module determines a sending queue corresponding to the destination information, caches the CAN message in the sending queue, and the sending queue sends the CAN message to a corresponding CAN sending task, including:

[0032] The cache module determines a sending queue corresponding to the destination channel, caches the CAN message in the sending queue, and the sending queue determines a priority according to a destination identifier of the CAN message, and sends the CAN message to a corresponding CAN sending task according to the priority.

[0033] According to a third aspect of the present application, a computer-readable storage medium is provided, wherein at least one instruction is stored in the storage medium, and the at least one instruction is loaded and executed by a processor to implement the CAN bus communication method as described above.

[0034] According to a fourth aspect of the present application, a computer device is provided, wherein the computer device includes the enhancement engine of the CAN bus described above.

[0035] The beneficial effects of the technical solution provided by this application include at least:

[0036] The physical CAN receiving task in the enhanced engine can receive CAN messages sent by the first physical CAN interface, the virtual CAN receiving task can receive CAN messages sent by the first physical CAN interface, the physical CAN sending task can send CAN messages to the second physical CAN interface, and the virtual CAN sending task can send CAN messages to the second virtual CAN interface. In this way, the combination can realize the communication between the physical CAN interface and the physical CAN interface, the physical CAN interface and the virtual CAN interface, the virtual CAN interface and the physical CAN interface, and the virtual CAN interface and the virtual CAN interface, which not only improves the flexibility of CAN communication across ECUs, but also reduces the number of wiring harnesses and wiring complexity, and facilitates the integration of ECUs. In addition, the communication between the physical CAN interface and the physical CAN interface is imperceptible to the ECU and the application layer, and will not introduce forwarding delays and CPU overhead.

[0037] When the source information of a CAN message matches multiple entries of information in the routing table, a CAN message can be forwarded to multiple physical CAN interfaces and / or virtual CAN interfaces, thereby realizing one-to-many CAN message forwarding. BRIEF DESCRIPTION OF THE DRAWINGS

[0038] In order to more clearly illustrate the technical solutions in the embodiments of the present application, the drawings required for use in the description of the embodiments will be briefly introduced below. Obviously, the drawings described below are only some embodiments of the present application. For ordinary technicians in this field, other drawings can be obtained based on these drawings without creative work.

[0039] Figure 1 is a structural schematic diagram of an enhancement engine according to some exemplary embodiments;

[0040] Figure 2 It is a structural block diagram of an enhancement engine of a CAN bus provided by an embodiment of the present application;

[0041] Figure 3 It is a structural diagram of an enhancement engine of a CAN bus provided by an embodiment of the present application;

[0042] Figure 4 is a flow chart of a CAN communication method of a first path in a CAN bus provided by an embodiment of the present application;

[0043] Figure 5is a flow chart of a CAN communication method of a second path in a CAN bus provided by an embodiment of the present application;

[0044] Figure 6 is a flow chart of a CAN communication method of a third path in a CAN bus provided by an embodiment of the present application;

[0045] Figure 7 It is a flowchart of a CAN communication method of the fourth path in a CAN bus provided by an embodiment of the present application. DETAILED DESCRIPTION

[0046] In order to make the objectives, technical solutions and advantages of the embodiments of the present application clearer, the implementation methods of the present application will be further described in detail below in conjunction with the accompanying drawings.

[0047] The chip includes multiple ECUs. The CAN interface in the chip includes a physical CAN interface and a virtual CAN interface. Each ECU corresponds to a physical CAN interface and each ECU corresponds to a virtual CAN interface. Each CAN interface is connected through an enhancement engine, so that CAN communication across ECUs is performed through the enhancement engine. Figure 1 As shown in the figure, CAN communication can be divided into the following four paths according to the different CAN interfaces:

[0048] (1) First path (PATH1): a communication path between physical CAN interfaces;

[0049] (2) Second path (PATH2): communication path between the physical CAN interface and the virtual CAN interface;

[0050] (3) The third path (PATH2): the communication path between the virtual CAN interface and the physical CAN interface;

[0051] (4) Fourth path (PATH3): a communication path between virtual CAN interfaces.

[0052] like Figure 2 As shown, it shows a structural block diagram of a CAN bus enhancement engine provided by an embodiment of the present application, and the CAN bus enhancement engine can be applied to a chip. The CAN bus enhancement engine can include m CAN receiving tasks 210, a routing module 220, a cache module 230 and n CAN sending tasks 240, where m and n are both positive integers.

[0053] (1) CAN receiving task 210

[0054] The CAN receiving task 210 is a task in the enhanced engine for receiving CAN messages sent by an external CAN interface. Figure 3As shown, each CAN receiving task 210 corresponds to a CAN interface. When the external CAN interface is a physical CAN interface (CAN transmit), the corresponding CAN receiving task 210 is a physical CAN receiving task (CAN rx task); when the external CAN interface is a virtual CAN interface (VCAN transmit), the corresponding CAN receiving task 210 is a virtual CAN receiving task (VCAN rx task). The sum of the number of physical CAN receiving tasks and virtual CAN receiving tasks is m.

[0055] When the CAN receiving task 210 is a physical CAN receiving task, the physical CAN receiving task is used to receive a CAN message sent by a corresponding first physical CAN interface, and forward the CAN message to the routing module 220 .

[0056] When the CAN receiving task 210 is a virtual CAN receiving task, the virtual CAN receiving task is used to receive a CAN message sent by a corresponding first virtual CAN interface, and forward the CAN message to the routing module 220 .

[0057] For ease of distinction, in this embodiment, the physical CAN interface that sends CAN messages is called the first physical CAN interface, and the physical CAN interface that receives CAN messages is called the second physical CAN interface; the virtual CAN interface that sends CAN messages is called the first virtual CAN interface, and the virtual CAN interface that receives CAN messages is called the second virtual CAN interface.

[0058] (2) Routing module 220

[0059] The routing module 220 is used to receive the CAN message sent by the CAN receiving task 210, search for destination information matching the source information of the CAN message in a preset routing table, and send the CAN message to the cache module 230 according to the destination information.

[0060] The routing table includes multiple routing information, each of which includes a source information and at least one destination information. The source information includes a source identifier (src id) and a source channel (src bus). The source identifier is used to identify the sender of the CAN message, and the source channel is used to identify the physical CAN interface or virtual CAN interface that sends the CAN message. The destination information includes a destination identifier (des id) and a destination channel (des bus). The destination identifier is used to identify the receiver of the CAN message, and the destination channel is used to identify the physical CAN interface or virtual CAN interface that receives the CAN message.

[0061] When a routing information includes a source information and a destination information, a CAN message is sent to one receiver; when a routing information includes a source information and k items of information, a CAN message is sent to k receivers, k ≥ 2.

[0062] After obtaining the routing table, the routing module 220 can obtain source information according to the CAN message, and then find the destination information of the CAN message based on the routing table, and send the CAN message to the cache module 230 for caching according to the destination information.

[0063] like Figure 3 As shown, the routing module 220 may include a CAN fetch task, a message pool (Rxpacket pool), a routing task (Routing task) and a routing table (Routing table).

[0064] The acquisition task is used to receive the CAN message sent by the CAN receiving task 210, and obtain the source channel of the CAN message, and store the CAN message and the source channel in the message pool. The source channel is used to identify the first physical CAN interface or the first virtual CAN interface that sends the CAN message.

[0065] Since each corresponds to a physical CAN interface or a virtual CAN interface, the acquisition task can determine the corresponding source channel according to the CAN receiving task 210 that sends the CAN message. The acquisition task stores the CAN message and the source channel in the message pool in correspondence.

[0066] The routing task is used to read the CAN message and the source channel from the message pool, form the source information of the CAN message with the source channel and the source identifier extracted from the CAN message, search the routing table for the destination information matching the source information, and send the CAN message to the cache module 230 according to the destination information, wherein the destination information includes the destination identifier and the destination channel.

[0067] Among them, the routing task can read the CAN message and the corresponding source channel from the message pool according to the first-in-first-out principle. Then, the routing task reads the source identifier from the CAN message, searches for routing information containing both the source identifier and the source channel in the routing table, reads the corresponding destination information (including the destination identifier and the destination channel) from the found routing information, and sends the CAN message to the cache module 230 according to the destination information.

[0068] When there is a destination information matching the source information in the routing table, the routing task is further used to replace the source identifier in the CAN message with the destination identifier, and send the CAN message to the cache module 230 according to the destination channel.

[0069] Assuming that the source identifier is src id0, the destination identifier is des id0, and the destination channel is des bus0, the routing task replaces src id0 in the CAN message with des id0 to generate a new CAN message, and sends the new CAN message and des bus0 to the cache module 230.

[0070] When there are k destination information matching the source information in the routing table and k≥2, the routing task is also used to copy the CAN message into k CAN messages; for each entry of information, the routing task is also used to replace the source identifier in a CAN message with the destination identifier in the destination information, and send the CAN message to the cache module 230 according to the destination channel in the destination information.

[0071] Assuming k=2, the source identifier is src id1, the destination identifier in one destination information is des id1, the destination channel is des bus1, and the destination identifier in another entry of information is des id2, and the destination channel is des bus2, then the routing task copies a CAN message and finally obtains two CAN messages; replaces src id1 in one CAN message with des id1 to generate a new CAN message, and sends the new CAN message and des bus1 to the cache module 230; replaces srcid0 in another CAN message with des id2 to generate a new CAN message, and sends the new CAN message and des bus2 to the cache module 230.

[0072] (3) Cache module 230

[0073] The buffer module 230 is used to determine a sending queue corresponding to the destination information, buffer the CAN message in the sending queue, and the sending queue sends the CAN message to the corresponding CAN sending task 240 .

[0074] Specifically, the cache module 230 is also used to determine the sending queue corresponding to the destination channel, cache the CAN message in the sending queue, and the sending queue determines the priority according to the destination identifier of the CAN message, and sends the CAN message to the corresponding CAN sending task 240 according to the priority.

[0075] like Figure 3 As shown, the buffer module 230 includes a transmission task (CAN transmit task) and n transmission queues (Txqueue), and each transmission queue corresponds to a CAN transmission task 240.

[0076] The transmission task is used to receive the CAN message and the destination channel sent by the routing module 220, determine the sending queue corresponding to the destination channel, and cache the CAN message into the sending queue, that is, Figure 2The sending queue reads the destination identifier of each CAN message in the queue, determines the priority of each CAN message according to the destination identifier, and sends the CAN messages to the corresponding CAN sending tasks 240 in descending order of priority. The priority is negatively correlated with the value of the destination identifier, that is, the smaller the value of the destination identifier, the higher the priority; the larger the value of the destination identifier, the lower the priority.

[0077] (4) CAN sending task 240

[0078] The CAN sending task 240 is a task in the enhanced engine for sending CAN messages to an external CAN interface. Each CAN sending task 240 corresponds to a CAN interface. When the external CAN interface is a physical CAN interface (CAN receive), the corresponding CAN sending task 240 is a physical CAN sending task (CAN tx task); when the external CAN interface is a virtual CAN interface (VCAN receive), the corresponding CAN sending task 240 is a virtual CAN sending task (VCAN tx task). The sum of the number of physical CAN sending tasks and virtual CAN sending tasks is n.

[0079] When the CAN sending task 240 is a physical CAN sending task, the physical CAN sending task is used to send the CAN message to a corresponding second physical CAN interface.

[0080] When the CAN sending task 240 is a virtual CAN sending task, the virtual CAN sending task is used to send the CAN message to a corresponding second virtual CAN interface.

[0081] The CAN sending task 240 can send the CAN message through a shared memory or a mailbox. The sending method of the CAN message is not limited in this embodiment.

[0082] In summary, the enhanced engine of the CAN bus provided by the embodiment of the present application, the physical CAN receiving task in the enhanced engine can receive the CAN message sent by the first physical CAN interface, the virtual CAN receiving task can receive the CAN message sent by the first physical CAN interface, the physical CAN sending task can send the CAN message to the second physical CAN interface, and the virtual CAN sending task can send the CAN message to the second virtual CAN interface. In this way, through the combination, the communication between the physical CAN interface and the physical CAN interface, the physical CAN interface and the virtual CAN interface, the virtual CAN interface and the physical CAN interface, and the virtual CAN interface and the virtual CAN interface can be realized, which not only improves the flexibility of CAN communication across ECUs, but also reduces the number of wiring harnesses and the complexity of wiring, and facilitates the integration of ECUs. In addition, the communication between the physical CAN interface and the physical CAN interface is imperceptible to the ECU and the application layer, and will not introduce forwarding delays and CPU overhead.

[0083] When the source information of a CAN message matches multiple entries of information in the routing table, a CAN message can be forwarded to multiple physical CAN interfaces and / or virtual CAN interfaces, thereby realizing one-to-many CAN message forwarding.

[0084] like Figure 4 As shown, it shows a method flow chart of a CAN bus communication method provided by an embodiment of the present application, and the CAN bus communication method can realize CAN communication of the first path. The CAN bus communication method may include:

[0085] Step 401: The physical CAN receiving task receives a CAN message sent by a corresponding first physical CAN interface, and forwards the CAN message to the routing module.

[0086] Step 402, the routing module receives the CAN message sent by the physical CAN receiving task, searches for destination information matching the source information of the CAN message in a preset routing table, and sends the CAN message to the cache module according to the destination information.

[0087] like Figure 3 As shown, the routing module includes an acquisition task, a message pool, a routing task and a routing table; the acquisition task receives the CAN message sent by the physical CAN receiving task, and obtains the source channel of the CAN message, and stores the CAN message and the source channel in the message pool, and the source channel is used to identify the first physical CAN interface that sends the CAN message; the routing task reads the CAN message and the source channel from the message pool, and composes the source information of the CAN message with the source channel and the source identifier extracted from the CAN message, searches the routing table for the destination information that matches the source information, and sends the CAN message to the cache module according to the destination information, and the destination information includes the destination identifier and the destination channel.

[0088] When a piece of routing information in the routing table includes a source information and a destination information, a CAN message is sent to a receiver; when a piece of routing information in the routing table includes a source information and information of k items, a CAN message is sent to k receivers, k≥2.

[0089] Correspondingly, sending the CAN message to the cache module according to the destination information may include:

[0090] (1) When there is a destination information matching the source information in the routing table, the routing task replaces the source identifier in the CAN message with the destination identifier and sends the CAN message to the cache module according to the destination channel.

[0091] (2) When there are k destination information matching the source information in the routing table and k ≥ 2, the routing task copies the CAN message into k CAN messages; for each entry of information, the source identifier in a CAN message is replaced with the destination identifier in the destination information, and the CAN message is sent to the cache module according to the destination channel in the destination information.

[0092] Step 403, the cache module determines a sending queue corresponding to the destination information, caches the CAN message in the sending queue, and the sending queue sends the CAN message to the corresponding physical CAN sending task.

[0093] Specifically, the cache module determines the sending queue corresponding to the destination information, caches the CAN message in the sending queue, and the sending queue sends the CAN message to the corresponding physical CAN sending task, which may include: the cache module determines the sending queue corresponding to the destination channel, caches the CAN message in the sending queue, the sending queue determines the priority according to the destination identifier of the CAN message, and sends the CAN message to the corresponding physical CAN sending task according to the priority.

[0094] like Figure 3 As shown in FIG. 1 , the cache module includes a transmission task and n transmission queues, each of which corresponds to a CAN transmission task. The transmission task receives the CAN message and the destination channel sent by the routing module, determines the transmission queue corresponding to the destination channel, and caches the CAN message into the transmission queue. Figure 2 The sending queue reads the destination identifier of each CAN message in the queue, determines the priority of each CAN message according to the destination identifier, and sends the CAN messages to the corresponding physical CAN sending tasks in order from high to low priority. Among them, the priority is negatively correlated with the value of the destination identifier, that is, the smaller the value of the destination identifier, the higher the priority; the larger the value of the destination identifier, the lower the priority.

[0095] Step 404: The physical CAN sending task sends the CAN message to a corresponding second physical CAN interface.

[0096] The physical CAN sending task can send the CAN message through a shared memory (Share Memory) or a mailbox (Mailbox). The sending method of the CAN message is not limited in this embodiment.

[0097] In summary, the communication method of the CAN bus provided in the embodiment of the present application can enhance the physical CAN receiving task in the engine to receive the CAN message sent by the first physical CAN interface, and the physical CAN sending task can send the CAN message to the second physical CAN interface. In this way, the communication between the physical CAN interface and the physical CAN interface can be realized through the combination, which not only improves the flexibility of CAN communication across ECUs, but also reduces the number of wire harnesses and wiring complexity, and facilitates the integration of ECUs. In addition, the communication between the physical CAN interface and the physical CAN interface is imperceptible to the ECU and the application layer, and will not introduce forwarding delays and CPU overhead.

[0098] When the source information of a CAN message matches multiple entries of information in the routing table, a CAN message can be forwarded to multiple physical CAN interfaces and / or virtual CAN interfaces, thereby realizing one-to-many CAN message forwarding.

[0099] like Figure 5 As shown, it shows a method flow chart of a CAN bus communication method provided by an embodiment of the present application, and the CAN bus communication method can realize CAN communication of the second path. The CAN bus communication method may include:

[0100] Step 501: The physical CAN receiving task receives a CAN message sent by a corresponding first physical CAN interface, and forwards the CAN message to a routing module.

[0101] Step 502: The routing module receives the CAN message sent by the physical CAN receiving task, searches for destination information matching the source information of the CAN message in a preset routing table, and sends the CAN message to the cache module according to the destination information.

[0102] The processing flow of the routing module for the CAN message is described in step 402 and will not be repeated here.

[0103] Step 503: the cache module determines a sending queue corresponding to the destination information, caches the CAN message in the sending queue, and the sending queue sends the CAN message to the corresponding virtual CAN sending task.

[0104] The processing flow of the cache module for the CAN message is described in step 403 and will not be repeated here.

[0105] Step 504: The virtual CAN sending task sends the CAN message to a corresponding second virtual CAN interface.

[0106] To sum up, the communication method of the CAN bus provided in the embodiment of the present application enhances the physical CAN receiving task in the engine to receive CAN messages sent by the first physical CAN interface, and the virtual CAN sending task to send CAN messages to the second virtual CAN interface. In this way, by combining the communication between the physical CAN interface and the virtual CAN interface, the flexibility of CAN communication across ECUs is improved, the number of wiring harnesses and the complexity of wiring are reduced, and the integration of ECUs is facilitated.

[0107] When the source information of a CAN message matches multiple entries of information in the routing table, a CAN message can be forwarded to multiple physical CAN interfaces and / or virtual CAN interfaces, thereby realizing one-to-many CAN message forwarding.

[0108] like Figure 6 As shown, it shows a method flow chart of a CAN bus communication method provided by an embodiment of the present application, and the CAN bus communication method can realize CAN communication of the third path. The CAN bus communication method may include:

[0109] Step 601: The virtual CAN receiving task receives a CAN message sent by a corresponding first virtual CAN interface, and forwards the CAN message to the routing module.

[0110] Step 602: the routing module receives the CAN message sent by the virtual CAN receiving task, searches for destination information matching the source information of the CAN message in a preset routing table, and sends the CAN message to the cache module according to the destination information.

[0111] The processing flow of the routing module for the CAN message is described in step 402 and will not be repeated here.

[0112] Step 603, the cache module determines a sending queue corresponding to the destination information, caches the CAN message in the sending queue, and the sending queue sends the CAN message to the corresponding physical CAN sending task.

[0113] The processing flow of the cache module for the CAN message is described in step 403 and will not be repeated here.

[0114] Step 604: The physical CAN sending task sends the CAN message to a corresponding second physical CAN interface.

[0115] To sum up, the communication method of the CAN bus provided in the embodiment of the present application enhances the virtual CAN receiving task in the engine to receive CAN messages sent by the first physical CAN interface, and the physical CAN sending task to send CAN messages to the second physical CAN interface. In this way, communication between the virtual CAN interface and the physical CAN interface can be achieved through combination, which not only improves the flexibility of CAN communication across ECUs, but also reduces the number of wiring harnesses and wiring complexity, thereby facilitating ECU integration.

[0116] When the source information of a CAN message matches multiple entries of information in the routing table, a CAN message can be forwarded to multiple physical CAN interfaces and / or virtual CAN interfaces, thereby realizing one-to-many CAN message forwarding.

[0117] like Figure 7 As shown, it shows a method flow chart of a CAN bus communication method provided by an embodiment of the present application, and the CAN bus communication method can realize CAN communication of the fourth path. The CAN bus communication method may include:

[0118] Step 701: The virtual CAN receiving task receives a CAN message sent by a corresponding first virtual CAN interface, and forwards the CAN message to the routing module.

[0119] Step 702: the routing module receives the CAN message sent by the virtual CAN receiving task, searches for destination information matching the source information of the CAN message in a preset routing table, and sends the CAN message to the cache module according to the destination information.

[0120] The processing flow of the routing module for the CAN message is described in step 402 and will not be repeated here.

[0121] Step 703, the cache module determines a sending queue corresponding to the destination information, caches the CAN message in the sending queue, and the sending queue sends the CAN message to the corresponding virtual CAN sending task.

[0122] The processing flow of the cache module for the CAN message is described in step 403 and will not be repeated here.

[0123] Step 704: The virtual CAN sending task sends the CAN message to a corresponding second virtual CAN interface.

[0124] To sum up, the communication method of the CAN bus provided in the embodiment of the present application enhances the virtual CAN receiving task in the engine to receive CAN messages sent by the first physical CAN interface, and the virtual CAN sending task to send CAN messages to the second virtual CAN interface. In this way, communication between virtual CAN interfaces and virtual CAN interfaces can be achieved through combination, which not only improves the flexibility of CAN communication across ECUs, but also reduces the number of wiring harnesses and wiring complexity, thereby facilitating ECU integration.

[0125] When the source information of a CAN message matches multiple entries of information in the routing table, a CAN message can be forwarded to multiple physical CAN interfaces and / or virtual CAN interfaces, thereby realizing one-to-many CAN message forwarding.

[0126] An embodiment of the present application provides a computer-readable storage medium, wherein the storage medium stores at least one instruction, and the at least one instruction is loaded and executed by a processor to implement the CAN bus communication method as described above.

[0127] An embodiment of the present application provides a computer device, wherein the computer device includes an enhancement engine of any of the above-mentioned CAN buses.

[0128] It should be noted that: the CAN bus enhancement engine provided in the above embodiment is only illustrated by the division of the above functional modules when performing CAN bus communication. In actual applications, the above functions can be assigned to different functional modules as needed, that is, the internal structure of the CAN bus enhancement engine is divided into different functional modules to complete all or part of the functions described above. In addition, the CAN bus enhancement engine provided in the above embodiment and the CAN bus communication method embodiment belong to the same concept, and the specific implementation process is detailed in the method embodiment, which will not be repeated here.

[0129] A person skilled in the art will understand that all or part of the steps to implement the above embodiments may be accomplished by hardware or by instructing related hardware through a program, and the program may be stored in a computer-readable storage medium, and the above-mentioned storage medium may be a read-only memory, a disk or an optical disk, etc.

[0130] The above description is not intended to limit the embodiments of the present application. Any modifications, equivalent substitutions, improvements, etc. made within the spirit and principles of the embodiments of the present application should be included in the protection scope of the embodiments of the present application.

Claims

1. A CAN bus enhancement engine, characterized in that: The enhancement engine includes m CAN receiving tasks, a routing module, a buffer module and n CAN sending tasks, where m and n are both positive integers; When the CAN receiving task is a physical CAN receiving task, the physical CAN receiving task is used to receive a CAN message sent by a corresponding first physical CAN interface, and forward the CAN message to the routing module; when the CAN receiving task is a virtual CAN receiving task, the virtual CAN receiving task is used to receive a CAN message sent by a corresponding first virtual CAN interface, and forward the CAN message to the routing module; The routing module is used to receive the CAN message sent by the CAN receiving task, search for destination information matching the source information of the CAN message in a preset routing table, and send the CAN message to the cache module according to the destination information; The cache module is used to determine a sending queue corresponding to the destination information, cache the CAN message into the sending queue, and the sending queue sends the CAN message to the corresponding CAN sending task; When the CAN sending task is a physical CAN sending task, the physical CAN sending task is used to send the CAN message to a corresponding second physical CAN interface; when the CAN sending task is a virtual CAN sending task, the virtual CAN sending task is used to send the CAN message to a corresponding second virtual CAN interface.

2. The CAN bus enhancement engine according to claim 1, characterized in that: The routing module includes an acquisition task, a message pool, a routing task and a routing table; The acquisition task is used to receive the CAN message sent by the CAN receiving task, and obtain the source channel of the CAN message, and store the CAN message and the source channel in the message pool, wherein the source channel is used to identify the first physical CAN interface or the first virtual CAN interface that sends the CAN message; The routing task is used to read the CAN message and the source channel from the message pool, form the source information of the CAN message with the source channel and the source identifier extracted from the CAN message, search the routing table for destination information matching the source information, and send the CAN message to the cache module according to the destination information, wherein the destination information includes the destination identifier and the destination channel.

3. The CAN bus enhancement engine according to claim 2, characterized in that: When there is a destination information matching the source information in the routing table, The routing task is also used to replace the source identifier in the CAN message with the destination identifier, and send the CAN message to the cache module according to the destination channel.

4. The CAN bus enhancement engine according to claim 2, characterized in that: When there are k destination information matching the source information in the routing table and k≥2, The routing task is also used to copy the CAN message into k CAN messages; For each entry of information, the routing task is further used to replace a source identifier in a CAN message with a destination identifier in the destination information, and send the CAN message to the cache module according to a destination channel in the destination information.

5. The CAN bus enhancement engine according to claim 3 or 4, characterized in that: The cache module is also used to determine a sending queue corresponding to the destination channel, cache the CAN message in the sending queue, and the sending queue determines the priority according to the destination identifier of the CAN message, and sends the CAN message to the corresponding CAN sending task according to the priority.

6. A CAN bus communication method, characterized in that: Used in the enhancement engine according to any one of claims 1 to 5, the method comprises: When the CAN receiving task is a physical CAN receiving task, the physical CAN receiving task receives a CAN message sent by a corresponding first physical CAN interface, and forwards the CAN message to the routing module; when the CAN receiving task is a virtual CAN receiving task, the virtual CAN receiving task receives a CAN message sent by a corresponding first virtual CAN interface, and forwards the CAN message to the routing module; The routing module receives the CAN message sent by the CAN receiving task, searches for destination information matching the source information of the CAN message in a preset routing table, and sends the CAN message to the cache module according to the destination information; The cache module determines a sending queue corresponding to the destination information, caches the CAN message into the sending queue, and the sending queue sends the CAN message to a corresponding CAN sending task; When the CAN sending task is a physical CAN sending task, the physical CAN sending task sends the CAN message to a corresponding second physical CAN interface; when the CAN sending task is a virtual CAN sending task, the virtual CAN sending task sends the CAN message to a corresponding second virtual CAN interface.

7. The CAN bus communication method according to claim 6, characterized in that: The routing module includes an acquisition task, a message pool, a routing task and a routing table; the routing module receives the CAN message sent by the CAN receiving task, searches for destination information matching the source information of the CAN message in a preset routing table, and sends the CAN message to the cache module according to the destination information, including: The acquisition task receives the CAN message sent by the CAN receiving task, and obtains the source channel of the CAN message, and stores the CAN message and the source channel in the message pool, wherein the source channel is used to identify the first physical CAN interface or the first virtual CAN interface that sends the CAN message; The routing task reads the CAN message and the source channel from the message pool, forms the source information of the CAN message with the source channel and the source identifier extracted from the CAN message, searches the routing table for destination information matching the source information, and sends the CAN message to the cache module according to the destination information, wherein the destination information includes the destination identifier and the destination channel.

8. The CAN bus communication method according to claim 7, characterized in that: The sending the CAN message to the cache module according to the destination information includes: When there is a destination information matching the source information in the routing table, the routing task replaces the source identifier in the CAN message with the destination identifier, and sends the CAN message to the cache module according to the destination channel; When there are k destination information matching the source information in the routing table and k≥2, the routing task copies the CAN message into k CAN messages; for each entry of information, the source identifier in a CAN message is replaced with the destination identifier in the destination information, and the CAN message is sent to the cache module according to the destination channel in the destination information.

9. The CAN bus communication method according to claim 8, characterized in that: The cache module determines a sending queue corresponding to the destination information, caches the CAN message in the sending queue, and the sending queue sends the CAN message to a corresponding CAN sending task, including: The cache module determines a sending queue corresponding to the destination channel, caches the CAN message in the sending queue, and the sending queue determines a priority according to a destination identifier of the CAN message, and sends the CAN message to a corresponding CAN sending task according to the priority.

10. A computer device, characterized in that: The computer device comprises: the enhancement engine of the CAN bus as described in any one of claims 1 to 5.

Citation Information

Patent Citations

  • Message forwarding method and device, equipment and medium

    CN118101564A

  • Control area network coupler and coupling method for communication in the multiple control area networks

    KR1020120113034A