CAN message sending method and device, electronic equipment and storage medium

By creating a scheduling function and optimizing the sending cycle in groups during the CAN bus message sending process, the CAN bus congestion and frame loss problems are solved, and efficient and accurate data transmission is achieved.

CN120811818APending Publication Date: 2025-10-17GUANGZHOU AUTOMOBILE GROUP CO LTD
View PDF 8 Cites 0 Cited by

Patent Information

Application Number
CN202511081156.1
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2025-08-01
Publication Date
2025-10-17

AI Technical Summary

Technical Problem

In the prior art, arbitration issues are not considered during the CAN bus message transmission process, resulting in congestion, high frame loss rate, and poor transmission accuracy and real-time performance.

Method used

By creating multiple CAN message scheduling functions and mapping them to tasks with different sending cycles, they are grouped according to the different sending cycles of the scheduling functions, and the scheduling function is controlled based on each message group to select the corresponding CAN message to be sent, priority sorting and network status grouping are used to optimize message sending.

Benefits of technology

It improves the sending efficiency of CAN messages, increases the arbitration success rate, avoids message congestion, and enhances the real-time and accuracy of vehicle data transmission.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN120811818A_ABST
    Figure CN120811818A_ABST
Patent Text Reader

Abstract

The invention provides a CAN message transmission method and device, electronic equipment and a storage medium. The method comprises the following steps: creating a scheduling function of a plurality of CAN messages; mapping the scheduling function to tasks of different sending periods; grouping the plurality of CAN messages according to different sending periods; and based on each message group, controlling the scheduling function to select and send the corresponding CAN message according to the task where the scheduling function is located. According to the method and the device, the scheduling function for creating the plurality of CAN messages is obtained, the CAN messages are grouped through different sending periods of the scheduling function, and the scheduling function of each message group is controlled to select and send the corresponding CAN message according to the task, so that the sending efficiency of the CAN messages is optimized, the message arbitration success rate is improved, the message congestion is avoided, and the service life of the CAN messages is prolonged. And the real-time performance and the accuracy of data transmission of the whole vehicle are improved.
Need to check novelty before this filing date? Find Prior Art

Description

TECHNICAL FIELD

[0001] The present application relates to the technical field of vehicle communication, and in particular to a CAN message sending method and device, electronic equipment and a computer readable storage medium. BACKGROUND

[0002] With the development of the automotive industry, the controller on the vehicle is intelligent from distributed to central controller CCU, and its functions are more and more complex, and the transceived messages are more and more numerous. Since the central domain controller is responsible for integrating the data interaction and collaborative control of each subsystem of the vehicle, it will process a large amount of data, and there may be situations such as a large number of messages and fluctuation of message sending period. Under normal circumstances, the fluctuation of the message sending period is required to be no more than 10%, which has a high requirement on the punctuality of message sending.

[0003] In related technologies, the standard platform (CP, Classical Platform) protocol stack of the current automotive open system architecture (AUTOSAR, Automotive Open System Architecture) performs unified processing on a scheduling function (such as a sending main function, Com_MainFunctionTx) when generating a controller area network (CAN, Controller Area Network) message group of the COM layer, and the processing time is long when the number of messages is large. Moreover, the sorting of the message group is determined by using the tool chain of the AUTOSAR CP according to the CAN channel and the name of the message, and the arbitration problem of sending the message to the CAN bus is not considered, which leads to congestion of the CAN bus, high responsibility rate, and even frame loss phenomenon, and reduces the real-time performance and accuracy of data transmission. SUMMARY

[0004] The present application provides a CAN message sending method, device, electronic equipment and computer readable storage medium to at least solve the problem that in related technologies, the sorting of the message group is determined according to the CAN channel and the name of the message, and the arbitration problem of sending the message to the CAN bus is not considered, which leads to congestion of the CAN bus, high responsibility rate and poor transmission accuracy. The technical solutions of the present application are as follows:

[0005] According to a first aspect of an embodiment of the present application, a CAN message sending method is provided, which is applied to an automotive open system architecture, and includes:

[0006] obtaining a scheduling function for creating a plurality of controller area network (CAN) messages;

[0007] mapping the scheduling function to tasks with different sending periods;

[0008] grouping the plurality of CAN messages according to different sending periods of the scheduling functions;

[0009] controlling the scheduling functions to send the corresponding CAN messages according to the tasks based on each message group.

[0010] Optionally, after grouping the plurality of CAN messages according to different sending periods of the scheduling functions, the method further comprises:

[0011] sorting the CAN messages in each message group according to the identifiers of the CAN messages from small to large to obtain a CAN message sequence with priorities from high to low;

[0012] controlling the scheduling functions to send the corresponding CAN messages according to the tasks based on each message group, comprising: controlling the scheduling functions to send the sorted CAN message sequence according to the tasks based on each message group.

[0013] Optionally, the grouping the plurality of CAN messages according to different sending periods of the scheduling functions comprises:

[0014] assigning event-type messages in the plurality of CAN messages to the scheduling function with the shortest sending period;

