CN114679249A - EtherCAT communication synchronization method and device - Google Patents

EtherCAT communication synchronization method and device Download PDF

Info

Publication number
CN114679249A
CN114679249A CN202210582505.8A CN202210582505A CN114679249A CN 114679249 A CN114679249 A CN 114679249A CN 202210582505 A CN202210582505 A CN 202210582505A CN 114679249 A CN114679249 A CN 114679249A
Authority
CN
China
Prior art keywords
driver
period
bottom layer
sync0
current
Prior art date
Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
Granted
Application number
CN202210582505.8A
Other languages
Chinese (zh)
Other versions
CN114679249B (en
Inventor
韩腾飞
张春林
Current Assignee (The listed assignees may be inaccurate. Google has not performed a legal analysis and makes no representation or warranty as to the accuracy of the list.)
Shenzhen Just Motion Control Electromechanics Co ltd
Original Assignee
Shenzhen Just Motion Control Electromechanics Co ltd
Priority date (The priority date is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the date listed.)
Filing date
Publication date
Application filed by Shenzhen Just Motion Control Electromechanics Co ltd filed Critical Shenzhen Just Motion Control Electromechanics Co ltd
Priority to CN202210582505.8A priority Critical patent/CN114679249B/en
Publication of CN114679249A publication Critical patent/CN114679249A/en
Application granted granted Critical
Publication of CN114679249B publication Critical patent/CN114679249B/en
Active legal-status Critical Current
Anticipated expiration legal-status Critical

Links

Images

Classifications

    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04LTRANSMISSION OF DIGITAL INFORMATION, e.g. TELEGRAPHIC COMMUNICATION
    • H04L7/00Arrangements for synchronising receiver with transmitter
    • H04L7/04Speed or phase control by synchronisation signals
    • H04L7/041Speed or phase control by synchronisation signals using special codes as synchronising signal
    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04LTRANSMISSION OF DIGITAL INFORMATION, e.g. TELEGRAPHIC COMMUNICATION
    • H04L7/00Arrangements for synchronising receiver with transmitter
    • H04L7/0016Arrangements for synchronising receiver with transmitter correction of synchronization errors
    • YGENERAL TAGGING OF NEW TECHNOLOGICAL DEVELOPMENTS; GENERAL TAGGING OF CROSS-SECTIONAL TECHNOLOGIES SPANNING OVER SEVERAL SECTIONS OF THE IPC; TECHNICAL SUBJECTS COVERED BY FORMER USPC CROSS-REFERENCE ART COLLECTIONS [XRACs] AND DIGESTS
    • Y02TECHNOLOGIES OR APPLICATIONS FOR MITIGATION OR ADAPTATION AGAINST CLIMATE CHANGE
    • Y02PCLIMATE CHANGE MITIGATION TECHNOLOGIES IN THE PRODUCTION OR PROCESSING OF GOODS
    • Y02P90/00Enabling technologies with a potential contribution to greenhouse gas [GHG] emissions mitigation
    • Y02P90/02Total factory control, e.g. smart factories, flexible manufacturing systems [FMS] or integrated manufacturing systems [IMS]

Landscapes

  • Engineering & Computer Science (AREA)
  • Computer Networks & Wireless Communication (AREA)
  • Signal Processing (AREA)
  • Synchronisation In Digital Transmission Systems (AREA)

Abstract

The application discloses and provides an EtherCAT communication synchronization method and a device, and the method judges whether the arrival time of the current sync0 synchronization signal is within a preset hysteresis time interval; if yes, setting the drive refreshing period of the bottom layer of the next servo as T _ driver; if not, the servo bottom layer drive refreshing period is adjusted to be T1_ driver according to the current servo bottom layer drive refreshing period, the refreshing times, the current servo bottom layer drive counter value and the next servo bottom layer drive counter value, so that EtherCAT communication synchronization is achieved, and the problems that in the prior art, the calculation is required in each period and is complex, once time deviation occurs, the calculation in the continuous synchronization process is needed, and excessive CPU calculation time is consumed due to the fact that the servo driver synchronization based on the EtherCAT real-time Ethernet is achieved are solved.

Description

EtherCAT communication synchronization method and device
Technical Field
The invention relates to the technical field of EtherCAT communication synchronization, in particular to an EtherCAT communication synchronization method and device.
Background
EtherCAT is a popular real-time industrial Ethernet protocol, has the characteristics of high speed, large data transmission quantity, high efficiency and the like, is the industrial Ethernet protocol with the highest transmission speed at present, can reach a data refresh period less than 100us, and can be used for closed-loop control of a bottom layer in a servo technology.
Industrial automation equipment such as numerical control processing equipment and robots generally require high-precision multi-axis synchronization to ensure control precision of the industrial automation equipment, servo drivers serve as core parts of the systems, and the control performance of the whole system is directly influenced by the synchronization precision among the servo drivers, so that a real-time ethernet bus ethecat is an indispensable communication mode for the high-performance servo drivers.
In the related technology, the ethecat communication synchronization is performed by adopting the following scheme, firstly, when a slave station link layer control module is triggered by a distributed clock, synchronous interruption is requested to an application layer control module, the application layer control module calculates interruption response delay delta t1 every time the synchronous interruption enters, when the synchronous interruption enters for the first time, Tset is calculated to be TOffset + (Tc-delta t1), Tset is the next servo interruption initiating time after the application layer control module receives the synchronous interruption request for the first time, and TOffset is the time offset value between the next servo interruption initiating time after the application layer control module receives the synchronous interruption request and the time when the synchronous interruption request is received. The application layer control module adjusts the servo program timing period when the synchronous interruption is firstly entered according to the Tset, and restores the rest servo program timing periods in the first communication period to normal. According to the scheme, calculation is required and complex in each period in the synchronization process, once time deviation occurs, calculation in the continuous synchronization process is required, and excessive CPU calculation time is consumed.
Disclosure of Invention
Therefore, the technical problem to be solved by the invention is to overcome the problems that in the prior art, the servo driver synchronization based on the EtherCAT real-time ethernet needs to be calculated and calculated in each period, once time deviation occurs, the calculation needs to be carried out in a continuous synchronization process, and the calculation time of a CPU is consumed too much.
In order to solve the above technical problem, the embodiments of the present disclosure at least provide an EtherCAT communication synchronization method and apparatus.
In a first aspect, an embodiment of the present disclosure provides an EtherCAT communication synchronization method, including:
acquiring a synchronization period value T _ sync0 of a sync signal of sync 0;
acquiring a current servo bottom layer drive refreshing period T _ driver;
calculating the refresh times N in the sync period of the sync signal of the sync0 according to the sync period value T _ sync0 of the sync0 sync signal and the current servo bottom layer driving refresh period T _ driver;
acquiring a current servo bottom layer driving counter value Kq multiplied by T _ driver;
obtaining a next servo bottom layer drive counter value Kp multiplied by T _ driver;
judging whether the arrival time of the current sync0 synchronous signal is within a preset hysteresis time interval;
if the arrival time of the current sync0 synchronous signal is within a preset hysteresis time interval, setting a next servo bottom layer driving refreshing period as T _ driver;
if the arrival time of the current sync0 synchronization signal is not within the preset hysteresis time interval, adjusting the next servo bottom layer driving refreshing period to be T1_ driver according to the current servo bottom layer driving refreshing period T _ driver, the refreshing time N, the current servo bottom layer driving counter value Kq multiplied by T _ driver and the next servo bottom layer driving counter value Kp multiplied by T _ driver, so as to realize the EtherCAT communication synchronization.
Optionally, the method further comprises: and setting the refresh period of the servo bottom layer driving at the next time as T _ driver.
Optionally, the adjusting the next servo bottom layer driving refresh period to be T1_ driver according to the current servo bottom layer driving refresh period T _ driver, the refresh number N, the current servo bottom layer driving counter value Kq × T _ driver, and the next servo bottom layer driving counter value Kp × T _ driver includes: judging that the arrival time of the sync signal of the next sync0 is at the position of the current sync period value T _ sync 0; if the arrival time of the sync signal of the next sync0 is in the former half period of the current sync period value T _ sync0, T1_ driver = T _ driver + (1-Kp + Kq) × T _ driver/N; if the arrival time of the sync signal of the next sync0 is not in the previous half period of the current sync period value T _ sync0, T1_ driver = T _ driver + (Kq-Kp) × T _ driver/N.
Optionally, the hysteresis time interval is between 0.7-0.9.
In a second aspect, an embodiment of the disclosure of the present invention further provides an EtherCAT communication synchronization apparatus, including:
a synchronization signal period obtaining module for obtaining a synchronization period value T _ sync0 of the sync signal of sync 0;
the driver refreshing cycle acquiring module is used for acquiring a current servo bottom layer driving refreshing cycle T _ driver;
the refresh frequency acquisition module is used for calculating the refresh times N in the sync period of the sync signal of the sync0 according to the sync period value T _ sync0 of the sync signal of the sync0 and the current servo bottom layer driving refresh period T _ driver;
the current driver value acquisition module is used for acquiring a current servo bottom layer drive counter value KqXT _ driver;
the next driver value acquisition module is used for acquiring a next servo bottom layer drive counter value Kp multiplied by T _ driver;
the time interval judging module is used for judging whether the arrival time of the current sync0 synchronous signal is within a preset hysteresis time interval;
the first next driving period determining module is used for setting the next servo bottom layer driving refreshing period as T _ driver if the arrival time of the current sync0 synchronization signal is within a preset hysteresis time interval;
and the second next driving period determining module is used for adjusting the next servo bottom layer driving refreshing period to be T1_ driver according to the current servo bottom layer driving refreshing period T _ driver, the refreshing frequency N, the current servo bottom layer driving counter value Kq multiplied by T _ driver and the next servo bottom layer driving counter value Kp multiplied by T _ driver if the arrival time of the current sync signal of sync0 is not within a preset hysteresis time interval, so as to realize the EtherCAT communication synchronization.
Optionally, the data collector is an open source data collection agent telegraff based on plug-in drive; telegraf software is deployed in the video service platform.
Optionally, the method further comprises: and the next and later drive refreshing period setting module is used for setting the next and later servo bottom layer drive refreshing period as T _ driver.
Optionally, the second next driving period determining module includes:
a synchronous signal position judgment submodule for judging the position of the arrival time of the next sync0 synchronous signal at the current sync period value T _ sync 0;
a first next synchronization period resetting sub-module, configured to, if the arrival time of the next sync0 sync signal is within the previous half period of the current sync period value T _ sync0, T1_ driver = T _ driver + (1-Kp + Kq) × T _ driver/N;
and the second next synchronization period resetting sub-module is used for T1_ driver = T _ driver + (Kq-Kp) × T _ driver/N if the arrival time of the synchronization signal of the next sync0 is not in the former half period of the current synchronization period value T _ sync 0.
Optionally, the hysteresis time interval is between 0.7-0.9.
In a third aspect, an embodiment of the present disclosure further provides a computer device, including: a processor, a memory and a bus, the memory storing machine-readable instructions executable by the processor, the processor and the memory communicating via the bus when the computer device is running, the machine-readable instructions when executed by the processor performing the steps of the first aspect described above, or any possible implementation of the first aspect.
In a fourth aspect, the disclosed embodiments of the present invention further provide a computer-readable storage medium, where a computer program is stored on the computer-readable storage medium, and the computer program is executed by a processor to perform the steps in the first aspect or any possible implementation manner of the first aspect.
The technical scheme provided by the embodiment of the invention has the following beneficial effects:
synchronous period data and a main control cycle are obtained through EtherCAT communication, and are synchronized with SYNC0 synchronous signal signals through simple operation; the method has the advantages that the servo bottom layer drive refreshing period can not be interrupted when data are received, the SYNC0 synchronous signal synchronous interruption is firstly entered, the servo bottom layer drive refreshing period in the synchronous period is finely adjusted, the arrival time of the SYNC0 synchronous signal can be quickly locked, synchronization is realized when the SYNC0 synchronous signal arrives next time, the original preset servo bottom layer drive refreshing period is recovered, the time interval of 877 times can be preset, namely, in a certain time range, the line synchronization process is not needed, the CPU calculation time is saved, and the calculation force is saved.
It is to be understood that both the foregoing general description and the following detailed description are exemplary and explanatory only and are not restrictive of the invention, as claimed.
Drawings
In order to more clearly illustrate the embodiments of the present invention or the technical solutions in the prior art, the drawings used in the description of the embodiments or the prior art will be briefly described below, and it is obvious that the drawings in the following description are some embodiments of the present invention, and other drawings can be obtained by those skilled in the art without creative efforts.
Fig. 1 shows a flowchart of an EtherCAT communication synchronization method according to an embodiment of the present disclosure;
fig. 2 is a flowchart illustrating another EtherCAT communication synchronization method according to the embodiment of the disclosure;
FIGS. 3, 4, and 5 show timing diagrams of synchronization signals in accordance with disclosed embodiments of the invention;
fig. 6 shows a schematic structural diagram of an EtherCAT communication synchronization apparatus according to an embodiment of the present disclosure;
fig. 7 shows a schematic structural diagram of a computer device according to an embodiment of the disclosure.
Detailed Description
Reference will now be made in detail to the exemplary embodiments, examples of which are illustrated in the accompanying drawings. When the following description refers to the accompanying drawings, like numbers in different drawings represent the same or similar elements unless otherwise indicated. The embodiments described in the following exemplary embodiments do not represent all embodiments consistent with the present invention. Rather, they are merely examples of apparatus and methods consistent with certain aspects of the invention, as detailed in the appended claims.
Example 1
As shown in fig. 1, a flow chart of an EtherCAT communication synchronization method provided in the embodiment of the present disclosure includes:
s11: obtaining a synchronization period value T _ sync0 of a sync signal of sync 0;
s12: acquiring a current servo bottom layer drive refreshing period T _ driver;
s13: calculating the refresh times N in the sync period of the sync signal of the sync0 according to the sync period value T _ sync0 of the sync signal of the sync0 and the current servo bottom layer driving refresh period T _ driver;
s14: acquiring a current servo bottom layer driving counter value Kq multiplied by T _ driver;
s15: obtaining a next servo bottom layer drive counter value Kp multiplied by T _ driver;
s16: judging whether the arrival time of the current sync0 synchronous signal is in a preset hysteresis time interval, if so, executing a step S17, and if not, executing a step S18;
s17: setting a drive refreshing period of a servo bottom layer at the next time as T _ driver;
s18: and adjusting the next servo bottom layer drive refresh period to be T1_ driver according to the current servo bottom layer drive refresh period T _ driver, the refresh frequency N, the current servo bottom layer drive counter value Kq multiplied by T _ driver and the next servo bottom layer drive counter value Kp multiplied by T _ driver so as to realize the EtherCAT communication synchronization.
It can be understood that, in the technical solution provided in this embodiment, the synchronous period data and the master control cycle period are obtained through EtherCAT communication, and are synchronized with the sync signal of sync0 through simple operation; the received data can not interrupt the refreshing period of the servo bottom layer drive, the arrival time of the sync signal of sync0 can be quickly locked by entering the sync signal of sync0 for the first time to be synchronously interrupted and finely adjusting the refreshing period of the servo bottom layer drive in the synchronizing period, the synchronization is realized when the sync signal of sync0 arrives next time, the original preset refreshing period of the servo bottom layer drive is recovered, the time interval of 877 times can be preset, namely, in a certain time range, the line synchronization process is not needed, the CPU calculation time is saved, and the calculation force is saved.
Example 2
As shown in fig. 2, another flow chart of an EtherCAT communication synchronization method according to an embodiment of the present disclosure includes:
s21: acquiring a synchronization period value T _ sync0 of a sync signal of sync 0;
s22: acquiring a current servo bottom layer drive refreshing period T _ driver;
s23: calculating the refresh times N in the sync period of the sync signal of the sync0 according to the sync period value T _ sync0 of the sync signal of the sync0 and the current servo bottom layer driving refresh period T _ driver;
s24: acquiring a current servo bottom layer driving counter value Kq multiplied by T _ driver;
as shown in FIG. 3, the Q time is the arrival time of sync0 sync signal, Kq × T _ driver servo bottom layer driving counter value; time P is the arrival time of the sync signal of the next sync0, Kp multiplied by T _ driver servo bottom layer driving counter value.
It should be noted that Kq represents the arrival time of the sync signal, and is also the ratio of the bottom-layer driving refresh counter value to the bottom-layer driving refresh period at the arrival time of the sync signal; kq T _ driver represents that Kq is multiplied by a bottom layer driving refreshing period, and represents the bottom layer driving refreshing counter value at the arrival time of the sync synchronous signal; kp represents the arrival time of the next sync signal, and is also the ratio of the bottom layer driving refreshing counter value to the bottom layer driving refreshing period at the arrival time of the next sync signal; kp and T _ driver represent Kp multiplied by the bottom layer driving refreshing period, and represent that the bottom layer driving refreshing counter value at the arrival time of the next sync signal should meet 0< = Kq < Kp < = 1.
S25: obtaining a next servo bottom layer drive counter value Kp multiplied by T _ driver;
s26: judging whether the arrival time of the current sync0 synchronous signal is in a preset hysteresis time interval, if so, executing a step S27, and if not, executing a step S28; the bottom layer drives the refresh counter value to reach the hysteresis time interval, and the SYNC synchronous signal arrives at the moment, so that the calculation of the synchronous process is not carried out, and the calculation force is saved.
S27: setting a drive refreshing period of a next servo bottom layer as T _ driver;
s28: and adjusting the next servo bottom layer drive refresh period to be T1_ driver according to the current servo bottom layer drive refresh period T _ driver, the refresh frequency N, the current servo bottom layer drive counter value Kq multiplied by T _ driver and the next servo bottom layer drive counter value Kp multiplied by T _ driver so as to realize the EtherCAT communication synchronization.
S29: and setting the refresh period of the servo bottom layer driving at the next time as T _ driver.
In a specific implementation, as shown by a dotted line in fig. 2, the step S28 of adjusting the next servo bottom layer driving refresh period to be T1_ driver according to the current servo bottom layer driving refresh period T _ driver, the refresh number N, the current servo bottom layer driving counter value Kq × T _ driver, and the next servo bottom layer driving counter value Kp × T _ driver includes:
s281: judging that the arrival time of the next sync0 sync signal is at the position of the current sync period value T _ sync0, if the arrival time of the next sync0 sync signal is in the previous half period of the current sync period value T _ sync0, executing step S282, and if the arrival time of the next sync0 sync signal is not in the previous half period of the current sync period value T _ sync0, executing step S283;
s282: adjusting a next servo bottom layer driving refreshing period T1_ driver = T _ driver + (1-Kp + Kq) × T _ driver/N;
as shown in fig. 4, when 0< Kq < = 0.5; and a new servo bottom layer drive refreshing period T1_ driver = T _ driver + (1-Kp + Kq) × T _ driver/N, and the servo bottom layer drive refreshing period recovers T _ driver after the arrival of a sync signal of the next sync 0.
S283: and adjusting the next servo bottom layer driving refreshing period T1_ driver = T _ driver + (Kq-Kp) × T _ driver/N.
As shown in fig. 5, when 0.5< = Kq < Kp < = 1; and a new servo bottom layer drive refreshing period T1_ driver = T _ driver + (Kq-Kp) × T _ driver/N, and the servo bottom layer drive refreshing period recovers T _ driver after the synchronization signal of the next sync0 arrives.
In particular practice, the hysteresis time interval is between 0.7 and 0.9.
It can be understood that, in the technical solution provided in this embodiment, the synchronous period data and the master control cycle period are obtained through EtherCAT communication, and are synchronized with the sync signal of sync0 through simple operation; the received data can not interrupt the refreshing period of the servo bottom layer drive, the arrival time of the sync signal of sync0 can be quickly locked by entering the sync signal of sync0 for the first time to be synchronously interrupted and finely adjusting the refreshing period of the servo bottom layer drive in the synchronizing period, the synchronization is realized when the sync signal of sync0 arrives next time, the original preset refreshing period of the servo bottom layer drive is recovered, the time interval of 877 times can be preset, namely, in a certain time range, the line synchronization process is not needed, the CPU calculation time is saved, and the calculation force is saved.
Example 3
As shown in fig. 6, an embodiment of the present invention further provides an EtherCAT communication synchronization apparatus, including:
a synchronization signal period obtaining module 61, configured to obtain a synchronization period value T _ sync0 of the sync signal of sync 0;
a driver refresh period obtaining module 62, configured to obtain a current servo bottom layer drive refresh period T _ driver;
a refresh frequency obtaining module 63, configured to calculate a refresh frequency N in a sync period of the sync signal of the sync0 according to the sync period value T _ sync0 of the sync signal of the sync0 and the current servo bottom layer driving refresh period T _ driver;
a current driver value obtaining module 64, configured to obtain a current servo bottom layer drive counter value Kq × T _ driver;
a next driver value obtaining module 65, configured to obtain a next servo bottom layer drive counter value Kp × T _ driver;
the time interval judging module 66 is used for judging whether the arrival time of the current sync0 synchronization signal is within a preset hysteresis time interval;
a first next driving period determining module 67, configured to set a next servo bottom layer driving refresh period to T _ driver if the arrival time of the current sync0 synchronization signal is within a preset hysteresis time interval;
and a second next driving period determining module 68, configured to adjust a next servo bottom layer driving refresh period to be T1_ driver according to the current servo bottom layer driving refresh period T _ driver, the refresh frequency N, the current servo bottom layer driving counter value Kq × T _ driver, and the next servo bottom layer driving counter value Kp × T _ driver if the arrival time of the current sync signal sync0 is not within the preset hysteresis time interval, so as to implement EtherCAT communication synchronization.
In a particular practice, as shown in phantom in fig. 3, the apparatus further comprises:
and a next subsequent driving refresh period setting module 69, configured to set the next subsequent servo bottom layer driving refresh period as T _ driver.
In particular practice, as shown by the dashed line in fig. 6, the second next driving period determining module 68 may include:
a synchronous signal position judgment submodule for judging the position of the arrival time of the next sync0 synchronous signal at the current sync period value T _ sync 0;
a first next synchronization period resetting sub-module, configured to, if the arrival time of the next sync0 sync signal is within the previous half period of the current sync period value T _ sync0, T1_ driver = T _ driver + (1-Kp + Kq) × T _ driver/N;
and the second next synchronization period resetting sub-module is used for T1_ driver = T _ driver + (Kq-Kp) × T _ driver/N if the arrival time of the synchronization signal of the next sync0 is not in the former half period of the current synchronization period value T _ sync 0.
It can be understood that, in the technical solution provided in this embodiment, the synchronous period data and the master control cycle period are obtained through EtherCAT communication, and are synchronized with the sync signal of sync0 through simple operation; the received data can not interrupt the refreshing period of the servo bottom layer drive, the arrival time of the sync signal of sync0 can be quickly locked by entering the sync signal of sync0 for the first time to be synchronously interrupted and finely adjusting the refreshing period of the servo bottom layer drive in the synchronizing period, the synchronization is realized when the sync signal of sync0 arrives next time, the original preset refreshing period of the servo bottom layer drive is recovered, the lag time interval of 877 can be preset, namely, in a certain time range, the synchronization process is not needed, the CPU calculation time is saved, and the calculation force is saved.
Example 4
Based on the same technical concept, an embodiment of the present application further provides a computer device, which includes a memory 1 and a processor 2, as shown in fig. 7, where the memory 1 stores a computer program, and the processor 2 implements the EtherCAT communication synchronization method described in any one of the above when executing the computer program.
The memory 1 includes at least one type of readable storage medium, which includes a flash memory, a hard disk, a multimedia card, a card type memory (e.g., SD or DX memory, etc.), a magnetic memory, a magnetic disk, an optical disk, and the like. The memory 1 may in some embodiments be an internal storage unit of the OTT video traffic monitoring system, e.g. a hard disk. The memory 1 may also be an external storage device of the OTT video service monitoring system in other embodiments, such as a plug-in hard disk, a Smart Media Card (SMC), a Secure Digital (SD) Card, a Flash memory Card (Flash Card), and the like. Further, the memory 1 may also include both an internal storage unit and an external storage device of the OTT video service monitoring system. The memory 1 may be used to store not only application software installed in the OTT video service monitoring system and various data, such as codes of OTT video service monitoring programs, but also temporarily store data that has been output or is to be output.
The processor 2 may be a Central Processing Unit (CPU), a controller, a microcontroller, a microprocessor or other data Processing chip in some embodiments, and is used to run program codes stored in the memory 1 or process data, for example, execute an OTT video service monitoring program.
It can be understood that, in the technical solution provided in this embodiment, the synchronization period data and the master control cycle period are obtained through EtherCAT communication, and are synchronized with the sync signal of sync0 through simple operation; the received data can not interrupt the refreshing period of the servo bottom layer drive, the arrival time of the sync signal of sync0 can be quickly locked by entering the sync signal of sync0 for the first time to be synchronously interrupted and finely adjusting the refreshing period of the servo bottom layer drive in the synchronizing period, the synchronization is realized when the sync signal of sync0 arrives next time, the original preset refreshing period of the servo bottom layer drive is recovered, the time interval of 877 times can be preset, namely, in a certain time range, the line synchronization process is not needed, the CPU calculation time is saved, and the calculation force is saved.
The embodiment of the disclosure of the present invention further provides a computer-readable storage medium, where a computer program is stored on the computer-readable storage medium, and when the computer program is executed by a processor, the steps of the EtherCAT communication synchronization method in the above method embodiment are executed. The storage medium may be a volatile or non-volatile computer-readable storage medium.
The computer program product of the EtherCAT communication synchronization method provided in the embodiments disclosed in the present invention includes a computer readable storage medium storing a program code, where instructions included in the program code may be used to execute the steps of the EtherCAT communication synchronization method described in the embodiments of the above method, which may be referred to in the embodiments of the above method specifically, and are not described herein again.
The embodiments disclosed herein also provide a computer program, which when executed by a processor implements any one of the methods of the preceding embodiments. The computer program product may be embodied in hardware, software or a combination thereof. In an alternative embodiment, the computer program product is embodied in a computer storage medium, and in another alternative embodiment, the computer program product is embodied in a Software product, such as a Software Development Kit (SDK), or the like.
It is understood that the same or similar parts in the above embodiments may be mutually referred to, and the same or similar contents in other embodiments may be referred to for the contents which are not described in detail in some embodiments.
It should be noted that the terms "first," "second," and the like in the description of the present invention are used for descriptive purposes only and are not to be construed as indicating or implying relative importance. Further, in the description of the present invention, the meaning of "a plurality" means at least two unless otherwise specified.
Any process or method descriptions in flow charts or otherwise described herein may be understood as representing modules, segments, or portions of code which include one or more executable instructions for implementing specific logical functions or steps of the process, and alternate implementations are included within the scope of the preferred embodiment of the present invention in which functions may be executed out of order from that shown or discussed, including substantially concurrently or in reverse order, depending on the functionality involved, as would be understood by those reasonably skilled in the art of the present invention.
It should be understood that portions of the present invention may be implemented in hardware, software, firmware, or a combination thereof. In the above embodiments, various steps or methods may be implemented in software or firmware stored in a memory and executed by a suitable instruction execution system. For example, if implemented in hardware, as in another embodiment, any one or combination of the following techniques, which are known in the art, may be used: a discrete logic circuit having a logic gate circuit for implementing a logic function on a data signal, an application specific integrated circuit having an appropriate combinational logic gate circuit, a Programmable Gate Array (PGA), a Field Programmable Gate Array (FPGA), or the like.
It will be understood by those skilled in the art that all or part of the steps carried by the method for implementing the above embodiments may be implemented by hardware related to instructions of a program, which may be stored in a computer readable storage medium, and when the program is executed, the program includes one or a combination of the steps of the method embodiments.
In addition, functional units in the embodiments of the present invention may be integrated into one processing module, or each unit may exist alone physically, or two or more units are integrated into one module. The integrated module can be realized in a hardware mode, and can also be realized in a software functional module mode. The integrated module, if implemented in the form of a software functional module and sold or used as a separate product, may also be stored in a computer-readable storage medium.
The storage medium mentioned above may be a read-only memory, a magnetic or optical disk, etc.
In the description herein, references to the description of the term "one embodiment," "some embodiments," "an example," "a specific example," or "some examples," etc., mean that a particular feature, structure, material, or characteristic described in connection with the embodiment or example is included in at least one embodiment or example of the invention. In this specification, the schematic representations of the terms used above do not necessarily refer to the same embodiment or example. Furthermore, the particular features, structures, materials, or characteristics described may be combined in any suitable manner in any one or more embodiments or examples.
Although embodiments of the present invention have been shown and described above, it is understood that the above embodiments are exemplary and should not be construed as limiting the present invention, and that variations, modifications, substitutions and alterations can be made to the above embodiments by those of ordinary skill in the art within the scope of the present invention.

Claims (10)

1. An EtherCAT communication synchronization method is characterized by comprising the following steps:
acquiring a synchronization period value T _ sync0 of a sync signal of sync 0;
acquiring a current servo bottom layer drive refreshing period T _ driver;
calculating the refresh times N in the sync period of the sync signal of the sync0 according to the sync period value T _ sync0 of the sync0 sync signal and the current servo bottom layer driving refresh period T _ driver;
acquiring a current servo bottom layer driving counter value Kq multiplied by T _ driver;
obtaining a next servo bottom layer drive counter value Kp multiplied by T _ driver;
judging whether the arrival time of the current sync0 synchronization signal is within a preset hysteresis time interval;
if the arrival time of the current sync0 synchronous signal is within a preset hysteresis time interval, setting a next servo bottom layer driving refreshing period as T _ driver;
if the arrival time of the current sync0 synchronization signal is not within the preset hysteresis time interval, adjusting the next servo bottom layer drive refresh period to be T1_ driver according to the current servo bottom layer drive refresh period T _ driver, the refresh frequency N, the current servo bottom layer drive counter value Kq multiplied by T _ driver and the next servo bottom layer drive counter value Kp multiplied by T _ driver, so as to realize the EtherCAT communication synchronization.
2. The EtherCAT communication synchronization method according to claim 1, further comprising:
and setting the refresh period of the servo bottom layer driving at the next time as T _ driver.
3. The EtherCAT communication synchronization method according to claim 2, wherein the adjusting the servo bottom layer driving refresh period to T1_ driver according to the current servo bottom layer driving refresh period T _ driver, the refresh number N, the current servo bottom layer driving counter value Kq × T _ driver, and the next servo bottom layer driving counter value Kp × T _ driver comprises:
judging that the arrival time of the sync signal of the next sync0 is at the position of the current sync period value T _ sync 0;
if the arrival time of the sync signal of the next sync0 is in the former half period of the current sync period value T _ sync0, T1_ driver = T _ driver + (1-Kp + Kq) × T _ driver/N;
if the arrival time of the sync signal of the next sync0 is not in the previous half period of the current sync period value T _ sync0, T1_ driver = T _ driver + (Kq-Kp) × T _ driver/N.
4. The EtherCAT communication synchronization method according to claim 3, wherein the hysteresis time interval is between 0.7 and 0.9.
5. An EtherCAT communication synchronizer, comprising:
a synchronization signal period obtaining module for obtaining a synchronization period value T _ sync0 of the sync signal of sync 0;
the driver refreshing cycle acquiring module is used for acquiring a current servo bottom layer driving refreshing cycle T _ driver;
the refresh frequency acquisition module is used for calculating the refresh times N in the sync period of the sync signal of the sync0 according to the sync period value T _ sync0 of the sync signal of the sync0 and the current servo bottom layer driving refresh period T _ driver;
the current driver value acquisition module is used for acquiring a current servo bottom layer drive counter value KqXT _ driver;
the next driver value acquisition module is used for acquiring a next servo bottom layer drive counter value Kp multiplied by T _ driver;
the time interval judging module is used for judging whether the arrival time of the current sync0 synchronous signal is within a preset hysteresis time interval;
the first next driving period determining module is used for setting the next servo bottom layer driving refreshing period as T _ driver if the arrival time of the current sync0 synchronization signal is within a preset hysteresis time interval;
and the second next driving period determining module is used for adjusting the next servo bottom layer driving refreshing period to be T1_ driver according to the current servo bottom layer driving refreshing period T _ driver, the refreshing time N, the current servo bottom layer driving counter value KqxT _ driver and the next servo bottom layer driving counter value KpXT _ driver if the arrival time of the current sync signal sync0 is not within a preset hysteresis time interval, so as to realize the EtherCAT communication synchronization.
6. The EtherCAT communication synchronizer according to claim 5, further comprising:
and the next and later drive refreshing period setting module is used for setting the next and later servo bottom layer drive refreshing period as T _ driver.
7. The EtherCAT communication synchronizer according to claim 6, wherein the second next driving cycle determining module comprises:
a synchronous signal position judgment submodule for judging the position of the arrival time of the next sync0 synchronous signal at the current sync period value T _ sync 0;
a first next synchronization period resetting sub-module, configured to, if the arrival time of the next sync0 sync signal is within the previous half period of the current sync period value T _ sync0, T1_ driver = T _ driver + (1-Kp + Kq) × T _ driver/N;
and the second next synchronization period resetting sub-module is used for T1_ driver = T _ driver + (Kq-Kp) × T _ driver/N if the arrival time of the synchronization signal of the next sync0 is not in the former half period of the current synchronization period value T _ sync 0.
8. The EtherCAT communication synchronizer according to claim 7 wherein the hysteresis time interval is between 0.7 and 0.9.
9. A computer device, comprising: a processor, a memory and a bus, the memory storing machine readable instructions executable by the processor, the processor and the memory communicating over the bus when a computer device is running, the machine readable instructions when executed by the processor performing the EtherCAT communication synchronization method of any one of claims 1 to 4.
10. A computer-readable storage medium, having stored thereon a computer program which, when executed by a processor, performs the EtherCAT communication synchronization method according to any one of claims 1 to 4.
CN202210582505.8A 2022-05-26 2022-05-26 EtherCAT communication synchronization method and device Active CN114679249B (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN202210582505.8A CN114679249B (en) 2022-05-26 2022-05-26 EtherCAT communication synchronization method and device

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN202210582505.8A CN114679249B (en) 2022-05-26 2022-05-26 EtherCAT communication synchronization method and device

Publications (2)

Publication Number Publication Date
CN114679249A true CN114679249A (en) 2022-06-28
CN114679249B CN114679249B (en) 2022-09-02

Family

ID=82081086

Family Applications (1)

Application Number Title Priority Date Filing Date
CN202210582505.8A Active CN114679249B (en) 2022-05-26 2022-05-26 EtherCAT communication synchronization method and device

Country Status (1)

Country Link
CN (1) CN114679249B (en)

Cited By (1)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN117707100A (en) * 2024-02-06 2024-03-15 深圳市杰美康机电有限公司 EtherCAT bus driving controller and synchronous control method thereof

Citations (7)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US20130141812A1 (en) * 2011-12-06 2013-06-06 Guzik Technical Enterprises Write clock synchronization appartus for magnetic recording disk drives with patterned media
CN105024777A (en) * 2015-07-29 2015-11-04 上海新时达电气股份有限公司 Servo driver synchronized method based on Ether CAT real-time Ethernet
CN107229240A (en) * 2017-06-13 2017-10-03 华南理工大学 A kind of multi-axis synchronized control apparatus and method based on EtherCAT
CN109947030A (en) * 2019-04-12 2019-06-28 南京埃斯顿自动化股份有限公司 The method in dynamic following EtherCat bus synchronous period in servo internal control period
CN111818127A (en) * 2020-06-11 2020-10-23 苏州伟创电气科技股份有限公司 Data synchronization method and device
CN112600640A (en) * 2020-12-29 2021-04-02 上海节卡机器人科技有限公司 Synchronization method, device and equipment of servo drive equipment and storage medium
CN114095304A (en) * 2022-01-24 2022-02-25 深圳市山龙智控有限公司 Inter-node synchronous precision compensation method and system based on EtherCAT bus

Patent Citations (8)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US20130141812A1 (en) * 2011-12-06 2013-06-06 Guzik Technical Enterprises Write clock synchronization appartus for magnetic recording disk drives with patterned media
CN105024777A (en) * 2015-07-29 2015-11-04 上海新时达电气股份有限公司 Servo driver synchronized method based on Ether CAT real-time Ethernet
CN107229240A (en) * 2017-06-13 2017-10-03 华南理工大学 A kind of multi-axis synchronized control apparatus and method based on EtherCAT
CN109947030A (en) * 2019-04-12 2019-06-28 南京埃斯顿自动化股份有限公司 The method in dynamic following EtherCat bus synchronous period in servo internal control period
WO2020206808A1 (en) * 2019-04-12 2020-10-15 南京埃斯顿自动化股份有限公司 Method for enabling servo internal control cycle to dynamically follow ethercat bus synchronization cycle
CN111818127A (en) * 2020-06-11 2020-10-23 苏州伟创电气科技股份有限公司 Data synchronization method and device
CN112600640A (en) * 2020-12-29 2021-04-02 上海节卡机器人科技有限公司 Synchronization method, device and equipment of servo drive equipment and storage medium
CN114095304A (en) * 2022-01-24 2022-02-25 深圳市山龙智控有限公司 Inter-node synchronous precision compensation method and system based on EtherCAT bus

Non-Patent Citations (1)

* Cited by examiner, † Cited by third party
Title
党选举等: "EtherCAT从站设计及精确时钟同步技术研究", 《测控技术》 *

Cited By (2)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN117707100A (en) * 2024-02-06 2024-03-15 深圳市杰美康机电有限公司 EtherCAT bus driving controller and synchronous control method thereof
CN117707100B (en) * 2024-02-06 2024-04-19 深圳市杰美康机电有限公司 EtherCAT bus driving controller and synchronous control method thereof

Also Published As

Publication number Publication date
CN114679249B (en) 2022-09-02

Similar Documents

Publication Publication Date Title
CN105024777B (en) Servo-driver synchronous method based on EtherCAT real-time ethernets
US7995620B2 (en) Method and data transmission system for transferring data between the data transmission system and a host processor of a participant in a data transmission system
US7898987B2 (en) Method and device for the exchange of data between at least two users connected to a bus system
US8321612B2 (en) Method and device for synchronizing two bus systems by transmission of a time associated trigger signal from one system to another
CN114679249B (en) EtherCAT communication synchronization method and device
JP6523497B1 (en) Master controller and synchronous communication system using the same
JP6404975B2 (en) Slave, serial communication system, and communication method of serial communication system
US7721030B2 (en) Method and device for connecting sensors or actuators to a bus system
CN106533399B (en) Circuit and method for modifying clock signal and device for executing time-sensitive task
CN105049309A (en) Servo driver synchronization method based on POWERLINK real-time Ethernet
CN107402534B (en) Adjusting method, EtherCAT main station and computer readable storage medium
EP3361635B1 (en) Control system and pulse output device
KR101589227B1 (en) Method and apparatus for controlling synchronization of camera shutter in in-vehicle Ethernet communication network
KR102291573B1 (en) Synchronization method and system among multiple MCUs in EtherCAT-based slave system
CN102013967A (en) 1588 protocol-based beidou time synchronization device and application thereof
CN109117395B (en) Microcomputer
US10606225B2 (en) Motor drive system, motor control system, and self-propelled robot
US20120106334A1 (en) Asynchronous logic circuit, congestion avoiding path calculation module, semiconductor circuit, and path calculation method in asynchronous logic circuit
US9742966B2 (en) Data processing system
WO2017203776A1 (en) Motor drive system, motor control system, and self-propelled robot
CN116318508A (en) EtherCAT slave station servo synchronization device, etherCAT slave station servo synchronization method, electronic equipment and storage medium
CN109444529B (en) Current sampling method and servo driver based on sigma delta type ADC
CN116015523A (en) Time synchronization method and device and electronic equipment
CN113890171A (en) Method for realizing inversion carrier synchronization of UPS parallel operation system
JP4019840B2 (en) Network communication system and control processing system using the network communication system

Legal Events

Date Code Title Description
PB01 Publication
PB01 Publication
SE01 Entry into force of request for substantive examination
SE01 Entry into force of request for substantive examination
GR01 Patent grant
GR01 Patent grant