CN-121984915-A - EtherCAT master station with double network ports redundant communication method and device
Abstract
The application discloses a redundant communication method and device of a dual-network-port EtherCAT master station, wherein the EtherCAT master station operates in a bare metal environment without an operating system and is provided with a master station redundant management layer, a first physical Ethernet port and a second physical Ethernet port; the method comprises the steps of controlling a first Ethernet port and a second Ethernet port to synchronously send the same EtherCAT data frame through a master station redundancy management layer in each EtherCAT communication period, receiving and obtaining a WKC value of a response frame returned by the first physical Ethernet port and the second physical Ethernet port respectively, judging the communication link state of the EtherCAT master station according to the comparison result of the sum of the WKC values returned by the first physical Ethernet port and the second physical Ethernet port and the total number of slave stations, and regenerating the communication path of the EtherCAT master station based on pre-stored slave station connection information when the communication link is abnormal.
Inventors
- Ou di
- XIE PENG
- LI KENAN
- Ban Bingbing
Assignees
- 深圳璇玑动力科技有限公司
Dates
- Publication Date
- 20260505
- Application Date
- 20260123
Claims (10)
- 1. The redundant communication method of the Ethernet CAT master station with the double network ports is characterized in that the Ethernet CAT master station is operated in a bare metal environment without an operating system and is provided with a master station redundant management layer, a first physical Ethernet port and a second physical Ethernet port, and the method comprises the following steps: in each EtherCAT communication period, the first physical Ethernet port and the second physical Ethernet port are controlled by the master station redundancy management layer to synchronously send the same EtherCAT data frame; Receiving and acquiring a work counter WKC value in response frames returned by the first physical Ethernet port and the second physical Ethernet port respectively; Judging the communication link state of the EtherCAT master station according to the comparison result of the sum of the WKC values returned by the first physical Ethernet port and the second physical Ethernet port and the total number of slave stations; and when the communication link is abnormal, regenerating the communication path of the EtherCAT master station based on the pre-stored slave station connection information.
- 2. The dual-port EtherCAT master station redundancy communication method of claim 1, wherein the first physical ethernet port and the second physical ethernet port are connected to form an EtherCAT ring or dual-line network topology.
- 3. The method for redundant communication of a dual-port EtherCAT master station of claim 2, wherein before the step of controlling two ports to synchronously transmit the same EtherCAT data frame through the master station redundancy management layer in each EtherCAT communication period, the method comprises: Initializing a first physical Ethernet port and a second physical Ethernet port; Starting a timing interrupt service routine in the bare computer environment based on a master station redundancy management layer, and judging whether interrupt triggering exists; and if the interrupt trigger exists, periodically triggering the master station redundancy management layer to execute synchronous transmission of a control instruction to the first physical Ethernet port and the second physical Ethernet port, and otherwise, asynchronously monitoring the state of a communication link by the master station redundancy management layer.
- 4. The method of claim 3, wherein the method is run on an embedded processor comprising a dual programmable real-time unit-industrial communication subsystem PRU-ICSSG, the first physical ethernet port and the second physical ethernet port are respectively driven by a dual PRU-ICSSG, and the dual PRU-ICSSG share the same memory area for buffering the synchronously transmitted EtherCAT data frames and the returned response frames.
- 5. The dual-port EtherCAT master station redundancy communication method of claim 4, wherein the step of receiving and acquiring the work counter WKC value in the response frames returned by the first physical ethernet port and the second physical ethernet port, respectively, comprises: receiving a first response frame from a first physical ethernet port through a first PRU-ICSSG of the dual PRU-ICSSG and a second response frame from a second physical ethernet port through a second PRU-ICSSG of the dual PRU-ICSSG; analyzing the first response frame and the second response frame to respectively obtain a first WKC value and a second WKC value; Writing the first WKC value into a first buffer reserved for a first physical Ethernet port in a shared memory area through the first PRU-ICSSG, and writing the second WKC value into a second buffer reserved for a second physical Ethernet port in the shared memory area through the second PRU-ICSSG; when the master station redundant layer accesses the shared memory area, the first WKC value and the second WKC value are respectively read from the first buffer area and the second buffer area and used as the WKC values returned by the first physical Ethernet port and the second physical Ethernet port.
- 6. The dual-port EtherCAT master station redundancy communication method of claim 5, wherein the step of determining the communication link state of the EtherCAT master station according to a comparison result between the sum of the WKC values returned from the first physical ethernet port and the second physical ethernet port and the total number of slave stations comprises: Acquiring a preset total number N of expected secondary stations of the network based on the primary station redundancy management layer; Calculating a target sum Σwkc of the first and second WKC values from the first and second WKC values; a link state determination is performed based on the total number of network intended secondary stations N, the first and second WKC values, and the target and Σwkc, generating a link state flag.
- 7. The dual-portal EtherCAT master station redundancy communication method of claim 6, wherein the performing a link state decision based on the total number N of network intended slave stations, the first and second WKC values, and the target and Σwkc, generating a link state flag comprises: if the first WKC value is equal to N and the second WKC value is equal to 0, calculating to obtain that the target sum Σwkc is equal to N, and generating a link state flag indicating "double link normal"; If the first WKC value is equal to 0 and the second WKC value is equal to N, calculating to obtain that the target sum Σwkc is equal to N, and generating a link state flag indicating "double link normal"; If the first WKC value is greater than 0 and the second WKC value is greater than 0, calculating that the target sum Σwkc is less than or equal to N, generating a link state flag indicating "communication loss".
- 8. The dual-portal EtherCAT master station redundancy communication method as set forth in claim 7, wherein the step of regenerating the communication path of the EtherCAT master station based on the pre-stored slave station connection information when the communication link is abnormal comprises: Determining a communication loss identifier and a corresponding abnormal type according to the link state identifier, wherein the abnormal type comprises link interruption or link slave station disconnection; Traversing a pre-stored slave station connection information table according to the communication loss identification and the abnormal type, and updating the state of a slave station node associated with an abnormal link; Based on the updated slave station connection information table, recalculating the optimal or available forwarding paths of the EtherCAT master station under the current network topology, and generating a new port forwarding mapping table; and loading the new port forwarding mapping table to a preset area in the shared memory of the double PRU-ICSSG so as to control the forwarding of the EtherCAT data frame.
- 9. The dual-portal EtherCAT master station redundancy communication method according to any one of claims 1-8, wherein the master station redundancy management layer is integrated in a SOEM protocol stack.
- 10. A dual-port EtherCAT master station redundant communication device, characterized in that the device comprises a memory, a processor and a computer program stored on the memory and operable on the processor, the computer program being configured to implement the steps of the dual-port EtherCAT master station redundant communication method according to any one of claims 1 to 9.
Description
EtherCAT master station with double network ports redundant communication method and device Technical Field The application relates to the technical field of Ethernet automatic control, in particular to a redundant communication method and device for a dual-port EtherCAT master station. Background EtherCAT, which is a high-performance industrial Ethernet protocol, is widely applied to motion control, robots and automation systems with extremely high requirements on real-time performance and reliability. In order to improve the availability of a communication network, a ring or bilinear network topology is adopted and a double-portal master station is equipped to realize link redundancy, so that the method has become a mainstream design choice of key equipment. Currently, a typical technical scheme for realizing the redundancy function of the EtherCAT master station generally depends on a standard protocol stack running on an operating system such as Linux, RTOS and the like. Under the architecture, the master station manages a plurality of physical ports through a network driving layer of an operating system, monitors the network state by using an upper protocol service, and further, when detecting a link interruption, the operating system schedules tasks to execute reconstruction of a network path. However, such operating system-based implementations expose inherent limitations in the face of resource-constrained, embedded bare metal application scenarios that require extreme certainty. Firstly, the redundancy management logic is deeply embedded in an operating system protocol stack and a scheduling system, so that the whole architecture is heavy, and the redundancy management logic cannot be transplanted and run in a bare computer environment without an operating system. And secondly, the inherent delay and uncertainty of task scheduling of an operating system make the data transmission and state comparison between the two network ports difficult to achieve strict frame-level synchronization, so that the fault detection time is prolonged. Finally, the path reconstruction process needs to undergo state confirmation and complex system call of a plurality of communication cycles, so that the fault recovery delay is obvious, and the severe requirement of the high-instantaneity control application on the self-healing of the sub-periodic level fault is difficult to meet. The foregoing is provided merely for the purpose of facilitating understanding of the technical solutions of the present application and is not intended to represent an admission that the foregoing is prior art. Disclosure of Invention The application mainly aims to provide a redundant communication method and device for an EtherCAT master station with double network ports, and aims to solve the technical problems that the EtherCAT master station is in redundant communication, rapid link switching and path reconstruction cannot be realized in a bare machine environment, and reconstruction delay is large. In order to achieve the above purpose, the present application provides a dual-port EtherCAT master station redundancy communication method, where the EtherCAT master station is operated in a bare metal environment without an operating system and is configured with a master station redundancy management layer, a first physical ethernet port and a second physical ethernet port, and the method includes: in each EtherCAT communication period, the first physical Ethernet port and the second physical Ethernet port are controlled by the master station redundancy management layer to synchronously send the same EtherCAT data frame; Receiving and acquiring a work counter WKC value in response frames returned by the first physical Ethernet port and the second physical Ethernet port respectively; Judging the communication link state of the EtherCAT master station according to the comparison result of the sum of the WKC values returned by the first physical Ethernet port and the second physical Ethernet port and the total number of slave stations; and when the communication link is abnormal, regenerating the communication path of the EtherCAT master station based on the pre-stored slave station connection information. In an embodiment, the first physical ethernet port and the second physical ethernet port are connected to form an EtherCAT ring or a bilinear network topology. In an embodiment, before the step of controlling, by the master station redundancy management layer, two ports to synchronously send the same EtherCAT data frame in each EtherCAT communication period, the method includes: Initializing a first physical Ethernet port and a second physical Ethernet port; Starting a timing interrupt service routine in the bare computer environment based on a master station redundancy management layer, and judging whether interrupt triggering exists; and if the interrupt trigger exists, periodically triggering the master station redundancy management layer