[0015] grouping periodic-type messages in the plurality of CAN messages according to the remaining different sending periods except the shortest sending period of the scheduling function.

[0016] Optionally, the grouping the periodic-type messages in the plurality of CAN messages according to the remaining different sending periods except the shortest sending period of the scheduling function comprises:

[0017] grouping the periodic-type messages in the plurality of CAN messages according to a message grouping rule and the remaining different sending periods except the shortest sending period of the scheduling function.

[0018] Optionally, the method further comprises: pre-setting the message grouping rule in the following manner:

[0019] setting the sending period of the scheduling function where the CAN message is located to be smaller than the message period of the CAN message;

[0020] setting the message period of the CAN message to be an integer multiple of the sending period of the scheduling function;

[0021] setting the sending period of the scheduling function where the CAN message is located to be the maximum period in the period selection condition.

[0022] Optionally, the method further comprises:

[0023] acquiring network states of all PNCs when the controller exists a local network cluster PNC;

[0024] grouping the periodic messages obtained after grouping again based on the network states of all PNCs to obtain a network wake-up message group and a network sleep message group;

[0025] controlling the scheduling function to send corresponding CAN messages according to the task where the scheduling function is located based on the network wake-up message group.

[0026] Optionally, the scheduling function for creating multiple controller area network (CAN) messages comprises:

[0027] creating a scheduling function for creating multiple controller area network (CAN) messages according to tasks existing in a current operating system and message periods.

[0028] According to a second aspect of the embodiment of the present application, a CAN message sending device is provided, which is applied to an automobile open system architecture and comprises:

[0029] a obtaining module configured to obtain a scheduling function for creating multiple controller area network (CAN) messages;

[0030] a mapping module configured to map the scheduling function to tasks with different sending periods;

[0031] a grouping module configured to group the multiple CAN messages according to different sending periods of the scheduling function;

[0032] a first control sending module configured to control the scheduling function to send corresponding CAN messages according to the task where the scheduling function is located based on each message group.

[0033] Optionally, the device further comprises:

[0034] a sorting module configured to sort CAN messages in each message group in ascending order of the identifiers of the CAN messages to obtain a CAN message sequence with priorities from high to low after the grouping module groups the multiple CAN messages according to different sending periods.

[0035] The first control sending module is further configured to control the scheduling function to send the sorted CAN message sequence in sequence according to the task where the scheduling function is located based on each message group.

[0036] Optionally, the grouping module comprises:

[0037] a first grouping module configured to assign event-type messages in the multiple CAN messages to a scheduling function with the shortest sending period.

[0038] The second grouping module is configured to group the periodic CAN messages in the plurality of CAN messages according to the remaining different sending periods except for the shortest sending period of the scheduling function.

[0039] Optionally, the second grouping module is specifically configured to group the periodic CAN messages in the plurality of CAN messages according to the message grouping rule and the remaining sending periods except for the shortest sending period of the scheduling function.

[0040] Optionally, the apparatus further comprises a preset module configured to preset the message grouping rule in the following manner: setting the sending period of the scheduling function in which the CAN message is located to be smaller than the message period of the CAN message; setting the message period of the CAN message to be an integer multiple of the sending period of the scheduling function; and setting the sending period of the scheduling function in which the CAN message is located to be the maximum period in the period compliance condition.

[0041] Optionally, the apparatus further comprises:

[0042] a network state acquisition module configured to acquire the network states of all PNCs when the controller exists in a local network cluster PNC;

[0043] a third grouping module configured to group the periodic CAN messages obtained by the second grouping module again based on the network states of all PNCs to obtain a network wake-up message group and a network sleep message group;

[0044] a second control sending module configured to control the scheduling function to send the corresponding CAN message according to the task in which the scheduling function is located based on the network wake-up message group.

[0045] Optionally, the creation module is specifically configured to create the scheduling function of the plurality of controller area network CAN messages according to the tasks and the message periods existing in the current operating system.

[0046] According to a third aspect of the embodiments of the present application, an electronic device is provided, comprising:

[0047] a processor;

[0048] a memory for storing instructions executable by the processor;

[0049] The processor is configured to execute the instructions to implement the CAN message sending method as described above.

[0050] According to a fourth aspect of the embodiments of the present application, a computer readable storage medium is provided, when the instructions in the computer readable storage medium are executed by the processor of an electronic device, the electronic device can execute the CAN message sending method as described above.

[0051] According to a fifth aspect of the embodiments of the present application, a computer program product is provided, comprising computer programs or instructions, which, when executed by a processor of an electronic device, implement the CAN message sending method as described above.

[0052] The technical solutions provided by the embodiments of the present application at least have the following beneficial effects:

[0053] In the embodiments of the present application, based on the AUTOSAR architecture, a plurality of CAN message scheduling functions are created, and the scheduling functions are respectively mapped to tasks with different sending periods. The plurality of CAN messages are grouped according to the different sending periods of the scheduling functions, and based on each message group, the scheduling function is controlled to select and send the corresponding CAN message according to the task. That is, in the embodiments of the present application, by obtaining the scheduling functions for creating a plurality of CAN messages, and grouping the CAN messages according to the different sending periods of the scheduling functions, the scheduling function of each message group is controlled to select and send the corresponding CAN message according to the task, thereby optimizing the sending efficiency of the CAN message, improving the message arbitration success rate, avoiding message congestion, and improving the real-time performance and accuracy of vehicle data transmission.

