Multi-device network access method and system
By using GPIO pin time-sharing enable and closed-loop confirmation mechanism, the problems of positioning and address allocation in traditional device network access are solved, realizing efficient and stable multi-device network access and system expansion, supporting unlimited cascaded topology and fast fault location.
Patent Information
- Application Number
- CN202511065862.7
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2025-07-31
- Publication Date
- 2025-11-07
AI Technical Summary
In existing technologies, the traditional CAN bus communication protocol cannot solve the problems of physical device location and dynamic address allocation. The Zigbee self-organizing network scheme has a high collision rate when the number of terminals is high. The DHCP networking scheme cannot support hierarchical topology and accurate device location, resulting in low device network access efficiency and difficult maintenance.
By enabling the GPIO pin in a time-sharing manner, the master station sends configuration information to the slave station via a broadcast address and binds the hardware identifier to the logical address. Combined with a closed-loop confirmation mechanism, this enables the slave station to respond dynamically and automatically allocate logical addresses.
It enables precise device location within a hierarchical topology, reduces communication collision rates, improves device network access efficiency and system stability, and supports unlimited cascading expansion and rapid fault location.
Smart Images

Figure CN120915809A_ABST
Abstract
Description
TECHNICAL FIELD
[0001] The present application relates to the technical field of power internet of things, and in particular to a multi-device networking method and system. BACKGROUND
[0002] The Controller Area Network (CAN) is a multi-master serial communication protocol using differential signal transmission, and its core mechanism is to solve the concurrent conflict of multiple devices through non-destructive bit-by-bit arbitration. When multiple nodes send data at the same time, the bus compares the binary bits of the message identifier, and the priority of the node sending the explicit level (logic 0) is higher than that of the implicit level (logic 1). The conflicting node immediately backs off and automatically retransmits, ensuring uninterrupted transmission of high-priority messages. Although this mechanism can avoid data damage, it cannot solve the problems of physical device positioning and dynamic address allocation - the node ID still needs to be manually preset, and there is no binding relationship between the logical address and the installation location. The Universally Unique Identifier (UUID) is designed to provide a unique identity for all elements in a distributed system without the need for a central authority to allocate, achieving decentralized identity management. Currently, the existing technology often uses Zigbee ad hoc networking scheme and DHCP networking scheme. The Zigbee ad hoc networking scheme uses a coordinator broadcast-terminal response mechanism: the coordinator sends a beacon frame to start the network, and the terminal device responds to the network request after a random delay (0-1s), and the 16-bit short address is dynamically allocated by the coordinator. However, this scheme has a high conflict rate due to random delay: when the number of terminals is greater than 20, random backoff cannot avoid overlapping responses, and the actual conflict rate is greater than 15%, requiring multiple retries to reduce throughput efficiency; no physical positioning capability: the logical address is completely decoupled from the device installation location, and it is not possible to quickly locate the faulty device during field maintenance (such as manually scanning the two-dimensional code for matching); the DHCP networking scheme relies on a client / server model, where the terminal broadcasts a discovery message, the server allocates an IP from the address pool and replies, and the binding is completed through the request-confirmation process. However, this scheme is limited to flat topology: all devices need to be connected directly to the same network segment, and cannot support hierarchical expansion (such as the child devices of slave station 1 cannot obtain IP through slave station 1); the address is not related to the location: the IP address is randomly allocated and cannot be associated with the physical location of the device (such as slot 1 of electrical box A), and the routing strategy needs to be reconfigured after replacing the device. Therefore, there is an urgent need to propose a multi-device networking method and system to solve the technical problems of manual allocation of sub-device addresses by the upper-level device in the traditional scheme or the inability to accurately locate the device location in hierarchical topology using broadcast automatic allocation, and the need for level-by-level waiting for responses in the traditional polling mechanism. SUMMARY
[0003] The main purpose of the present application is to provide a multi-device networking method and system, aiming at solving the technical problems that the upper device needs to manually assign the address of the sub-device or adopt the broadcast automatic allocation in the hierarchical topology, which cannot accurately locate the device position, and the traditional polling mechanism needs to wait for the response step by step.
[0004] To achieve the above-mentioned purpose, the present application provides a multi-device networking method, wherein the multi-device networking method comprises the following steps:
[0005] S1, time-sharing enabling, the master station pulls down the GPIO pin to control the network configuration process of the slave station;
[0006] S2, directional broadcast, the master station sends configuration information to the slave station through the broadcast address;
[0007] S3, dynamic response, after receiving the configuration information, the slave station feeds back the network configuration information to the master station, and binds the hardware identification and the logical address;
[0008] S4, closed-loop confirmation, the master station sends an acknowledgement message to the slave station, and pulls up the GPIO pin to end the network configuration process of the slave station.
[0009] In one of the preferred schemes, the slave station comprises a first-level slave station, a second-level slave station,..., and an n-level slave station which are communicated in turn.
[0010] In one of the preferred schemes, the network configuration process of the first slave station is specifically:
[0011] The master station pulls down the GPIO-1 pin from high level to low level, and sets it to 0;
[0012] The master station sends first configuration information to the first-level slave station through the broadcast address;
[0013] After receiving the first configuration information, the first-level slave station feeds back first network configuration information to the master station using the unicast address, and binds the hardware identification and the logical address;
[0014] The master station sends an acknowledgement message to the first-level slave station through the unicast address, and pulls up the GPIO pin from low level to high level, and sets it to 1, thereby completing the network configuration process of the first-level slave station.
[0015] In one of the preferred schemes, the first configuration information comprises the master station UUID, the number assigned by the master station to the first-level slave station, and the CAN unicast communication address of the first slave station.
[0016] In one of the preferred schemes, the first network configuration information comprises the configuration state of the first-level slave station and the UUID of the first-level slave station.
[0017] In one of the preferred schemes, the network configuration process of the n-level slave station is specifically:
[0018] The n-1 level slave station pulls the high level of the GPIO-n-1 pin to low level and sets it to 0;
[0019] The n-1 level slave station sends the n configuration information to the n level slave station through a broadcast address;
[0020] After the n level slave station receives the n configuration information, the n network configuration information is fed back to the master station using a unicast address, and the binding of the hardware identifier and the logical address is performed;
[0021] The master station sends an acknowledgement message to the n-1 level slave station through a unicast address, and after the n-1 level slave station receives the acknowledgement message from the master station, the GPIO-n-1 pin is pulled from low level to high level and set to 1, and the network configuration process of the n level slave station is completed.
[0022] In one of the preferred solutions, the n-1 level slave station sends the n configuration information to the n level slave station through a broadcast address, specifically:
[0023] The n-1 level slave station obtains the n configuration information of the n level slave station by adding 1 to its own number, and the n configuration information includes the master station UUID, the number of the n level slave station and the CAN unicast communication address of the n level slave station.
[0024] In one of the preferred solutions, the n network configuration information includes the configuration state of the n level slave station and the UUID of the n level slave station.
[0025] A multi-device network entry system comprising the multi-device network entry method, comprising:
[0026] A GPIO control module, a CAN message sending module, a CAN message receiving module, a CAN message processing module, an information storage module and a control center; the control center is connected with the GPIO control module, the CAN message processing module and the information storage module respectively, and the CAN message processing module is connected with the CAN message sending module and the CAN message receiving module respectively;
[0027] The GPIO control module is used to pull up or pull down the corresponding GPIO pin and read the pin level;
[0028] The CAN message sending module is used to send CAN broadcast or unicast messages;
[0029] The CAN message receiving module is used to receive CAN broadcast or unicast messages;
[0030] The CAN message processing module is used to process the analysis and packaging of CAN message protocols.
[0031] Preferably, the multi-device networking system further comprises an anomaly detection module connected to the control center, and the anomaly detection module is configured to detect whether each module of the system is operating normally.
[0032] In the technical scheme, the multi-device networking method comprises the following steps: time-sharing enabling, the master station enables the networking process of the slave station by pulling down the GPIO pin; directional broadcasting, the master station sends configuration information to the slave station through a broadcast address; dynamic response, the slave station feeds back the networking information to the master station after receiving the configuration information, and binds the hardware identifier and the logical address; closed-loop confirmation, the master station sends a confirmation response message to the slave station, and ends the networking process of the slave station by pulling up the GPIO pin. The technical scheme solves the technical problems in the prior art, i.e., the upper device needs to manually assign the address of the sub-device or the broadcast automatic assignment cannot accurately locate the device position in the hierarchical topology, and the traditional polling mechanism needs to wait for the response level by level.
[0033] In the technical scheme, the GPIO pin is used to time-share enable the communication windows of the slave stations, and the existence sequence of the GPIO pins of the slave stations is determined, so that the communication message collision is avoided, and the network congestion and the multi-device communication conflict caused by the overlapping response of the slave stations in the traditional communication are overcome.
[0034] In the technical scheme, the number of each level of the slave station is associated with the UUID and the physical position of the corresponding slave station, and a binding chain of "physical position-logical number-device identity" is formed. When the slave station is hot-plugged, the slave station reenters the networking process, and the networking process is automatically and quickly completed, so that the stability of the system is ensured, and the problem of configuration failure caused by address conflict when the slave station is hot-plugged is solved.
[0035] In the technical scheme, the upper level of the slave station which has completed the configuration is used as the secondary master station of the next level of the slave station, the same protocol is reused to trigger the next level, the original master station UUID and the number of the new slave station are uniformly contained in the broadcast message, the identity consistency of the whole system is ensured, the whole system has the ability of unlimited cascade expansion, the slave station protocol can be completely reused, and the debugging efficiency is improved, so that the device number is accurately located, the real physical position of the device is quickly found, and the compatibility problem of system expansion is solved. BRIEF DESCRIPTION OF DRAWINGS
[0036] In order to more clearly illustrate the technical scheme in the embodiments of the present application or the prior art, the drawings needed in the following embodiment or prior art description will be briefly introduced. Obviously, the drawings in the following description are only some embodiments of the present application, and other drawings can be obtained by those skilled in the art without creative labor.
[0037] Fig. 1A first schematic diagram of a multi-device networking method according to an embodiment of the present application;
[0038] Fig. 2 A second schematic diagram of a multi-device networking method according to an embodiment of the present application.
[0039] The implementation, functional features and advantages of the present application will be further described with reference to the accompanying drawings. DETAILED DESCRIPTION
[0040] The technical solutions in the embodiments of the present application will be clearly and completely described with reference to the accompanying drawings in the embodiments of the present application. Obviously, the described embodiments are only part of the embodiments of the present application, rather than all the embodiments of the present application. Based on the embodiments in the present application, all other embodiments obtained by a person of ordinary skill in the art without creative work fall within the protection scope of the present application.
[0041] It should be noted that all directional indications (such as up, down, etc.) in the embodiments of the present application are only used to explain the relative positional relationship, movement condition, etc. between components in a certain posture (as shown in the drawings), and if the certain posture changes, the directional indications also change accordingly.
[0042] In addition, the description such as “first”, “second” and the like in the present application is only for the purpose of description, and cannot be understood as indicating or implying the relative importance of the indicated technical features or implicitly indicating the number of the indicated technical features. Therefore, the features defined as “first”, “second” can explicitly or implicitly include at least one of the features.
[0043] In addition, the technical solutions of the various embodiments of the present application can be combined with each other, but it must be based on the fact that a person of ordinary skill in the art can realize it, and when the combination of technical solutions appears to be contradictory or unachievable, it should be considered that the combination of technical solutions does not exist, and is also not within the protection scope claimed by the present application.
[0044] Referring to Figs. 1-2 According to an aspect of the present application, a multi-device networking method is provided, wherein the multi-device networking method comprises the following steps:
[0045] S1, time-sharing enabling, the master station pulls down the GPIO pin to control the networking process of the slave station;
[0046] S2, directional broadcast, the master station sends configuration information to the slave station through the broadcast address;
[0047] S3, dynamic response, after receiving the configuration information, the slave station feeds back the networking information to the master station, and performs the binding of the hardware identification and the logical address;
[0048] S4, closed loop confirmation, the master station sends an acknowledgement message to the slave station, and pulls up the GPIO pin to end the network configuration process of the slave station.
[0049] Specifically, in the embodiment, the slave station includes a first level slave station, a second level slave station,..., and an n-th level slave station which are sequentially connected in communication.
[0050] Specifically, in the embodiment, the network configuration process of the first slave station is specifically as follows:
[0051] The master station pulls down the GPIO-1 pin from high level to low level and sets it to 0, so as to realize the notification of the master station to the first slave station.
[0052] The master station has a delay of 500 ms with the first slave station, waits for the first slave station to start broadcast reception, and sends first configuration information to the first level slave station through a broadcast address; only when the GPIO-1 is at low level, the first slave station receives the broadcast of the master station, and the first configuration information includes the master station UUID, the number allocated by the master station to the first level slave station, and the CAN unicast communication address of the first slave station.
[0053] After the first level slave station receives the first configuration information, the first level slave station feeds back first network configuration information to the master station using a unicast address, and binds the hardware identifier and the logical address; the first network configuration information includes the configuration state of the first level slave station and the UUID of the first level slave station; if the master station receives the first network configuration information, it indicates that the corresponding slave station configuration has taken effect.
[0054] The master station sends an acknowledgement message to the first level slave station through a unicast address, indicating that the master station has received the data of the first slave station and can consider canceling, because when the first slave station is configured, the master station itself as the superior of the first slave station can indicate that the data is successfully received by pulling up the pin, and the consistency of each round of configuration process can be maintained to facilitate program writing and modularization; and the GPIO pin is pulled up from low level to high level and set to 1, so as to realize the master station informing the first slave station that the UUID information of the first slave station has been received, and the subsequent UUID information and position information are bound, which is used to confirm whether the slave module at the current position changes, and completes the network configuration process of the first level slave station.
[0055] Specifically, in the embodiment, the network configuration process of the n-th level slave station is specifically as follows:
[0056] When the numbering of the (n-1)th slave station ends, that is, the level of the GPIO-n-1 pin is pulled back to the high level, the numbering of the nth slave station is started; the (n-1)th slave station pulls the high level of the GPIO-n-1 pin to the low level and sets it to 0, realizing the notification of the nth slave station by the (n-1)th slave station; that is, when the upper-level slave station completes the network configuration, the master station serving as the lower-level slave station controls;
[0057] The (n-1)th slave station and the nth slave station have a delay of 500 ms, and the nth slave station is waited to start the broadcast reception; the (n-1)th slave station sends the nth configuration information to the nth slave station through the broadcast address; since the (n-1)th slave station has the address information issued by the upper-level master station, the (n-1)th slave station obtains the nth configuration information of the nth slave station according to the number of itself plus 1; only when the GPIO-n-1 pin is at the low level, the nth slave station receives the broadcast of the (n-1)th slave station; the nth configuration information includes the master station UUID, the number of the nth slave station and the CAN unicast communication address of the nth slave station;
[0058] After the nth slave station receives the nth configuration information, the nth network configuration information is fed back to the master station by using the unicast address, and the binding of the hardware identification and the logical address is performed; the nth network configuration information includes the configuration state of the nth slave station and the UUID of the nth slave station; if the (n-1)th slave station receives the nth network configuration information, it indicates that the corresponding slave station configuration has taken effect;
[0059] The master station sends an acknowledgement message to the (n-1)th slave station through the unicast address, indicating that the (n-1)th slave station has received the data of the nth slave station; after the (n-1)th slave station receives the acknowledgement message of the master station, the GPIO-n-1 pin is pulled from the low level to the high level and set to 1, realizing that the (n-1)th slave station informs the nth slave station that the UUID information of the nth slave station has been received, and completing the network configuration process of the nth slave station.
[0060] According to another aspect of the present application, the present application provides a multi-device network system, wherein the multi-device network system comprises a GPIO control module, a CAN message sending module, a CAN message receiving module, a CAN message processing module, an information storage module and a control center; the control center is connected with the GPIO control module, the CAN message processing module and the information storage module respectively, and the CAN message processing module is connected with the CAN message sending module and the CAN message receiving module respectively;
[0061] The GPIO control module is used for pulling up or pulling down the corresponding GPIO pin according to the network configuration instruction of the control center, reading the pin level, and feeding back the GPIO pin level state to the control center to inform the control center to prepare for the network configuration;
[0062] The CAN message sending module is configured to send a CAN broadcast or unicast message.
[0063] The CAN message receiving module is configured to receive a CAN broadcast or unicast message.
[0064] The CAN message processing module is configured to process CAN message protocol analysis and encapsulation.
[0065] The control center is configured to be responsible for system state synchronization and initiation of network configuration instructions.
[0066] Specifically, in the embodiment, the multi-device network system further comprises an abnormality detection module connected with the control center, and the abnormality detection module is configured to detect whether each module of the system is normally operated.
[0067] Specifically, in the embodiment, the existing scheme such as Zigbee or DHCP relies on random backoff or centralized address allocation, lacks a hardware-level device isolation means, and causes a conflict rate greater than 15% when multiple devices are accessed, a retransmission-induced throughput drop greater than 40%, and a large-scale networking reliability drop. That is, a high conflict rate and low reliability are caused by the lack of a physical isolation mechanism. To solve the problem, the GPIO pin is used to time-share enable the physical isolation of the communication window of each slave station, the triggering of the pins at each level has a sequence, and the communication message collision is avoided, and the communication delay can be reduced from seconds to milliseconds. In the existing scheme, due to the cascaded topology, manual configuration or fixed polling is required at each level, the interval is greater than or equal to 1 second, and there is no parallel triggering mechanism, so that when n-level networking is performed, the delay is greater than or equal to N*1.5 seconds, which cannot meet the millisecond-level real-time requirement of industrial control. By constructing a synchronization window with a certain time length and a protocol-physical joint triggering process, that is, the pin is pulled low to trigger the configuration, the n-level topology delay is reduced from greater than or equal to N*1.5 seconds to less than or equal to N*1.5 seconds, which meets the industrial real-time requirement. In the existing scheme, when the slave station is hot-plugged, address conflict may cause configuration failure, for example, two devices compete for the same logical address. The application adopts a double-identity binding mechanism, the slave station number is associated with the corresponding slave station UUID, that is, the physical position, to form a binding chain of “physical position-logical number-device identity”. When hot-plugged, the network configuration process is automatically and quickly completed, the stability of the overall system is ensured, and the reliability of the address of dynamic access is overcome. The application reuses the configured slave station as a secondary master station, reuses the same protocol trigger to trigger the next level slave station, for example, the n-1 level slave station is used as the master station of the n level slave station, and the broadcast message contains the UUID of the original master station and the number of the new slave station, which is beneficial to guarantee the consistency of the system identity, enables the system to have wireless cascading expansion capability, the slave station protocol can be completely reused, and the debugging efficiency is improved, the fault positioning is accurate to the device number, and thus the real physical position of the device can be quickly found.
[0068] The above merely describes the preferred embodiments of the present application, and is not intended to limit the patent scope of the present application. Any equivalent structural changes made according to the content of the present application specification and drawings, or direct / indirect application in other related technical fields are included in the patent protection scope of the present application.
Claims
1. A multi-device commissioning method, the method comprising: The method comprises the following steps: S1, time-sharing enabling, the master station enables the network configuration process of the slave station by pulling down the GPIO pin; S2, directional broadcast, the master station sends configuration information to the slave station through broadcast address; S3, dynamic response, the slave station feeds back the network configuration information to the master station after receiving the configuration information, and binds the hardware identification and the logical address; S4, closed-loop confirmation, the master station sends a confirmation reply message to the slave station, and ends the network configuration process of the slave station by pulling up the GPIO pin.
2. The method of claim 1, wherein, The slave station comprises a first-level slave station, a second-level slave station,..., and an n-level slave station which are sequentially cascaded in communication.
3. The method of claim 2, wherein, The network configuration process of the first slave station is specifically as follows: The master station pulls down the GPIO-1 pin from high level to low level, and sets it to 0; The master station sends first configuration information to the first-level slave station through broadcast address; After receiving the first configuration information, the first-level slave station feeds back first network configuration information to the master station through unicast address, and binds the hardware identification and the logical address; The master station sends a confirmation reply message to the first-level slave station through unicast address, and pulls up the GPIO pin from low level to high level, and sets it to 1, thereby completing the network configuration process of the first-level slave station.
4. The method of claim 3, wherein, The first configuration information comprises the master station UUID, the number assigned by the master station to the first-level slave station, and the CAN unicast communication address of the first slave station.
5. The method of claim 3, wherein, The first network configuration information comprises the configuration state of the first-level slave station and the UUID of the first-level slave station.
6. The method of claim 3, wherein, The network configuration process of the n-level slave station is specifically as follows: The n-1-level slave station pulls down the GPIO-n-1 pin from high level to low level, and sets it to 0; The n-1-level slave station sends n-th configuration information to the n-level slave station through broadcast address; After receiving the n-th configuration information, the n-level slave station feeds back n-th network configuration information to the master station through unicast address, and binds the hardware identification and the logical address; The master station sends a confirmation reply message to the n-1-level slave station through unicast address, and the n-1-level slave station pulls up the GPIO-n-1 pin from low level to high level after receiving the confirmation reply message from the master station, and sets it to 1, thereby completing the network configuration process of the n-level slave station.
7. The method of claim 6, wherein, The n-1-level slave station sends n-th configuration information to the n-level slave station through broadcast address, specifically as follows: The n-1-level slave station obtains the n-th configuration information of the n-level slave station according to the number of itself plus 1, and the n-th configuration information comprises the master station UUID, the number of the n-level slave station, and the CAN unicast communication address of the n-level slave station.
8. The method of claim 6, wherein, The n-th network configuration information comprises the configuration state of the n-level slave station and the UUID of the n-level slave station.
9. A multi-device commissioning system comprising a multi-device commissioning method according to any one of claims 1 to 8, characterized in that, It comprises: a GPIO control module, a CAN message sending module, a CAN message receiving module, a CAN message processing module, an information storage module, and a control center; the control center is connected with the GPIO control module, the CAN message processing module, and the information storage module respectively, and the CAN message processing module is connected with the CAN message sending module and the CAN message receiving module respectively; the GPIO control module is used for pulling up or pulling down the corresponding GPIO pin, and reading the pin level; the CAN message sending module is used for sending CAN broadcast or unicast message; The CAN message receiving module is used for receiving a CAN broadcast or unicast message. The CAN message processing module is used for processing CAN message protocol analysis and encapsulation.
10. The multi-device onboarding system of claim 9, wherein, The multi-device networking system further comprises an abnormality detection module connected with the control center, and the abnormality detection module is used for detecting whether each module of the system is normally operated.
Citation Information
Patent Citations
Distributed CAN (Controller Area Network) network supporting plug and play and automatic node address allocation method thereof
CN105007340A
Free networking method of RS485 communication terminal
CN105743757A
Automatic Modbus remote terminal unit (RTU) bus address allocation method
CN106878488A
Communication system and slave station address allocation method, setting method and device thereof
CN114827087A
Data interaction method and device, electronic equipment and storage medium
CN117424775A
Cited By
Method and apparatus for industrial serial bus device ad hoc networking based on dynamic time slot mapping
CN122420282A