Method, device, medium and electronic equipment for assigning can id of can bus
By constructing a CAN communication matrix signal library and parsing CAN communication change requests, and assigning CANIDs based on attribute information, the problems of low CANID allocation efficiency and duplicate allocation are solved, achieving efficient and accurate CANID allocation.
Patent Information
- Application Number
- CN202410829639.4
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2024-06-25
- Publication Date
- 2025-11-25
- Estimated Expiration
- 2044-06-25
AI Technical Summary
In existing technologies, CANID allocation is inefficient and prone to duplicate allocation and position conflicts, especially in the field of automotive electronics where maintaining signal relationships between different vehicle models is challenging.
By constructing a CAN communication matrix signal library, parsing CAN communication change requests, querying the attribute information of messages and signals to be added, and assigning new CANIDs to new messages and signals according to pre-set CANID allocation rules, duplicate allocation and position conflicts are avoided.
It improves the efficiency and effectiveness of CANID allocation, ensures the accuracy and consistency of CANID allocation, reduces manual intervention, and enhances the automation level of the system.
Smart Images

Figure CN118869659B_ABST
Abstract
Description
TECHNICAL FIELD
[0001] The present application belongs to the technical field of communication, and particularly relates to a CAN bus CANID allocation method and device, a medium and an electronic device. BACKGROUND
[0002] CAN communication is a bus type serial communication network. Any node on the network can send information to the bus at any time without distinction between master and slave. This communication mode has been widely used in the fields of automotive electronics, industrial control, medical treatment, etc. In the field of automotive electronics, due to the large number of vehicle models and the fact that signals between different vehicle models may be the same or different, it is a great challenge to maintain the signal relationship between different vehicle models. In particular, when there are new signals or new messages, manual table lookup is often required for CANID allocation, which is not only low in efficiency, but also prone to repeated allocation, position conflict of new signals between different vehicle models, etc. Therefore, how to improve the allocation efficiency of CANID and ensure the allocation effect has become a technical problem to be solved. SUMMARY
[0003] Embodiments of the present application provide a CAN bus CANID allocation method, device, medium and electronic device, which can at least improve the allocation efficiency of CANID and ensure the allocation effect.
[0004] Other characteristics and advantages of the present application will become apparent from the following detailed description, or will be learned by practice of the present application.
[0005] According to a first aspect of embodiments of the present application, a CAN bus CANID allocation method is provided, comprising:
[0006] According to the received CAN communication change request, the attribute information corresponding to the to-be-added message and / or the to-be-added signal is determined;
[0007] According to the attribute information corresponding to the to-be-added message and / or the to-be-added signal, a pre-constructed CAN communication matrix signal library is queried, the CAN communication matrix signal library comprising attribute information corresponding to known messages and known signals;
[0008] For the to-be-added message, if there is no known message with the same attribute information in the CAN communication matrix signal library, a new CANID is allocated for the to-be-added message according to the attribute information corresponding to the to-be-added message and according to a pre-set CANID allocation rule;
[0009] If there is no known signal with the same attribute information in the CAN communication matrix signal library, and it is determined that the to-be-added signal cannot be added to the empty position of the known message, a new CAN ID is allocated to the to-be-added signal according to the attribute information corresponding to the to-be-added signal and the CAN ID allocation rule.
[0010] According to an aspect of an embodiment of the present application, a CAN bus CAN ID allocation device is provided, comprising:
[0011] The analysis module is configured to analyze the received CAN communication change request, and determine attribute information corresponding to a to-be-added message and / or a to-be-added signal.
[0012] The query module is configured to query a pre-constructed CAN communication matrix signal library according to the attribute information corresponding to the to-be-added message and / or the to-be-added signal, wherein the CAN communication matrix signal library comprises attribute information corresponding to known messages and known signals.
[0013] The allocation module is configured to, for the to-be-added message, if there is no known message with the same attribute information in the CAN communication matrix signal library, allocate a new CAN ID to the to-be-added message according to the attribute information corresponding to the to-be-added message and a pre-set CAN ID allocation rule; for the to-be-added signal, if there is no known signal with the same attribute information in the CAN communication matrix signal library, and it is determined that the to-be-added signal cannot be added to the empty position of the known message, a new CAN ID is allocated to the to-be-added signal according to the attribute information corresponding to the to-be-added signal and the CAN ID allocation rule.
[0014] According to an aspect of an embodiment of the present application, a computer readable medium having a computer program stored thereon is provided, wherein the computer program is executed by a processor to implement the CAN bus CAN ID allocation method as described in the above embodiments.
[0015] According to an aspect of an embodiment of the present application, an electronic device is provided, comprising: one or more processors; a storage device configured to store one or more programs, wherein the one or more programs, when executed by the one or more processors, cause the one or more processors to implement the CAN bus CAN ID allocation method as described in the above embodiments.
[0016] According to an aspect of an embodiment of the present application, a computer program product or computer program is provided, which comprises computer instructions stored in a computer readable storage medium. A processor of a computer device reads the computer instructions from the computer readable storage medium, and the processor executes the computer instructions to enable the computer device to perform the CAN ID allocation method of the CAN bus provided in the above embodiments.
[0017] In the technical solution provided in some embodiments of the present application, the attribute information corresponding to the to-be-added message and / or the to-be-added signal is determined by analyzing the received CAN communication change request, and the CAN communication matrix signal library pre-constructed is queried according to the attribute information, the CAN communication matrix signal library comprising attribute information corresponding to known messages and known signals; according to the query result, for the to-be-added message, if there is no known message with the same attribute information in the CAN communication matrix signal library, a new CAN ID is allocated for the to-be-added message according to the attribute information corresponding to the to-be-added message according to the pre-set CAN ID allocation rule, and for the to-be-added signal, if there is no known signal with the same attribute information in the CAN communication matrix signal library, and it is determined that the to-be-added signal cannot be added to the empty position of the known message, a new CAN ID is allocated for the to-be-added signal according to the attribute information corresponding to the to-be-added signal according to the CAN ID allocation rule.
[0018] Therefore, by pre-constructing the CAN communication matrix signal library and querying according to the attribute information of the to-be-added message or the to-be-added signal, it can be quickly identified whether the to-be-added message or the to-be-added signal already exists, which not only improves the query efficiency, but also avoids repeated allocation. Moreover, for the to-be-added signal, it is not only identified whether it already exists in the CAN communication matrix signal library, but also identified whether it can be added to the empty position of the known message, so as to avoid unnecessary CAN ID allocation. In this way, the technical solution of the embodiments of the present application can not only improve the allocation efficiency of the CAN ID, but also ensure the allocation effect of the CAN ID.
[0019] It should be understood that the foregoing general description and the following detailed description are only exemplary and explanatory, and cannot limit the present application. BRIEF DESCRIPTION OF DRAWINGS
[0020] The drawings incorporated into the specification and forming a part thereof illustrate embodiments consistent with the present application and, together with the description, serve to explain the principles of the application. Obviously, the drawings in the following description are only some embodiments of the present application, and other drawings can be obtained by those skilled in the art without creative labor. In the drawings:
[0021] Figure 1A flowchart of the CANID allocation method of the CAN bus in the embodiment of the present application is shown.
[0022] Figure 2 A detailed flowchart of the CANID allocation method of the CAN bus in the embodiment of the present application is shown.
[0023] Figure 3 A block diagram of the CANID allocation device of the CAN bus in the embodiment of the present application is shown.
[0024] Figure 4 A structural schematic diagram of a computer system of an electronic device suitable for implementing the embodiment of the present application is shown. DETAILED DESCRIPTION
[0025] The technical solutions in the embodiments of the present application will be described clearly and completely below with reference to the drawings in the embodiments of the present application. Obviously, the described embodiments are only some of the embodiments of the present application, but not all the embodiments of the present application. Based on the embodiments in the present application, all other embodiments obtained by those skilled in the art without creative work fall within the scope of protection of the present application.
[0026] In addition, the described features, structures or characteristics can be combined in any suitable way in one or more embodiments. In the following description, numerous specific details are provided to give a sufficient understanding of the embodiments of the present application. However, those skilled in the art will realize that the technical solutions of the present application can be practiced without one or more of the specific details, or can employ other methods, components, devices, steps, etc. In other cases, well-known methods, devices, implementations or operations are not shown or described in detail to avoid obscuring the aspects of the present application.
[0027] The block diagrams shown in the drawings are only functional entities, and do not necessarily correspond to physically independent entities. That is, these functional entities can be implemented in the form of software, or in one or more hardware modules or integrated circuits, or in different network and / or processor devices and / or microcontroller devices.
[0028] The flowcharts shown in the drawings are only exemplary illustrations, and do not necessarily include all contents and operations / steps, nor do they necessarily be executed in the described order. For example, some operations / steps can be further decomposed, and some operations / steps can be combined or partially combined, so the actual execution order can be changed according to the actual situation.
[0029] In the description of the present application, it should be understood that the terms "first", "second" are only for the purpose of description, and cannot be understood as indicating or implying relative importance or implicitly indicating the number of indicated technical features. Therefore, the features defined with "first", "second" can explicitly or implicitly include one or more of the features. In the description of the present application, unless otherwise specified, the meaning of "multiple" is two or more.
[0030] Figure 1 A flowchart of a CAN ID allocation method of a CAN bus according to an embodiment of the present application is shown.
[0031] The method can be applied in a terminal device or a server, wherein the terminal device can include, but is not limited to, one or more of a smartphone, a tablet computer, a portable computer, and a desktop computer; and the server can be a physical server or a cloud server.
[0032] As Figure 1 shown, the CAN ID allocation method of the CAN bus includes at least steps S110 to S140, which are described in detail as follows: (Hereinafter, the method is applied to a terminal device as an example, hereinafter referred to as "terminal")
[0033] In step S110, the received CAN communication change request is parsed to determine the attribute information corresponding to the to-be-added message and / or the to-be-added signal.
[0034] Among them, the CAN communication change request can be information for requesting to add a message or a signal in the CAN network communication of a certain, part or all vehicle models. It should be noted that one message can contain one or more signals, and "multiple" in the present application means two or any number of two or more.
[0035] In this embodiment, when there is a demand for adding a message or a signal, a user (such as a researcher, etc.) can fill in the relevant demand information, i.e., the attribute information of the to-be-added message or the to-be-added signal, to generate a CAN communication change request. After receiving the CAN communication change request, the terminal can parse the CAN communication change request to extract the attribute information corresponding to the to-be-added message and / or the to-be-added signal.
[0036] It should be noted that in a CAN communication change request, only a message can be requested to be added, only a signal can be requested to be added, or a message and a signal can be requested to be added at the same time, and the number of to-be-added messages and to-be-added signals is not limited. That is, the user can process each addition demand separately, or can process the addition demand in batches.
[0037] In an embodiment of the present application, the terminal can summarize the CAN communication change requests received historically to form a CAN communication change list, which can include the change requirements of each vehicle model that have been completed or not completed. The manager can periodically check the CAN communication change list, select the change table item of the new message requirement or the new signal requirement that needs to be allocated CAN ID for confirmation. The terminal can extract the attribute information of the to-be-added message and / or the to-be-added signal according to the change table item selected by the manager.
[0038] In step S120, according to the attribute information corresponding to the to-be-added message and / or the to-be-added signal, the CAN communication matrix signal library pre-constructed is queried, and the CAN communication matrix signal library includes the attribute information corresponding to the known message and the known signal.
[0039] In this embodiment, the manager can summarize the attribute information of the known message and the known signal to form the CAN communication matrix signal library. Taking the known message as an example, the CAN communication matrix signal library can arrange the message type, message sending type, message purpose, and message priority and the like information of the known message. The CAN communication matrix signal library can also arrange the related information of the signal contained in the known message, such as the signal name, signal length, signal start position, signal period and the like.
[0040] Therefore, when the attribute information corresponding to the to-be-added message and / or the to-be-added signal is determined, the terminal can query the CAN communication matrix signal library to determine whether the to-be-added message and / or the to-be-added signal already exist in the CAN communication matrix signal library according to the query result. It should be understood that if the known message or the known signal with the same attribute information already exists in the CAN communication matrix signal library, it means that the to-be-added message or the to-be-added signal already exists or the attribute information is filled in error. At this time, the terminal can reject the corresponding CAN communication change request and prompt the sender of the CAN communication change request with the related information. If the known message or the known signal with the same attribute information does not exist in the CAN communication matrix signal library, it means that the to-be-added message or the to-be-added signal is new, and subsequent processing can be performed.
[0041] In step S130, for the to-be-added message, if the known message with the same attribute information does not exist in the CAN communication matrix signal library, a new CAN ID is allocated to the to-be-added message according to the attribute information corresponding to the to-be-added message and the pre-set CAN ID allocation rule.
[0042] In this embodiment, when the CAN communication change request is a request to add a new message, the terminal can compare the attribute information of the new message to be added with the attribute information of the known messages in the CAN communication matrix signal library. If there is no known message with the same attribute information in the CAN communication matrix signal library, it indicates that a new CAN ID can be assigned to the new message to be added. It should be understood that the CAN ID is a key field in the CAN (Controller Area Network) bus protocol for identifying messages. In the CAN bus system, each message contains a unique CAN ID, which is used to distinguish different messages and signals.
[0043] When it is determined that a new CAN ID needs to be assigned to the new message to be added, the terminal can assign a new CAN ID to the new message to be added based on the attribute information of the new message to be added according to a pre-set CAN ID assignment rule. The CAN ID assignment rule can be a determination rule for determining the value range of the required CAN ID, which can be pre-set by a person skilled in the art according to actual implementation needs. When the value range is determined, the terminal can select an unused specific value from the value range (for example, the terminal can query the CAN communication matrix signal library to determine which value of the CAN ID is not used) as the new CAN ID.
[0044] In an example, the terminal can select an unused value from the determined value range in order as the new CAN ID; in another example, the terminal can also randomly select a value from the unused values in the determined value range as the new CAN ID. A person skilled in the art can select the corresponding implementation mode according to actual implementation needs, which is not specially limited.
[0045] Please continue to refer to Figure 1 In step S140, for the new signal to be added, if there is no known signal with the same attribute information in the CAN communication matrix signal library, and it is determined that the new signal to be added cannot be added to the empty position of the known message, a new CAN ID is assigned to the new signal to be added according to the attribute information corresponding to the new signal to be added according to the CAN ID assignment rule.
[0046] In this embodiment, when the CAN communication change request is a new signal, for the new signal, when querying the CAN communication matrix signal library, based on determining whether there is a known signal with the same attribute information in the CAN communication matrix signal library, if there is no known signal with the same attribute information in the CAN communication matrix signal library, it is further determined whether the new signal can be added to the empty position of the known message, thereby avoiding unnecessary CAN ID allocation.
[0047] Only when there is no known signal with the same attribute information in the CAN communication matrix signal library, and the new signal cannot be added to the empty position of the known message, a new CAN ID is allocated for the new signal. At this time, the terminal can allocate a new CAN ID for the new signal according to the attribute information of the new signal according to the aforementioned CAN ID allocation rule.
[0048] Therefore, according to the CAN ID allocation method of the CAN bus provided by the embodiment of the application, by analyzing the received CAN communication change request, the attribute information corresponding to the new message and / or the new signal is determined, the CAN communication matrix signal library pre-constructed is queried according to the attribute information, the CAN communication matrix signal library includes the attribute information corresponding to the known message and the known signal; according to the query result, for the new message, if there is no known message with the same attribute information in the CAN communication matrix signal library, a new CAN ID is allocated for the new message according to the attribute information corresponding to the new message according to the pre-set CAN ID allocation rule, for the new signal, if there is no known signal with the same attribute information in the CAN communication matrix signal library, and it is determined that the new signal cannot be added to the empty position of the known message, a new CAN ID is allocated for the new signal according to the attribute information corresponding to the new signal according to the CAN ID allocation rule.
[0049] Therefore, by pre-constructing the CAN communication matrix signal library and querying according to the attribute information of the new message or the new signal, it can be quickly identified whether the new message or the new signal already exists, not only improving the query efficiency, but also avoiding repeated allocation. Moreover, for the new signal, not only whether it already exists in the CAN communication matrix signal library is identified, but also whether it can be added to the empty position of the known message is identified, so as to avoid unnecessary CAN ID allocation. The CAN ID allocation method of the CAN bus provided by the embodiment of the application not only can improve the allocation efficiency of the CAN ID, but also can ensure the allocation effect of the CAN ID.
[0050] In an embodiment of the application, the attribute information of the new signal includes a signal name, a CAN ID, a signal period, a signal start bit, and a signal length.
[0051] The method further comprises:
[0052] According to the signal name of the signal to be added, the CAN communication matrix signal library is queried;
[0053] If the known signal with the same signal name exists in the CAN communication matrix signal library, the CAN communication change request is rejected.
[0054] If the known signal with the same signal name does not exist in the CAN communication matrix signal library, whether the signal to be added can be added to the empty position of the known message is determined according to the CAN ID, signal period, signal start bit and signal length of the signal to be added.
[0055] In this embodiment, the attribute information of the signal to be added can include the signal name, CAN ID, signal period, signal start bit and signal length. It is worth noting that the CAN ID contained in the attribute information of the signal to be added is the CAN ID of the known message to which the user wants to add the signal to be added. If the user does not want to add the known message, the CAN ID can be empty when filling in the related information of the signal to be added.
[0056] When the CAN communication change request is to add a signal, for the signal to be added, the terminal can query the CAN communication matrix signal library according to the signal name of the signal to be added, determine whether the known signal with the same signal name exists, and if the known signal with the same signal name exists, the terminal can reject the CAN communication change request and prompt that the signal already exists.
[0057] In an example, when it is determined that the known signal with the same signal name exists in the CAN communication matrix signal library, the terminal can continue to compare other attribute information of the signal to be added with the attribute information corresponding to the known signal. If the other attribute information is also the same, the terminal can reject the CAN communication change request and prompt that the signal already exists, please confirm. If the other attribute information is inconsistent, the terminal can reject the CAN communication change request and prompt that the signal attribute is inconsistent, please confirm.
[0058] If the known signal with the same signal name does not exist in the CAN communication matrix signal library, the terminal can determine whether the signal to be added can be added to the empty position of the known message according to other attribute information of the signal to be added, i.e., the CAN ID, signal period and signal length, to avoid unnecessary CAN ID allocation.
[0059] In an embodiment of the present application, whether the signal to be added can be added to the empty position of the known message according to the CAN ID, signal period, signal start bit and signal length of the signal to be added, comprises:
[0060] If the CANID and signal period corresponding to the signal to be added are both empty, the CAN communication change request is rejected and a first prompt message is sent.
[0061] If the CANID corresponding to the signal to be added is empty, but the signal period is not empty, then based on the signal length of the signal to be added, it is determined whether the signal to be added can be added to the empty position of a known message with the same signal period.
[0062] If the signal to be added can be added to an empty position in a known message with the same signal period, then the position for adding the signal to be added is determined and a second prompt message is sent.
[0063] In this embodiment, such as Figure 2 As shown, after determining that no known signal with the same name exists in the CAN communication matrix signal library, the terminal can first check if the CANID of the signal to be added is empty. If the CANID is empty, it checks if the signal period of the signal to be added is empty. If the signal period is also empty, not only can the signal to be added not be added to the known messages, but even if a new message is created for the signal to be added, the transmission period of the new message cannot be determined. Therefore, when both the CANID and the signal period of the signal to be added are empty, the terminal can reject the CAN communication change request and generate and send a first prompt message. This first prompt message can be used to prompt the user that the signal period of the signal to be added is empty and request confirmation, so that the user can understand the request processing status and take appropriate action based on the first prompt message.
[0064] If the CANID of the signal to be added is empty, but the signal period is not empty, the terminal can query the CAN communication matrix signal library based on the signal period to determine a known message with the same signal period. Then, based on the signal length of the signal to be added, it can be determined whether there are enough empty spaces in the known message to accommodate the signal to be added.
[0065] It should be understood that there can be one or more known messages with the same signal period as the signal to be added. If there are multiple known messages with the same signal period, the terminal can confirm each of the multiple known messages one by one until it is determined that there is an empty space in one known message that can accommodate the signal to be added, or that there is no empty space in any of the known messages that can accommodate the signal to be added.
[0066] If the empty position of the known message can accommodate the to-be-added signal, the terminal can determine the adding position of the to-be-added signal, generate and send second prompt information, which can be used to prompt the user that the signal adding is completed and indicate the adding position of the to-be-added signal. In an example, the second prompt information can include the CANID of the known message to which the to-be-added signal is added and the signal start bit of the to-be-added signal in the known message.
[0067] In an embodiment, if the CANID of the to-be-added signal is empty and the signal period is not empty, the to-be-added signal cannot be added to the known message with the same signal period, the terminal can allocate a new CANID to the to-be-added signal according to the attribute information of the to-be-added signal according to the CANID allocation rule.
[0068] In an embodiment of the present application, the method further comprises:
[0069] If the CANID corresponding to the to-be-added signal and the signal start bit are both not empty, whether the to-be-added signal can be added to the empty position of the known message corresponding to the CANID is determined according to the signal start bit and the signal length of the to-be-added signal;
[0070] If the to-be-added signal can be added to the empty position of the known message corresponding to the CANID, the adding position of the to-be-added signal is determined and third prompt information is sent;
[0071] If the to-be-added signal cannot be added to the empty position of the known message corresponding to the CANID, whether the to-be-added signal can be added to the empty position of other known messages with the same signal period is determined according to the signal length of the to-be-added signal;
[0072] If the to-be-added signal can be added to the empty position of other known messages with the same signal period, the adding position of the to-be-added signal is determined and fourth prompt information is sent.
[0073] In this embodiment, please continue to refer to Figure 2 When it is determined that the CANID corresponding to the to-be-added signal is not empty, i.e., there is a known message to which the user wants to add the to-be-added signal, the terminal can continue to detect whether the signal start bit of the to-be-added message is empty. It should be understood that the signal start bit can be used to determine the start position of the to-be-added message in the message.
[0074] If the CANID of the to-be-added signal is not empty and the signal start bit is also not empty, the terminal can determine the corresponding known message according to the CANID of the to-be-added signal, and determine whether the to-be-added signal can be added to the known message according to the signal start bit and the signal length of the to-be-added signal.
[0075] If yes, the terminal determines the adding position of the to-be-added signal, generates and sends third prompt information to the user to prompt the user that the to-be-added signal is added successfully and indicates the specific adding position.
[0076] In an embodiment, determining whether the to-be-added signal can be added to the empty position of the known message corresponding to the CANID according to the signal start bit and the signal length of the to-be-added signal comprises:
[0077] Determining whether the to-be-added signal can be added to the empty position corresponding to the signal start bit in the known message corresponding to the CANID according to the signal start bit and the signal length of the to-be-added signal;
[0078] If the to-be-added signal can be added to the empty position corresponding to the signal start bit in the known message corresponding to the CANID, the adding position of the to-be-added signal is determined and fifth prompt information is sent.
[0079] If the to-be-added signal cannot be added to the empty position corresponding to the signal start bit in the known message corresponding to the CANID, it is determined whether the to-be-added signal can be added to other empty positions in the known message corresponding to the CANID according to the signal length of the to-be-added signal.
[0080] If the to-be-added signal can be added to other empty positions in the known message corresponding to the CANID, the adding position of the to-be-added signal is determined and sixth prompt information is sent.
[0081] In this embodiment, when determining whether the to-be-added signal can be added to the known message corresponding to the CANID thereof, the terminal can first determine whether the position corresponding to the signal start bit in the known message is empty according to the signal start bit of the to-be-added signal. If the position is not empty, it means that the to-be-added signal cannot be added according to the signal start bit thereof; if the position is empty, the terminal continues to confirm whether the length of the empty position corresponding to the signal start bit in the known message is sufficient to accommodate the to-be-added signal with the signal length, and if yes, it means that the to-be-added signal can be added according to the original CAN communication change request. At this time, the terminal can confirm the adding position of the to-be-added signal, generate and send fifth prompt information to the user to prompt the user that the to-be-added signal is added successfully and indicate the adding position of the to-be-added signal.
[0082] If the position corresponding to the signal start bit in the known message corresponding to the CAN ID of the signal to be added is not empty or the empty position corresponding to the signal start bit is not enough to accommodate the signal to be added, the terminal can continue to determine whether there is an empty position of sufficient length in other places in the known message to accommodate the signal to be added according to the signal length of the signal to be added. If there is, the terminal can determine to add the signal to be added to the position, generate and send the sixth prompt information to the user to prompt the user that the addition of the signal to be added is completed, and indicate the addition position of the signal to be added. In an example, the sixth prompt information can include the signal start bit of the signal to be added after the change.
[0083] Please continue to refer to Figure 2 If the known message corresponding to the CAN ID of the signal to be added cannot accommodate the signal to be added, the terminal can determine whether there is an empty position of sufficient length in other known messages with the same period to accommodate the signal to be added according to the signal period and the signal length of the signal to be added. If the empty position of the other known message is sufficient to accommodate the signal to be added, the terminal can determine the addition position of the signal to be added, generate and send the fourth prompt information to the user to prompt the user that the addition of the signal to be added is completed, and indicate the addition position of the signal to be added. In an example, the fourth prompt information can include the CAN ID after the change, and can also include the signal start bit of the signal to be added in the known message.
[0084] If the signal to be added cannot be added to other known messages with the same signal period, the terminal can assign a new CAN ID to the signal to be added according to the attribute information of the signal to be added according to the CAN ID allocation rule.
[0085] In an embodiment of the present application, the method further comprises:
[0086] If the CAN ID corresponding to the signal to be added is not empty, and the signal start bit is empty, it is determined whether the signal to be added can be added to the empty position in the known message corresponding to the CAN ID according to the signal length of the signal to be added.
[0087] If the signal to be added can be added to the empty position of the known message corresponding to the CAN ID, the addition position of the signal to be added is determined and the seventh prompt information is sent.
[0088] In this embodiment, please refer to Figure 2If the CAN ID corresponding to the to-be-added signal is not empty and the signal start bit of the to-be-added signal is empty, it indicates that the to-be-added signal only needs to be added to the known message corresponding to the CAN ID, without limitation on the specific position. Therefore, the terminal can determine whether there is a sufficient empty position in the known message corresponding to the CAN ID to accommodate the to-be-added signal according to the signal length of the to-be-added signal. If there is, the terminal can determine the addition position of the to-be-added signal, generate and send the seventh prompt information to the user to prompt the user that the addition of the to-be-added signal is completed and indicate the addition position of the to-be-added signal. In an example, the seventh prompt information can include the determined signal start bit of the to-be-added signal.
[0089] In an embodiment of the present application, the CAN ID allocation rule provided by the present application includes:
[0090] determining a value range of the new CAN ID for the to-be-added signal or the to-be-added message according to at least one of the message type, the message sending type, the message sending period, the message purpose, and the message priority.
[0091] In this embodiment, the CAN ID allocation rule can include determining a value range of the new CAN ID for the to-be-added signal or the to-be-added message according to various attribute information. The attribute information can include, but is not limited to, at least one of the message type, the message sending type, the message sending period, the message purpose, and the message priority.
[0092] In an example, the CAN ID allocation rule can determine the value range of the new CAN ID according to the message type, the message sending type, the message sending period, the message purpose, and the message priority. When setting the CAN ID allocation rule, a person skilled in the art can determine the value range of the CAN ID corresponding to each attribute information according to the order of gradually narrowing the value range. When allocating the new CAN ID according to the CAN ID allocation rule, the terminal can first determine a larger value range according to a certain attribute information, then determine a smaller value range from the determined larger value range according to another attribute information, and so on, until all attribute information is matched, thereby determining the value range of the new CAN ID.
[0093] For example, the message type can include Normal, Diag, and NM, and the value ranges of the CAN ID corresponding to various message types can be Normal: 0x000-0x5FF, Diag: 0x600-0x6FF, and NM: 0x700-0x7FF, respectively.
[0094] The message sending type can include Event, CE, and Cycle. When the message type is Normal, the numerical ranges of the CANIDs corresponding to the three message sending types can be: Event: 0x000-0x07F; CE, Cycle: 0x080-0x5FF.
[0095] When the message type is Normal and the message sending type is CE or Cycle, the numerical ranges of different message sending periods can be:
[0096] 10-20ms: 0x080-0x0FF;
[0097] 20-100ms: 0x100-0x27F;
[0098] 100-200ms: 0x280-0x3FF;
[0099] 200-500ms: 0x400-0x4FF;
[0100] ≥500ms: 0x500-0x5FF;
[0101] That is, the smaller the message sending period, the earlier the selection when allocating the numerical range.
[0102] The message purpose can include, but is not limited to, power, chassis, intelligent driving, instrument, vehicle body, safety, testing / calibration, etc. When the message type is Normal, the message sending type is CE or Cycle, and the message sending period is ≥500ms, the numerical range corresponding to the message purpose of testing / calibration can be 0x57F-0x5FF.
[0103] After determining the corresponding numerical range according to the aforementioned attribute information, the specific numerical range, i.e., the numerical range corresponding to the new CANID, can be determined from the previously determined numerical range according to the message priority.
[0104] It should be understood that the above numbers are only exemplary examples, and those skilled in the art can determine the numerical range corresponding to each attribute information according to actual implementation needs, which is not specially limited in the present application.
[0105] In an embodiment of the present application, after determining the new CANID corresponding to the to-be-added signal and / or the to-be-added message, the terminal can also calculate the network segment message period jitter to determine whether the demand is met. It should be understood that the network segment message period jitter can be a periodic change or instability phenomenon that a message may encounter when sent in different network segments (i.e., different parts or nodes of a network) in a vehicle CAN bus system. It can be caused by network delay, node processing time, network congestion, priority scheduling, hardware differences, or software configuration, etc.
[0106] In the case that the network segment message period jitter meets the requirement, the terminal can determine a new CANID and send corresponding prompt information to the user to prompt that the CANID allocation is completed, and the prompt information can include the new CANID.
[0107] In the case that the network segment message period jitter does not meet the requirement, the terminal can reevaluate the period allocation, that is, reevaluate and allocate the CANID according to the sending period and priority of the message, to ensure that the sending period of the message is more uniform and meets the requirement; or the terminal can optimize the network configuration to reduce the period jitter; or the terminal can adjust the priority of the message to ensure that the message can be sent in time, and the like.
[0108] After the new CANID is determined, the terminal can update the CAN communication matrix signal library according to the related information of the new CANID, so as to facilitate subsequent query and allocation.
[0109] The following describes an apparatus embodiment of the present application, which can be used to execute the CANID allocation method of the CAN bus in the above embodiments of the present application. For details not disclosed in the apparatus embodiment of the present application, refer to the above embodiments of the CANID allocation method of the CAN bus.
[0110] Referring to Figure 3 , a block diagram of a CANID allocation apparatus of the CAN bus in an embodiment of the present application is shown.
[0111] As shown in Figure 3 , the CANID allocation apparatus of the CAN bus includes:
[0112] A parsing module is configured to parse the received CAN communication change request to determine attribute information corresponding to a to-be-added message and / or a to-be-added signal.
[0113] A query module is configured to query a pre-constructed CAN communication matrix signal library according to the attribute information corresponding to the to-be-added message and / or the to-be-added signal, wherein the CAN communication matrix signal library includes attribute information corresponding to known messages and known signals.
[0114] The allocation module is configured to, for the to-be-added message, if there is no known message with the same attribute information in the CAN communication matrix signal library, allocate a new CAN ID for the to-be-added message according to attribute information corresponding to the to-be-added message and according to a pre-set CAN ID allocation rule; for the to-be-added signal, if there is no known signal with the same attribute information in the CAN communication matrix signal library and if it is determined that the to-be-added signal cannot be added to the empty position of the known message, allocate a new CAN ID for the to-be-added signal according to attribute information corresponding to the to-be-added signal and according to the CAN ID allocation rule.
[0115] In an embodiment of the present application, the attribute information of the to-be-added signal includes a signal name, a CAN ID, a signal period, a signal start bit and a signal length.
[0116] The allocation module is further configured to, according to the signal name of the to-be-added signal, query a pre-constructed CAN communication matrix signal library; if there is a known signal with the same signal name in the CAN communication matrix signal library, reject the CAN communication change request; and if there is no known signal with the same signal name in the CAN communication matrix signal library, determine whether the to-be-added signal can be added to the empty position of the known message according to the CAN ID, the signal period, the signal start bit and the signal length of the to-be-added signal.
[0117] In an embodiment of the present application, the determination of whether the to-be-added signal can be added to the empty position of the known message according to the CAN ID, the signal period, the signal start bit and the signal length of the to-be-added signal includes: if the CAN ID and the signal period corresponding to the to-be-added signal are both empty, rejecting the CAN communication change request and sending first prompt information; if the CAN ID corresponding to the to-be-added signal is empty but the signal period is not empty, determining whether the to-be-added signal can be added to the empty position of the known message with the same signal period according to the signal length of the to-be-added signal; and if the to-be-added signal can be added to the empty position of the known message with the same signal period, determining the addition position of the to-be-added signal and sending second prompt information.
[0118] In an embodiment of the present application, the distribution module is further configured to: if the CAN ID corresponding to the signal to be added and the signal start bit are both not empty, determine whether the signal to be added can be added to the empty position of the known message corresponding to the CAN ID according to the signal start bit and the signal length of the signal to be added; if the signal to be added can be added to the empty position of the known message corresponding to the CAN ID, determine the adding position of the signal to be added and send a third prompt information; if the signal to be added cannot be added to the empty position of the known message corresponding to the CAN ID, determine whether the signal to be added can be added to the empty position of other known messages with the same signal period according to the signal length of the signal to be added; if the signal to be added can be added to the empty position of other known messages with the same signal period, determine the adding position of the signal to be added and send a fourth prompt information.
[0119] In an embodiment of the present application, the determination of whether the signal to be added can be added to the empty position of the known message corresponding to the CAN ID according to the signal start bit and the signal length of the signal to be added comprises: determining whether the signal to be added can be added to the empty position corresponding to the signal start bit in the known message corresponding to the CAN ID according to the signal start bit and the signal length of the signal to be added; if the signal to be added can be added to the empty position corresponding to the signal start bit in the known message corresponding to the CAN ID, determining the adding position of the signal to be added and sending a fifth prompt information; if the signal to be added cannot be added to the empty position corresponding to the signal start bit in the known message corresponding to the CAN ID, determining whether the signal to be added can be added to other empty positions in the known message corresponding to the CAN ID according to the signal length of the signal to be added; if the signal to be added can be added to other empty positions in the known message corresponding to the CAN ID, determining the adding position of the signal to be added and sending a sixth prompt information.
[0120] In an embodiment of the present application, the distribution module is further configured to: if the CAN ID corresponding to the signal to be added is not empty and the signal start bit is empty, determine whether the signal to be added can be added to the empty position in the known message corresponding to the CAN ID according to the signal length of the signal to be added; if the signal to be added can be added to the empty position in the known message corresponding to the CAN ID, determining the adding position of the signal to be added and sending a seventh prompt information.
[0121] In an embodiment of the present application, the CAN ID allocation rule comprises: determining a value range of the new CAN ID for the to-be-added signal or the to-be-added message according to at least one of a message type, a message sending type, a message sending period, a message purpose, and a message priority.
[0122] Figure 4 A structural diagram of a computer system of an electronic device suitable for implementing embodiments of the present application is shown.
[0123] It should be noted that, Figure 4 The computer system of the electronic device shown is only an example and should not impose any limitation on the functions and use range of embodiments of the present application.
[0124] As Figure 4 shown, the computer system includes a central processing unit (CPU) 401 which can perform various appropriate actions and processes according to programs stored in a read-only memory (ROM) 402 or loaded from a storage portion 408 into a random access memory (RAM) 403, such as performing the methods described in the above embodiments. Various programs and data required for system operation are also stored in the RAM 403. The CPU 401, the ROM 402, and the RAM 403 are connected to each other through a bus 404. An input / output (I / O) interface 405 is also connected to the bus 404.
[0125] The following components are connected to the I / O interface 405: an input portion 406 including a keyboard, a mouse, and the like; an output portion 407 including a display such as a cathode ray tube (CRT), a liquid crystal display (LCD), and the like, and a speaker, and the like; a storage portion 408 including a hard disk, and the like; and a communication portion 409 including a network interface card such as a LAN (Local Area Network) card, a modem, and the like. The communication portion 409 performs communication processing via a network such as the Internet. A drive 410 is also connected to the I / O interface 405 as necessary. A removable recording medium 411 such as a magnetic disk, an optical disk, a magneto-optical disk, a semiconductor memory, and the like is attached to the drive 410 as necessary, so that a computer program read therefrom is installed into the storage portion 408 as necessary.
[0126] In particular, the processes described above with reference to the flow charts can be implemented as a computer software program in accordance with the embodiments of the present application. For example, embodiments of the present application include a computer program product comprising a computer program carried on a computer readable medium, the computer program comprising computer instructions for performing the methods illustrated by the flow charts. In such embodiments, the computer program can be downloaded and installed from a network via the communication section 409 and / or installed from the removable media 411. When the computer program is executed by the central processing unit (CPU) 401, various functions defined in the system of the present application are performed.
[0127] It should be noted that the computer readable medium shown in the embodiments of the present application can be a computer readable signal medium or a computer readable storage medium or any combination of the two. The computer readable storage medium may, for example, be, but is not limited to, an electronic, magnetic, optical, electromagnetic, infrared, or semiconductor system, device or apparatus, or any combination of the above. More specific examples of the computer readable storage medium can include, but are not limited to, an electrical connection having one or more wires, a portable computer diskette, a hard disk, a random access memory (RAM), a read-only memory (ROM), an erasable programmable read-only memory (EPROM), a flash memory, an optical fiber, a portable compact disc read-only memory (CD-ROM), an optical storage device, a magnetic storage device, or any suitable combination of the above. In this application, the computer readable storage medium can be any tangible medium that contains or stores a program used by or in connection with an instruction execution system, apparatus or device. In this application, the computer readable signal medium can include a data signal carried in a baseband or as part of a carrier wave, in which the computer readable program is carried. Such a propagated data signal can take any of a variety of forms, including but not limited to electro-magnetic, optical, or any suitable combination thereof. The computer readable signal medium can also be any computer readable medium that is not a computer readable storage medium and that can communicate, propagate or transport a program for use by or in connection with an instruction execution system, apparatus or device. The computer program contained in the computer readable medium can be transmitted using any suitable medium, including but not limited to wireless, wired, optical, or any suitable combination of the above.
[0128] The flowcharts and block diagrams in the drawings illustrate the architecture, functionality, and operation of possible implementations of systems, methods and computer program products according to various embodiments of the present application. In this regard, each block in the flowcharts or block diagrams can represent a module, segment, or portion of code, which comprises one or more executable instructions for implementing the specified logical functions. It should also be noted that in some alternative implementations, the functions noted in the blocks can occur out of the order noted in the figures. For example, two blocks shown in succession may, in fact, be executed substantially concurrently or the blocks can sometimes be executed in the reverse order, depending upon the functionality involved. It will also be noted that each block of the block diagrams and / or flowchart illustrations, and combinations thereof, can be implemented by a dedicated hardware-based system that performs the specified functions or operations, or combinations of hardware and software.
[0129] The units described in the embodiments of the present application can be implemented by software, or by hardware, or by a combination of software and hardware. The units described may
[0130] As another aspect, the present application also provides a computer readable medium, which can be included in the electronic device described in the above embodiments, or can exist separately without being assembled into the electronic device. The computer readable medium carries one or more programs, which, when executed by the electronic device, cause the electronic device to implement the method described in the above embodiments.
[0131] It should be noted that although several modules or units of the device for action execution are mentioned in the above detailed description, the division is not mandatory. In fact, according to the embodiments of the present application, the features and functions of two or more modules or units described above can be embodied in one module or unit. Conversely, the features and functions of one module or unit described above can be further divided into a plurality of modules or units.
[0132] From the above description of the embodiments, those skilled in the art will readily appreciate that the example embodiments described herein can be implemented by software and / or by hardware coupled with software. Accordingly, the technical solutions according to the embodiments of the present application can be embodied in the form of a software product. The software product can be stored in a non-volatile storage medium (which can be a CD-ROM, a USB flash drive, a mobile hard disk, or the like) or on a network, and includes a number of instructions for causing a computing device (which can be a personal computer, a server, a touch terminal, or a network device, etc.) to perform the methods according to the embodiments of the present application.
[0133] Other embodiments of the application will be apparent to those skilled in the art from consideration of the specification and practice of the features disclosed herein. It is intended that the application embrace any and all variations of the present application that fall within the scope of the general inventive concept as defined by the appended claims and their equivalents. It is intended that the application not be limited to the examples described herein and that upon reading this disclosure, persons of ordinary skill in the art will appreciate still other implementations that are within the scope of the present application. Accordingly, the application is not to be restricted except in light of the attached claims and their equivalents.
[0134] It is to be understood that the application is not limited to the precise details of construction and the arrangement of components described above and illustrated in the drawings. The scope of the application should only be limited by the claims appended hereto.
Claims
1. A method of CAN ID assignment for a CAN bus, characterized in that, The method comprises the following steps: According to the received CAN communication change request, the attribute information corresponding to the to-be-added message and / or the to-be-added signal is determined; According to the attribute information corresponding to the to-be-added message and / or the to-be-added signal, the CAN communication matrix signal library pre-constructed is queried, and the CAN communication matrix signal library comprises attribute information corresponding to known messages and known signals; For the to-be-added message, if there is no known message with the same attribute information in the CAN communication matrix signal library, a new CANID is allocated to the to-be-added message according to the attribute information corresponding to the to-be-added message and according to the pre-set CANID allocation rule; For the to-be-added signal, if there is no known signal with the same attribute information in the CAN communication matrix signal library and it is determined that the to-be-added signal cannot be added to the empty position of the known message, a new CANID is allocated to the to-be-added signal according to the attribute information corresponding to the to-be-added signal and according to the CANID allocation rule; The attribute information of the to-be-added signal comprises a signal name, a CANID, a signal period, a signal start bit and a signal length; the method further comprises the following steps: According to the signal name of the to-be-added signal, the CAN communication matrix signal library pre-constructed is queried; If there is a known signal with the same signal name in the CAN communication matrix signal library, the CAN communication change request is rejected; If there is no known signal with the same signal name in the CAN communication matrix signal library and the CANID and the signal period corresponding to the to-be-added signal are both empty, the CAN communication change request is rejected and a first prompt information is sent; If there is no known signal with the same signal name in the CAN communication matrix signal library and the CANID corresponding to the to-be-added signal is empty but the signal period is not empty, it is determined whether the to-be-added signal can be added to the empty position of the known message with the same signal period according to the signal length of the to-be-added signal; if the to-be-added signal can be added to the empty position of the known message with the same signal period, the addition position of the to-be-added signal is determined and a second prompt information is sent.
2. The method of claim 1, wherein, The method further comprises the following steps: If the CANID and the signal start bit corresponding to the to-be-added signal are both not empty, it is determined whether the to-be-added signal can be added to the empty position of the known message corresponding to the CANID according to the signal start bit and the signal length of the to-be-added signal; If the to-be-added signal can be added to the empty position of the known message corresponding to the CANID, the addition position of the to-be-added signal is determined and a third prompt information is sent; If the to-be-added signal cannot be added to the empty position of the known message corresponding to the CANID, it is determined whether the to-be-added signal can be added to the empty position of other known messages with the same signal period according to the signal length of the to-be-added signal; If the to-be-added signal can be added to the empty position of the other known message with the same signal period, the adding position of the to-be-added signal is determined and the fourth prompt information is sent.
3. The method of claim 2, wherein, According to the signal start bit and the signal length of the to-be-added signal, it is determined whether the to-be-added signal can be added to the empty position of the known message corresponding to the CANID, comprising: According to the signal start bit and the signal length of the to-be-added signal, it is determined whether the to-be-added signal can be added to the empty position of the known message corresponding to the CANID, comprising: If the to-be-added signal can be added to the empty position of the known message corresponding to the CANID, the adding position of the to-be-added signal is determined and the fifth prompt information is sent. If the to-be-added signal cannot be added to the empty position of the known message corresponding to the CANID, according to the signal length of the to-be-added signal, it is determined whether the to-be-added signal can be added to other empty positions in the known message corresponding to the CANID. If the to-be-added signal can be added to other empty positions in the known message corresponding to the CANID, the adding position of the to-be-added signal is determined and the sixth prompt information is sent.
4. The method of claim 1, wherein, The method further comprises: If the CANID corresponding to the to-be-added signal is not empty, and the signal start bit is empty, according to the signal length of the to-be-added signal, it is determined whether the to-be-added signal can be added to the empty position in the known message corresponding to the CANID. If the to-be-added signal can be added to the empty position of the known message corresponding to the CANID, the adding position of the to-be-added signal is determined and the seventh prompt information is sent.
5. The method according to any one of claims 1-4, characterized in that, The CANID allocation rule comprises: According to at least one of the message type, the message sending type, the message sending period, the message purpose and the message priority, the value range of the new CANID for the to-be-added signal or the to-be-added message is determined.
6. A CAN ID assignment apparatus of a CAN bus, characterized by comprising: Comprise: The analysis module is used for analyzing the received CAN communication change request, and determining the attribute information corresponding to the to-be-added message and / or the to-be-added signal; The attribute information of the to-be-added signal comprises a signal name, a CANID, a signal period, a signal start bit and a signal length; The query module is used for querying the pre-constructed CAN communication matrix signal library according to the attribute information corresponding to the to-be-added message and / or the to-be-added signal, wherein the CAN communication matrix signal library comprises the attribute information corresponding to the known message and the known signal; The allocation module is used for, for the to-be-added message, if there is no known message with the same attribute information in the CAN communication matrix signal library, according to the attribute information corresponding to the to-be-added message, allocating a new CANID for the to-be-added message according to the pre-set CANID allocation rule; If there is no known signal with the same attribute information in the CAN communication matrix signal library, and it is determined that the to-be-added signal cannot be added to the empty position of the known message, a new CAN ID is allocated to the to-be-added signal according to the attribute information corresponding to the to-be-added signal and the CAN ID allocation rule; The allocation module is further configured to query a pre-constructed CAN communication matrix signal library according to the signal name of the to-be-added signal; if there is a known signal with the same signal name in the CAN communication matrix signal library, the CAN communication change request is rejected; if there is no known signal with the same signal name in the CAN communication matrix signal library, and the CAN ID and the signal period corresponding to the to-be-added signal are both empty, the CAN communication change request is rejected and first prompt information is sent; if there is no known signal with the same signal name in the CAN communication matrix signal library, and the CAN ID corresponding to the to-be-added signal is empty but the signal period is not empty, it is determined whether the to-be-added signal can be added to the empty position of the known message with the same signal period according to the signal length of the to-be-added signal; If the to-be-added signal can be added to the empty position of the known message with the same signal period, the addition position of the to-be-added signal is determined and second prompt information is sent.
7. A computer readable medium having stored thereon a computer program, characterized in that, The computer program is executed by a processor to implement the CAN ID allocation method of the CAN bus according to any one of claims 1 to 5.
8. An electronic device, comprising: Comprise: One or more processors; Storage device for storing one or more programs, when the one or more programs are executed by the one or more processors, so that the one or more processors implement the CAN ID allocation method of the CAN bus according to any one of claims 1 to 5.
Citation Information
Patent Citations
Control method for CAN bus ID distribution
CN112866072A