[0054] It should be understood that the above general description and the following detailed description are only exemplary and explanatory, and cannot limit the present application. BRIEF DESCRIPTION OF DRAWINGS

[0055] The accompanying drawings, which are incorporated into and form part of the specification, illustrate embodiments consistent with the present application and, together with the specification, serve to explain the principles of the present application, and do not constitute an undue limitation on the present application. In order to more clearly illustrate the technical solutions in the embodiments of the present application or the prior art, the drawings needed in the following embodiment or prior art description will be briefly introduced. Obviously, the drawings in the following description are some embodiments of the present application, and those skilled in the art can obtain other drawings according to these drawings without creative labor.

[0056] Figure 1 is a flowchart of a CAN message sending method provided by an embodiment of the present application.

[0057] Figure 2 is another flowchart of a CAN message sending method provided by an embodiment of the present application.

[0058] Figure 3 is a schematic diagram of grouping and sorting a plurality of CAN messages provided by the present application.

[0059] Figure 4 is a sorting schematic diagram of a modified CAN sending FIFO provided by the present application.

[0060] Figure 5 is a schematic diagram of grouping the periodic messages in the group again when the controller exists PNC provided by the present application.

[0061] Figure 6 is a block diagram of a CAN message sending device provided by an embodiment of the present application.

[0062] Figure 7 is another block diagram of a CAN message sending device provided by an embodiment of the present application.

[0063] Figure 8 is a block diagram of an electronic device provided by an embodiment of the present application.

[0064] Figure 9 is a block diagram of a device for CAN message sending provided by an embodiment of the present application. DETAILED DESCRIPTION

[0065] In order to make the ordinary person skilled in the art better understand the technical solutions of the present application, the technical solutions in the embodiments of the present application will be described clearly and completely below in conjunction with the drawings.

[0066] It should be noted that the terms "first", "second", etc. in the specification and claims of the present application and the above-mentioned drawings are used to distinguish similar objects, and do not necessarily describe a specific order or sequence. It should be understood that the data thus used can be interchanged under appropriate circumstances, so that the embodiments of the present application described herein can be implemented in an order other than that illustrated or described herein. The embodiments described in the following exemplary embodiments do not represent all embodiments consistent with the present application. Rather, they are merely examples of devices and methods consistent with some aspects of the present application as detailed in the appended claims.

[0067] Please refer to Figure 1 is a flowchart of a CAN message sending method provided by an embodiment of the present application, as Figure 1 shown, the CAN message sending method is applied to an automotive open system architecture (AUTOSAR), and includes the following steps:

[0068] Step 101: obtaining a scheduling function for creating a plurality of controller area network (CAN) messages.

[0069] Step 102: mapping the scheduling function to tasks with different sending periods.

[0070] Step 103: grouping the plurality of CAN messages according to different sending periods of the scheduling function.

[0071] Step 104: based on each message group, control the scheduling function to send the corresponding CAN message according to the task where it is located.

[0072] In the embodiment of the application, based on the AUTOSAR architecture, the scheduling function of the plurality of CAN messages is created, and the scheduling function is mapped to the tasks with different sending periods respectively, and based on each message group, the scheduling function is controlled to send the corresponding CAN message according to the task where it is located. That is, in the embodiment of the application, the corresponding scheduling function is created for the plurality of CAN messages, and the corresponding CAN message is sent based on the different sending periods of the scheduling function, which optimizes the sending efficiency of the CAN message, improves the message arbitration success rate, avoids message congestion, and improves the real-time performance and accuracy of vehicle data transmission.

[0073] The CAN message sending method described in the application can be applied to the vehicle end, the cloud end, etc., and is not limited herein. The vehicle end implementation device can be a vehicle terminal, a vehicle control platform, an industrial computer, or an electronic device such as a vehicle controller. The cloud end can be a standalone server, a server cluster, or a server providing cloud services, cloud databases, cloud computing, cloud functions, cloud storage, network services, cloud communication, intermediate services, domain name services, security services, content distribution networks, or big data and artificial intelligence platforms, etc., and is not limited herein.

[0074] The specific implementation steps of the CAN message sending method provided in the embodiment of the application will be described in detail below. Figure 1

[0075] In step 101, a scheduling function of a plurality of controller area network (CAN) messages is obtained.

[0076] In this step, based on the AUTOSAR architecture, a scheduling function of a plurality of CAN messages is created in advance. Specifically, the scheduling function of the plurality of CAN messages can be created according to the tasks (Task) and the specific message period of the current operating system (OS, Operating System) existing. The scheduling function can include a sending main function (Com_MainFunctionTx), etc., and the embodiment is not limited.

