Device addressing method, host computer and target node device
By broadcasting instructions to disconnect the communication connection with the next-level node device, obtain and send address information, the problem of long node device address confirmation time is solved and fast address determination is achieved.
Patent Information
- Application Number
- CN202310473943.5
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2023-04-27
- Publication Date
- 2025-09-16
- Estimated Expiration
- 2043-04-27
AI Technical Summary
In the prior art, after the MAC address of a node device changes, the system cannot automatically associate, resulting in a long time to confirm the node device address.
The node device is disconnected from the communication connection with the next-level node device by broadcasting instructions, and the address information is obtained and sent. The instructions are sent repeatedly in sequence to determine the address of the target node device.
It can quickly determine the address information of the node device and shorten the confirmation time.
Smart Images

Figure CN116405428B_ABST
Abstract
Description
Technical Field
[0001] The present invention relates to the field of communication technology, and in particular to a device addressing method, a host computer and a target node device. Background Art
[0002] In highly integrated devices, bus communication is a key technology for device control. In related technologies, a host computer is connected to each node device separately, communicating with different node devices during the communication process. However, in related technologies, the addresses of multiple node devices are pre-fixed. When a node device is replaced and the device's Media Access Control (MAC) address changes, the system cannot associate the new MAC address with the actual device, making it impossible to communicate directly with the node device. The host computer must configure the node device's MAC address before communication can proceed, resulting in a long communication process.
[0003] It can be seen that the prior art has the problem of a long time required to confirm the address of a node device. Summary of the Invention
[0004] The embodiment of the present invention provides a device addressing method, a host computer and a target node device, so as to solve the problem in the prior art that it takes a long time to confirm the address of a node device.
[0005] To solve the above problems, the present invention is achieved as follows:
[0006] In a first aspect, an embodiment of the present invention provides a device addressing method, which is applied to a host computer, wherein the host computer is communicatively connected to a node device at one endpoint among a plurality of node devices connected in series, comprising:
[0007] Broadcasting a first instruction, wherein the first instruction is used to instruct the node device that receives the first instruction to disconnect the communication connection with the next-level node device, where the next-level node device is a node device connected to the node device and away from the host computer;
[0008] Broadcasting a second instruction, where the second instruction is used to obtain an address of a node device;
[0009] receiving first address information, where the first address information is address information of the first node device sent to the host computer after the first node device receives the second instruction and when the first node device and the first lower-level node device are disconnected from each other, wherein the first node device is a node device connected to the host computer, and the first lower-level node device is a node device at a lower level corresponding to the first node device;
[0010] Sending a third instruction to the address corresponding to the last received address information, wherein the third instruction is used to instruct the node device that receives the third instruction to establish a communication connection with the next-level node device corresponding to the node device that receives the third instruction;
[0011] Repeat broadcasting the second instruction and sending the third instruction to the address corresponding to the last received address information in sequence until the second address information of the target node device is received. The second address information is the address information sent by the target node device to the upper computer after receiving the second instruction and when the communication connection between the target node device and the second lower-level node device is disconnected. The target node device is one of the multiple node devices, and the second lower-level node device is the next-level node device corresponding to the target node.
[0012] In a second aspect, an embodiment of the present invention provides a device addressing method, which is applied to a target node device, wherein the target node device is connected in series with other node devices, and a node device at one end of the series connection is communicatively connected with a host computer, comprising:
[0013] receiving a first instruction, where the first instruction is an instruction broadcast by the host computer and is used to instruct a node device that has received the first instruction to disconnect a communication connection with a next-level node device, where the next-level node device is a node device connected to the node device and away from the host computer;
[0014] Disconnecting the communication connection with a first lower-level node device, where the first lower-level node device is a lower-level node device corresponding to the target node device;
[0015] receiving a second instruction, where the second instruction is an instruction broadcast by the host computer and is used to obtain an address of a node device;
[0016] When the target node device and the first lower-level node device are disconnected from each other, sending first address information to the host computer;
[0017] receiving a third instruction, where the third instruction is an instruction sent by the host computer to the first address information and is used to instruct the target node device to establish a communication connection with the first lower-level node device;
[0018] Establishing a communication connection with the first lower-level node device.
[0019] In a third aspect, an embodiment of the present invention provides a host computer, wherein the host computer is communicatively connected to a node device at one endpoint among a plurality of node devices connected in series, including:
[0020] a first sending module, configured to broadcast a first instruction, wherein the first instruction is configured to instruct a node device that has received the first instruction to disconnect from a next-level node device, where the next-level node device is a node device connected to the node device and located away from the host computer;
[0021] A second sending module is used to broadcast a second instruction, where the second instruction is used to obtain an address of a node device;
[0022] a first receiving module, configured to receive first address information, wherein the first address information is address information of the first node device sent to the host computer after the first node device receives the second instruction and when the first node device and the first lower-level node device are disconnected from each other, wherein the first node device is a node device connected to the host computer, and the first lower-level node device is a node device at a lower level corresponding to the first node device;
[0023] a third sending module, configured to send a third instruction to the address corresponding to the last received address information, wherein the third instruction is used to instruct the node device that has received the third instruction to establish a communication connection with a next-level node device corresponding to the node device that has received the third instruction;
[0024] The fourth sending module is used to repeatedly broadcast the second instruction in sequence and send the third instruction to the address corresponding to the last received address information until the second address information of the target node device is received. The second address information is the address information sent by the target node device to the upper computer after receiving the second instruction and when the communication connection between the target node device and the second lower-level node device is disconnected. The target node device is one of the multiple node devices, and the second lower-level node device is the next-level node device corresponding to the target node.
[0025] In a fourth aspect, an embodiment of the present invention provides a target node device, wherein the target node device is connected in series with other node devices, and the node device at one end of the series connection is communicatively connected with a host computer, including:
[0026] a first receiving module, configured to receive a first instruction, the first instruction being an instruction broadcast by the host computer and being configured to instruct a node device that has received the first instruction to disconnect from a next-level node device, the next-level node device being a node device connected to the node device and away from the host computer;
[0027] a first processing module, configured to disconnect a communication connection with a first lower-level node device, where the first lower-level node device is a lower-level node device corresponding to the target node device;
[0028] a second receiving module, configured to receive a second instruction, where the second instruction is an instruction broadcast by the host computer and is configured to obtain an address of a node device;
[0029] A second sending module is used to send first address information to the host computer when the communication connection between the target node device and the first lower-level node device is disconnected;
[0030] a third receiving module, configured to receive a third instruction, wherein the third instruction is an instruction sent by the host computer to the first address information and is configured to instruct the target node device to establish a communication connection with the first lower-level node device;
[0031] The second processing module is configured to establish a communication connection with the first lower-level node device.
[0032] In a fifth aspect, an embodiment of the present invention further provides an electronic device comprising a processor, a memory, and a computer program stored in the memory and executable on the processor. When the computer program is executed by the processor, the steps of the device addressing method described in the first aspect are implemented, or the steps of the device addressing method described in the second aspect are implemented.
[0033] In a sixth aspect, an embodiment of the present invention further provides a readable storage medium for storing a program, which, when executed by a processor, implements the steps in the device addressing method described in the first aspect above, or implements the steps in the device addressing method described in the second aspect above.
[0034] In an embodiment of the present invention, the target node device receives a first instruction, sends the first instruction to the first lower-level node device, and disconnects the communication connection with the first lower-level node device, and then receives a second instruction. When the target node device and the first lower-level node device disconnect the communication connection, the target node device sends first address information to the upper computer and establishes a communication connection with the first lower-level node device; when the target node device and the first lower-level node device maintain the communication connection, the target node device sends a second instruction to the first lower-level node device, receives the second address information sent by the first lower-level device, and sends the second address information to the upper computer, thereby sending address information to the upper computer when the second instruction is received for the first time, and not responding to the second instruction when the second instruction is received for the second time or thereafter, but forwarding the address of the node device that responds to the instruction to the upper computer, so that the upper computer can receive address information once each time it sends the second instruction. The address information is the address information of each node device in the serial order, which quickly determines the address information of the node device, thereby shortening the determination time of the node device. BRIEF DESCRIPTION OF THE DRAWINGS
[0035] In order to more clearly illustrate the technical solutions of the embodiments of the present invention, the following briefly introduces the drawings required for use in the description of the embodiments of the present invention. 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 any creative labor.
[0036] Figure 1 is a flow chart of a device addressing method provided by an embodiment of the present invention;
[0037] Figure 2 This is a schematic diagram of the connection between the host computer and the node device provided by an embodiment of the present invention;
[0038] Figure 3 is a schematic structural diagram of a node device provided by an embodiment of the present invention;
[0039] Figure 4 is a flow chart of a device addressing method provided by an embodiment of the present invention;
[0040] Figure 5 This is a structural diagram of a host computer provided by an embodiment of the present invention;
[0041] Figure 6 is a structural diagram of a target node device provided by an embodiment of the present invention;
[0042] Figure 7 This is a structural diagram of an electronic device provided by an embodiment of the present invention. DETAILED DESCRIPTION
[0043] The following will clearly and completely describe the technical solutions in the embodiments of the present invention in conjunction with the accompanying drawings. Obviously, the described embodiments are only part of the embodiments of the present invention, not all of them. All other embodiments obtained by ordinary technicians in this field based on the embodiments of the present invention without making any creative efforts shall fall within the scope of protection of the present invention.
[0044] See Figure 1 , Figure 1 This is a flow chart of a device addressing method provided by an embodiment of the present invention, which is applied to a host computer, wherein the host computer is in communication connection with a node device at one end point of a plurality of node devices connected in series, such as Figure 2 As shown, the node device at one end point of the series is connected to the host computer for communication, as shown in Figure 1 As shown, the method includes the following steps:
[0045] Step 101: broadcast a first instruction, wherein the first instruction is used to instruct a node device that receives the first instruction to disconnect the communication connection with a next-level node device, where the next-level node device is a node device connected to the node device and away from the host computer.
[0046] The above node devices are connected in series, and the node device can control the communication connection between the next node device connected to the node device. Figure 3 As shown, the current node device includes an upper-level port and a lower-level port. The upper-level port is connected to the upper-level node device, and the lower-level port is connected to the lower-level node device. The connection or disconnection between the upper-level port and the lower-level port is controlled by the current node device.
[0047] Among them, the upper-level node device is a node device directly connected to the current node device and located on the side of the current node device close to the host computer; the lower-level node device is a node device directly connected to the current node device and located on the side of the current node device far from the host computer.
[0048] It should be understood that when the current node device disconnects the communication connection with the next-level node device, the next-level node device directly connected to the current node device, and the node device directly or indirectly connected to the next-level node device all disconnect the communication connection with the host computer.
[0049] The first instruction is sent by the host computer and instructs all node devices to disconnect from the node devices at the next level. It should be understood that each node device is connected in series. By disconnecting the communication connection between each node device and the node device at the next level, and then reconnecting to each node device in turn, and obtaining the address of each node device in turn, the address information corresponding to each node device can be determined. See the subsequent embodiments for details.
[0050] Step 102: Broadcast a second instruction, where the second instruction is used to obtain the address of the node device.
[0051] The above-mentioned second instruction is an instruction for obtaining the address of the node device. Each time the host computer sends a second instruction, only one node device in the serial node devices responds to the second instruction and sends address information. In this way, the address information corresponding to each node device is obtained. For details, see the subsequent embodiments.
[0052] It should be understood that when the target node device receives the second instruction, the address information of the node devices before the target node device has been acquired by the host computer, and the target node device only needs to determine whether it needs to respond to the second instruction.
[0053] Step 103: Receive first address information. The first address information is address information of the first node device sent to the upper computer after the first node device receives the second instruction and the communication connection between the first node device and the first lower-level node device is disconnected. The first node device is a node device connected to the upper computer, and the first lower-level node device is a next-level node device corresponding to the first node device.
[0054] The first node device is directly connected to the host computer. It maintains a long-term communication connection with the host computer and cannot be disconnected by other node devices. Because the first node device is directly connected to the host computer, it is guaranteed to receive the second command broadcast by the host computer and then determine whether to respond to the second command based on the communication connection between the first node device and the node device at the next level corresponding to the first node device.
[0055] Specifically, when the current node device that has received the second instruction is in a state where the communication connection with the next-level node device is disconnected, the current node device needs to respond to the second instruction by sending the address information of the current node device to the host computer. Since the communication connection with the next-level node device is disconnected via one node device among all the node devices that have received the second instruction, the host computer can only receive one piece of address information.
[0056] When the current node device that receives the second instruction is in a communication connection with the next-level node device, the current node device believes that it has already responded to the second instruction and does not need to respond to the second instruction again, that is, it does not send the address information of the current device to the upper computer, so that the upper computer can only receive one address information.
[0057] Step 104: Send a third instruction to the address corresponding to the last received address information, wherein the third instruction is used to instruct the node device that receives the third instruction to establish a communication connection with the next-level node device corresponding to the node device that receives the third instruction.
[0058] Since the current node device will send address information when it receives the second instruction and is disconnected from the next-level node device, in order to avoid repeated transmission by the current node device, it is necessary to send a third instruction to the address information of the current node device in this embodiment, so that a communication connection is established between the current node device and the next-level node device. In this way, the current node device only reports the address information once.
[0059] Step 105: Repeat broadcasting the second instruction and sending the third instruction to the address corresponding to the last received address information in sequence until the second address information of the target node device is received. The second address information is the address information sent by the target node device to the upper computer after receiving the second instruction and when the communication connection between the target node device and the second lower-level node device is disconnected. The target node device is one of the multiple node devices, and the second lower-level node device is the next-level node device corresponding to the target node.
[0060] It should be understood that when the target node device receives the second instruction for the first time, the communication connection between the target node device and the second lower-level node device is disconnected. In this case, the target node device sends the second address information, and the node devices before the target node device are all in a communication connection state and will not respond to the second instruction; the node devices after the target node device are in a disconnected communication connection state, cannot receive the second instruction, and will not send address information. In this case, the upper computer will only receive the second address information sent by the target node device, and then according to the number of times the upper computer sends the second instruction, the position of the target node device can be corresponded to the second address information of the target node device.
[0061] Exemplarily, the host computer is directly connected to node device A, node device A is connected to node device B, node device B is connected to the target node device (ie, node device C), the target node device is connected to node device D, and the communication connection between each node device is disconnected.
[0062] When the host computer sends the second instruction for the first time, the host computer is in communication with node device A, and the communication connection between node device A and node device B is disconnected. Only node device A receives the second instruction sent by the host computer. At this time, node device A obtains that the communication connection status between node device A and node device B is disconnected. Node device A sends address information a to the host computer, and a communication connection is established between node device A and node device B. The host computer determines that the address of node device A is address information a. The host computer then sends a third instruction to the address corresponding to address information a, so that the communication connection between node device A and node device B is established.
[0063] When the host computer sends the second instruction for the second time, the host computer is in communication with node device A, node device A is in communication with node device B, and node device B is disconnected from the target node device. The second instruction sent by the host computer is received by node devices A and B, but because node device A has already responded to the second instruction, node devices A and B are in communication with each other and do not respond to the second instruction. However, node device B is disconnected from the target node device. Node device B responds to the second instruction, i.e., node device B sends address information b to the host computer, and a communication connection is established between node device B and the target node device. The host computer determines that the address of node device B is address information b. The host computer then sends a third instruction to the address corresponding to address information b, establishing a communication connection between node device B and the target node device.
[0064] When the upper computer sends the second instruction for the third time, the upper computer is in communication connection with node device A, node device A is in communication connection with node device B, node device B is in communication connection with the target node device, and the target device and node device D are disconnected from each other. The second instruction sent by the upper computer is received by node device A, node device B and target node device. Since node device A and node device B have already responded to the second instruction, they are in communication connection state with the lower-level devices and no longer respond to the second instruction. The communication connection between the target node device and node device D is disconnected. At this time, the target node device responds to the second instruction, that is, the target node device sends address information c to the upper computer, and establishes a communication connection between the target node device and node device D. The upper computer determines that the address of the target node device is address information c.
[0065] The host computer obtains the address information corresponding to each node device by repeatedly sending the second instruction and sending the third instruction to the address corresponding to the address information received last.
[0066] In an embodiment of the present invention, a host computer broadcasts a first instruction, causing a node device that receives the first instruction to disconnect from a next-level node device. A second instruction for acquiring the address of the node device is then broadcast to receive the first address information. A third instruction is then sent to the address corresponding to the last received address information, causing the node device that receives the third instruction to establish a communication connection with the corresponding next-level node device. The second instruction is broadcasted and the third instruction is sent to the address corresponding to the last received address information repeatedly until the second address information of the target node device is received. This allows the host computer to receive one address information each time it broadcasts the second instruction in the serial order of the node devices. By repeatedly broadcasting the second instruction and sending the third instruction to the address corresponding to the last received address information, the address information of the target node device can be automatically and quickly acquired, thereby shortening the time it takes to determine the node device.
[0067] In one embodiment, each node device also establishes a communication connection with a next-level node device corresponding to each node device when sending address information to the host computer;
[0068] Before sending the third instruction to the address corresponding to the last received address information, the method further includes:
[0069] broadcasting the first instruction;
[0070] The sending of the third instruction to the address corresponding to the last received address information includes:
[0071] Sending the third instruction to the addresses corresponding to all received address information;
[0072] The repeatedly broadcasting the second instruction and sending the third instruction in sequence includes:
[0073] Repeat broadcasting the second instruction, broadcasting the first instruction, and sending the third instruction to addresses corresponding to all received address information.
[0074] It should be understood that before the upper computer sends the first instruction, that is, before disconnecting the communication connection between all node devices, it is necessary to first determine that all node devices are in a connected state to avoid the situation where one node device in the series is disconnected from the lower-level node device, resulting in the upper computer being unable to accurately receive the address information of each node device.
[0075] For example, node device A, node device B, node device C, node device D, node device E, and node device F are connected in series, and the host computer is connected to node device A. If the communication connection between node device C and node device D has been disconnected, while the communication connection between node device D, node device E, and node device F is still maintained. If the host computer does not send the third instruction to establish the communication connection between node device C and node device D, but directly sends the first instruction, the communication connection between node device A, node device B, node device C, and node device D will be disconnected, while the communication connection between node device D, node device E, and node device F will still be maintained. In this case, the host computer obtains the address information of each node device through the second instruction, and the host computer can only obtain the address information of four node devices, namely, the address information a of node device A, the address information b of node device B, the address information c of node device C, and the address information f of node device F. However, since the host computer only receives the address information of 4 node devices, the host computer will mistakenly believe that the node devices in series are node device A, node device B, node device C and node device D, and the address information is address information a, address information b, address information c and address information f. The host computer fails to receive the address information of each node device (only receives 4 address information), and there is a situation where the node device corresponding to the address information is different from the actual node device (the address information of node device D is mistakenly believed to be address information f).
[0076] However, in a specific production process, it is impossible to determine whether each node device disconnects the communication connection or maintains the communication connection. Therefore, in this embodiment, after setting the response to the second instruction in the node device, a communication connection with the next-level node device is established, and then the communication connection between all node devices is disconnected by broadcasting the first instruction, and then the third instruction is sent to the address corresponding to all the address information that has been received to establish a communication connection, thereby achieving the acquisition of the address information of each node device in a serial order.
[0077] For example, node devices A, B, C, and D are connected in series, with node device A connected to a host computer. After the host computer broadcasts a first instruction, the communication connection between node devices A and B is disconnected, while the communication connection between node devices B and C remains established, and the communication connection between node devices C and D is established. After the host computer broadcasts the first and second instructions for the first time, it receives address information a corresponding to node device A. The host computer then broadcasts the first instruction and sends a third instruction to address information a, establishing a communication connection between node devices A and B. Node devices B and C are disconnected, and the second instruction is then broadcast again, allowing the host computer to receive address information b corresponding to node device B. This method enables the host computer to obtain the address information of each node device in the order in which the node devices are connected in series.
[0078] In an embodiment of the present invention, each node device is configured to establish a communication connection with the next-level node device corresponding to each node device after responding to the second instruction, and the upper computer repeatedly broadcasts the second instruction and the first instruction, and sends the third instruction to the addresses corresponding to all received address information, so that the upper computer can obtain the address information of each node device according to the serial order of the node devices.
[0079] In one embodiment, after receiving the second address information of the target node device, the method further includes:
[0080] Repeating the broadcasting of the second instruction, the broadcasting of the first instruction, and the sending of the third instruction to the addresses corresponding to all received address information, until no address information is received after the second instruction is sent;
[0081] All received address information is sorted based on the order in which the second instructions are sent, and the arrangement order of the address information of each node device is determined.
[0082] In this embodiment of the present invention, since the multiple node devices are connected in series, the multiple node devices respond to the second instruction sent by the host computer in the order in which they are connected. For example, the host computer is directly connected to node device A, node device A is connected to node device B, node device B is connected to node device C, and node device C is connected to node device D. The host computer sends the second instruction in sequence, and node devices A, B, C, and D respond to the second instruction in sequence. The host computer then sorts the received address information to determine the address information corresponding to each node device.
[0083] In one embodiment, each node device among the multiple node devices is connected to the host computer via a bus, and the host computer is used to send information to each node device via the bus, or to receive information sent by each node device via the bus.
[0084] It should be understood that the node device cannot confirm the address information of the connected upper-level node device and the lower-level node device, cannot forward instructions, and can only communicate with the host computer. Therefore, it is necessary to send the first instruction, the second instruction and the third instruction through the host computer to obtain the address information of the node device.
[0085] In one embodiment, the address corresponding to the first address information is a media access control MAC address of a node device, and the address corresponding to the second address information is a media access control MAC address of a node device.
[0086] It should be understood that when a node device in the series is replaced, the MAC address of the replaced node device is an unknown address to the host computer, and the host computer cannot automatically address or assign addresses. It is necessary to first determine the correspondence between the node device and the MAC address in the host computer, and then assign an Internet Protocol (IP) address to each node device, or implement automatic addressing through the MAC address.
[0087] The address corresponding to the first address information is a MAC address, and the address corresponding to the second address information is also a MAC address.
[0088] In an embodiment of the present invention, the address corresponding to the first address information is a MAC address, and the address corresponding to the second address information is also a MAC address. The upper computer obtains the MAC address information of each node device through the first instruction and the second instruction, and then realizes the allocation of IP addresses through the MAC address of each node device, or realizes automatic addressing through the MAC address of each node device.
[0089] See Figure 4 , Figure 4 This is a flow chart of a device addressing method provided by an embodiment of the present invention, which is applied to a target node device. The target node device is connected in series with other node devices, and the node device at one end of the series connection is communicatively connected with a host computer, including:
[0090] Step 401: Receive a first instruction, where the first instruction is broadcast by the host computer and is used to instruct a node device that receives the first instruction to disconnect from a next-level node device, where the next-level node device is a node device connected to the node device and located away from the host computer.
[0091] Step 402: disconnect the communication connection with the first lower-level node device, where the first lower-level node device is a lower-level node device corresponding to the target node device;
[0092] Step 403: Receive a second instruction, where the second instruction is an instruction broadcast by the host computer and is used to obtain an address of a node device;
[0093] Step 404: When the target node device and the first lower-level node device are disconnected from each other, first address information is sent to the host computer.
[0094] Step 405: Receive a third instruction, where the third instruction is an instruction sent by the host computer to the first address information and is used to instruct the target node device to establish a communication connection with the first lower-level node device;
[0095] Step 406: Establish a communication connection with the first lower-level node device.
[0096] In one embodiment, before receiving the third instruction, the method further includes:
[0097] Establishing a communication connection with the first lower-level node device;
[0098] receiving the first instruction;
[0099] Disconnect the communication connection with the first lower-level node device.
[0100] In one embodiment, the method further comprises:
[0101] When the second instruction is received and the target node device is in communication connection with the first lower-level node device, the target node device does not respond to the second instruction.
[0102] In one embodiment, each node device among the multiple node devices is connected to the host computer via a bus, and the host computer is used to send information to each node device via the bus, or to receive information sent by each node device via the bus.
[0103] In one embodiment, the address corresponding to the first address information is a media access control MAC address of a node device.
[0104] In an embodiment of the present invention, the host computer first broadcasts the first instruction to multiple node devices, and then repeatedly broadcasts the second instruction and the first instruction in sequence, and sends the third instruction to all received address information, so that each time the second instruction is sent, one address information can be obtained in sequence in a serial order, and the order of acquisition is the same as the order in which the multiple node devices are arranged. The address information corresponding to each node device can be determined, and then the address information of the target node device can be determined.
[0105] The target node device is a node device among the multiple node devices, and may be a newly replaced node device or an unreplaced node device.
[0106] See Figure 5 , Figure 5 This is a structural diagram of a host computer provided by an embodiment of the present invention, wherein the host computer is in communication connection with a node device at one end point of a plurality of node devices connected in series, such as Figure 5 As shown, the host computer 500 includes:
[0107] A first sending module 501 is configured to broadcast a first instruction, wherein the first instruction is configured to instruct a node device that has received the first instruction to disconnect from a next-level node device, where the next-level node device is a node device connected to the node device and located away from the host computer.
[0108] A second sending module 502 is configured to broadcast a second instruction, where the second instruction is configured to obtain an address of a node device;
[0109] A first receiving module 503 is configured to receive first address information, where the first address information is address information of the first node device sent to the host computer after the first node device receives the second instruction and the communication connection between the first node device and the first lower-level node device is disconnected. The first node device is a node device connected to the host computer, and the first lower-level node device is a node device at a lower level corresponding to the first node device.
[0110] A third sending module 504 is configured to send a third instruction to the address corresponding to the last received address information, wherein the third instruction is used to instruct the node device that has received the third instruction to establish a communication connection with a next-level node device corresponding to the node device that has received the third instruction;
[0111] The fourth sending module 505 is used to repeatedly broadcast the second instruction and send the third instruction to the address corresponding to the last received address information until the second address information of the target node device is received. The second address information is the address information sent by the target node device to the upper computer after receiving the second instruction and when the communication connection between the target node device and the second lower-level node device is disconnected. The target node device is one of the multiple node devices, and the second lower-level node device is the next-level node device corresponding to the target node.
[0112] In one embodiment, each node device also establishes a communication connection with a next-level node device corresponding to each node device when sending address information to the host computer;
[0113] Before the third sending module 504, the host computer 500 further includes:
[0114] a fifth sending module, configured to broadcast the first instruction;
[0115] The third sending module 504 includes:
[0116] a first sending unit, configured to send the third instruction to addresses corresponding to all received address information;
[0117] The fourth sending module 505 includes:
[0118] The second sending unit is used to repeatedly broadcast the second instruction and the first instruction in sequence, and send the third instruction to the addresses corresponding to all the received address information.
[0119] In one embodiment, after the fourth sending module 505, the host computer 500 further includes:
[0120] a sixth sending module, configured to repeatedly broadcast the second instruction, broadcast the first instruction, and send the third instruction to addresses corresponding to all received address information, until no address information is received after the second instruction is sent;
[0121] The processing module is used to sort all the received address information based on the order of sending the second instruction, and determine the arrangement order of the address information of each node device.
[0122] In one embodiment, each node device among the multiple node devices is connected to the host computer via a bus, and the host computer is used to send information to each node device via the bus, or to receive information sent by each node device via the bus.
[0123] In one embodiment, the address corresponding to the first address information is a media access control MAC address of a node device, and the address corresponding to the second address information is a media access control MAC address of a node device.
[0124] The host computer provided in the embodiment of the present invention is capable of implementing each process of each embodiment of the above-mentioned device addressing method applied to the host computer. The technical features correspond one to one and can achieve the same technical effect. To avoid repetition, they will not be described here.
[0125] It should be noted that the host computer in the embodiment of the present invention may be a device, or a component, an integrated circuit, or a chip in an electronic device.
[0126] See Figure 6 , Figure 6 This is a structural diagram of a target node device provided by an embodiment of the present invention. The target node device is connected in series with other node devices, and a node device at one end of the series is connected to a host computer for communication. Figure 6 As shown, the target node device 600 includes:
[0127] A first receiving module 601 is configured to receive a first instruction, where the first instruction is an instruction broadcast by the host computer and is configured to instruct a node device that has received the first instruction to disconnect from a next-level node device, where the next-level node device is a node device connected to the node device and located away from the host computer.
[0128] A first processing module 602 is configured to disconnect the communication connection with a first lower-level node device, where the first lower-level node device is a lower-level node device corresponding to the target node device;
[0129] A second receiving module 603 is configured to receive a second instruction, where the second instruction is an instruction broadcast by the host computer and is configured to obtain an address of a node device;
[0130] A second sending module 604 is configured to send first address information to the host computer when the target node device and the first lower-level node device are disconnected from each other;
[0131] A third receiving module 605 is configured to receive a third instruction, where the third instruction is an instruction sent by the host computer to the first address information and is configured to instruct the target node device to establish a communication connection with the first lower-level node device;
[0132] The second processing module 606 is configured to establish a communication connection with the first lower-level node device.
[0133] In one embodiment, before the third receiving module 605, the target node device 600 further includes:
[0134] a third processing module, configured to establish a communication connection with the first lower-level node device;
[0135] a fourth receiving module, configured to receive the first instruction;
[0136] The fourth processing module is used to disconnect the communication connection with the first lower-level node device.
[0137] In one embodiment, the target node device further includes:
[0138] The fifth receiving module is configured to not respond to the second instruction when the second instruction is received and the target node device is in communication connection with the first lower-level node device.
[0139] In one embodiment, each node device among the multiple node devices is connected to the host computer via a bus, and the host computer is used to send information to each node device via the bus, or to receive information sent by each node device via the bus.
[0140] In one embodiment, the address corresponding to the first address information is a media access control MAC address of a node device.
[0141] The target node device provided by the embodiment of the present invention is capable of implementing the various processes of the various embodiments of the above-mentioned device addressing method applied to the target node device. The technical features correspond one to one and can achieve the same technical effects. To avoid repetition, they will not be described here.
[0142] It should be noted that the target node device in the embodiment of the present invention may be a device, or a component, an integrated circuit, or a chip in an electronic device.
[0143] The embodiment of the present invention further provides an electronic device, see Figure 7 , Figure 7 The electronic device includes a memory 701, a processor 702, and a program or instruction stored in the memory 701 and executed by the processor 702. Figure 1 Any steps in the corresponding method embodiments can achieve the same beneficial effects, or realize Figure 4 Any steps in the corresponding method embodiments and achieving the same excellent effects will not be repeated here.
[0144] The processor 702 may be a CPU, an ASIC, an FPGA, or a GPU.
[0145] Those skilled in the art will appreciate that all or part of the steps of implementing the above-described embodiment method may be accomplished through hardware associated with program instructions, and the program may be stored in a readable medium.
[0146] The embodiment of the present invention further provides a readable storage medium, which stores a computer program. When the computer program is executed by a processor, the above Figure 1 Any step in the corresponding method embodiment, or to implement the above Figure 4 Any steps in the corresponding method embodiments can achieve the same technical effect and are not described here to avoid repetition. The storage medium is, for example, a read-only memory (ROM), a random access memory (RAM), a magnetic disk or an optical disk.
[0147] The terms "first", "second" etc. in the embodiments of the present invention are used to distinguish similar objects and are not necessarily used to describe a specific order or sequential order. In addition, the terms "including" and "having" and any of their variations are intended to cover non-exclusive inclusions, for example, the process, method, system, product or equipment comprising a series of steps or units is not necessarily limited to those steps or units clearly listed, but may include other steps or units that are not clearly listed or that are inherent to these processes, methods, products or equipment. In addition, "and / or" is used in this application to represent at least one of the connected objects, for example A and / or B and / or C, which means comprising 7 situations including single A, single B, single C, and both A and B exist, both B and C exist, both A and C exist, and both A, B and C exist.
[0148] It should be noted that, in this document, the terms "comprises," "includes," or any other variations thereof are intended to encompass non-exclusive inclusion, such that a process, method, article, or apparatus comprising a series of elements includes not only those elements but also other elements not explicitly listed, or elements inherent to such process, method, article, or apparatus. In the absence of further limitations, an element defined by the phrase "comprising a ..." does not exclude the presence of other identical elements in the process, method, article, or apparatus comprising the element.
[0149] Through the description of the above implementation methods, those skilled in the art can clearly understand that the above-mentioned embodiment methods can be implemented by means of software plus the necessary general hardware platform, and of course can also be implemented by hardware, but in many cases the former is a better implementation method. Based on this understanding, the technical solution of the present application, or the part that contributes to the prior art, can be embodied in the form of a software product, which is stored in a storage medium (such as ROM / RAM, magnetic disk, optical disk), and includes a number of instructions for enabling a terminal (which can be a mobile phone, computer, server, air conditioner, or second terminal device, etc.) to execute the methods of each embodiment of the present application.
[0150] The embodiments of the present application are described above in conjunction with the accompanying drawings, but the present application is not limited to the above-mentioned specific implementation methods. The above-mentioned specific implementation methods are merely illustrative and not restrictive. Under the guidance of this application, ordinary technicians in this field can also make many forms without departing from the purpose of this application and the scope of protection of the claims, all of which are within the protection of this application.
Claims
1. A device addressing method, applied to a host computer, wherein the host computer is in communication with a node device at one end point of a plurality of node devices connected in series, characterized in that: include: Broadcasting a first instruction, wherein the first instruction is used to instruct the node device that receives the first instruction to disconnect the communication connection with the next-level node device, where the next-level node device is a node device connected to the node device and away from the host computer; Broadcasting a second instruction, where the second instruction is used to obtain an address of a node device; receiving first address information, where the first address information is address information of the first node device sent to the host computer after the first node device receives the second instruction and when the first node device and the first lower-level node device are disconnected from each other, wherein the first node device is a node device connected to the host computer, and the first lower-level node device is a node device at a lower level corresponding to the first node device; Sending a third instruction to the address corresponding to the last received address information, wherein the third instruction is used to instruct the node device that receives the third instruction to establish a communication connection with the next-level node device corresponding to the node device that receives the third instruction; Repeat broadcasting the second instruction and sending the third instruction to the address corresponding to the last received address information in sequence until the second address information of the target node device is received. The second address information is the address information sent by the target node device to the upper computer after receiving the second instruction and when the communication connection between the target node device and the second lower-level node device is disconnected. The target node device is one of the multiple node devices, and the second lower-level node device is the next-level node device corresponding to the target node.
2. The method according to claim 1, characterized in that Each node device also establishes a communication connection with a next-level node device corresponding to each node device when sending address information to the host computer; Before sending the third instruction to the address corresponding to the last received address information, the method further includes: broadcasting the first instruction; The sending of the third instruction to the address corresponding to the last received address information includes: Sending the third instruction to the addresses corresponding to all received address information; The repeatedly broadcasting the second instruction and sending the third instruction in sequence includes: Repeat broadcasting the second instruction, broadcasting the first instruction, and sending the third instruction to addresses corresponding to all received address information.
3. The method according to claim 2, characterized in that After receiving the second address information of the target node device, the method further includes: Repeating the broadcasting of the second instruction, the broadcasting of the first instruction, and the sending of the third instruction to all received address information until no address information is received after the second instruction is sent; All received address information is sorted based on the order in which the second instructions are sent, and the arrangement order of the address information of each node device is determined.
4. The method according to claim 1, wherein Each node device among the multiple node devices is connected to the host computer via a bus. The host computer is used to send information to each node device via the bus, or to receive information sent by each node device via the bus.
5. The method according to claim 1, characterized in that The address corresponding to the first address information is a media access control MAC address of a node device, and the address corresponding to the second address information is a media access control MAC address of a node device.
6. A device addressing method, applied to a target node device, wherein the target node device is connected in series with other node devices, and the node device at one end of the series connection is communicatively connected with a host computer, characterized in that: include: receiving a first instruction, where the first instruction is an instruction broadcast by the host computer and is used to instruct a node device that has received the first instruction to disconnect a communication connection with a next-level node device, where the next-level node device is a node device connected to the node device and away from the host computer; Disconnecting the communication connection with a first lower-level node device, where the first lower-level node device is a lower-level node device corresponding to the target node device; receiving a second instruction, where the second instruction is an instruction broadcast by the host computer and is used to obtain an address of a node device; When the target node device and the first lower-level node device are disconnected from each other, sending first address information to the host computer; receiving a third instruction, where the third instruction is an instruction sent by the host computer to the first address information and is used to instruct the target node device to establish a communication connection with the first lower-level node device; Establishing a communication connection with the first lower-level node device.
7. The method according to claim 6, characterized in that Before receiving the third instruction, the method further includes: Establishing a communication connection with the first lower-level node device; receiving the first instruction; Disconnect the communication connection with the first lower-level node device.
8. The method according to claim 6, characterized in that The method further comprises: When the second instruction is received and the target node device is in communication connection with the first lower-level node device, the target node device does not respond to the second instruction.
9. A host computer, wherein the host computer is in communication connection with a node device at one end point among a plurality of node devices connected in series, characterized in that: include: a first sending module, configured to broadcast a first instruction, wherein the first instruction is configured to instruct a node device that has received the first instruction to disconnect from a next-level node device, where the next-level node device is a node device connected to the node device and located away from the host computer; A second sending module is used to broadcast a second instruction, where the second instruction is used to obtain an address of a node device; a first receiving module, configured to receive first address information, wherein the first address information is address information of the first node device sent to the host computer after the first node device receives the second instruction and when the first node device and the first lower-level node device are disconnected from each other, wherein the first node device is a node device connected to the host computer, and the first lower-level node device is a node device at a lower level corresponding to the first node device; a third sending module, configured to send a third instruction to the address corresponding to the last received address information, wherein the third instruction is used to instruct the node device that has received the third instruction to establish a communication connection with a next-level node device corresponding to the node device that has received the third instruction; The fourth sending module is used to repeatedly broadcast the second instruction in sequence and send the third instruction to the address corresponding to the last received address information until the second address information of the target node device is received. The second address information is the address information sent by the target node device to the upper computer after receiving the second instruction and when the communication connection between the target node device and the second lower-level node device is disconnected. The target node device is one of the multiple node devices, and the second lower-level node device is the next-level node device corresponding to the target node.
10. A target node device, wherein the target node device is connected in series with other node devices, and the node device at one end of the series connection is communicatively connected with a host computer, characterized in that: include: a first receiving module, configured to receive a first instruction, the first instruction being an instruction broadcast by the host computer and being configured to instruct a node device that has received the first instruction to disconnect from a next-level node device, the next-level node device being a node device connected to the node device and away from the host computer; a first processing module, configured to disconnect the communication connection with a first lower-level node device, where the first lower-level node device is a lower-level node device corresponding to the target node device; a second receiving module, configured to receive a second instruction, where the second instruction is an instruction broadcast by the host computer and is configured to obtain an address of a node device; A second sending module is used to send first address information to the host computer when the communication connection between the target node device and the first lower-level node device is disconnected; a third receiving module, configured to receive a third instruction, wherein the third instruction is an instruction sent by the host computer to the first address information and is configured to instruct the target node device to establish a communication connection with the first lower-level node device; The second processing module is configured to establish a communication connection with the first lower-level node device.
Citation Information
Patent Citations
Address allocation method for serial port communication equipment, communication device and storage medium
CN112905508A
Multi-device automatic addressing method and system and electronic device
CN113014686A