Node address coding method of CAN network and computer program product
By broadcasting coded request messages in CAN network and calculating coded addresses using identification data, the problem of automatic allocation of CAN bus node addresses in the field of power battery applications is solved, and flexibility and reliability are improved.
Patent Information
- Application Number
- CN202410940076.6
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2024-07-12
- Publication Date
- 2025-03-07
AI Technical Summary
In the field of power battery applications, it is difficult for the prior art to realize automatic allocation method of CAN bus node addresses, no manual intervention and low requirements for wiring sequence, resulting in insufficient system reliability and flexibility.
By broadcasting the code request message in the CAN network, the target node sorts according to its own identification data, determines the sequential bit number, and calculates its own encoding address based on the maximum encoding address and sequential bit number of the target node that has completed the address encoding, realizing automatic encoding of the node address.
Automatic address encoding of target nodes in the CAN network is realized, which reduces the requirements for docking order, reduces system complexity and material costs, and improves the reliability and flexibility of the system.
Smart Images

Figure CN119583509A_ABST
Abstract
Description
Technical Field
[0001] The present invention relates to the field of CAN communication technology, and in particular to a method for encoding node addresses of a CAN network and a computer program product. Background Art
[0002] CAN (Control Area Network) is an ISO internationally standardized serial communication protocol. CAN bus is widely used in the fields of shipbuilding, medical treatment, industrial automation, automobiles, energy storage, etc.
[0003] When using the CAN bus for networking, it is necessary to assign addresses to all nodes in the network. In some application areas, due to the existence of some devices with similar or identical functions, when these devices are connected to the same CAN network at the same time, or when one or more identical devices need to be added to the CAN network where these devices already exist, in order to prevent the communication between these devices from affecting and interfering with each other, different communication addresses need to be assigned to these devices.
[0004] At present, in the field of power battery applications using CAN networks, the methods for implementing address allocation mainly adopt the following two methods:
[0005] 1. According to the physical location of the battery, each slave control is connected to the CAN bus in sequence, and the master control sets the communication address of the slave control according to the time sequence of the slave control connection. This method can avoid connecting additional wiring harnesses to the slave control, and can also ensure that the setting result of the communication address is controllable, but it requires manual cooperation and cannot achieve automatic configuration; at the same time, this configuration method is one-time. After completing the address configuration, the slave control needs to record the address in the non-volatile memory and read it after each subsequent power-on. If the non-volatile memory fails, the system will not be able to operate normally, and the reliability is low.
[0006] Second, the communication address of the slave control is set by transmitting the enable signal from the master control to the slave control in sequence. The setting result of the communication address is determined by the connection sequence of the enable signal line. In order to ensure that the setting result of the slave control communication address is controllable, the wiring harness that transmits the enable signal cannot be changed at will. This method increases the complexity of the system, reduces the reliability of the system, and is not conducive to the free combination of the system.
[0007] Therefore, how to realize a method for automatically allocating communication addresses of a CAN bus with low requirements on the wiring sequence is a problem that needs to be solved urgently in the current power battery application field. Summary of the invention
[0008] The object of the present invention is to provide a method for encoding node addresses of a CAN network and a computer program product to solve or at least partially solve the technical problems mentioned in the above background technology.
[0009] To achieve this object, the present invention adopts the following technical solutions:
[0010] In a first aspect, the present invention provides a method for encoding a node address of a CAN network, comprising:
[0011] The target node in the CAN network that has not been address-encoded broadcasts a coded request message with its own identification data to the CAN bus;
[0012] Receiving encoding request messages broadcasted by other target nodes in the CAN network that have not been address-encoded, and / or, a compiled message with its own encoding address broadcasted to the CAN bus by a target node in the CAN network that has completed address encoding after monitoring the encoding request message;
[0013] Sort all target nodes in the CAN network that have not been address-coded according to the identification data and determine their own sequence numbers;
[0014] Calculate its own encoding address according to the maximum encoding address of all target nodes that have completed address encoding in the CAN network and the determined sequence number;
[0015] The identification data is data generated according to the unique identity identifier of the target node.
[0016] Optionally, before sorting all target nodes that are not address-encoded in the CAN network according to the identification data and determining their own sequence numbers, the method further includes:
[0017] When a target node in the CAN network that has not been address-encoded receives an encoding request message broadcasted by other target nodes in the CAN network, it extracts identification data in the received encoding request message, and determines whether the extracted identification data contains identification data identical to its own identification data;
[0018] If so, new identification data is formed based on the own identification data plus a randomly generated random number, and the encoding request message with the new identification data is broadcasted to the CAN bus again.
[0019] Optionally, before the target node in the CAN network that has not been address-encoded broadcasts the encoding request message with its own identification data to the CAN bus, the following steps are further included:
[0020] Determine whether the target node has a coded address;
[0021] If yes, the target node in the CAN network that has completed address encoding monitors in real time whether it has received the encoding request message broadcast by other target nodes in the CAN network;
[0022] After the real-time monitoring of whether the encoding request message broadcasted by other target nodes in the CAN network is received, the method further includes:
[0023] If so, broadcast the compiled message with its own encoded address to the CAN bus;
[0024] If not, continue to monitor in real time whether the encoding request message broadcasted by other target nodes in the CAN network is received.
[0025] Optionally, after broadcasting the compiled message with the self-encoded address to the CAN bus, the method further includes:
[0026] The target node in the CAN network that has completed address encoding receives the compiled message broadcast by other target nodes;
[0027] Extract the encoded address in the received compiled message and put it into its own temporary cache space;
[0028] Check the continuity of the extracted encoding addresses that are smaller than the own encoding address, and determine the number of discontinuous addresses in the encoding addresses that are smaller than the own encoding address;
[0029] Update its own encoding address according to the number of discontinuous addresses;
[0030] The updated encoding address is equal to the original encoding address of the target node that has completed address encoding in the CAN network minus the number of discontinuous addresses.
[0031] Optionally, the calculating of the own encoding address according to the maximum encoding address of all target nodes that have completed address encoding in the CAN network and the determined sequence number specifically includes:
[0032] The target node in the CAN network that has not been address-encoded extracts the encoded address in the received compiled message and puts it into its own temporary cache space;
[0033] Check the continuity of the extracted coded addresses and determine the total number of discontinuous addresses;
[0034] Calculate its own coding address according to the maximum coding address, the total number of discontinuous addresses and its own sequence number;
[0035] The calculation method of the coded address of the target node that has not been address-coded in the CAN network is: the maximum coded address + its own sequence number - the total number of discontinuous addresses.
[0036] Optionally, before broadcasting the encoding request message with the self-identification data to the CAN bus, the method further includes:
[0037] Real-time monitoring of whether the CAN bus is in an idle state;
[0038] After the real-time monitoring of whether the CAN bus is in an idle state, the method further includes:
[0039] If yes, there is a target node in the CAN network that has not been address-encoded, and three frames of encoding request messages with its own identification data are broadcasted to the CAN bus in a staggered manner;
[0040] If not, the target node that has not been address-encoded in the CAN network continues to monitor in real time whether the CAN bus is in an idle state.
[0041] Optionally, the identification data is data obtained by operating a unique identifier of the target node through a predetermined polynomial;
[0042] The predetermined polynomial is: G(x)=x 16 +x 12 +x5+1;
[0043] The compiled message uses an 11-bit address identifier, and the 11-bit address identifier is composed of a coded address and preset specific data;
[0044] The upper three bits of the 11-bit address identifier are the specific data; the lower eight bits of the 11-bit address identifier are filled with the encoded address of the target node.
[0045] Optionally, the broadcasting of the compiled message with the self-encoded address to the CAN bus is specifically:
[0046] When the target node that has completed address coding in the CAN network receives one frame of the coding request message, it continuously broadcasts three frames of compiled messages to the CAN bus at a predetermined time interval.
[0047] Optionally, the target node is a battery; all target nodes are connected in parallel.
[0048] In a second aspect, the present invention further provides a computer program product, including a computer program / instruction, characterized in that when the computer program / instruction is executed by a processor, the above-mentioned method for encoding node addresses of a CAN network is implemented.
[0049] Compared with the prior art, the present invention has the following beneficial effects:
[0050] The present invention solves the problem of automatic address coding of target nodes in a CAN network having multiple target nodes with similar or identical functions, and has no strict requirements on the wiring sequence of the target nodes, and does not need to add physical dip switches for address allocation, thereby reducing material costs and facilitating use and management. The present technology can be used to conveniently increase / decrease target nodes in the CAN network without affecting the normal operation of the target nodes in the original CAN network. BRIEF DESCRIPTION OF THE DRAWINGS
[0051] In order to more clearly illustrate the embodiments of the present invention or the technical solutions in the prior art, the drawings required for use in the embodiments or the description of the prior art will be briefly introduced below. Obviously, the drawings described below are only some embodiments of the present invention. For ordinary technicians in this field, other drawings can be obtained based on these drawings without paying creative work.
[0052] Figure 1 A flow chart of a method for node address encoding of a CAN network provided by an embodiment of the present invention.
[0053] Figure 2 A flow chart of another method for node address encoding of a CAN network provided by an embodiment of the present invention.
[0054] Figure 3 A flow chart of a method for encoding node addresses of a CAN network provided in another embodiment of the present invention.
[0055] Figure 4 A flow chart of a method for encoding node addresses of a CAN network provided in another embodiment of the present invention.
[0056] Figure 5 A system architecture diagram of node address encoding of a CAN network provided in an embodiment of the present invention.
[0057] In the figure:
[0058] 10. Target node; 20. CAN bus. DETAILED DESCRIPTION
[0059] In order to make the purpose, features and advantages of the present invention more obvious and easy to understand, the technical solutions in the embodiments of the present invention will be clearly and completely described below in conjunction with the drawings in the embodiments of the present invention. Obviously, the embodiments described below are only part of the embodiments of the present invention, not all of the embodiments. Based on the embodiments of the present invention, all other embodiments obtained by ordinary technicians in this field without creative work are within the scope of protection of the present invention.
[0060] Please refer to Figure 1 and Figure 5 , Figure 1 A flow chart of a method for encoding node addresses of a CAN network provided by an embodiment of the present invention, Figure 5 A system architecture diagram of node address encoding of a CAN network provided in an embodiment of the present invention.
[0061] In this embodiment, the CAN network includes a plurality of target nodes 10 connected in parallel, and communication connection can be established between the target nodes 10 via the CAN bus 20; for ease of understanding, illustratively, the target node 10 in this embodiment is a battery or a battery pack.
[0062] Based on the above system architecture, this embodiment proposes a method for encoding node addresses of a CAN network, which specifically includes:
[0063] Step 110 , determine whether the target node 10 has been set with a coded address; if so, execute step 111 ; if not, execute step 112 .
[0064] Before performing address coding, it is necessary to determine whether each target node 10 has set a coding address. A target node 10 that has not set a coding address needs to perform address coding. For example, a newly added target node 10 needs to perform address coding.
[0065] Step 111 , monitor in real time whether the encoding request message broadcasted by other target nodes 10 is received; if so, execute step 120 ; if not, monitor in real time whether the encoding request message broadcasted by other target nodes 10 is received.
[0066] In this step, for the target node 10 that has completed address encoding in the CAN network, it is necessary to monitor or listen to the encoding request message broadcast in the CAN network in real time, and use the receipt of the encoding request message as the condition for triggering its own broadcast of the encoding address to announce its own encoding address to other target nodes 10 in the CAN network.
[0067] Step 120 : broadcast the compiled message with the self-encoded address to the CAN bus 20 .
[0068] Specifically, in this embodiment, when the target node 10 that has completed address encoding in the CAN network receives each frame of encoding request message, it continuously broadcasts 3 frames of compiled messages to the CAN bus 20 at a predetermined time interval; exemplarily, in this embodiment, the predetermined time interval is set to 100ms.
[0069] Step 112, monitor in real time whether the CAN bus 20 is in an idle state; if so, execute step 1121; if not, continue to monitor in real time whether the CAN bus 20 is in an idle state.
[0070] In order to avoid communication congestion, which may lead to encoding failure due to missing data message transmission, the target node 10 needs to monitor the status of the CAN bus before performing the address encoding operation. In this embodiment, the target node 10 can only carry out address encoding when the CAN bus 20 is in an idle state.
[0071] Step 1121 : broadcast a coding request message with self-identification data to the CAN bus 20 .
[0072] For a target node 10 that has not been address-encoded in the CAN network, when the CAN bus 20 is in an idle state, a coding request message with its own identification data is broadcasted to the CAN bus 20;
[0073] The target node 10 generally has identification data that can uniquely identify itself; in this embodiment, the identification data of the target node 10 is the identification data D obtained by calculating the chip unique identity identifier. x , where x is a natural number used to distinguish different target nodes 10;
[0074] As an optional implementation, the identification data is data obtained by operating the unique identifier of the target node through a predetermined polynomial;
[0075] The polynomial used in this embodiment is: G(x)=x 16 +x 12 +x5+1.
[0076] Step 130: Receive the encoding request message broadcasted by other target nodes 10, and / or the compiled message with its own encoding address.
[0077] The target node 10 in the CAN network that has not been address-encoded will monitor and receive in real time the messages broadcast by other target nodes 10 in the CAN network, including encoding request messages broadcast by other target nodes 10 in the CAN network that have not been address-encoded, and compiled messages with their own encoded addresses broadcast by target nodes 10 in the CAN network that have completed address encoding.
[0078] Step 140: Sort each target node 10 according to the identification data to determine its own sequence number.
[0079] In step 140, for the target nodes 10 that have not been address-coded in the CAN network, because all target nodes 10 that have not been address-coded will broadcast coding request messages with their own identification data, and this identification data is also unique, the target nodes 10 that have not been address-coded in the CAN network can sort all target nodes 10 that have not been address-coded in the CAN network according to the identification data, so as to determine their own sequence number; in this embodiment, as a feasible implementation method, the sorting method is to sort according to the size of the identification data, and the sequence number uses a natural number greater than 1.
[0080] Step 150: Calculate the own encoding address according to the maximum encoding address of all target nodes 10 that have completed address encoding in the CAN network and the determined sequence number.
[0081] Step 150, illustratively, the maximum coded address among the currently coded addresses in the CAN network is A max , then the address of the target node 10 can be set to A max +serial number.
[0082] The above method solves the problem of automatic address coding of target nodes 10 in a CAN network having multiple target nodes 10 with similar or identical functions, without resorting to components or materials such as dip switches, thereby reducing material costs; the above method can be implemented based on CAN communication, so there are no strict requirements on the wiring sequence of the target nodes, and it is easy to use and manage; the above method can be used to easily add / subtract target nodes in the CAN network without affecting the normal operation of the target nodes in the original CAN network.
[0083] Please refer to Figure 2 , Figure 2 A flow chart of another method for node address encoding of a CAN network provided by an embodiment of the present invention.
[0084] In step 140, there may be a situation where the identification data is the same, although the possibility is very small. However, in order to avoid such a situation of identification data conflict, in this embodiment, after step 130, an action of determining whether the identification data conflicts is added, namely:
[0085] Step 210, extract the identification data in the received encoding request message, and determine whether the extracted identification data contains identification data that is the same as its own identification data; if so, execute step 211; otherwise, execute step 140.
[0086] When a target node 10 in the CAN network that has not been address-encoded receives an encoding request message broadcasted by other target nodes 10 in the CAN network, it extracts identification data in the received encoding request message and determines whether the extracted identification data contains identification data identical to its own identification data.
[0087] Step 211, form new identification data based on the own identification data plus a randomly generated random number; and return to step 1121.
[0088] When a target node 10 that has not been address-encoded in the CAN network finds that its own identification data conflicts with the identification data of other target nodes 10 in the CAN network, it will form new identification data based on its own identification data plus a random number, and re-broadcast the encoding request message with the new identification data to the CAN bus until the identification data of all target nodes 10 in the CAN network are different.
[0089] The CAN bus 2.0B specification provides two CAN message formats: standard frame and extended frame. The standard frame message format provides an 11-bit address identifier, and the extended frame format provides a 29-bit address identifier. In this implementation, the encoding request message M0 and the encoded message M1 use an 11-bit address identifier, but it does not limit the encoding request message M0 and the encoded message M1 to only use an 11-bit address identifier;
[0090] The above 11-bit address identifier is composed of a coded address and preset specific data; in this embodiment, the upper three bits of the 11-bit address identifier are specific data, for example, set to 111; the lower eight bits of the 11-bit address identifier are filled with the coded address of the target node; the coded address range is set between 1 and 255, and it is agreed that other CAN messages in the system shall not use addresses in the range of 0x701 to 0x7FF as address identifiers. Generally, the coded request message is held by devices or components with similar or identical functions in the system, and other devices or components with different functions are not good at broadcasting the coded request message.
[0091] Since the address range is limited, when performing address coding, this embodiment also fully considers the full utilization of the address, that is, when setting the address, the coded address is made continuous.
[0092] Please continue to refer to Figure 3 and Figure 4 , Figure 3 A flowchart of a method for encoding a node address of a CAN network provided by an embodiment of the present invention is provided. Figure 4 A flow chart of a method for encoding node addresses of a CAN network provided in another embodiment of the present invention.
[0093] After step 120, the method further includes:
[0094] Step 310 : Receive the compiled message broadcasted by other target nodes 10 .
[0095] The target node 10 that has completed address coding in the CAN network monitors and receives the compiled messages broadcasted by other target nodes 10 in real time.
[0096] Step 320: extract the encoded address in the received compiled message and put it into its own temporary cache space.
[0097] After receiving the compiled message broadcasted by other target nodes 10, the target node 10 in the CAN network that has completed address coding extracts the coded address in the message and puts it into its own temporary cache space. In this way, the coded addresses of all target nodes 10 in the CAN network that have completed address coding are stored in the temporary cache space.
[0098] Step 330: Check the continuity of the extracted coded addresses that are smaller than the own coded address, and determine the number of discontinuous addresses in the coded addresses that are smaller than the own coded address.
[0099] In step 330, the number of discontinuous addresses refers to the number of discontinuous vacant addresses. For ease of explanation, the coding address is represented by a natural number between 1 and 255. For example, currently, the coding addresses stored in the temporary cache space are 1, 3, 4, 6, 7 and 8, a total of 6 coding addresses (including its own address 6), among which the maximum coding address is 8, the coding addresses smaller than itself are 1, 3 and 4, and the vacant addresses are 2 and 5. In this case, the number of discontinuous addresses that are smaller than itself is 2.
[0100] Step 340: Update the encoding address of the device according to the number of discontinuous addresses;
[0101] In order to achieve address continuity, its own address 6 is updated to 6-2=4, that is, its original coding address minus the number of discontinuous addresses; similarly, as the target node 10 with an original coding address of 4, its updated coding address is 4-1=3, and so on, so that the original coding address of the target node 10 in the CAN network is updated to consecutive addresses such as 1, 2, 3, 4, 5 and 6 in turn.
[0102] That is, the updated coded address is equal to the original coded address of the target node 10 that has completed address coding in the CAN network minus the number of discontinuous addresses.
[0103] Similarly, the address of the target node 10 that has not been address-coded in the CAN network also needs to be set as a continuous address, so after step 140, the following steps are included:
[0104] Step 410: extract the coded address in the received compiled message and put it into its own temporary cache space.
[0105] The target node 10 in the CAN network that has not performed address encoding extracts the encoded address in the received compiled message and puts it into its own temporary cache space.
[0106] Step 420: Check the continuity of the extracted coded addresses and determine the total number of discontinuous addresses.
[0107] Exemplarily, for example, there are 6 encoding addresses stored in the temporary cache space, namely 1, 3, 4, 6, 7 and 8, among which the maximum encoding address is 8 and the vacant addresses are 2 and 5. In this case, the total number of discontinuous addresses is 2.
[0108] Step 430: Calculate its own encoding address according to the maximum encoding address, the total number of discontinuous addresses and its own sequence number.
[0109] In step 430, the coded address of the target node 10 that has not been coded in the CAN network is calculated as follows: the maximum coded address A max + its own sequence number - the total number of discontinuous addresses;
[0110] According to the example of step 420, if the sequence number of the target node 10 that has not been address-encoded in the CAN network is 1, then its coded address = 8 + 1 - 2 = 7, which is exactly connected to the updated coded address.
[0111] Based on the same concept, an embodiment of the present invention further provides a computer-readable storage medium, in which at least one instruction is stored. The instruction is loaded and executed by a processor to implement the method for node address encoding of a CAN network provided in an embodiment of the present invention.
[0112] Based on the same concept, an embodiment of the present invention further provides a computer program product, including a computer program / instruction. When the computer program / instruction is executed by a processor, the method for encoding node addresses of a CAN network provided by an embodiment of the present invention is implemented.
[0113] A person skilled in the art will understand that all or part of the steps to implement the above embodiments may be accomplished by hardware or by instructing related hardware through a program, and the program may be stored in a computer-readable storage medium, and the above-mentioned storage medium may be a read-only memory, a disk or an optical disk, etc.
[0114] As described above, the above embodiments are only used to illustrate the technical solutions of the present invention, rather than to limit the same. Although the present invention has been described in detail with reference to the aforementioned embodiments, those skilled in the art should understand that the technical solutions described in the aforementioned embodiments may still be modified, or some of the technical features thereof may be replaced by equivalents. However, these modifications or replacements do not deviate the essence of the corresponding technical solutions from the spirit and scope of the technical solutions of the embodiments of the present invention.
Claims
1. A method for encoding node addresses of a CAN network, characterized in that: include: The target node in the CAN network that has not been address-encoded broadcasts a coded request message with its own identification data to the CAN bus; Receiving encoding request messages broadcasted by other target nodes in the CAN network that have not been address-encoded, and / or, a compiled message with its own encoding address broadcasted to the CAN bus by a target node in the CAN network that has completed address encoding after monitoring the encoding request message; Sort all target nodes in the CAN network that have not been address-coded according to the identification data and determine their own sequence numbers; Calculate its own encoding address according to the maximum encoding address of all target nodes that have completed address encoding in the CAN network and the determined sequence number; The identification data is data generated according to the unique identity identifier of the target node.
2. The method for node address encoding of a CAN network according to claim 1, characterized in that: Before the method of sorting all target nodes that have not been address-encoded in the CAN network according to the identification data and determining their own sequence numbers, it also includes: When a target node in the CAN network that has not been address-encoded receives an encoding request message broadcasted by other target nodes in the CAN network, it extracts identification data in the received encoding request message, and determines whether the extracted identification data contains identification data identical to its own identification data; If so, new identification data is formed based on the own identification data plus a randomly generated random number, and the encoding request message with the new identification data is broadcasted to the CAN bus again.
3. A method for encoding node addresses of a CAN network according to claim 1 or 2, characterized in that: Before the target node in the CAN network that has not been address-encoded broadcasts the encoding request message with its own identification data to the CAN bus, the method further includes: Determine whether the target node has a coded address; If yes, the target node in the CAN network that has completed address encoding monitors in real time whether it has received the encoding request message broadcast by other target nodes in the CAN network; After the real-time monitoring of whether the encoding request message broadcasted by other target nodes in the CAN network is received, the method further includes: If so, broadcast the compiled message with its own encoded address to the CAN bus; If not, continue to monitor in real time whether the encoding request message broadcasted by other target nodes in the CAN network is received.
4. The method for node address encoding of a CAN network according to claim 3, characterized in that: After broadcasting the compiled message with its own encoding address to the CAN bus, it also includes: The target node in the CAN network that has completed address encoding receives the compiled message broadcast by other target nodes; Extract the encoded address in the received compiled message and put it into its own temporary cache space; Check the continuity of the extracted encoding addresses that are smaller than the own encoding address, and determine the number of discontinuous addresses in the encoding addresses that are smaller than the own encoding address; Update its own encoding address according to the number of discontinuous addresses; The updated encoding address is equal to the original encoding address of the target node that has completed address encoding in the CAN network minus the number of discontinuous addresses.
5. The method for node address encoding of a CAN network according to claim 3, characterized in that: The step of calculating the encoding address of the node itself according to the maximum encoding address of all target nodes that have completed address encoding in the CAN network and the determined sequence number specifically includes: The target node in the CAN network that has not been address-encoded extracts the encoded address in the received compiled message and puts it into its own temporary cache space; Check the continuity of the extracted coded addresses and determine the total number of discontinuous addresses; Calculate its own coding address according to the maximum coding address, the total number of discontinuous addresses and its own sequence number; The calculation method of the coded address of the target node that has not been address-coded in the CAN network is: the maximum coded address + its own sequence number - the total number of discontinuous addresses.
6. The method for node address encoding of a CAN network according to claim 1, characterized in that: Before broadcasting the coding request message with the self-identification data to the CAN bus, the method further comprises: Real-time monitoring of whether the CAN bus is in an idle state; After the real-time monitoring of whether the CAN bus is in an idle state, the method further includes: If yes, there is a target node in the CAN network that has not been address-encoded, and three frames of encoding request messages with its own identification data are broadcasted to the CAN bus in a staggered manner; If not, the target node that has not been address-encoded in the CAN network continues to monitor in real time whether the CAN bus is in an idle state.
7. The method for node address encoding of a CAN network according to claim 1, characterized in that: The identification data is data obtained by operating the unique identity identifier of the target node through a predetermined polynomial; The predetermined polynomial is: G(x)=x 16 +x 12 +x5+1; The compiled message uses an 11-bit address identifier, and the 11-bit address identifier is composed of a coded address and preset specific data; The upper three bits of the 11-bit address identifier are the specific data; the lower eight bits of the 11-bit address identifier are filled with the encoded address of the target node.
8. The method for node address coding of a CAN network according to claim 3, characterized in that: The broadcasting of the compiled message with its own coded address to the CAN bus is specifically: When the target node that has completed address coding in the CAN network receives one frame of the coding request message, it continuously broadcasts three frames of compiled messages to the CAN bus at a predetermined time interval.
9. The method for node address coding of a CAN network according to claim 1, characterized in that: The target nodes are batteries; all target nodes are connected in parallel.
10. A computer program product comprising a computer program / instructions, characterized in that When the computer program / instructions are executed by a processor, the method for encoding node addresses of a CAN network as claimed in claim 1 is implemented.