[0077] It should be noted that according to the task of 500 ms existing in the current OS system and the sending period of 1 s of the message, the Com_MainFunctionTx can be created in the task with a sending period of 1 s.

[0078] ​Afterwards, a controller (such as a central domain controller, etc.) acquires a scheduling function for creating a plurality of CAN messages, which is acquired in a manner known to those skilled in the art and thus will not be described here.

[0079] In step 102, the scheduling function is mapped to tasks with different sending periods.

[0080] In this step, the sending period of the scheduling function can generally be set to 5 ms, 10 ms, 20 ms, 50 ms, 100 ms, etc., and is not limited thereto in specific applications. Of course, the sending period of the scheduling function can also be set to other periods according to actual application conditions, and the present embodiment is not limited thereto.

[0081] In this step, the scheduling function is mapped to tasks with sending periods of 5 ms, 10 ms, 20 ms, 50 ms, and 100 ms, and the purpose is to split and process various types of CAN messages on the vehicle to improve the sending rate of the CAN messages. The CAN messages can include event-type messages and periodic messages, and can also include other messages such as hybrid messages, etc.

[0082] In step 103, the plurality of CAN messages are grouped according to the different sending periods of the scheduling function.

[0083] In this step, the event-type messages in the plurality of CAN messages are assigned to the scheduling function with the shortest sending period, and the periodic messages in the plurality of CAN messages are grouped according to the remaining different sending periods other than the shortest sending period of the scheduling function.

[0084] That is, in this step, the scheduling function with the shortest sending period is assigned to the event-type messages, because the event-type messages are messages generated when specific events occur, and these specific events can be external triggers (such as sensors detecting abnormalities, etc.), internal state changes, or user operations, etc. In addition, the sending time of the event-type messages is uncertain and completely depends on the occurrence of events. It is generally used to report urgent or important events, and thus requires high real-time and accuracy of the messages. Based on this, the present embodiment reserves the scheduling function with the shortest sending period for the event-type messages to improve the real-time and accuracy of the event-type message sending.

[0085] The periodic message is a message sent periodically according to a fixed time interval. This kind of message is usually used to monitor the state of a system, collect regular data or perform a timing task, etc. The sending time of the periodic message is predictable and is performed according to a preset time interval. Although a certain timeliness is required, the real-time requirement is lower compared with the event message. Therefore, in this embodiment, the scheduling function with the shortest sending period is assigned to the event message, and the scheduling function with other sending periods except the shortest sending period is assigned to the periodic message. In this way, the timeliness of the event message can be ensured, and the stability of the periodic message can also be ensured.

[0086] Optionally, the periodic messages in the plurality of CAN messages are grouped according to the remaining different sending periods except the shortest sending period of the scheduling function, specifically including: grouping the periodic messages in the plurality of CAN messages according to the message grouping rule and the remaining different sending periods except the shortest sending period of the scheduling function.

[0087] In this embodiment, suppose that all the sending periods of the scheduling function are 5 ms, 10 ms, 20 ms, 50 ms and 100 ms. Among them, the shortest sending period of the scheduling function is 5 ms, and the other sending periods of the scheduling function are 10 ms, 20 ms, 50 ms and 100 ms. Of course, the sending periods are not limited to this in more specific applications.

[0088] As shown in the sending periods of the scheduling function, in this embodiment, the scheduling function with the shortest sending period of 5 ms is assigned to the event message. For the periodic message, the periodic message is grouped according to the message grouping rule and the sending periods of 10 ms, 20 ms, 50 ms and 100 ms. That is, the scheduling functions with the sending periods of 10 ms, 20 ms, 50 ms and 100 ms are respectively assigned to different periodic messages.

[0089] Among them, in this embodiment, the message grouping rule is set in advance, and is set according to the following manner: setting the sending period of the scheduling function in which the CAN message is located to be smaller than the message period of the CAN message; setting the message period of the CAN message to be an integer multiple of the sending period of the scheduling function; and setting the sending period of the scheduling function in which the CAN message is located to be the maximum period in the period condition.

[0090] That is, in this embodiment, taking the sending main function (Com_MainFunctionTx) as an example, the set message grouping rule needs to meet the following conditions:

[0091] 1) the sending period of the Com_MainFunctionTx where the message is located is smaller than the period of the message, so that the message will not be lost due to unstable task period; 2) the message period is an integer multiple of the sending period of the Com_MainFunctionTx, so that the effect of timing sending can be achieved through the task; 3) the sending period of the Com_MainFunctionTx where the message is located is selected to be the largest one that meets the condition, for example, the message with a period of 100 ms, and the Com_MainFunctionTx with a sending period of 10 ms, 20 ms or 50 ms all meet the requirement, and the embodiment provides that the sending period of 50 ms closest to the message period is selected, so that the polling frequency of the Com_MainFunctionTx for sending the message can be reduced. The embodiment groups the period type messages according to the message sending rule and the different sending periods of the scheduling function, so as to improve the sending efficiency of the grouped messages.

[0092] In step 104, based on each message group, the scheduling function is controlled to send the corresponding CAN message according to the task where the scheduling function is located.

