Chain type automatic addressing device and method for double RJ45 seat RS485 equipment
The automatic addressing device of the chain with dual RJ45 RS485 devices realizes automatic addressing of devices in the whole link, which solves the problems of time-consuming manual operation, resource occupation and electromagnetic interference in the existing technology, and improves the addressing efficiency and the convenience of fault diagnosis.
Patent Information
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- SHENZHEN TOPRIE ELECTRONICS CO LTD
- Filing Date
- 2026-02-04
- Publication Date
- 2026-04-17
AI Technical Summary
In existing RS485 device networks, manual addressing is time-consuming, labor-intensive, and prone to errors. Centralized addressing of hosts consumes resources and is not suitable for large-scale networking. Traditional chain addressing has poor adaptability and is susceptible to electromagnetic interference, making it difficult to troubleshoot addressing failures.
The chain-type automatic addressing device, which uses dual RJ45 RS485 devices, achieves automatic addressing of all devices in the entire chain through host broadcast start, chain-type recursive communication, first unit identification and timed control, and can quickly locate faults by combining with the fault diagnosis unit.
It reduces human error, improves addressing efficiency and anti-interference capabilities, simplifies troubleshooting, and adapts to dynamic topologies of multiple devices and strong electromagnetic environments.
Smart Images

Figure CN121887833A_ABST
Abstract
Description
Technical Field
[0001] This invention relates to the field of RS485 communication equipment addressing technology, and specifically to a chain-type automatic addressing device and method for dual RJ45 RS485 devices. Background Technology
[0002] In RS485 multi-device networking systems, device address configuration is a prerequisite for ensuring normal communication. Currently, the mainstream addressing methods are divided into two categories: manual addressing and host-centralized addressing. Manual addressing requires setting the address of each device individually through DIP switches or dedicated software. Host-centralized addressing requires the host to establish a separate communication link with each device to allocate addresses one by one. Both methods rely on the host interacting with each device individually or on manual operation of each device. Furthermore, the devices often use a single RJ45 interface or a dedicated interface for power supply and communication.
[0003] Existing technologies suffer from numerous problems: manual addressing requires significant manpower, is time-consuming, and is prone to address duplication and omissions; centralized host addressing consumes substantial host CPU resources and communication bandwidth, leading to a decrease in overall system response speed and making it unsuitable for large-scale device networking; traditional chained addressing requires pre-setting the first device, necessitating reconfiguration during topology changes, resulting in poor adaptability; industrial environments are prone to strong electromagnetic interference, and traditional addressing, often involving single address transmissions, is susceptible to addressing failures due to interference; addressing failures can be caused by various factors, lacking clear fault correlation logic, making troubleshooting difficult and maintenance inefficient; some solutions require complex level control of specific pins on the RJ45 interface, increasing the complexity of host control logic and reducing interface resource utilization efficiency. These problems stem from the limitations of one-to-one interactive addressing logic and the design of a single communication link, collectively restricting the efficiency and stability of RS485 device networking.
[0004] To address this, a chain-type automatic addressing device and method for dual RJ45 RS485 devices is proposed. Summary of the Invention
[0005] The present invention aims to solve the problems mentioned in the background art by providing a chain-type automatic addressing device and method for dual RJ45 RS485 devices.
[0006] The specific technical solution is as follows: A chain-type automatic addressing device for dual RJ45 RS485 devices includes a host and multiple dual RJ45 RS485 devices. Each dual RJ45 RS485 device is equipped with an IN port and an OUT port. The host is connected to the IN port of the first dual RJ45 RS485 device via an RJ45 cable. The OUT port of the previous dual RJ45 RS485 device is sequentially connected to the IN port of the next dual RJ45 RS485 device via RJ45 cables, forming a daisy-chain topology. The host is equipped with a broadcast initiation unit, which is used to generate and send a broadcast packet containing the starting address information to trigger full-link addressing. Each dual RJ45 RS485 device is equipped with a chain-relay communication unit, a first identification unit, and a timing control unit. The chain-recursive communication unit includes an address receiving end and an address sending end. The address receiving end corresponds to a designated pin of the device's IN port and is used to receive the address signal transmitted by the upstream device. The address sending end corresponds to a designated pin of the device's OUT port and is used to send the updated local address to the downstream device in the form of a message. The first identification unit is used to detect whether there is an address signal sent by the upstream device at the address receiving end. If no address signal is detected, the device is determined to be the first device, and the first device uses the first address in the broadcast packet as its final address. If an address signal is detected, the device is determined to be a non-first device, and the non-first device uses the upstream device address plus 1 as its final address. The timing control unit is used to control the address sending end to replay the local address message at a fixed period and set the addressing exit time limit. When the device completes the local address determination and the addressing exit time limit is reached, the addressing process is terminated. The above structure and logic enable automatic addressing of devices across the entire link.
[0007] The aforementioned chain-type automatic addressing device for dual RJ45 RS485 devices has the following pinout definitions for the IN and OUT ports: For the IN port, pins 1 and 2 are 12V power supply terminals, pin 3 is the address receiving terminal, pins 4 and 5 are ground terminals, pin 6 is a no-connection pin, and pins 7 and 8 are RS485 communication terminals; for the OUT port, pins 1 and 2 are 12V power supply terminals, pin 3 is the address transmitting terminal, pins 4 and 5 are ground terminals, pin 6 is a no-connection pin, and pins 7 and 8 are RS485 communication terminals; the broadcast packet is transmitted to the end-to-end device via the RS485 communication terminal.
[0008] In the aforementioned chain-type automatic addressing device for dual RJ45 RS485 devices, the timing control unit controls the address sending end to replay the address message at a fixed period of 0.1 seconds to 0.5 seconds.
[0009] The chain-type automatic addressing device for the aforementioned dual RJ45 RS485 device has an addressing exit time limit of 40 to 80 seconds.
[0010] In the aforementioned chain-type automatic addressing device for dual RJ45 RS485 devices, the broadcast packet is an instruction message containing a register address and a starting address value. The register address is used to identify the addressing control register, and the starting address value is the starting address of the full-link device addressing.
[0011] The aforementioned chain-type automatic addressing device for dual RJ45 RS485 devices further includes a fault diagnosis unit. The fault diagnosis unit determines the fault type as a link break or the transmission line length exceeding the TTL serial communication limit if the automatic addressing of the entire link is not completed based on the association logic between the addressing result and the link status.
[0012] In the aforementioned chain-type automatic addressing device for dual RJ45 RS485 devices, the broadcast initiation unit sends a broadcast packet only once. When the broadcast packet is transmitted through the RS485 communication terminal, all dual RJ45 RS485 devices in the entire link receive the broadcast packet through their own RS485 communication terminals and temporarily store the starting address information.
[0013] The aforementioned chain-type automatic addressing device for dual RJ45 RS485 devices includes a status indicator unit for each dual RJ45 RS485 device. The status indicator unit flashes continuously during the addressing task and stops flashing after the addressing task is terminated.
[0014] In the aforementioned chain-type automatic addressing device for dual RJ45 RS485 devices, the fixed period is 0.25 seconds, the addressing exit time limit is 50 seconds, during which the farthest device on the link receives address packets no less than 3 times, and the nearest device receives address packets no less than 200 times.
[0015] The aforementioned chain-type automatic addressing device for dual RJ45 RS485 devices is suitable for daisy-chain networking scenarios such as sensor networking in industrial control production lines, monitoring equipment networking in intelligent security systems, or IoT terminal equipment networking, wherein the number of devices in the scenario is not less than one and dynamic topology adjustment is supported.
[0016] The present invention also provides a chain-based automatic addressing method for dual RJ45 RS485 devices, applicable to any of the above-described chain-based automatic addressing devices for dual RJ45 RS485 devices, the method comprising the following steps: Step 1: Addressing Startup. The host's broadcast startup unit generates a broadcast packet containing the starting address information. The broadcast packet is sent to the first device through the RJ45 cable connecting the host's RS485 communication interface to pins 7 and 8 of the IN port of the first dual RJ45 RS485 device. The host does not need to control the level of pin 3 of the RJ45 interface. Step 2: First address reception and task start-up. After the first device receives the broadcast packet through pins 7 and 8 of the IN port, it forwards it to all dual RJ45 RS485 devices in the entire link through the RS485 communication bus. After each device receives the broadcast packet, it temporarily stores the first address information and simultaneously starts the addressing task and the timing function of the timing control unit. The status indicator unit of the device starts to flash continuously. Step 3: First device identification. The first identification unit of each device checks whether there is an address signal sent by the upstream device on pin 3 of its own IN port. If no address signal is detected, it is determined to be the first device of the link, and the temporary first address is directly used as the final address of the device. If an address signal is detected, it is determined to be a non-first device, and step 4 is executed. Step 4: Address chaining recursion. Non-first devices receive address packets transmitted by upstream devices through pin 3 of the IN port, extract the upstream device address and add 1, use the result as the final address of the device, and then send a packet containing the final address of the device to downstream devices through pin 3 of its own OUT port, thus realizing the chaining propagation of address information. Step 5: Timed Replay and Addressing Termination. The timed control unit controls pin 3 of the device's OUT port to replay the local address message at a fixed interval of 0.1 to 0.5 seconds until the addressing exit timeout period of 40 to 80 seconds is reached. When the device completes the local address determination and the timeout period is reached, the timed control unit sends a termination signal, the device stops sending address messages, the status indicator unit stops flashing, and the addressing task is terminated. Step 6: Fault diagnosis. The fault diagnosis unit receives the addressing completion feedback signal of the entire link device through the RS485 communication bus. If no feedback signal is received from a certain device, the fault type is determined by combining the connection channel status of pin 3 of the IN port and pin 3 of the OUT port between the devices. The fault type is either a link break or the transmission line length exceeds the TTL serial communication limit.
[0017] The present invention has the following beneficial effects: 1. By employing a dual RJ45 connector design and a daisy-chain topology, independent transmission of power supply, grounding, communication, and address transfer is achieved, avoiding mutual interference between different functional signals and ensuring the stability of signal transmission. The host broadcast-initiated addressing method eliminates the need for individual interaction between the host and each device, significantly reducing host hardware resource consumption and improving the overall system response speed. Address allocation between devices is automatically completed through chain-like recursion, eliminating the need for manual settings and avoiding errors caused by manual operation, thus improving addressing efficiency.
[0018] 2. Utilizing the adaptive identification logic of the first device, there is no need to pre-set the first device identifier, and no reconfiguration is required when the topology changes. It can adapt to daisy-chain topologies of different lengths, improving the adaptability and flexibility of the solution. The timed replay mechanism allows downstream devices to obtain multiple address reception opportunities, effectively covering periods of electromagnetic interference in industrial environments, and improving the anti-interference capability and success rate of addressing.
[0019] 3. By establishing a logical association between addressing results and link status, fault types can be quickly located based on addressing success or failure without the need for an additional fault detection module. This simplifies troubleshooting and reduces maintenance difficulty and costs. The host only issues broadcast commands through the communication pins of the RJ45 interface, eliminating the need for complex level control of specific pins. This improves the utilization efficiency of the RJ45 interface, simplifies the host's trigger control logic, and reduces the difficulty of host hardware design and software development. The overall solution is suitable for multi-device daisy-chain networking requirements in various fields such as industrial control, smart security, and the Internet of Things, and is particularly suitable for scenarios with a large number of devices, dynamically changing topologies, and strong electromagnetic interference. Attached Figure Description
[0020] Figure 1 A connection diagram of the chain-type automatic addressing device for a dual RJ45 RS485 device provided in an embodiment of the present invention; Figure 2 A flowchart illustrating the chain-based automatic addressing method for a dual RJ45 RS485 device provided in an embodiment of the present invention; Figure 3 This is a graph showing the addressing time stability. Figure 4 The anti-interference success rate curve; Figure 5 A graph showing the accuracy of fault location; Figure 6 This is a graph showing the CPU utilization rate of the host computer. Detailed Implementation
[0021] The technical solution of the present invention will be further described below with reference to the accompanying drawings and specific embodiments.
[0022] The accompanying drawings are for illustrative purposes only and are schematic diagrams, not actual images. They should not be construed as limiting the scope of this application. To better illustrate the embodiments of the present invention, some parts in the drawings may be omitted, enlarged, or reduced, and do not represent the actual dimensions of the product. It is understandable to those skilled in the art that some well-known structures and their descriptions may be omitted in the drawings.
[0023] In the accompanying drawings of the embodiments of the present invention, the same or similar reference numerals correspond to the same or similar components. In the description of the present invention, it should be understood that if terms such as "upper," "lower," "left," "right," "inner," and "outer" indicate the orientation or positional relationship based on the orientation or positional relationship shown in the drawings, they are only for the convenience of describing the present invention and simplifying the description, and do not indicate or imply that the device or element referred to must have a specific orientation, or be constructed and operated in a specific orientation. Therefore, the terms used to describe positional relationships in the drawings are only for illustrative purposes and should not be construed as limiting the present application. For those skilled in the art, the specific meaning of the above terms can be understood according to the specific circumstances.
[0024] In the description of this invention, unless otherwise explicitly specified and limited, the term "connection" or similar designation indicating a connection between components should be interpreted broadly. For example, it can refer to a fixed connection, a detachable connection, or an integral part; it can be a mechanical connection or an electrical connection; it can be a direct connection or an indirect connection through an intermediate medium; it can refer to the internal communication between two components or the interaction between two components. Those skilled in the art can understand the specific meaning of the above terms in this invention based on the specific circumstances.
[0025] Example 1: The chain-type automatic addressing device for dual RJ45 RS485 devices provided in this example, such as Figure 1 As shown, it includes a host and multiple dual RJ45 RS485 devices. Each dual RJ45 RS485 device is equipped with an IN port and an OUT port. Both the IN port and the OUT port are 8-pin interfaces, and each pin corresponds to the power supply, grounding, communication, address transmission and no-pin functions, respectively. The host is connected to the IN port of the first dual-RJ45 RS485 device via an RJ45 cable. The OUT port of the preceding dual-RJ45 RS485 device is connected to the IN port of the following dual-RJ45 RS485 device via RJ45 cables, forming a daisy-chain topology. Specifically, the power supply pins of all devices' IN ports are connected in series with the corresponding power supply pins of the preceding device's OUT ports, forming a full-link power transmission loop; the grounding pins of all devices' IN ports are connected in series with the corresponding grounding pins of the preceding device's OUT ports, forming a unified grounding loop; the communication pins of all devices' IN ports are connected in series with the corresponding communication pins of the preceding device's OUT ports, forming an RS485 communication bus; and the address transmission pins of all devices' IN ports are connected in series with the corresponding address transmission pins of the preceding device's OUT ports, forming an address signal chain transmission channel. The host is equipped with a broadcast start unit. The signal output terminal of the broadcast start unit is electrically connected to the RS485 communication interface of the host. The RS485 communication interface of the host is connected to the IN port communication pin of the first dual RJ45 RS485 device via an RJ45 cable. The broadcast start unit is used to generate and send a broadcast packet containing the first address information. The broadcast packet is transmitted to the full-link device via the RS485 communication bus to trigger full-link addressing. Each dual RJ45 RS485 device is equipped with a chain-relay communication unit, a first identification unit, and a timing control unit. The chain-recursive communication unit includes an address receiving end and an address sending end. The address receiving end is electrically connected to the address transmission pin of the device's IN port and is used to receive the address signal transmitted by the upstream device through the address signal chain transmission channel. The address sending end is electrically connected to the address transmission pin of the device's OUT port and is used to send the updated local address to the downstream device in the form of a message through the address signal chain transmission channel. The first identification unit is connected to the address receiving end of the chain-recursive communication unit. It is used to detect whether there is an address signal sent by the upstream device at the address receiving end. If no address signal is detected, the device is determined to be the first device, and the first device uses the first address in the broadcast packet as its final address. If an address signal is detected, the device is determined to be a non-first device, and the non-first device uses the upstream device address plus 1 as its final address. The timing control unit is electrically connected to the address sending end of the chain-recursive communication unit. It is used to control the address sending end to replay the local address message at a fixed period and set the addressing exit time limit. The timing control unit is also connected to the addressing control module inside the device. When the addressing control module confirms that the device has completed the local address determination and the addressing exit time limit has been reached, the timing control unit sends a termination signal to control the address sending end to stop sending messages and terminate the addressing process. The above structure and logic enable automatic addressing of devices across the entire link.
[0026] This solution constructs independent transmission channels for power supply, grounding, communication, and address transmission through a daisy-chain topology. Combined with the collaborative working logic of broadcast initiation, chain recursion, first-unit identification, and timed control, it achieves automatic addressing of all devices in the entire link, eliminating the need for manual operation of each device or setting of addresses, thus reducing errors caused by manual intervention. The host only needs to perform a broadcast operation to trigger addressing, without having to establish communication with each individual device, reducing the host's hardware resource consumption. It adapts to the needs of multi-device daisy-chain networking, improving the stability and orderliness of the addressing process.
[0027] Specifically, in this embodiment, the pinout of the IN port and the OUT port is defined as follows: Pins 1 and 2 of the IN port are 12V power supply terminals, pin 3 is the address receiving terminal, pins 4 and 5 are ground terminals, pin 6 is a no-connection pin, and pins 7 and 8 are RS485 communication terminals; Pins 1 and 2 of the OUT port are 12V power supply terminals, pin 3 is the address transmitting terminal, pins 4 and 5 are ground terminals, pin 6 is a no-connection pin, and pins 7 and 8 are RS485 communication terminals. The specific connection is as follows: Pin 3 of the OUT port of the preceding dual RJ45 RS485 device is connected to pin 3 of the IN port of the following dual RJ45 RS485 device via an RJ45 cable, forming an address signal chain transmission channel; pins 1 and 2 of the IN port of all dual RJ45 RS485 devices are connected in series with pins 1 and 2 of the OUT port of the preceding device via RJ45 cables, forming a full-link power supply transmission loop; pins 4 and 5 of the IN port of all dual RJ45 RS485 devices are connected to the preceding device... Pins 4 and 5 of the OUT port of one device are connected in series via RJ45 cables to form a unified grounding loop; pins 7 and 8 of the IN port of all dual RJ45 RS485 devices are connected in series with pins 7 and 8 of the OUT port of the previous device via RJ45 cables to form an RS485 communication bus; the RS485 communication interface of the host is connected to pins 7 and 8 of the IN port of the first dual RJ45 RS485 device via RJ45 cables, and broadcast packets are transmitted to all devices in the entire link via the RS485 communication bus.
[0028] This solution clarifies the functional definitions of each pin on the IN and OUT ports and the corresponding connection methods between devices, enabling power supply, grounding, communication, and address transmission to form independent and stable transmission paths, avoiding mutual interference between different functional signals; ensuring that broadcast packets are accurately transmitted through dedicated communication channels and address signals are transmitted in an orderly manner through dedicated channels, improving the reliability of collaboration among functional modules, and guaranteeing the accuracy and stability of signal transmission during the addressing process.
[0029] Specifically, in this embodiment, the timing control unit is electrically connected to the address sending end of the chain-recursive communication unit. The signal output period of the address sending end is adjusted by the output control signal, so that the address sending end outputs address messages at a fixed period of 0.1 seconds to 0.5 seconds. The address sending end is connected to the address receiving end of the downstream dual RJ45 RS485 device through an RJ45 cable to ensure that the timed replay address messages can be accurately transmitted to the downstream device through the address signal chain transmission channel.
[0030] This scheme adjusts the signal output cycle of the address transmitter by using a timing control unit, enabling address messages to be replayed multiple times. This gives downstream devices more opportunities to receive address signals, effectively addresses potential interference factors in the environment, reduces addressing interruptions caused by single signal transmission failures, and improves the anti-interference capability and overall reliability of the addressing process.
[0031] Specifically, in this embodiment, the addressing exit timeout is 40 to 80 seconds; the timing control unit is electrically connected to the addressing control module of the dual RJ45 RS485 device, and the addressing control module is signal-connected to the chain-recursive communication unit and the first identification unit respectively; when the chain-recursive communication unit completes the local address determination, the addressing control module sends an address confirmation signal to the timing control unit, the timing control unit starts timing, and when the timing reaches the addressing exit timeout, it sends a termination signal to the addressing control module, and the addressing control module then controls the chain-recursive communication unit to stop sending address messages and terminate the addressing process.
[0032] This solution sets a reasonable addressing exit time limit and coordinates the signal interaction between the timing control unit and the addressing control module to ensure that all devices in the entire link have sufficient time to complete the address determination and transmission operations, avoiding incomplete addressing due to insufficient addressing time; at the same time, it avoids the addressing process from continuing indefinitely, ensuring the orderly termination of the addressing process and improving the standardization and controllability of the addressing process.
[0033] Specifically, in this embodiment, the broadcast packet is an instruction message containing a register address and a starting address value. The register address is used to identify the addressing control register, and the starting address value is the starting address of the full-link device addressing. The signal output terminal of the broadcast start unit is electrically connected to the RS485 communication interface of the host. The RS485 communication interface of the host is connected to pins 7 and 8 of the IN port of the first dual RJ45 RS485 device via an RJ45 cable. Pins 7 and 8 of the OUT port of the first dual RJ45 RS485 device and pins 7 and 8 of the IN port of subsequent devices are connected in series via RJ45 cables to form an RS485 communication bus. The broadcast packet is transmitted to all dual RJ45 RS485 devices in the entire link through this bus. After receiving the broadcast packet, the RS485 communication terminal of each device transmits it to the addressing control module through the internal signal channel. The addressing control module temporarily stores the starting address value to provide a data basis for subsequent first device identification and address recursion.
[0034] This scheme clarifies the information composition and transmission path of the broadcast packet, enabling the first address information to be accurately and completely transmitted to every device in the entire link via the RS485 communication bus. The addressing control module's temporary storage design for the first address provides a unified and reliable data benchmark for subsequent identification of the first device and address chain recursion, reducing addressing errors caused by deviations in the transmission of the initial address information and ensuring the accuracy of addressing.
[0035] Specifically, in this embodiment, a fault diagnosis unit is also included. The fault diagnosis unit is signal-connected to the addressing control module of each dual RJ45 RS485 device. Each addressing control module interacts with the broadcast start unit signal of the host through the RS485 communication bus. The fault diagnosis unit receives address completion feedback signals from all devices via the RS485 communication bus. If no address completion feedback signal is received from a certain device, the fault type is determined based on the connection relationship between the devices: if there is no address signal transmission in the address signal chain transmission channel between adjacent devices, it is determined to be a link break; if the remote device does not receive the address message and the link is not broken, it is determined to be that the transmission line length exceeds the TTL serial port communication limit. The address signal chain transmission channel is formed by connecting the OUT port pin 3 of the previous device to the IN port pin 3 of the next device. TTL serial port communication relies on this channel to realize address signal transmission.
[0036] This solution establishes a logical association between addressing results and link status through signal interaction between the fault diagnosis unit, the addressing control module of each device, and the host broadcast start unit. This eliminates the need to individually test each host, device, and link to locate the fault type. It simplifies the fault diagnosis process, reduces the operational difficulty during operation and maintenance, reduces the time spent on fault diagnosis, improves operation and maintenance efficiency, and reduces the impact of system downtime due to faults.
[0037] Specifically, in this embodiment, the broadcast initiation unit sends a broadcast packet only once. When the broadcast packet is transmitted through the RS485 communication bus, all dual RJ45 RS485 devices in the entire link receive the broadcast packet through their own RS485 communication terminals (pins 7 and 8 of the IN port). The RS485 communication bus is formed by connecting pins 7 and 8 of the IN port of all devices in series with pins 7 and 8 of the OUT port of the previous device. After the broadcast packet is sent from the host, it is received by the RS485 communication terminal of the first device and forwarded to the next device through pins 7 and 8 of its OUT port. This process is repeated for each device to achieve full-link coverage. After each device receives the broadcast packet, the addressing control module temporarily stores the first address information and simultaneously starts the workflow of the first identification unit and the chain recursive communication unit.
[0038] In this scheme, a broadcast packet is sent once by the broadcast initiation unit. Combined with the per-device forwarding mechanism of the RS485 communication bus, the broadcast packet can be fully covered by all devices in the link. At the same time, the communication operation frequency of the host is reduced, and the host resource consumption is further reduced. After receiving the broadcast packet, the device synchronously starts the addressing related unit to ensure the synchronization of the addressing process of each device and improve the overall addressing efficiency.
[0039] Specifically, in this embodiment, each dual RJ45 RS485 device is also equipped with a status indication unit, which is electrically connected to the device's addressing control module. The addressing control module is signal-connected to the timing control unit and the chain-recursive communication unit, respectively. When the addressing control module receives the broadcast packet via the RS485 communication terminal, it immediately sends a flashing control signal to the status indicator unit, and the status indicator unit begins to flash continuously. When the addressing control module receives the termination signal from the timing control unit and confirms that the chain recursive communication unit has completed the address transfer, it stops sending the flashing control signal, and the status indicator unit stops flashing. The power supply of the status indicator unit is obtained from the device's 12V power supply terminal (pins 1 and 2 of the IN port) and is electrically connected to the full-link power supply transmission loop to ensure continuous power supply during the addressing process.
[0040] This solution uses the linkage between the status indicator unit and the addressing control module to intuitively present the addressing status of the equipment, enabling staff to quickly grasp the addressing progress and promptly identify equipment that is not participating in the addressing process; it improves the monitorability of the addressing process, reduces the workload and difficulty of manual inspection, and facilitates timely handling of abnormal situations that occur during the addressing process.
[0041] Specifically, in this embodiment, the fixed period is 0.25 seconds and the addressing exit timeout is 50 seconds. At this time, the farthest device on the link receives address packets no less than 3 times and the near-end device receives address packets no less than 200 times. The electrical connection between the timing control unit and the address transmitter adopts a level signal control method. The address transmitter is triggered to output an address message once every 0.25 seconds. The address message is transmitted through the address signal chain transmission channel (the connection channel between pin 3 of the OUT port of the previous device and pin 3 of the IN port of the next device) to ensure that the downstream device can capture the address signal multiple times and resist electromagnetic interference in the industrial environment.
[0042] This solution optimizes the address replay cycle and addressing exit time limit, and combines a level signal-controlled replay method to provide downstream devices with more opportunities to receive addresses, thus better resisting common electromagnetic interference in industrial environments. It further improves the success rate and stability of the addressing process, making the solution more adaptable to the complex environmental requirements of industrial scenarios.
[0043] Specifically, in this embodiment, it is applicable to daisy-chain networking scenarios for industrial control production line sensor networking, intelligent security system monitoring equipment networking, or IoT terminal equipment networking, where the number of devices in the scenario is not less than 1 and dynamic topology adjustment is supported; When the topology changes, the connection between devices is reconfigured by plugging and unplugging RJ45 cables. The OUT port of the previous device is connected to the IN port of the new next device. The first identification unit re-determines the first device by detecting the silent state of the address receiving end (pin 3 of the IN port). The new topology can be adapted to complete the addressing without additional hardware connection or software configuration adjustments.
[0044] This solution expands its application scope by adapting to daisy-chain networking scenarios in multiple fields such as industrial control, smart security, and the Internet of Things; it supports dynamic topology adjustment, allowing it to adapt to new topologies without additional modifications to hardware connections or software configurations, thus improving the solution's flexibility and adaptability and meeting the addressing requirements of multi-device networking in different scenarios.
[0045] Example 2: This example provides a chain-based automatic addressing method for a dual RJ45 RS485 device, applied to the chain-based automatic addressing device for the dual RJ45 RS485 device in Example 1, such as... Figure 2 As shown, the method includes the following steps: Step 1: Addressing Startup. The host's broadcast startup unit generates a broadcast packet containing the starting address information. The broadcast packet is sent to the first device through the RJ45 cable connecting the host's RS485 communication interface to pins 7 and 8 of the IN port of the first dual RJ45 RS485 device. The host does not need to control the level of pin 3 of the RJ45 interface. Step 2: First address reception and task start-up. After the first device receives the broadcast packet through pins 7 and 8 of the IN port, it forwards it to all dual RJ45 RS485 devices in the entire link through the RS485 communication bus. After each device receives the broadcast packet, it temporarily stores the first address information and simultaneously starts the addressing task and the timing function of the timing control unit. The status indicator unit of the device starts to flash continuously. Step 3: First device identification. The first identification unit of each device checks whether there is an address signal sent by the upstream device on pin 3 of its own IN port. If no address signal is detected, it is determined to be the first device of the link, and the temporary first address is directly used as the final address of the device. If an address signal is detected, it is determined to be a non-first device, and step 4 is executed. Step 4: Address chaining recursion. Non-first devices receive address packets transmitted by upstream devices through pin 3 of the IN port, extract the upstream device address and add 1, use the result as the final address of the device, and then send a packet containing the final address of the device to downstream devices through pin 3 of its own OUT port, thus realizing the chaining propagation of address information. Step 5: Timed Replay and Addressing Termination. The timed control unit controls pin 3 of the device's OUT port to replay the local address message at a fixed interval of 0.1 to 0.5 seconds until the addressing exit timeout period of 40 to 80 seconds is reached. When the device completes the local address determination and the timeout period is reached, the timed control unit sends a termination signal, the device stops sending address messages, the status indicator unit stops flashing, and the addressing task is terminated. Step 6: Fault diagnosis. The fault diagnosis unit receives the addressing completion feedback signal of the entire link device through the RS485 communication bus. If no feedback signal is received from a certain device, the fault type is determined by combining the connection channel status of pin 3 of the IN port and pin 3 of the OUT port between the devices. The fault type is either a link break or the transmission line length exceeds the TTL serial communication limit.
[0046] This solution features a complete set of steps, including addressing startup, first address reception, first unit identification, address recursion, timed replay, and fault diagnosis, forming an orderly and efficient automatic addressing process. It reduces manual intervention, lowers the communication burden on the host, and improves addressing efficiency. It also has anti-interference and fault location capabilities, ensuring the stability and reliability of the addressing process. Furthermore, it adapts to dynamic topologies and complex application environments, simplifying operation and maintenance.
[0047] Specifically, in this embodiment, the timing control unit dynamically adjusts the replay period of the address packet using an adaptive replay period equation, which is: ; in: The actual replay period (unit: seconds) is used, and its value ranges from 0.1 to 0.8. The basic replay period ranges from 0.1 to 0.5 seconds. L is the physical link length (in meters) between the current device and the first device, ranging from 0 to... ; This is the maximum link length (in meters) supported by the system, and its value is set by the system. N is the total number of devices in the current link; This represents the maximum number of devices the system supports. I represents the current environmental interference intensity level (dimensionless, value range 0 to 10), where 0 indicates no interference and 10 indicates the strongest interference. The maximum interference level supported by the system (taken as 10). α, β, and γ are the weighting coefficients for link length, number of devices, and interference intensity, respectively. Their values range from 0 to 1, and they satisfy α + β + γ = 1. α represents the degree of influence of link length on periodic adjustment; β represents the degree of influence of number of devices on periodic adjustment; and γ represents the degree of influence of interference intensity on periodic adjustment.
[0048] The derivation of the equation is as follows: 2.1 Design Principles 1. Basic cycle principle: Set a basic replay cycle. To ensure the shortest replay interval under ideal conditions and to guarantee the lower limit of addressing speed.
[0049] 2. Impact of link length: Signal transmission delay increases in long links, which can easily cause signal overlap and require a longer replay cycle.
[0050] 3. Impact of the number of devices: An increase in the number of devices leads to the accumulation of chain transmission delays and an increased probability of message collisions, requiring an appropriate extension of the cycle.
[0051] 4. Environmental interference: When interference increases, the message loss rate rises. The replay cycle should be shortened to increase the replay frequency and enhance anti-interference capabilities.
[0052] 2.2 Derivation Steps 1. Establish the basic model: ; in These are adjustment factors for link length, number of devices, and interference intensity, respectively.
[0053] 2. Link length adjustment factor: ; When L=0, =1, no adjustment.
[0054] When L= hour, =1+α, and the maximum extension ratio is α.
[0055] 3. Equipment quantity adjustment factor: ; When N=1, =1, no adjustment.
[0056] When N= hour, =1+β, and the maximum extension ratio is β.
[0057] 4. Interference intensity adjustment factor: ; When I=0 =1, no adjustment.
[0058] When I= hour, The maximum shortening ratio is γ.
[0059] 5. Synthetic Equation: .
[0060] Example: 3.1 System Parameter Settings Basic replay cycle: =0.25s; Maximum link length: =500m; Maximum number of devices: =50 units; Maximum interference level: =10; Weighting coefficients: α=0.4, β=0.3, γ=0.3.
[0061] 3.2 On-site environmental parameters Current link length: L=300m; Current number of devices: N=20; Current interference level: I=6.
[0062] 3.3 Calculation process 1. Calculate the link length factor: ; 2. Calculate the equipment quantity factor: ; 3. Calculate the interference intensity factor: ; 4. Calculate the actual replay cycle: .
[0063] 3.4 Interpretation of Results Ideal environmental cycle: 0.25s; After considering the link length and number: the cycle time is extended to approximately 0.408 seconds; After considering interference: the period is shortened to approximately 0.293s; The final cycle is 17.2% longer than the basic cycle, which not only ensures the stability of long links with multiple devices, but also enhances the anti-interference capability.
[0064] Technical effect 5.1 Adaptive optimization capability Environmental adaptability: The replay cycle is dynamically adjusted based on the actual link length, number of devices, and interference intensity.
[0065] Anti-interference enhancement: When interference increases, the cycle is automatically shortened, the message replay frequency is increased, and the probability of correct reception by downstream devices is increased.
[0066] Long link stability: When extending the link, appropriately extend the period to avoid signal overlap and transmission conflicts.
[0067] 5.2 System Performance Improvement Improved addressing success rate: The dynamic adjustment mechanism ensures that the addressing process maintains a high success rate in different environments.
[0068] Resource utilization optimization: Avoid inefficiency or failure in extreme environments at fixed cycles.
[0069] Enhanced compatibility: The weighting coefficients are configurable to adapt to different application scenarios (industrial, security, IoT, etc.).
[0070] 5.3 Ease of Operation and Maintenance Automatic parameter adjustment: The system automatically adapts to environmental changes without manual intervention.
[0071] Fault prevention: Prevent addressing failures caused by environmental changes through periodic adjustments.
[0072] Working principle: This solution is based on a daisy-chain topology. The core hardware includes a host and multiple dual RJ45 RS485 devices. Each device is equipped with two 8-pin interfaces, an IN port and an OUT port. Each pin is responsible for power supply, grounding, communication, address transmission, and unused functions, respectively. The host is connected to the IN port of the first device, and the OUT port of the previous device is connected to the IN port of the next device in sequence through RJ45 cables, forming an independent power supply transmission loop, grounding loop, RS485 communication bus, and address signal chain transmission channel.
[0073] The addressing process is based on the core logic of "host broadcast initiation + device chain recursion": The host's broadcast initiation unit generates a broadcast packet containing the starting address information, sends it to the first device via the RS485 communication interface, and then transmits it to all devices in the link via the RS485 communication bus, triggering the addressing task to start. Each device receives the broadcast packet, temporarily stores the starting address, and simultaneously starts the addressing task and the timing control unit. The device's first identification unit checks whether there is an upstream address signal on the IN port address transmission pin. If there is no signal, it is determined to be the first device, and the temporarily stored starting address is used as its final address; if there is a signal, it is determined to be a non-first device, and the upstream address is incremented by 1 as its final address. The chain recursion communication unit receives the upstream address signal through the IN port address transmission pin, and then sends the updated local address to downstream devices in the form of a message through the OUT port address transmission pin. The timing control unit controls the address sending end to replay the address message at a fixed period, and simultaneously sets an addressing exit timeout. After the device completes address determination and the timeout is reached, the timing control unit sends a termination signal to stop address message transmission and terminate the addressing process. In addition, the fault diagnosis unit uses the correlation logic between addressing results and link status to determine the link status and locate the fault type by checking whether the addressing was successful.
[0074] How to use: 1. Equipment Connection: Following the daisy-chain topology, use RJ45 cables to connect the RS485 communication interface of the host to the IN port of the first dual RJ45 RS485 device. Then connect the OUT port of the previous device to the IN port of the next device in sequence to ensure the normal conduction of power supply, grounding, communication and address transmission channels.
[0075] 2. Start Addressing: The host does not need to perform additional control on specific pins of the RJ45 interface. It sends a broadcast packet containing the starting address information through its own RS485 communication interface to trigger the start addressing task of the entire link device.
[0076] 3. Addressing process: After receiving a broadcast packet, the device automatically stores the first address. The first identification unit automatically determines the device type and determines the final address of the device. After the non-first device completes the address update, it sends the address message to the downstream device through the OUT port. At the same time, the timed control unit controls the replay of the address message according to a fixed period.
[0077] 4. Addressing Termination: When the device completes the local address determination and reaches the set addressing exit time limit, the timer control unit sends a termination signal, the device stops sending address messages, the addressing task is completed, and the device status indicator unit stops flashing.
[0078] 5. Fault Handling: If full-link addressing is not completed, the fault diagnosis unit, in conjunction with the connection status between devices, determines the fault type as a link break or an excessively long transmission line, so that staff can conduct targeted troubleshooting.
[0079] In summary, the chain-type automatic addressing device and method for dual RJ45 RS485 devices provided in this embodiment have the following advantages: 1. By employing a dual RJ45 connector design and a daisy-chain topology, independent transmission of power supply, grounding, communication, and address transfer is achieved, avoiding mutual interference between different functional signals and ensuring the stability of signal transmission. The host broadcast-initiated addressing method eliminates the need for individual interaction between the host and each device, significantly reducing host hardware resource consumption and improving the overall system response speed. Address allocation between devices is automatically completed through chain-like recursion, eliminating the need for manual settings and avoiding errors caused by manual operation, thus improving addressing efficiency.
[0080] 2. Utilizing the adaptive identification logic of the first device, there is no need to pre-set the first device identifier, and no reconfiguration is required when the topology changes. It can adapt to daisy-chain topologies of different lengths, improving the adaptability and flexibility of the solution. The timed replay mechanism allows downstream devices to obtain multiple address reception opportunities, effectively covering periods of electromagnetic interference in industrial environments, and improving the anti-interference capability and success rate of addressing.
[0081] 3. By establishing a logical association between addressing results and link status, fault types can be quickly located based on addressing success or failure without the need for an additional fault detection module. This simplifies troubleshooting and reduces maintenance difficulty and costs. The host only issues broadcast commands through the communication pins of the RJ45 interface, eliminating the need for complex level control of specific pins. This improves the utilization efficiency of the RJ45 interface, simplifies the host's trigger control logic, and reduces the difficulty of host hardware design and software development. The overall solution is suitable for multi-device daisy-chain networking requirements in various fields such as industrial control, smart security, and the Internet of Things, and is particularly suitable for scenarios with a large number of devices, dynamically changing topologies, and strong electromagnetic interference.
[0082] In addition, this application also provides the following implementation example: an industrial control sensor networking implementation example of a chain-type automatic addressing device and method for dual RJ45 RS485 devices.
[0083] I. Technical Solution (a) Component composition The core components of this implementation example include a host 1, 64 dual RJ45 RS485 devices 2, and a fault diagnosis unit 3. The host 1 integrates a broadcast start unit 11 and an RS485 communication interface 12; each dual RJ45 RS485 device 2 is equipped with an IN port 21, an OUT port 22, and a built-in chain-recursive communication unit 23, a first-unit identification unit 24, a timing control unit 25, an addressing control module 27, and a status indication unit 26; the chain-recursive communication unit 23 includes an address receiver 231 and an address transmitter 232.
[0084] The pin definitions for IN port 21 are as follows: pins 1 (211) and 2 (212) are 12V power supply terminals; pin 3 (213) is the address receiving terminal; pins 4 (214) and 5 (215) are ground terminals; pin 6 (216) is a no-connect pin; and pins 7 (217) and 8 (218) are RS485 communication terminals. The pin definitions for OUT port 22 are as follows: pins 1 (221) and 2 (222) are 12V power supply terminals; pin 3 (223) is the address transmitting terminal; pins 4 (224) and 5 (225) are ground terminals; pin 6 (226) is a no-connect pin; and pins 7 (227) and 8 (228) are RS485 communication terminals.
[0085] (ii) Connection relationship A daisy-chain topology is used for connection: the RS485 communication interface 12 of host 1 is connected to the IN ports 217 and 218 of the first dual-RJ45 RS485 device 2 via RJ45 cables; the OUT port 221 of the first dual-RJ45 RS485 device 2 is connected to the IN port 211, OUT port 222, and IN port 212 of the second dual-RJ45 RS485 device 2 via RJ45 cables, forming a complete power transmission loop; the OUT port 224 of the first dual-RJ45 RS485 device 2 is connected to the IN port 217 and 218 of the second dual-RJ45 RS485 device 2. Ports 214, OUT, and IN are connected via RJ45 cables to form a unified grounding loop. The OUT port 227 of the previous dual-RJ45 RS485 device 2 is connected via RJ45 cables to the IN port 217, OUT port 228, and IN port 218 of the next dual-RJ45 RS485 device 2 to form an RS485 communication bus. The OUT port 223 of the previous dual-RJ45 RS485 device 2 is connected via RJ45 cables to the IN port 213 of the next dual-RJ45 RS485 device 2 to form an address signal chain transmission channel.
[0086] The fault diagnosis unit 3 is connected to the addressing control module 27 of each dual RJ45 RS485 device 2. Each addressing control module 27 interacts with the broadcast start unit 11 of the host 1 via the RS485 communication bus.
[0087] (III) Function settings for each module Broadcast initiation unit 11: Generates a broadcast packet containing a register address and a starting address value. The register address identifies the addressing control register, and the starting address value is set to the full-link addressing start address. Only one broadcast packet is sent.
[0088] Chain-recursive communication unit 23: Address receiving end 231 is electrically connected to IN port 213 and receives address signals transmitted by upstream device 2 through address signal chain transmission channel; Address sending end 232 is electrically connected to OUT port 223 and sends the updated local address to downstream device 2 in the form of a message.
[0089] First identification unit 24: It is connected to the address receiver 231 by signal, detects whether the address receiver 231 has an address signal sent by the upstream device 2, and completes the determination of the first device 2.
[0090] Timing control unit 25: electrically connected to address transmitter 232, using level signal control, triggers address transmitter 232 to output an address message every 0.25 seconds; sets a 50-second addressing exit timeout, is signal-connected to addressing control module 27, and sends a termination signal.
[0091] Addressing control module 27: After receiving the broadcast packet, it temporarily stores the starting address, coordinates the operation of the chain-recursive communication unit 23, the first identification unit 24, and the timing control unit 25, and receives feedback signals from each unit.
[0092] Status indicator unit 26: Electrically connected to addressing control module 27, it obtains 12V power supply through IN ports 211 and 212, flashes continuously during addressing tasks, and stops flashing after addressing is terminated.
[0093] Fault diagnosis unit 3: Receives addressing completion feedback signals from all devices 2 via RS485 communication bus, and determines the fault type by combining the address signal chain transmission channel status.
[0094] II. Working Principle Addressing Startup: The broadcast startup unit 11 of host 1 generates a broadcast packet, which is sent to the IN ports 217 and 218 of the first device 2 through the RS485 communication interface 12. The broadcast packet is then forwarded to all 64 devices 2 in the entire link via the RS485 communication bus.
[0095] First address reception: Each device 2 receives broadcast packets through IN ports 217 and 218. The addressing control module 27 temporarily stores the first address, synchronously starts the addressing task, the status indicator unit 26 starts flashing continuously, and the timing control unit 25 starts the timing function.
[0096] First device identification: The first device identification unit 24 detects whether the address receiving end 231 has an address signal sent by the upstream device 2. If the address receiving end 231 of the first device 2 has no upstream address signal, it is determined to be the first device 2, and the addressing control module 27 directly uses the temporarily stored first address as the final address of the local device; if the address receiving ends 231 of other non-first devices 2 detect the upstream address signal, they are determined to be non-first devices 2.
[0097] Address recursion: The addressing control module 27 of non-first device 2 extracts the address of upstream device 2 and increments it by 1 to determine the final address of the local device. Then, it controls the address sending end 232 of the chain recursion communication unit 23 to send a message containing the final address of the local device to downstream device 2 through OUT port 223.
[0098] Timed replay: The timed control unit 25 controls the address sending end 232 to replay the local address message at a fixed period of 0.25 seconds to ensure that the downstream device 2 can capture the address signal.
[0099] Addressing Termination: When device 2 completes the local address determination and the timing control unit 25 reaches the 50-second addressing exit time limit, the timing control unit 25 sends a termination signal to the addressing control module 27. The addressing control module 27 controls the address sending end 232 to stop sending address messages, the status indicator unit 26 stops flashing, and the addressing task is terminated.
[0100] Fault diagnosis: The fault diagnosis unit 3 receives the addressing completion feedback signal of the full-link device 2 through the RS485 communication bus. If no feedback signal is received from a certain device 2, the address signal chain transmission channel between adjacent devices 2 is detected. If there is no address signal transmission, it is determined that the link is broken. If the link is not broken but the remote device 2 does not receive the address message, it is determined that the transmission line length exceeds the TTL serial port communication limit.
[0101] III. Experimental Data An industrial control production line sensor networking test environment was set up. Following the above technical solution, 64 dual RJ45 RS485 devices (2) were connected to the host (1). An industrial electromagnetic interference environment was simulated (interference intensity conformed to GB / T17626.3-2016 standard), and multiple rounds of testing were conducted. Key data were recorded as follows: Addressing completion time: After 30 consecutive tests, the addressing completion time remained stable within the set range each time, without significant fluctuations. Figure 3 As shown, the addressing completion time remained stable at around 48 seconds in 30 consecutive tests, verifying the reliability of the device addressing.
[0102] Interference resistance test: Addressing was initiated 100 times consecutively, with 99 successful attempts. Only once did a single device fail to receive the address signal initially due to extremely strong interference; subsequent attempts were completed by using a timed replay mechanism to retrieve the address signal. Figure 4 As shown, it maintains a high success rate of 99% in 100 startup addressing tests, meeting the requirements of industrial electromagnetic interference environment.
[0103] Fault location test: Thirty link disconnection faults and 20 transmission line overrun faults were artificially created. Fault diagnosis unit 3 accurately identified the fault type in all cases, achieving a 100% fault location accuracy rate. Figure 5 As shown in the bar chart, the 100% accurate identification rate of 30 link breakage faults and 20 transmission overrun faults is presented intuitively.
[0104] Host resource utilization test: During the addressing process, the CPU utilization of host 1 remained at a low level, and the communication bandwidth consumption was less than 1 / 60 of that of the traditional centralized host addressing method. Figure 6 As shown, during the simulated addressing process, the CPU utilization rate fluctuates around 5%, demonstrating low resource consumption characteristics.
[0105] IV. Technical Effects Addressing efficiency and accuracy are improved: addressing is triggered by a single broadcast packet sent by the broadcast initiation unit 11. With the address diffusion mechanism of the chain-recursive communication unit 23, the entire link device 2 can complete the addressing without manual operation, avoiding the problems of address duplication and omission that may occur during manual operation. The addressing process is efficient and orderly.
[0106] Reduced host resource consumption: Host 1 only performs one broadcast operation. The subsequent addressing process is completed autonomously by devices 2 through the address signal chain transmission channel. There is no need to establish a communication link with each device 2 individually, which greatly reduces the CPU resources and communication bandwidth consumption of host 1 and improves the overall system response speed.
[0107] Enhanced topology adaptability: The first identification unit 24 automatically determines the first device 2 by detecting the signal status of the address receiver 231, without the need for manual preset identification. When the link topology changes, device 2 can autonomously re-determine the first device 2 and complete the addressing, adapting to daisy-chain topologies of different lengths, significantly improving flexibility.
[0108] Anti-interference capability optimization: The 0.25-second fixed-cycle replay mechanism of the timing control unit 25 enables each device 2 to obtain multiple address reception opportunities, effectively covering the electromagnetic interference period in the industrial environment. Even in strong interference scenarios, the effectiveness of address transmission can be guaranteed, and the addressing success rate is greatly improved.
[0109] Convenient troubleshooting: The fault diagnosis unit 3 establishes a direct correlation between the addressing results and the link status, which can quickly locate the fault type without having to check each link such as host 1 and device 2 one by one. This simplifies the fault troubleshooting process, reduces the difficulty of operation and maintenance, and improves the efficiency of operation and maintenance.
[0110] Optimized host control and interface utilization: Host 1 does not need to perform complex level control on specific pins of the RJ45 interface. It only issues broadcast commands through the RS485 communication bus composed of IN ports 217 and 218 and OUT ports 227 and 228, which improves the utilization efficiency of the RJ45 interface, simplifies the trigger control logic of host 1, and reduces the difficulty of hardware design and software development of host 1.
[0111] Wide adaptability to various scenarios: The entire solution is suitable for multi-device daisy-chain networking scenarios such as industrial control, intelligent security, and the Internet of Things. It is especially able to meet the application needs of a large number of devices, dynamic topology changes, and strong electromagnetic interference, with outstanding stability and practicality.
[0112] The above are merely preferred embodiments of the present invention and are not intended to limit the implementation methods and protection scope of the present invention. Those skilled in the art should recognize that any equivalent substitutions and obvious changes made based on the description and illustrations of the present invention should be included within the protection scope of the present invention.
Claims
1. A chained automatic addressing device for a dual RJ45 jack RS485 device, characterized in that, The system includes a host and multiple dual RJ45 RS485 devices. Each dual RJ45 RS485 device is equipped with an IN port and an OUT port. The host is connected to the IN port of the first dual RJ45 RS485 device via an RJ45 cable. The OUT port of the previous dual RJ45 RS485 device is connected to the IN port of the next dual RJ45 RS485 device via RJ45 cables in sequence, forming a daisy-chain topology. The host is equipped with a broadcast initiation unit, which is used to generate and send a broadcast packet containing the starting address information to trigger full-link addressing. Each dual RJ45 RS485 device is equipped with a chain-relay communication unit, a first identification unit, and a timing control unit. The chain-recursive communication unit includes an address receiving end and an address sending end. The address receiving end corresponds to a designated pin of the device's IN port and is used to receive the address signal transmitted by the upstream device. The address sending end corresponds to a designated pin of the device's OUT port and is used to send the updated local address to the downstream device in the form of a message. The first identification unit is used to detect whether there is an address signal sent by the upstream device at the address receiving end. If no address signal is detected, the device is determined to be the first device, and the first device uses the first address in the broadcast packet as its final address. If an address signal is detected, the device is determined to be a non-first device, and the non-first device uses the upstream device address plus 1 as its final address. The timing control unit is used to control the address sending end to replay the local address message at a fixed period and set the addressing exit time limit. When the device completes the local address determination and the addressing exit time limit is reached, the addressing process is terminated.
2. The chain automatic addressing device of a dual RJ45 seat RS485 equipment according to claim 1, characterized in that, The pinouts of the IN and OUT ports are defined as follows: For the IN port, pins 1 and 2 are 12V power supply terminals, pin 3 is the address receiving terminal, pins 4 and 5 are ground terminals, pin 6 is a no-connection pin, and pins 7 and 8 are RS485 communication terminals; for the OUT port, pins 1 and 2 are 12V power supply terminals, pin 3 is the address transmitting terminal, pins 4 and 5 are ground terminals, pin 6 is a no-connection pin, and pins 7 and 8 are RS485 communication terminals; the broadcast packet is transmitted to the end-to-end device via the RS485 communication terminal.
3. The chain automatic addressing device of a dual RJ45 seat RS485 equipment according to claim 1, characterized in that, The timing control unit controls the address sending end to replay the address message at a fixed period of 0.1 seconds to 0.5 seconds.
4. The chain automatic addressing device of a dual RJ45 seat RS485 equipment according to claim 1, characterized in that, The addressing exit timeout is 40 to 80 seconds.
5. The chain automatic addressing device of a dual RJ45 seat RS485 equipment according to claim 1, characterized in that, The broadcast packet is an instruction message containing a register address and a starting address value. The register address is used to identify the addressing control register, and the starting address value is the starting address of the full-link device addressing.
6. The chain automatic addressing device of a dual RJ45 seat RS485 equipment according to claim 1, characterized in that, It also includes a fault diagnosis unit. Based on the correlation logic between the addressing result and the link status, if the entire link has not completed automatic addressing, the fault type is determined to be a link break or the transmission line length exceeds the TTL serial communication limit.
7. The chain automatic addressing device of a dual RJ45 seat RS485 device according to claim 2, characterized in that, The broadcast initiation unit sends a broadcast packet only once. When the broadcast packet is transmitted through the RS485 communication terminal, all dual RJ45 RS485 devices in the entire link receive the broadcast packet through their own RS485 communication terminals and temporarily store the starting address information.
8. The chain automatic addressing device of a dual RJ45 seat RS485 device according to claim 1, characterized in that, Each dual RJ45 RS485 device is also equipped with a status indicator unit, which flashes continuously during the addressing task and stops flashing after the addressing task is terminated.
9. The chain automatic addressing device of a dual RJ45 seat RS485 device according to claim 3, characterized in that, The fixed period is 0.25 seconds, and the addressing exit timeout is 50 seconds. During this time, the farthest device on the link receives address packets no less than 3 times, and the nearest device receives address packets no less than 200 times.
10. A method for automatic addressing of a chain of RS485 devices with dual RJ45 sockets, characterized in that, A chain-type automatic addressing device applied to any of the dual RJ45 RS485 devices according to claims 1 to 9, the method comprising the following steps: Step 1: Addressing Startup. The host's broadcast startup unit generates a broadcast packet containing the starting address information. The broadcast packet is sent to the first device through the RJ45 cable connecting the host's RS485 communication interface to pins 7 and 8 of the IN port of the first dual RJ45 RS485 device. The host does not need to control the level of pin 3 of the RJ45 interface. Step 2: First address reception and task start-up. After the first device receives the broadcast packet through pins 7 and 8 of the IN port, it forwards it to all dual RJ45 RS485 devices in the entire link through the RS485 communication bus. After each device receives the broadcast packet, it temporarily stores the first address information and simultaneously starts the addressing task and the timing function of the timing control unit. The status indicator unit of the device starts to flash continuously. Step 3: First device identification. The first identification unit of each device checks whether there is an address signal sent by the upstream device on pin 3 of its own IN port. If no address signal is detected, it is determined to be the first device of the link, and the temporary first address is directly used as the final address of the device. If an address signal is detected, it is determined to be a non-first device, and step 4 is executed. Step 4: Address chaining recursion. Non-first devices receive address packets transmitted by upstream devices through pin 3 of the IN port, extract the upstream device address and add 1, use the result as the final address of the device, and then send a packet containing the final address of the device to downstream devices through pin 3 of its own OUT port, thus realizing the chaining propagation of address information. Step 5: Timed Replay and Addressing Termination. The timed control unit controls pin 3 of the device's OUT port to replay the local address message at a fixed interval of 0.1 to 0.5 seconds until the addressing exit timeout period of 40 to 80 seconds is reached. When the device completes the local address determination and the timeout period is reached, the timed control unit sends a termination signal, the device stops sending address messages, the status indicator unit stops flashing, and the addressing task is terminated. Step 6: Fault diagnosis. The fault diagnosis unit receives the addressing completion feedback signal of the entire link device through the RS485 communication bus. If no feedback signal is received from a certain device, the fault type is determined by combining the connection channel status of pin 3 of the IN port and pin 3 of the OUT port between the devices. The fault type is either a link break or the transmission line length exceeds the TTL serial communication limit.