Node address allocation method for in-vehicle network and computer readable storage medium
By determining the random backoff time based on device identifier and session identifier information in the LIN bus, and combining hash operation and step-by-step confirmation mechanism, flexible address allocation of slave nodes is realized, improving the scalability and maintainability of the LIN bus.
Patent Information
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- GUANGZHOU AUTOMOBILE GROUP CO LTD
- Filing Date
- 2026-04-15
- Publication Date
- 2026-07-31
AI Technical Summary
In existing technologies, LIN bus slave node address allocation relies on hard coding or physical location, resulting in rigid system wiring, poor scalability, and difficult maintenance.
By determining the random backoff time based on device identification information and session identification information, monitoring the network bus status, sending address request information to the master node, and the master node allocating node addresses, flexible address allocation is achieved by combining hash operation and step-by-step confirmation mechanism.
It improves the scalability, maintainability, and reliability of the LIN bus, and solves the problems of poor scalability and difficult maintenance during address allocation.
Smart Images

Figure CN122496491A_ABST
Abstract
Description
Technical Field
[0001] This application relates to the field of communication technology, and in particular to a node address allocation method and a computer-readable storage medium for a vehicle network. Background Technology
[0002] In automotive distributed electronic control systems, the Local Interconnect Network (LIN) bus, as a low-cost serial communication protocol, is widely used in multi-node control scenarios such as doors, seats, and lights. Efficient allocation of slave node addresses is fundamental to the normal operation of the system. However, related technologies generally rely on hard-coded addresses, physical location detection, or sequential activation mechanisms for address allocation, requiring additional hardware or fixed topologies. This can easily lead to rigid system wiring, poor scalability, and maintenance difficulties.
[0003] There is currently no good solution to the above problems. Summary of the Invention
[0004] This application provides a node address allocation method and a computer-readable storage medium for an in-vehicle network, aiming to improve the technical problems of poor scalability and difficult maintenance when allocating node addresses on a LIN bus.
[0005] According to one aspect of the embodiments of this application, a node address allocation method for an in-vehicle network is provided, comprising: in response to receiving an initialization broadcast message from a master node in the in-vehicle communication network, determining a random backoff time based on device identification information corresponding to a slave node in the in-vehicle communication network and session identification information in the initialization broadcast message; starting a backoff timer according to the random backoff time, and monitoring the network bus status of the in-vehicle communication network during the backoff timer's timing period; in response to the backoff timer ending and the network bus status being idle after the timing ends, sending address request information to the master node, so that the master node allocates node addresses to slave nodes based on the address request information.
[0006] Furthermore, determining the random backoff time based on the device identification information and session identification information corresponding to the slave node in the vehicle communication network includes: performing a hash operation on the device identification information, session identification information, and the upper limit of the random backoff time to obtain a target random number; and performing a multiplication operation on the target random number and the preset time slot value to obtain the random backoff time.
[0007] Furthermore, hashing the device identification information, session identification information, and the upper limit of the random backoff time to obtain the target random number involves: performing an XOR operation on the device identification information and session identification information to obtain the XOR operation result; performing a modulo operation on the upper limit of the random backoff time using the XOR operation result to obtain the modulo operation result; and performing a hash operation based on the modulo operation result to obtain the target random number.
[0008] Furthermore, the node address allocation method of the vehicle network also includes: in response to the network bus state being in a non-idle state during the timing period, controlling the backoff timer to pause timing; in response to the network bus state returning from a non-idle state to an idle state, controlling the backoff timer to resume timing from the paused position.
[0009] Furthermore, after sending the address request information to the master node, the method also includes: receiving a temporary address allocation message sent by the master node, wherein the temporary address allocation message is used to determine the temporary node address and the validity period of the address corresponding to the slave node.
[0010] Furthermore, after receiving the temporary address allocation message from the master node, the method further includes: receiving an address confirmation request sent by the master node using the temporary node address, wherein the address confirmation request is used to determine the target node address and address configuration parameters corresponding to the slave node; and sending a confirmation response message to the master node based on the address confirmation request, so that the master node registers the mapping relationship between the slave node and the target node address in the address allocation table based on the confirmation response message, wherein the confirmation response message includes the device capability information, device type identifier, and communication verification information corresponding to the slave node.
[0011] Furthermore, after sending a confirmation response message to the master node based on the address confirmation request, the method also includes: in response to receiving a registration completion notification message sent by the master node, storing the target node address in a preset location, and responding to the master node's data communication instructions using the target node address.
[0012] According to another aspect of the embodiments of this application, a node address allocation device for a vehicle network is also provided, comprising: a determining module, configured to determine a random backoff time based on device identification information corresponding to a slave node in the vehicle communication network and session identification information in the initialization broadcast message in response to receiving an initialization broadcast message from a master node in the vehicle communication network; a monitoring module, configured to start a backoff timer according to the random backoff time and monitor the network bus status of the vehicle communication network during the backoff timer's timing period; and a first sending module, configured to send address request information to the master node in response to the end of the backoff timer's timing and the network bus status being idle after the timing period, so that the master node allocates node addresses to slave nodes based on the address request information.
[0013] Furthermore, the determination module is also used to: perform a hash operation on the device identification information, session identification information, and the upper limit of the random backoff time to obtain a target random number; and perform a multiplication operation on the target random number and the preset time slot value to obtain the random backoff time.
[0014] Furthermore, the determination module is also used to: perform an XOR operation on the device identification information and the session identification information to obtain the XOR operation result; use the XOR operation result to perform a modulo operation on the upper limit of the random backoff time to obtain the modulo operation result; and perform a hash operation based on the modulo operation result to obtain the target random number.
[0015] Furthermore, the node address allocation device of the vehicle network also includes: a control module, used to control the backoff timer to pause timing in response to the network bus state being in a non-idle state during the timing period; and to control the backoff timer to resume timing from the paused position in response to the network bus state returning to an idle state from a non-idle state.
[0016] Furthermore, the node address allocation device of the vehicle network also includes: a first receiving module, used to receive a temporary address allocation message sent by the master node, wherein the temporary address allocation message is used to determine the temporary node address and the address validity period of the slave node.
[0017] Furthermore, the node address allocation device of the vehicular network also includes: a second sending module, used to: receive an address confirmation request sent by the master node using a temporary node address, wherein the address confirmation request is used to determine the target node address and address configuration parameters corresponding to the slave node; and send a confirmation response message to the master node based on the address confirmation request, so that the master node registers the mapping relationship between the slave node and the target node address in the address allocation table based on the confirmation response message, wherein the confirmation response message includes the device capability information, device type identifier and communication verification information corresponding to the slave node.
[0018] Furthermore, the node address allocation device of the vehicle network also includes: a second receiving module, used to: store the target node address in a preset location in response to receiving a registration completion notification message sent by the master node, and respond to the data communication instructions of the master node using the target node address.
[0019] According to another aspect of the embodiments of this application, an electronic device is also provided, including a processor and a memory, wherein the memory is used to store a computer program; and the processor is used to execute the program stored in the memory to implement the methods in the various embodiments of this application.
[0020] According to another aspect of the embodiments of this application, a vehicle is also provided, which includes the above-described electronic equipment.
[0021] According to another aspect of the embodiments of this application, a computer-readable storage medium is also provided, the computer-readable storage medium including a stored executable program, wherein, when the executable program is running, it controls the device where the computer-readable storage medium is located to perform the methods of various embodiments of this application.
[0022] In this embodiment, in response to receiving an initialization broadcast message from the master node in the vehicular communication network, a random backoff time is determined based on the device identification information corresponding to the slave node in the vehicular communication network and the session identification information in the initialization broadcast message. Then, a backoff timer is started according to the random backoff time, and the network bus status of the vehicular communication network is monitored during the backoff timer's timing. Finally, in response to the end of the backoff timer and the network bus status being idle after the timing ends, an address request information is sent to the master node, so that the master node can allocate node addresses to the slave node based on the address request information. This achieves the purpose of flexible address allocation for slave nodes, thereby improving the scalability, maintainability, and reliability of LIN bus deployment and solving the technical problems of poor scalability and difficult maintenance when allocating slave node addresses on the LIN bus. Attached Figure Description
[0023] Figure 1 This is a flowchart of a node address allocation method for an in-vehicle network provided in an embodiment of this application;
[0024] Figure 2 This is a structural block diagram of a node address allocation system for a vehicle network provided in an embodiment of this application;
[0025] Figure 3 This is a flowchart of another node address allocation method for a vehicle network provided in the embodiments of this application;
[0026] Figure 4 This is an interactive flowchart of a node address allocation method for an in-vehicle network provided in an embodiment of this application;
[0027] Figure 5 This is a structural block diagram of a node address allocation device for a vehicle network provided in an embodiment of this application.
[0028] Figure 6 This is a structural block diagram of an electronic device provided in an embodiment of this application. Detailed Implementation
[0029] To make the technical problems, technical solutions, and beneficial effects solved by this application clearer, the following detailed description is provided in conjunction with embodiments. It should be understood that the specific embodiments described herein are merely illustrative and not intended to limit the scope of this application.
[0030] LIN bus, as a low-cost, single-wire serial communication network, is widely used in distributed control scenarios of automotive electronic systems, such as door control, seat adjustment, and lighting management. However, in traditional LIN bus systems, the address allocation of slave nodes generally relies on hard coding or physical topology, which leads to significant challenges in terms of system flexibility, maintainability, and cost control.
[0031] Currently, the mainstream address allocation methods mainly include four types: First, hard-coded address allocation, which assigns a unique address to each slave node during the manufacturing stage. Although this method is simple to implement, it significantly increases the complexity of component management. When replacing a node, the address must be accurately matched, which is not conducive to standardization and after-sales maintenance. Second, physical location-dependent allocation, which identifies the node's installation position on the bus by current direction detection or resistor voltage divider network to infer the address. This requires additional hardware such as sampling resistors and current detection circuits, which not only increases the printed circuit board (PCB) area and material cost, but also imposes stringent requirements on circuit accuracy and wiring consistency. Third, sequential activation allocation, where the master node distinguishes and allocates addresses by outputting different test voltages and sampling the feedback voltage of the slave nodes. This method is sensitive to changes in bus impedance, has high requirements for voltage generation and analog-to-digital converter (ADC) sampling circuits, and has poor system robustness. Fourth, daisy-chain allocation, which achieves sequential address allocation through series connection and step-by-step switching activation. However, if any node in the chain fails, all subsequent nodes will be unable to complete address configuration, posing a significant single point of failure risk.
[0032] In summary, the relevant technologies generally suffer from three major drawbacks: First, address allocation is highly dependent on the physical connection location or order of nodes, severely limiting the flexibility and modular expansion capabilities of system wiring; second, most solutions rely on dedicated hardware circuits, such as ADCs, precision resistors, and variable current sources, increasing system cost and design complexity; and third, sequential allocation mechanisms have a single point of failure vulnerability, where any node malfunction can cause the entire address allocation process to be interrupted, significantly reducing system reliability and availability. These drawbacks collectively restrict the efficient application of the LIN bus in increasingly complex and dynamic modern automotive electronic systems, resulting in rigid system wiring, poor scalability, and difficult maintenance.
[0033] This application provides a method for allocating node addresses in a vehicle network. Figure 1 This is a flowchart illustrating a node address allocation method for an in-vehicle network provided in an embodiment of this application, as shown below. Figure 1 As shown, it includes the following steps:
[0034] Step S11: In response to receiving the initialization broadcast message from the master node in the vehicle communication network, determine the random backoff time based on the device identification information corresponding to the slave node in the vehicle communication network and the session identification information in the initialization broadcast message.
[0035] Step S12: Start the backoff timer according to the random backoff time, and monitor the network bus status of the vehicle communication network during the backoff timer's timing period;
[0036] In step S13, in response to the end of the backoff timer and the network bus state being idle after the timer ends, an address request message is sent to the master node so that the master node can allocate node addresses to the slave nodes based on the address request message.
[0037] The aforementioned vehicle communication network refers to a single-wire serial communication network built using the LIN bus protocol. It consists of one master node and multiple slave nodes, with all nodes communicating in half-duplex mode via a single signal line. The master node is the control core of the communication, responsible for initiating the address allocation process, managing the address allocation table, and coordinating communication between slave nodes. Slave nodes are execution terminal devices, such as door controllers and seat motor drivers, each possessing unique and unchangeable device identification information. This information is a hardware-fixed unique identifier used to distinguish different physical nodes.
[0038] The aforementioned device identification information represents a unique hardware identifier that is permanently stored in non-volatile memory during the manufacturing process of the slave node. This identifier is globally unique, unchangeable, and uncopyable, and is used to uniquely identify the physical entity of each slave node in the LIN bus network.
[0039] The aforementioned session identifier information represents a unique temporary identifier dynamically generated by the master node each time the address allocation process is initiated, used to clearly define an independent address allocation operation. Furthermore, the session identifier information is generated based on a timestamp, system state, or other random factors, ensuring the uniqueness of each address allocation session.
[0040] The aforementioned initialization broadcast message represents the first global control command sent by the LIN bus master node to all slave nodes on the bus when initiating the address allocation process. This message is broadcast and is not targeted at any specific slave node; instead, it is simultaneously received by all slave nodes in standby mode across the network. The initialization broadcast message includes: session identifier (ID), message type, available address range, and contention window size (CW), used to synchronize the participation of all slave nodes in this address allocation process. The session identifier is a temporary number uniquely identifying this address allocation activity, ensuring isolation from other historical or parallel operations and preventing address confusion. The message type explicitly indicates that this message is an "address allocation request" instruction, notifying slave nodes to enter the address contention preparation state. The available address range defines the logical address interval that can be allocated, such as addresses 2-14, to limit the address space that slave nodes can request, avoiding out-of-bounds access or conflicts. The contention window size controls the upper limit of the random backoff time generated by slave nodes, indirectly adjusting the intensity of contention and ensuring stable system operation even when the number of nodes changes.
[0041] The aforementioned random backoff time represents an indeterminate delay value independently generated by the slave node after receiving the master node's initialization broadcast message, based on its own unique device identifier and the unique session identifier of the current address allocation session. This time value controls when the slave node waits on the bus and attempts to send an address request message, ensuring that multiple slave nodes do not initiate contention at the same time.
[0042] The above response to receiving the initialization broadcast message from the master node in the vehicular communication network indicates that after the slave node listens to the broadcast command sent by the master node on the LIN bus communication link, which includes session identification information, available address range and contention window size, it triggers the start action of the address allocation process.
[0043] The aforementioned backoff timer refers to a software timing device installed inside the LIN bus slave node, used to accurately measure the random backoff time determined by device identification information and session identification information.
[0044] The aforementioned network bus status represents the electrical and communication activity of the LIN bus at any given time, specifically manifested as changes in the bus signal level and the presence of data transmission. In the LIN protocol, the idle state corresponds to a high bus level, indicating that no node is transmitting data; while the busy state is represented by a low level, indicating that a node is transmitting a message. The network bus status is monitored in real time by slave nodes through hardware detection circuitry to determine whether the current bus allows the initiation of new communication.
[0045] The above-mentioned start of the backoff timer based on the random backoff time means that after the slave node completes the local calculation of the random backoff time, it calls the internal timing module to start a countdown timer based on a fixed time slot unit. The set value of the timer is equal to the determined random backoff time, which is used to precisely control the delay timing when the slave node initiates an address request on the bus.
[0046] During the backoff timer period, the node is in a listening state throughout the entire time window from the start to the end of the backoff timer. During this period, it does not actively send any messages, but only performs bus status detection and timer status maintenance operations to ensure the integrity of the timing process and the non-interference of communication behavior.
[0047] The aforementioned monitoring of the network bus status of the vehicle communication network means that the slave node continuously samples the electrical signal level of the LIN bus through a hardware level detection circuit to determine whether it is currently in a high or low level state. When it detects that the bus is occupied by another node, i.e., at a low level, the slave node pauses the backoff timer counting until the bus returns to a high level idle state, and then resumes counting from the pause point; if the bus remains idle, i.e. at a high level, the timer decrements normally until it reaches zero.
[0048] The address request information mentioned above refers to a specific communication message sent by a LIN bus slave node to the master node after completing the random backoff timer and confirming that the network bus is idle. This message contains the slave node's unique device identifier and the session identifier of the current address allocation session. This specific communication message formally submits an address allocation request to the master node, indicating that the slave node wishes to participate in the current address allocation process and obtain a logical address.
[0049] The above response indicates that the backoff timer has finished counting down, meaning that the slave node triggers the address request action after the local backoff timer countdown reaches zero.
[0050] Sending address request information to the master node as described above indicates that the slave node constructs and sends a communication message conforming to the LIN protocol format after satisfying the dual conditions that the backoff timer ends and the network bus is in an idle state after the timer ends. This message contains the slave node's device identification information and the session identification information of the current address allocation session, serving as the unique credential for formally requesting a logical address.
[0051] The above-mentioned method enables the master node to allocate node addresses to the slave node based on the address request information. This means that after receiving the address request information, the master node identifies the slave node that initiated the request based on the device identification information, confirms that it belongs to the current valid allocation period based on the session identification information, and, in accordance with the first-come-first-served principle, allocates an unallocated available address as a temporary address to the slave node, thus completing the first response action of address allocation.
[0052] Based on steps S11 to S13, this embodiment of the application, in response to receiving an initialization broadcast message from the master node in the vehicle communication network, determines a random backoff time based on the device identification information corresponding to the slave node in the vehicle communication network and the session identification information in the initialization broadcast message. Then, it starts a backoff timer according to the random backoff time, and monitors the network bus status of the vehicle communication network during the backoff timer's timing. Finally, in response to the end of the backoff timer and the network bus status being idle after the timing ends, it sends an address request information to the master node, so that the master node can allocate node addresses to the slave node based on the address request information. This achieves the purpose of flexible address allocation for slave nodes, thereby improving the scalability, maintainability, and reliability of LIN bus deployment and solving the technical problems of poor scalability and difficult maintenance when allocating slave node addresses on the LIN bus.
[0053] Furthermore, determining the random backoff time based on the device identification information and session identification information corresponding to the slave node in the vehicle communication network includes: performing a hash operation on the device identification information, session identification information, and the upper limit of the random backoff time to obtain a target random number; and performing a multiplication operation on the target random number and the preset time slot value to obtain the random backoff time.
[0054] The upper limit of the random backoff time mentioned above represents the contention window size CW explicitly specified by the master node in the initialization broadcast message. This value defines the boundary of the maximum backoff time that the slave node can generate, in units of the number of time slots. It is used to control the delay range of the entire address contention process, avoid the backoff time of a single node being too long and affecting system efficiency, and limit the predictability of the contention cycle.
[0055] The hash operation described above, which hashes the device identifier, session identifier, and upper limit of the random backoff time, means that the slave node takes the device identifier, session identifier, and contention window size as input parameters, performs a mathematical transformation using a preset deterministic hash function, and outputs a fixed-length pseudo-random value. The preset deterministic hash function can be a Cyclic Redundancy Check (CRC), Secure Hash Algorithm 1 (SHA-1), or a custom lightweight hash algorithm, etc. This hash operation is unidirectional and collision-resistant, ensuring that the same input always produces the same output, and different inputs are almost impossible to produce the same result, thus achieving reproducibility and differentiation of the backoff time.
[0056] The aforementioned target random number represents the output of the hash operation. The value of this output is a pseudo-random value in integer form, and its range is limited by the output bit width of the hash function. It serves as the basic seed for generating the backoff time and is used for subsequent time scale mapping.
[0057] The multiplication operation described above, involving the target random number and the preset time slot value, represents multiplying the target random number obtained from the hash operation by the fixed time slot unit defined by the master node in the initialization broadcast. This maps the pseudo-random value from the discrete integer domain to the actual time domain, thereby obtaining a physically meaningful backoff delay value. The fixed time slot unit can be 100 microseconds (μs). The backoff delay value, i.e., the random backoff time, is between 0 and "contention window size × time slot unit," serving as the specific timing reference for the slave node to wait on the bus and initiate an address request.
[0058] Based on the above optional embodiments, the embodiments of this application realize that slave nodes generate highly differentiated and reproducible backoff delays based on unique hardware identities and dynamic session contexts under decentralized coordination conditions, effectively avoiding address application conflicts caused by overlapping backoff times of multiple slave nodes, and improving the fairness and communication efficiency of the distributed competition process.
[0059] Furthermore, hashing the device identification information, session identification information, and the upper limit of the random backoff time to obtain the target random number involves: performing an XOR operation on the device identification information and session identification information to obtain the XOR operation result; performing a modulo operation on the upper limit of the random backoff time using the XOR operation result to obtain the modulo operation result; and performing a hash operation based on the modulo operation result to obtain the target random number.
[0060] The above-mentioned hash operation on the device identification information, session identification information, and upper limit of random backoff time to obtain the target random number includes three steps: First, an XOR operation is performed on the device identification information and session identification information to obtain the XOR result. This step XORs the unique hardware identifier fixed by the slave node with the session identification information dynamically generated by the master node bitwise, ensuring that the input data depends on both the physical identity of the node and the unique context of the current communication session, thus ensuring that the input combination of each slave node in each address allocation session is unique and unpredictable; Second, the modulo operation is performed on the upper limit of random backoff time using the XOR result to obtain the modulo operation result. This step maps the XOR result to [0, The upper limit of the random backoff time is set to an integer range of [-1], which strictly constrains the output value within the contention window broadcast by the master node, preventing the backoff time from exceeding the preset time slot boundary and achieving time controllability of distributed contention. Finally, a hash operation is performed based on the modulo operation result to obtain the target random number. This step takes the modulo operation result as input and inputs it into the secure hash algorithm 1 function. Through nonlinear diffusion and confusion processing, the uneven distribution of numerical values that may be introduced by the modulo operation is eliminated, enhancing the randomness and uniformity of the output value. This ensures that the target random number is statistically balanced and avoids multiple slave nodes generating the same backoff time due to the low entropy of the input data.
[0061] Specifically, the formula for calculating the random retreat time is:
[0062]
[0063] in, This indicates the device identification information of the slave node. This represents the session identification information for the address allocation session. CW represents the upper limit of the random backoff time, i.e., the contention window size. This indicates the preset time slot value, which is a fixed time unit defined in the LIN bus protocol, such as 100 microseconds. This represents the random backoff time of the final output.
[0064] Based on the above optional embodiments, this application embodiment realizes the deep coupling processing of device identification information, session identification information and contention window size. It uses XOR operation as the fusion mechanism of identity and session, modulo operation as the constraint mechanism of time range, and hash operation as the enhancement mechanism of distribution uniformity. The three are sequentially connected to form a deterministic randomization generation chain, instead of using a single random number generator or simple linear mapping. Thus, without additional hardware support, it significantly reduces the probability of multiple slave nodes competing for address request messages at the same time, and ensures the orderliness of communication timing and the effectiveness of conflict avoidance during address allocation.
[0065] Furthermore, the node address allocation method of the vehicle network also includes: in response to the network bus state being in a non-idle state during the timing period, controlling the backoff timer to pause timing; in response to the network bus state returning from a non-idle state to an idle state, controlling the backoff timer to resume timing from the paused position.
[0066] The above response to the network bus status being non-idle during the timing period, controlling the backoff timer to pause the timing, means that after the backoff timer starts, the slave node continuously listens to the network bus status. If it detects that the network bus status is non-idle during the timing period, it indicates that other nodes are currently transmitting data. At this time, the backoff timer is immediately paused to prevent the continuous timing from causing a conflict by mistakenly sending address request messages when the bus is busy.
[0067] The above response is that when the network bus state recovers from a non-idle state to an idle state, the backoff timer is controlled to continue counting from the paused position. This means that when the network bus state recovers from a non-idle state to an idle state, it indicates that the bus has completed the current communication cycle and entered a contentionable period. At this time, the backoff timer continues counting from the remaining time value before the pause, ensuring that the accumulated backoff time value remains intact and is not reset or lost due to bus occupancy.
[0068] The above steps are implemented during the backoff phase before the slave node executes the address request, in order to dynamically adapt to real-time changes in the bus communication environment.
[0069] Based on the above optional embodiments, this application embodiment achieves real-time perception of bus occupancy and adaptive adjustment of backoff behavior without introducing additional hardware detection circuits. The backoff timer is designed as a non-resettable state machine that can be paused and resumed, rather than the fixed delay or restart mechanism used in traditional solutions. This ensures the accuracy of backoff time accumulation while avoiding repeated competition or timeout failures caused by bus busyness, thereby improving the reliability and timing stability of the address request process.
[0070] Furthermore, after sending the address request information to the master node, the method also includes: receiving a temporary address allocation message sent by the master node, wherein the temporary address allocation message is used to determine the temporary node address and the validity period of the address corresponding to the slave node.
[0071] The aforementioned temporary node address represents a non-permanent logical identifier dynamically assigned by the master node from the available address range after receiving the first valid address request. It is intended to provide a temporary communication identity for the successfully competing slave node, used for bidirectional message exchange during the subsequent address confirmation phase, and to avoid bus conflicts caused by using unauthorized addresses before the official address is registered.
[0072] The validity period of the above address is explicitly specified by the master node in the temporary address allocation message, which defines the legal usage period of the temporary node address. The unit is time period or message frame number. It can constrain the communication window of the slave node before the address confirmation is completed, and prevent the temporary address from occupying address resources for a long time due to slave node failure, lost response or communication interruption.
[0073] The aforementioned receipt of a temporary address allocation message from the master node indicates that after initiating an address request, the slave node must wait for the master node's confirmation response. It obtains a temporary identity with a clearly defined validity period through this response, rather than directly acquiring a permanent address or choosing its own address. This allows for phased control of address allocation. Furthermore, this step is executed during the address contention allocation phase.
[0074] Based on the above optional embodiments, this application embodiment implements a step-by-step confirmation mechanism for the address allocation process between the master node and the slave node by receiving temporary address allocation messages. It introduces dual constraints of temporary node addresses and address validity duration, rather than directly allocating permanent addresses or relying on physical topology pre-allocation. This step-by-step confirmation mechanism makes the address allocation process revocable and recoverable. The slave node must complete address confirmation within a specified time limit; otherwise, the temporary node address automatically expires. This ensures that address resources are not locked for extended periods due to abnormal nodes, effectively reducing the risk of address conflicts and improving the fault tolerance and execution security of the address allocation process.
[0075] Furthermore, after receiving the temporary address allocation message from the master node, the method further includes: receiving an address confirmation request sent by the master node using the temporary node address, wherein the address confirmation request is used to determine the target node address and address configuration parameters corresponding to the slave node; and sending a confirmation response message to the master node based on the address confirmation request, so that the master node registers the mapping relationship between the slave node and the target node address in the address allocation table based on the confirmation response message, wherein the confirmation response message includes the device capability information, device type identifier, and communication verification information corresponding to the slave node.
[0076] The aforementioned temporary node address represents a temporary communication identifier obtained by the slave node during the address contention phase. It is used to establish a one-way communication channel with the master node before final registration is completed, ensuring that the address confirmation request can be accurately directed to the slave node that has successfully competed for the address.
[0077] The aforementioned address confirmation request is sent by the master node via unicast through a temporary node address. Its content includes the target node address and address configuration parameters. The target node address represents the permanent logical address assigned after being reviewed by the master node, and the address configuration parameters represent the set of communication parameters required for the slave node to work normally. This request triggers the final confirmation process for the slave node to complete the identity binding.
[0078] The aforementioned confirmation response message is generated and sent by the slave node after receiving the address confirmation request. Its content includes device capability information, device type identifier, and communication verification information. The device capability information includes the software and hardware version number, which is used by the master node to evaluate the compatibility of the slave node. The device type identifier is used to classify and manage nodes with different functions. The communication verification information is a checksum generated based on the message content, which is used to verify communication integrity and prevent tampering.
[0079] The address allocation table mentioned above represents a non-volatile storage structure maintained by the master node, used to record the mapping relationship between slave node device identification information and target node address. The receipt of the confirmation message triggers the master node to register the mapping relationship, ensuring the persistence and consistency of the address allocation state.
[0080] The above-described process involves using a temporary node address to receive an address confirmation request from the master node, and then sending a confirmation response message to the master node based on the address confirmation request. This allows the master node to register the mapping relationship between the slave node and the target node address in its address allocation table based on the confirmation response message. In other words, after obtaining a temporary node address, the slave node must receive the master node's address confirmation request through that address and respond with a confirmation response message containing complete identity and verification information. Only then can the master node complete the registration in the address allocation table based on this message, thereby achieving the binding from temporary communication to permanent identity. This step is performed during the address confirmation and registration phase.
[0081] Based on the above optional embodiments, this application embodiment achieves two-way verification and identity binding in the address allocation process by using temporary node addresses to receive address confirmation requests and send confirmation response messages containing device capability information, device type identifiers, and communication verification information. This transforms address allocation from a one-way allocation behavior into a closed-loop confirmation process that includes device capability verification, type identification, and communication integrity verification, rather than relying solely on address responses to complete registration. This effectively prevents illegal nodes, spoofed nodes, or nodes with abnormal communication from occupying legitimate addresses, ensuring the authenticity, completeness, and traceability of the mapping relationships recorded in the address allocation table.
[0082] Furthermore, after sending a confirmation response message to the master node based on the address confirmation request, the method also includes: in response to receiving a registration completion notification message sent by the master node, storing the target node address in a preset location, and responding to the master node's data communication instructions using the target node address.
[0083] The aforementioned registration completion notification message is a confirmation instruction sent by the master node to the slave node by unicast after verifying the confirmation response message and successfully updating the address allocation table. It is used to clearly inform the slave node that its address registration process has been successfully completed. This registration completion notification message is the trigger condition for the slave node to enter normal working mode.
[0084] The aforementioned target node address represents a permanent logical address that has been reviewed and officially assigned by the master node, serving as the unique identifier for the slave node to participate in subsequent data communication within the LIN bus network.
[0085] The aforementioned preset location represents a dedicated storage area pre-allocated from the non-volatile memory inside the node, used to persistently save the target node address, ensuring that the address information can still be retained after the system is powered off, reset, or restarted, thus avoiding repeated participation in the address allocation process.
[0086] The aforementioned data communication commands represent standardized message commands sent by the LIN bus master node to registered slave nodes. They include command identifiers, data fields, and verification information, and are used to request the slave node to perform specific functions, such as reporting status or receiving control commands. Their effective response depends on the target node address that the slave node has correctly stored and enabled.
[0087] The above response to receiving the registration completion notification message from the master node, storing the target node address in a preset location, and responding to the master node's data communication instructions using the target node address indicates that after completing authentication, the slave node must wait for the master node's explicit authorization signal, i.e., the registration completion notification message, before it can perform the persistent storage of the target node address. Only after storage is completed can the slave node identify and respond to the master node's data communication instructions based on the target node address.
[0088] Based on the above optional embodiments, this application embodiment achieves a smooth transition from a temporary communication state to a permanent working state by storing and applying the target node address in response to the registration completion notification message. The address storage behavior is strictly bound to the master node's registration completion notification, forming a closed-loop process of "confirmation—notification—storage—activation," rather than storing or automatically switching upon receiving a temporary address. This ensures that the legality and validity of the target node address have been verified at the master node system level, solving the problem of illegal address persistence caused by communication anomalies or message loss. It realizes the legality, persistence, and functionality of the slave node's communication identity, ensuring the final effectiveness of the address allocation result and the compliant initiation of communication behavior.
[0089] Figure 2 This is a structural block diagram of a node address allocation system for a vehicle network provided in this application embodiment. This application embodiment achieves efficient, reliable, and adaptive distributed address management through five collaborative closed-loop stages, specifically including: address allocation request stage, address contention allocation stage, address confirmation and registration stage, address management and maintenance mechanism, and fault handling and system recovery mechanism.
[0090] During the address allocation request phase, the master node first initializes the address allocation table stored in non-volatile memory after power-on. This table records the slave node's device ID, allocated logical address, address status, session identifier, and timestamp. The address status indicates whether the address is allocated or unallocated. The master node then broadcasts a system initialization message to the bus. This message includes a unique session identifier generated by the timestamp, a message type identifying the address allocation session, the range of logical addresses available for allocation, and a contention window size (CW) to constrain the slave node's contention behavior. Upon receiving this broadcast message, the slave node parses the session identifier and available address range, enters the address-awaiting state, and completes the preparatory work for participating in address contention. This provides a unified session context and address allocation boundary for subsequent dynamic address contention based on a distributed strategy.
[0091] During the address contention allocation phase, each slave node independently generates an unpredictable target random number based on its unique device identifier and the session identifier broadcast by the master node, using an XOR operation combined with a hash algorithm. This generates a unique backoff time, ensuring a statistically even distribution of response times across different nodes. Subsequently, each slave node starts a backoff timer and continuously monitors the LIN bus status during the timer. If the bus is busy, the timer is paused and resumed when the bus is idle. Once the timer reaches zero and the bus is idle, the node immediately sends an address request message containing its own device ID and current session ID. The master node then receives and processes the first valid request using a "first-come, first-served" principle, allocating a temporary address to the slave node and unicasting a temporary address allocation message with the device ID as the addressing target. This message includes the temporary address and its validity period. The slave node that successfully obtains the temporary address enters the confirmation phase, while other slave nodes that do not respond or are not selected continue to wait for the next contention window. This mechanism completely eliminates physical topology dependencies through decentralized random backoff, achieving fair, low-conflict, and high-concurrency address allocation.
[0092] During the address confirmation and registration phase, to ensure the accuracy and reliability of address allocation, the master node sends a confirmation request containing the official address and device configuration parameters to the temporary address after allocating it. Upon receiving the request, the slave node immediately replies with a confirmation response message containing the device's hardware and software version, type identifier, and communication checksum to verify its identity and communication integrity. After receiving a valid response, the master node establishes a permanent mapping between the slave node's device ID and the official logical address, updates the status in the address allocation table to "allocated," synchronously records the timestamp and associated session information, and sends a registration completion notification to the slave node. Upon receiving this notification, the slave node persistently stores the official address in non-volatile memory, switches to normal operating mode, and begins responding to the master node's regular communication commands. This two-way confirmation mechanism, through multi-layered verification and status feedback, effectively prevents erroneous binding caused by address misallocation or communication interference. Even in high-noise environments, the master node can achieve fault-tolerant recovery by resending confirmation requests, thereby ensuring high reliability and system stability in the address allocation process.
[0093] In addition, the embodiments of this application can perform address management and maintenance to realize dynamic and adaptive address control of the LIN bus system during operation. Specifically, this includes: First, periodic status checks, where the master node periodically broadcasts status query commands to monitor the online status of all slave nodes with allocated addresses in real time. If a slave node fails to respond multiple times consecutively, the system marks its address as "suspicious" and initiates a retry mechanism to attempt to confirm its true status through resending commands or communication recovery procedures, thus avoiding accidental reclaiming of addresses.
[0094] Second, address reclamation and reuse: For nodes that do not respond after multiple attempts and continue to time out, the master node upgrades its address status to "reclaimable" and actively releases the address back to the available address pool after a set safe time window, such as several minutes to several hours, to achieve intelligent reclamation and efficient reuse of resources.
[0095] Third, dynamic address updates: The system also supports slave nodes to actively initiate address change requests, such as replacing hardware, upgrading modules, or relocating. The master node evaluates the legality based on device capabilities, address pool status, and system policies. After approval, it dynamically allocates new addresses and updates the address mapping table in real time, ensuring that system configuration and physical changes are synchronized, greatly improving the flexibility of system deployment and maintenance.
[0096] Fourth, conflict detection and resolution: The master node continuously listens to bus communication messages. Once an address conflict is detected, i.e. multiple different device IDs use the same logical address, the conflict detection protocol is immediately triggered to suspend related communication, lock the conflicting address, and start a new round of distributed competition and confirmation process to reassign a unique address to the conflicting node and update the table entry synchronously.
[0097] The aforementioned address management and maintenance mechanism requires no manual intervention and possesses automatic sensing, intelligent decision-making, and self-healing capabilities, significantly enhancing the system's adaptability, reliability, and scalability in highly dynamic automotive electronics scenarios.
[0098] This application also provides fault handling and system recovery mechanisms to ensure that the LIN bus network can quickly recover and maintain stable operation under various abnormal conditions. Specifically, this includes: First, when a power outage occurs, both the master node and slave nodes attempt to restore the original state based on the address mapping relationship retained in non-volatile memory. The master node then sends a fast query broadcast, and successfully registered slave nodes can respond immediately and resume communication without the need for address reallocation, greatly shortening the system startup time. Unresponsive nodes automatically enter a new round of address contention, achieving seamless connection.
[0099] Second, for hardware failures of slave nodes, the master node determines the abnormality by continuous communication failures, marks the corresponding address as "faulty" and reports it to the upper-level management system so that operation and maintenance can intervene. After the faulty node is replaced, the newly connected node does not need to be manually configured and can automatically obtain a new address through a distributed competition mechanism. The original faulty address is isolated and reclaimed, which does not affect the normal operation of other nodes, thus realizing fault isolation and system self-healing.
[0100] Third, when a persistent physical fault occurs on the LIN bus, such as a short circuit or open circuit, the master node can actively identify the abnormal bus state, immediately enter safe mode, suspend all address allocation and communication commands to prevent error propagation, and after the fault is cleared and the bus returns to normal, the master node restores the address associations and communication configurations of existing nodes item by item based on the complete address allocation table stored locally, and quickly rebuilds the network topology.
[0101] The aforementioned fault handling and system recovery mechanism enables self-recovery across all scenarios, from power outages and node failures to bus anomalies. This significantly improves the reliability and availability of the system in automotive environments. Fault isolation, address reallocation, and network reconstruction can be completed without manual intervention, truly achieving the management goals of "plug and play, no disruption during power outages, and self-healing from faults."
[0102] Figure 3 This is a flowchart of another node address allocation method for a vehicle network provided in the embodiments of this application, such as... Figure 3 As shown, the process includes the following steps:
[0103] Step S301: The master node initializes the address allocation table;
[0104] Step S302: The master node sends an initialization broadcast message;
[0105] Step S303: Receive the initialization broadcast message from the node and start the backoff timer, while monitoring the network bus status of the vehicle communication network;
[0106] Step S304: When the backoff timer ends and the network bus is in an idle state after the timer ends, the slave node sends an address request message.
[0107] Step S305: The master node assigns a temporary address to the slave node and sends an address confirmation request;
[0108] Step S306: Confirm the address information from the node, send an confirmation response message, and store the target node address information;
[0109] Step S307: The master node updates the address allocation table;
[0110] Step S308: The master node periodically polls to confirm the online status of the slave nodes. Slave nodes that do not respond are reclaimed, and slave nodes that are reused by different devices are dynamically reallocated.
[0111] Based on steps S301 to S308, this embodiment of the application, in response to receiving an initialization broadcast message from the master node in the vehicle communication network, determines a random backoff time based on the device identification information corresponding to the slave node in the vehicle communication network and the session identification information in the initialization broadcast message. Then, a backoff timer is started according to the random backoff time, and the network bus status of the vehicle communication network is monitored during the backoff timer's timing. Finally, in response to the end of the backoff timer and the network bus status being idle after the timing ends, an address request information is sent to the master node, so that the master node can allocate node addresses to the slave node based on the address request information. This achieves the purpose of flexible address allocation for slave nodes, thereby realizing the technical effect of improving the scalability, maintainability, and reliability of LIN bus deployment, and solving the technical problems of poor scalability and difficult maintenance when allocating slave node addresses on the LIN bus.
[0112] Figure 4 This is an interactive flowchart of a node address allocation method for a vehicle network provided in an embodiment of this application, such as... Figure 4 As shown, the process includes the following steps:
[0113] Step S401: The master node sends an initialization broadcast message;
[0114] Step S402: Receive the initialization broadcast message from the node, start the backoff timer, and monitor the network bus status of the vehicle communication network;
[0115] Step S403: When the backoff timer ends and the slave node detects that the network bus status is idle after the timer ends, it sends an address request to the master node.
[0116] Step S404: The master node sends a temporary address allocation message to the slave node;
[0117] Step S405: The slave node receives the temporary address allocation message from the master node;
[0118] Step S406: The master node sends an address confirmation request to the slave node;
[0119] Step S407: The slave node receives the address confirmation request from the master node and sends a confirmation response message to the master node based on the address confirmation request;
[0120] In step S408, the master node receives the confirmation response message from the slave node and updates the address allocation table, and then sends a registration completion notification message to the slave node.
[0121] Step S409: The slave node receives the registration completion notification message from the master node and stores the target node address in a preset location.
[0122] Based on steps S401 to S409, this embodiment of the application, in response to receiving an initialization broadcast message from the master node in the vehicle communication network, determines a random backoff time based on the device identification information corresponding to the slave node in the vehicle communication network and the session identification information in the initialization broadcast message. Then, it starts a backoff timer according to the random backoff time, and monitors the network bus status of the vehicle communication network during the backoff timer's timing. Finally, in response to the end of the backoff timer and the network bus status being idle after the timing ends, it sends an address request information to the master node, so that the master node can allocate node addresses to the slave node based on the address request information. This achieves the purpose of flexible address allocation for slave nodes, thereby realizing the technical effect of improving the scalability, maintainability, and reliability of LIN bus deployment, and solving the technical problems of poor scalability and difficult maintenance when allocating slave node addresses on the LIN bus.
[0123] Figure 5 This is a structural block diagram of a node address allocation device for a vehicle network provided in an embodiment of this application, as shown below. Figure 5 As shown, it includes: a determining module 501, used to determine a random backoff time based on the device identification information corresponding to the slave node in the vehicle communication network and the session identification information in the initialization broadcast message in response to receiving an initialization broadcast message from the master node in the vehicle communication network; a monitoring module 502, used to start a backoff timer according to the random backoff time and monitor the network bus status of the vehicle communication network during the backoff timer's timing period; and a first sending module 503, used to send address request information to the master node in response to the end of the backoff timer and the network bus status being idle after the timing period, so that the master node can allocate node addresses to the slave node based on the address request information.
[0124] Furthermore, the determining module 501 is also used to: perform a hash operation on the device identification information, session identification information, and the upper limit of the random backoff time to obtain a target random number; and perform a multiplication operation on the target random number and the preset time slot value to obtain the random backoff time.
[0125] Furthermore, the determination module 501 is also used to: perform an XOR operation on the device identification information and the session identification information to obtain the XOR operation result; use the XOR operation result to perform a modulo operation on the upper limit of the random backoff time to obtain the modulo operation result; and perform a hash operation based on the modulo operation result to obtain the target random number.
[0126] Furthermore, the node address allocation device of the vehicle network also includes: a control module 505, which controls the backoff timer to pause timing in response to the network bus state being in a non-idle state during the timing period; and controls the backoff timer to resume timing from the paused position in response to the network bus state returning to an idle state from a non-idle state.
[0127] Furthermore, the node address allocation device of the vehicle network also includes: a first receiving module 505, used to receive a temporary address allocation message sent by the master node, wherein the temporary address allocation message is used to determine the temporary node address and the address validity period of the slave node.
[0128] Furthermore, the node address allocation device of the vehicular network also includes: a second sending module 506, used to: receive an address confirmation request sent by the master node using a temporary node address, wherein the address confirmation request is used to determine the target node address and address configuration parameters corresponding to the slave node; and send a confirmation response message to the master node based on the address confirmation request, so that the master node registers the mapping relationship between the slave node and the target node address in the address allocation table based on the confirmation response message, wherein the confirmation response message includes the device capability information, device type identifier and communication verification information corresponding to the slave node.
[0129] Furthermore, the node address allocation device of the vehicle network also includes: a second receiving module 507, used to: store the target node address in a preset location in response to receiving a registration completion notification message sent by the master node, and respond to the data communication instructions of the master node using the target node address.
[0130] Figure 6 This is a structural block diagram of an electronic device provided in an embodiment of this application, such as... Figure 6 As shown, it includes a processor 610 and a memory 620, wherein the memory 610 is used to store computer programs; the processor 620 is used to execute the programs stored in the memory 610 to implement the node address allocation method of the vehicle network described in any embodiment of this application.
[0131] According to another aspect of the embodiments of this application, a vehicle is also provided, which includes the above-described electronic equipment.
[0132] This application also provides a computer-readable storage medium storing a computer program that, when executed by a processor, implements the node address allocation method for an in-vehicle network described in any embodiment of this application.
[0133] In this application, "multiple" refers to two or more.
[0134] In this application, unless otherwise expressly defined, the terms "installation," "connection," and "linking" should be interpreted broadly. For example, they can refer to a fixed connection, a detachable connection, or an integral connection; they can refer to a mechanical connection or an electrical connection; they can refer to a direct connection or an indirect connection through an intermediate medium; and they can refer to the internal connection between two components. Those skilled in the art can understand the specific meaning of the above terms in this application based on the specific circumstances.
[0135] The terms “first,” “second,” “third,” “fourth,” etc., in this application (if present) are used to distinguish similar objects and are not necessarily used to describe a specific order or sequence.
[0136] In this application, the term "and / or" is merely a description of the relationship between related objects, indicating that three relationships can exist. For example, A and / or B can represent: A existing alone, A and B existing simultaneously, or B existing alone. Additionally, in this application, the character " / " generally indicates that the preceding and following related objects have an "or" relationship.
[0137] Unless otherwise specified, all steps in this application may be performed sequentially or randomly. For example, if the method includes steps A and B, it means that the method may include steps A and B performed sequentially, or it may include steps B and A performed sequentially. For example, if the method may also include step C, it means that step C may be added to the method in any order. For example, the method may include steps A, B, and C, or it may include steps A, C, and B, or it may include steps C, A, and B, etc.
[0138] The above description is merely a preferred embodiment of this application and is not intended to limit this application. Any modifications, equivalent substitutions, and improvements made within the spirit and principles of this application should be included within the protection scope of this application.
Claims
1. A method for allocating node addresses in a vehicle-mounted network, characterized in that, include: In response to receiving an initialization broadcast message from the master node in the vehicular communication network, a random backoff time is determined based on the device identification information corresponding to the slave node in the vehicular communication network and the session identification information in the initialization broadcast message; The backoff timer is started according to the random backoff time, and the network bus status of the vehicle communication network is monitored during the timing of the backoff timer; In response to the end of the backoff timer and the network bus state being idle after the timer expires, an address request is sent to the master node so that the master node can allocate a node address to the slave node based on the address request.
2. The method according to claim 1, characterized in that, Determining the random backoff time based on the device identification information and session identification information corresponding to the slave node in the vehicular communication network includes: A hash operation is performed on the device identification information, the session identification information, and the upper limit of the random backoff time to obtain a target random number; The random retreat time is obtained by multiplying the target random number and the preset time slot value.
3. The method according to claim 2, characterized in that, The target random number is obtained by performing a hash operation on the device identification information, the session identification information, and the upper limit of the random backoff time. Perform an XOR operation on the device identification information and the session identification information to obtain the XOR result; The upper limit of the random retreat time is moduloed using the XOR operation result to obtain the modulo operation result; The target random number is obtained by performing a hash operation based on the modulo operation result.
4. The method according to claim 1, characterized in that, The method further includes: In response to the network bus being in a non-idle state during the timing period, the backoff timer is controlled to pause timing; In response to the network bus state returning from the non-idle state to the idle state, the backoff timer is controlled to continue counting from the paused position.
5. The method according to claim 1, characterized in that, After sending the address request information to the master node, the method further includes: The system receives a temporary address allocation message sent by the master node, wherein the temporary address allocation message is used to determine the temporary node address and the validity period of the address corresponding to the slave node.
6. The method according to claim 5, characterized in that, After receiving the temporary address allocation message from the master node, the method further includes: The temporary node address is used to receive the address confirmation request sent by the master node, wherein the address confirmation request is used to determine the target node address and address configuration parameters corresponding to the slave node; Based on the address confirmation request, a confirmation response message is sent to the master node, so that the master node can register the mapping relationship between the slave node and the target node address in the address allocation table based on the confirmation response message. The confirmation response message includes the device capability information, device type identifier and communication verification information corresponding to the slave node.
7. The method according to claim 6, characterized in that, After sending an acknowledgment response message to the master node based on the address acknowledgment request, the method further includes: In response to receiving a registration completion notification message from the master node, the target node address is stored in a preset location, and the target node address is used to respond to the master node's data communication instructions.
8. An electronic device, characterized in that, Including processor and memory, among which, Memory, used to store computer programs; A processor for executing a program stored in memory to implement the method described in any one of claims 1-7.
9. A vehicle, characterized in that, It includes the electronic device as described in claim 8.
10. A computer-readable storage medium, characterized in that, The computer-readable storage medium stores a computer program that, when executed by a processor, implements the method described in any one of claims 1 to 7.