[0093] In this step, based on each message group obtained after grouping, the scheduling function (such as Com_MainFunctionTx) is controlled to send the corresponding message according to the task (task) where the scheduling function is located. That is, when the Com_MainFunctionTx is assigned to different tasks, the Com_MainFunctionTx needs to send the corresponding message according to the incoming parameter (ComTxPduInfoTableIndex) of the task where the Com_MainFunctionTx is located, that is, the ComTxPduInfoTableIndex is used to determine which messages in the message group the Com_MainFunctionTx needs to send.

[0094] Among them, when the sending mode of the Com_MainFunctionTx is PERIODIC, the CAN message sending will call the function Com_SendIpdu() to send; if the sending mode is MIXED or DIRECT, the rte function will directly call Com_SendIpdu() to send.

[0095] In the embodiment of the present application, based on the AUTOSAR architecture, a plurality of CAN message scheduling functions are created, and the scheduling functions are mapped to tasks with different sending periods respectively. The plurality of CAN messages are grouped according to the different sending periods of the scheduling functions, and based on each message group, the scheduling function is controlled to select and send the corresponding CAN message according to the task. That is, in the embodiment of the present application, by obtaining the scheduling functions for creating a plurality of CAN messages, and grouping each CAN message according to the different sending periods of the scheduling functions, the scheduling function of each message group is controlled to select and send the corresponding CAN message according to the task, thereby optimizing the sending efficiency of the CAN message, improving the message arbitration success rate, avoiding message congestion, and improving the real-time performance and accuracy of vehicle data transmission.

[0096] Also see Figure 2 Another flowchart of a CAN message sending method provided in the embodiment of the present application is provided, and the method is used for an automotive open system architecture, comprising:

[0097] Step 201: Obtain scheduling functions for creating a plurality of controller area network (CAN) messages.

[0098] Step 202: Map the scheduling functions to tasks with different sending periods.

[0099] Step 203: Group the plurality of CAN messages according to the different sending periods of the scheduling functions.

[0100] In this embodiment, the specific implementation process in steps 201 to 203 is described in detail in the implementation process of the corresponding steps in the above embodiments, which will not be repeated here.

[0101] Step 204: Sort the CAN messages in each message group according to the CAN message identifiers from small to large, to obtain a CAN message sequence with high to low priority.

[0102] In this step, for all CAN messages in each message group obtained after grouping, the CAN messages are sorted according to the CAN message identifiers (IDs) from small to large, to obtain a CAN message sequence with high to low priority. It should be noted that the smaller the CAN message identifier, the higher the priority, and correspondingly, the larger the CAN message identifier, the lower the priority. For example, Figure 3 As shown in FIG. 8, a schematic diagram of grouping and sorting a plurality of CAN messages is provided in the present application.

[0103] Suppose all the sending periods of the scheduling functions are 5ms, 10ms, 20ms, 50ms and 100ms; wherein, in the embodiment, the scheduling function with the shortest sending period of 5ms is assigned to the event type message; and for the period type message, the message grouping rule of the period type message and the sending periods of 10ms, 20ms, 50ms and 100ms are used for grouping. That is, the scheduling functions with the sending periods of 10ms, 20ms, 50ms and 100ms are respectively assigned to different period type messages.

[0104] As shown in Figure 3 , the multiple CAN messages are assigned to the scheduling functions with the sending periods of 5ms, 10ms, 20ms, 50ms and 100ms, that is, the multiple CAN messages are assigned to Com_MainFunctionTx_5ms, Com_MainFunctionTx_10ms, Com_MainFunctionTx_20ms, Com_MainFunctionTx_50ms and Com_MainFunctionTx_100ms, each Com_MainFunctionTx of different sending period corresponds to a sending process function (Com_pduTxProcess). The CAN messages in each message group are respectively as shown in Figure 3 The rightmost frame is not repeated here.

[0105] In order to preferentially send the CAN messages with high priority, the CAN messages in each message group are sorted according to the identification of the CAN messages from small to large in the embodiment, so as to improve the real-time performance of message sending and optimize the sending efficiency of the messages.

[0106] Step 205: based on each message group, controlling the scheduling function to sequentially send the sorted CAN message sequence according to the task selection.

[0107] In this step, based on each message group, the scheduling function corresponding to the each message group is controlled to sequentially send the sorted CAN message according to the task selection according to the priority. As shown in Figure 4 , it is a sorting diagram of a modified CAN sending FIFO provided by the application, the messages of the FIFO OUT are sorted according to the message ID from small to large (that is, the priority from high to low), and the specific sorting is as shown in Figure 4 The rightmost frame is not repeated here.

[0108] In an embodiment of the present application, the main function of CAN message sending is split, and the sending scheduling function of each CAN message is allocated according to the message grouping rules and message period; and the sending order of the CAN messages in each message group obtained after grouping is sorted according to the priority, that is, the CAN message ID is sorted from small (high priority) to large (low priority), and the messages are sent in sequence from high to low according to the priority of the sorted messages, thereby optimizing the CAN message sending efficiency, improving communication reliability, and reducing data loss; improving the message arbitration success rate, avoiding message congestion, optimizing bus utilization; and improving the real-time performance of vehicle data transmission.

[0109] Optionally, in another embodiment, based on the above embodiment, the method may also include: when a local network cluster PNC exists in the controller, obtaining the network status of all PNCs; based on the network status of all PNCs, grouping the periodic messages obtained after grouping again to obtain a network wake-up message group and a network sleep message group; based on the network wake-up message group, controlling the scheduling function to select and send the corresponding CAN message according to the task in which it is located.

[0110] That is, in this embodiment, when there is a local network cluster PNC on the controller of the vehicle, the grouped periodic messages are grouped again according to whether the PNC is in the network awake state. That is, the messages in the message group whose PNC is in the network awake state are grouped together, and the messages in the message group whose PNC is in the network dormant state are grouped together. For the group whose PNC is in the network awake state, the specific example is as follows: Figure 5 As shown, Figure 5 This is a schematic diagram of regrouping periodic messages within a group when a controller provided by the present application has a PNC. Figure 5 In the example, the PNC of the message in the message group with a sending period of 10ms of the scheduling function is in the network awake state, that is, all controls of channel 1 are in the network awake state, then all messages in the message group sent through channel 1 are divided into one group, and the remaining messages in the message group are divided into another group, as shown in the figure, which will not be repeated here.

[0111] It is necessary to call a function to send the messages in this message group; for a group whose PNC is in network dormancy, it is not necessary to call a function to send the messages in the message group. It should be noted that the functions of various components in the vehicle can be called controllers, such as the controller that wakes up and opens the car door.

[0112] In this embodiment, when the controller exists PNC, the message in the PNC is skipped in the Com_MainFunctionTx polling, the processing efficiency of the Com_MainFunctionTx is improved, and the PNC of the network wake-up is not optimized in the bus arbitration, the overall optimization is relatively small, and the CANNM needs to notify the Com_MainFunctionTx through a self-defined variable or a callback function.

[0113] In this embodiment, the message sending logic is optimized to reduce the processing time peak of the Com_MainFunctionTx, adjust the success rate of the CAN message bus arbitration, reduce the time fluctuation of the CAN message sent to the bus, and optimize the bus utilization; the real-time performance and accuracy of the vehicle data transmission are improved.

[0114] It should be noted that, for the method embodiment, in order to simply describe, it is expressed as a series of action combinations, but those skilled in the art should know that the embodiment disclosed is not limited by the action order described, because according to the present application, certain steps can be performed in other order or simultaneously. Secondly, those skilled in the art should know that the embodiments described in the specification are all preferred embodiments, and the actions involved are not necessarily necessary for the present application.

[0115] Please also refer to Figure 6 A CAN message sending device block diagram provided by the embodiment of the present application. The device is applied to an automobile open system architecture, comprising: an acquisition module 601, a mapping module 602, a grouping module 603 and a first control sending module 604, wherein,

[0116] The acquisition module 601 is configured to acquire a scheduling function for creating a plurality of controller area network (CAN) messages.

[0117] The mapping module 602 is configured to map the scheduling function to tasks with different sending periods.

[0118] The grouping module 603 is configured to group the plurality of CAN messages according to different sending periods of the scheduling function.

[0119] The first control sending module 604 is configured to control the scheduling function to send corresponding CAN messages according to the task based on each message group.

[0120] Optionally, in another embodiment, the device can further comprise a sorting module 701, as shown in the structural block diagram of Figure 7

[0121] ​The sorting module 701 is configured to sort the CAN messages in each message group in ascending order of the identifiers of the CAN messages after the grouping module 603 groups the plurality of CAN messages according to different sending periods, to obtain a CAN message sequence with high to low priorities.

[0122] The first control sending module 604 is further configured to control the scheduling function to send the sorted CAN message sequence according to the task selection based on each message group.

[0123] Optionally, in another embodiment, the embodiment is based on the above-mentioned embodiment, and the grouping module comprises:

[0124] The first grouping module is configured to assign event-type messages in the plurality of CAN messages to the scheduling function with the shortest sending period.

[0125] The second grouping module is configured to group period-type messages in the plurality of CAN messages according to the remaining different sending periods except for the shortest sending period of the scheduling function.

[0126] Optionally, in another embodiment, the embodiment is based on the above-mentioned embodiment, and the second grouping module is specifically configured to group the period-type messages in the plurality of CAN messages according to the message grouping rule and the remaining sending periods except for the shortest sending period of the scheduling function.

[0127] Optionally, in another embodiment, the embodiment is based on the above-mentioned embodiment, and the device further comprises a preset module configured to preset the message grouping rule in the following manner: setting the sending period of the scheduling function in which the CAN message is located to be smaller than the message period of the CAN message; setting the message period of the CAN message to be an integer multiple of the sending period of the scheduling function; and setting the sending period of the scheduling function in which the CAN message is located to be the maximum period in the period selection condition.

[0128] Optionally, in another embodiment, the embodiment is based on the above-mentioned embodiment, and the device further comprises:

[0129] The network state acquisition module is configured to acquire the network states of all PNCs when the controller exists in a local network cluster PNC.

[0130] The third grouping module is configured to group the period-type messages obtained after the second grouping module groups the plurality of CAN messages again based on the network states of all PNCs, to obtain a network wake-up message group and a network sleep message group.

[0131] The second control sending module is configured to control the scheduling function to send the corresponding CAN message according to the task selection based on the network wake-up message group.

[0132] Optionally, in another embodiment, the embodiment is based on the above-mentioned embodiment, and the creating module is specifically configured to create a plurality of CAN message scheduling functions according to tasks and message cycles existing in the current operating system.

[0133] Optionally, the embodiment of the present application further provides an electronic device, comprising:

[0134] a processor;

[0135] a memory for storing processor-executable instructions;

[0136] The processor is configured to execute the instructions to implement the CAN message sending method as described above.

[0137] Optionally, the embodiment of the present application further provides a computer readable storage medium, when the instructions in the computer readable storage medium are executed by the processor of the electronic device, the electronic device can execute the CAN message sending method as described above.

[0138] Optionally, the embodiment of the present application further provides a computer program product, comprising a computer program or instructions, which are executed by the processor of the electronic device to implement the CAN message sending method as described above.

[0139] Regarding the device in the above-mentioned embodiments, the specific manner in which each module performs operations has been described in detail in the embodiments related to the method, and will not be described in detail here.

[0140] The device embodiments described above are only schematic, wherein the units shown as separate components can or can not be physically separate, and the components shown as units can or can not be physical units, i.e., can be located in one place, or can be distributed on a plurality of network units. Part or all of the modules can be selected according to actual needs to achieve the purpose of the embodiment scheme. Those skilled in the art can understand and implement it without creative labor.

[0141] Figure 8 is a block diagram of an electronic device 800 provided by the embodiment of the present application. As shown in the figure, it comprises a processor 801, a communication interface 802, a memory 803 and a communication bus 804, wherein the processor 801, the communication interface 802 and the memory 803 complete mutual communication through the communication bus 804;

[0142] The memory 803 is used for storing processor-executable instructions;

[0143] The processor 801, when executing the executable instructions on the memory 803, implements the method as described above.

[0144] The communication bus in this embodiment can be a Peripheral Component Interconnect (PCI) bus, an Extended Industry Standard Architecture (EISA) bus, or the like. The communication bus can be divided into an address bus, a data bus, a control bus, and the like. For ease of representation, only one thick line is shown in the figure, but it does not mean that there is only one bus or only one type of bus.

[0145] The communication interface is used for communication between the electronic device and other devices.

[0146] The memory can include a Random Access Memory (RAM) and can also include a non-volatile memory, such as at least one disk memory. Optionally, the memory can also be at least one storage device located away from the aforementioned processor.

[0147] The processor described above can be a general-purpose processor, including a Central Processing Unit (CPU), a Network Processor (NP), and the like; can also be a Digital Signal Processor (DSP), an Application Specific Integrated Circuit (ASIC), a Field-Programmable Gate Array (FPGA) or other programmable logic device, a discrete gate or transistor logic device, a discrete hardware component.

[0148] In another embodiment provided in the present application, a computer readable storage medium is also provided, when instructions in the computer readable storage medium are executed by a processor of an electronic device, the electronic device can execute the CAN message sending method as described above. For example, the computer readable storage medium can be a ROM, a Random Access Memory (RAM), a CD-ROM, a magnetic tape, a floppy disk, and an optical data storage device, and the like.

[0149] In another embodiment provided in the present application, a computer program product is also provided, including a computer program or instructions, when the computer program or instructions are executed by a processor of an electronic device, the CAN message sending method as described above is implemented.

[0150] In the embodiments described above, the whole or part of the embodiments can be implemented by software, hardware, firmware or any combination thereof. When implemented by software, the whole or part of the embodiments can be implemented in the form of a computer program product. The computer program product includes one or more computer instructions. When the computer program instructions are loaded and executed on a computer, the whole or part of the processes or functions described in the embodiments are generated. The computer can be a general purpose computer, a special purpose computer, a computer network, or other programmable apparatus. The computer instructions can be stored in a computer readable storage medium or transferred from one computer readable storage medium to another computer readable storage medium, for example, the computer instructions can be transferred from one website, computer, server or data center to another website, computer, server or data center through wired (such as coaxial cable, optical fiber, digital subscriber line (DSL)) or wireless (such as infrared, wireless, microwave, etc.) manner. The computer readable storage medium can be any available medium that can be accessed by a computer or a data storage device such as a server, data center, etc. integrated with one or more available media. The available media can be magnetic media (for example, floppy disk, hard disk, magnetic tape), optical media (for example, DVD), or semiconductor media (for example, solid state disk (SSD)) and the like.

[0151] Figure 9 is a block diagram of an apparatus 900 for CAN message sending provided by an embodiment of the present application. For example, the apparatus 900 can be provided as a server. Referring to Figure 9 , the apparatus 900 includes a processing component 922, which further includes one or more processors, and a memory resource represented by a memory 932, for storing instructions executable by the processing component 922, such as an application program. The application program stored in the memory 932 can include one or more than one module each corresponding to a set of instructions. In addition, the processing component 922 is configured to execute the instructions to perform the above method.

[0152] The apparatus 900 can also include a power supply component 926 configured to perform power management of the apparatus 900, a wired or wireless network interface 950 configured to connect the apparatus 900 to a network, and an input output (I / O) interface 958. The apparatus 900 can operate based on an operating system stored in the memory 932, such as Windows ServerTM, Mac OS XTM, UnixTM, LinuxTM, FreeBSDTM or the like.

[0153] Other embodiments of the application will be apparent to those skilled in the art from consideration of the specification and practice of the application disclosed herein. It is intended that the specification and examples be considered as exemplary only, with the true scope and spirit of the application being indicated by the following claims.

[0154] It is to be understood that the application is not limited to the precise construction herein disclosed and shown in the drawings, and that various changes in shape, size and arrangements of parts can be made without departing from the scope of the application. The scope of the application is only limited by the appended claims.

Claims

1. A CAN message sending method, characterized in that: The method is applied to an automotive open system architecture, comprising: Get the scheduling function for creating multiple CAN messages; Mapping the scheduling function to tasks with different sending cycles; Grouping the multiple CAN messages according to different sending cycles of the scheduling function; Based on each message group, the scheduling function is controlled to select and send the corresponding CAN message according to the task in which it is located.

2. The CAN message sending method according to claim 1, characterized in that: After grouping the multiple CAN messages according to different sending periods of the scheduling function, the method further includes: Sort the CAN messages in each message group from small to large according to the identifiers of the CAN messages to obtain a CAN message sequence from high to low priority; Based on each message group, controlling the scheduling function to select and send the corresponding CAN message according to the task in which it is located includes: based on each message group, controlling the scheduling function to select and send the sorted CAN message sequence in sequence according to the task in which it is located.

3. The CAN message sending method according to claim 1, characterized in that: The step of grouping the plurality of CAN messages according to different sending periods of the scheduling function comprises: Allocating event-type messages in the plurality of CAN messages to a scheduling function with the shortest transmission period; The periodic messages in the plurality of CAN messages are grouped according to the remaining different sending periods except the shortest sending period of the scheduling function.

4. The CAN message sending method according to claim 3, characterized in that: The grouping of the periodic messages in the plurality of CAN messages according to the remaining different transmission periods except the shortest transmission period of the scheduling function specifically includes: The periodic messages in the plurality of CAN messages are grouped according to a message grouping rule and the remaining different sending periods except the shortest sending period of the scheduling function.

5. The CAN message sending method according to claim 4, characterized in that: The method further includes: presetting a message grouping rule in the following manner: Setting the sending period of the scheduling function of the CAN message to be smaller than the message period of the CAN message; Set the CAN message period to be an integer multiple of the scheduling function's sending period; When setting the sending period of the scheduling function where the CAN message is located, the maximum period among the periods that meet the conditions should be selected.

6. The CAN message sending method according to any one of claims 1 to 5, characterized in that: The method further comprises: When a local network cluster PNC exists on the controller, obtain the network status of all PNCs; Based on the network status of all PNCs, the periodic messages obtained after grouping are grouped again to obtain a network wake-up message group and a network sleep message group; Based on the network wake-up message group, the control scheduling function selects to send the corresponding CAN message according to the task in which it is located.

7. The CAN message sending method according to any one of claims 1 to 5, characterized in that: The scheduling function for creating multiple controller area network (CAN) messages includes: Create scheduling functions for multiple Controller Area Network (CAN) messages based on the existing tasks and message cycles of the current operating system.

8. A CAN message sending device, characterized in that: The device is applied to an automotive open system architecture, including: An acquisition module is used to obtain a scheduling function for creating multiple controller area network (CAN) messages; A mapping module, used for mapping the scheduling function to tasks with different sending periods; A grouping module, configured to group the plurality of CAN messages according to different sending periods of the scheduling function; The first control sending module is used to control the scheduling function to send the corresponding CAN message according to the task selection based on each message group.

9. An electronic device, characterized in that: include: processor; a memory for storing instructions executable by the processor; The processor is configured to execute the instruction to implement the CAN message sending method according to any one of claims 1 to 7.

10. A computer-readable storage medium, characterized in that When the instructions in the computer-readable storage medium are executed by a processor of an electronic device, the electronic device is enabled to execute the CAN message sending method according to any one of claims 1 to 7.

Citation Information

Patent Citations

  • CAN message sending method and device, storage medium and electronic equipment

    CN111106987A

  • SOC-based CAN communication method and system

    CN114915515A

  • Vehicle domain controller communication signal period optimization method and system and vehicle

    CN115454594A

  • AutoSar-based power domain controller application layer architecture and control method thereof

    CN117289927A

  • Message sending and receiving method of controller local area network, related equipment and vehicle

    CN117640553A