[go: up one dir, main page]

CN118611810A - Synchronous processing method, device and electronic device based on data interface - Google Patents

Synchronous processing method, device and electronic device based on data interface Download PDF

Info

Publication number
CN118611810A
CN118611810A CN202410704307.3A CN202410704307A CN118611810A CN 118611810 A CN118611810 A CN 118611810A CN 202410704307 A CN202410704307 A CN 202410704307A CN 118611810 A CN118611810 A CN 118611810A
Authority
CN
China
Prior art keywords
timestamp
data packet
data
control field
bit
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.)
Pending
Application number
CN202410704307.3A
Other languages
Chinese (zh)
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.)
Lenovo Beijing Ltd
Original Assignee
Lenovo Beijing 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 Lenovo Beijing Ltd filed Critical Lenovo Beijing Ltd
Priority to CN202410704307.3A priority Critical patent/CN118611810A/en
Publication of CN118611810A publication Critical patent/CN118611810A/en
Pending legal-status Critical Current

Links

Classifications

    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04JMULTIPLEX COMMUNICATION
    • H04J3/00Time-division multiplex systems
    • H04J3/02Details
    • H04J3/06Synchronising arrangements
    • H04J3/0635Clock or time synchronisation in a network
    • H04J3/0638Clock or time synchronisation among nodes; Internode synchronisation

Landscapes

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

Abstract

本公开提供了一种基于数据接口的同步处理方法。第一设备通过数据接口与多个第二设备通信,其中,第一设备运行有多个主时钟程序,该方法包括:向至少一个第二设备发送第一时间信息和第二时间信息,其中,第一时间信息表征主时钟程序发送第一数据包至数据接口的时刻,第二时间信息表征第二设备发送第一同步数据包至数据接口的时刻。根据第一时间信息和第二时间信息,对多个第二设备进行时钟同步。其中,数据接口用于识别第一数据包中的控制字段,或者增加控制字段到第一同步数据包,得到第二数据包。控制字段用于控制数据接口对第一数据包和第二数据包进行打时间戳,以及记录第二设备的端口地址。

The present disclosure provides a synchronization processing method based on a data interface. A first device communicates with multiple second devices through a data interface, wherein the first device runs multiple master clock programs, and the method includes: sending first time information and second time information to at least one second device, wherein the first time information represents the moment when the master clock program sends a first data packet to the data interface, and the second time information represents the moment when the second device sends a first synchronization data packet to the data interface. Clock synchronization is performed on multiple second devices according to the first time information and the second time information. The data interface is used to identify a control field in a first data packet, or to add a control field to a first synchronization data packet to obtain a second data packet. The control field is used to control the data interface to timestamp the first data packet and the second data packet, and to record the port address of the second device.

Description

基于数据接口的同步处理方法、装置和电子设备Synchronous processing method, device and electronic device based on data interface

技术领域Technical Field

本公开涉及时钟同步技术领域,尤其涉及一种基于数据接口的同步处理方法、装置和电子设备。The present disclosure relates to the technical field of clock synchronization, and in particular to a synchronization processing method, device and electronic device based on a data interface.

背景技术Background Art

在数字通信网中,数据通信设备通过信号发送端在发送数字脉冲信号时将脉冲放在特定的时隙中,而接收端要能够在特定的时隙将该脉冲提取出来,以保证发送端和接收端正常通信。信号发送端和接收端的时钟保持一致,是双方能正常准确通讯的前提条件。In a digital communication network, data communication equipment places pulses in specific time slots when sending digital pulse signals through the signal transmitter, and the receiver must be able to extract the pulses in specific time slots to ensure normal communication between the transmitter and the receiver. Keeping the clocks of the signal transmitter and the receiver consistent is a prerequisite for normal and accurate communication between the two parties.

然而,在当前的时钟同步过程中,主时钟设备和从时钟设备是绑定独立的网络接口进行工作的。在报文多播的场景下,共用一个网络接口时难以确定目标设备。However, in the current clock synchronization process, the master clock device and the slave clock device are bound to independent network interfaces to work. In the scenario of message multicast, it is difficult to determine the target device when sharing a network interface.

发明内容Summary of the invention

本公开的一个方面提供了一种基于数据接口的同步处理方法,第一设备通过数据接口与多个第二设备通信,其中,第一设备运行有多个主时钟程序,方法包括:向至少一个第二设备发送第一时间信息和第二时间信息,其中,第一时间信息表征主时钟程序发送第一数据包至数据接口的时刻,第二时间信息表征第二设备发送第一同步数据包至数据接口的时刻。根据第一时间信息和第二时间信息,对多个第二设备进行时钟同步。其中,数据接口用于识别第一数据包中的控制字段,或者增加控制字段到第一同步数据包,得到第二数据包。控制字段用于控制数据接口对第一数据包和第二数据包进行打时间戳,以及记录第二设备的端口地址。One aspect of the present disclosure provides a synchronization processing method based on a data interface, wherein a first device communicates with multiple second devices via a data interface, wherein the first device runs multiple master clock programs, and the method comprises: sending first time information and second time information to at least one second device, wherein the first time information represents the moment when the master clock program sends a first data packet to the data interface, and the second time information represents the moment when the second device sends a first synchronization data packet to the data interface. Clock synchronization is performed on multiple second devices according to the first time information and the second time information. The data interface is used to identify a control field in a first data packet, or to add a control field to a first synchronization data packet to obtain a second data packet. The control field is used to control the data interface to timestamp the first data packet and the second data packet, and to record the port address of the second device.

可选地,数据接口为硬件接口,用于对数据包进行时间戳打戳,向至少一个第二设备发送第一时间信息和第二时间信息包括:响应于识别第一数据包的第一控制字段,在第一数据包的第二同步数据包中插入第一时间戳。根据端口地址,将包含第一时间戳的第二同步数据包发送到多个第二设备中的至少一个。响应于增加第二控制字段到第一同步数据包,在第二控制字段中插入第二时间戳。以及根据端口地址,将包含第二时间戳的第二同步数据包发送到多个第二设备中的至少一个。Optionally, the data interface is a hardware interface for timestamping the data packet, and sending the first time information and the second time information to the at least one second device comprises: in response to identifying the first control field of the first data packet, inserting the first time stamp in a second synchronization data packet of the first data packet. According to the port address, sending the second synchronization data packet containing the first time stamp to at least one of the plurality of second devices. In response to adding the second control field to the first synchronization data packet, inserting the second time stamp in the second control field. And sending the second synchronization data packet containing the second time stamp to at least one of the plurality of second devices according to the port address.

可选地,采用精确时间协议对第一设备和第二设备进行时钟同步,第一数据包包括事件报文和通用报文。Optionally, a precision time protocol is used to synchronize the clocks of the first device and the second device, and the first data packet includes an event message and a general message.

可选地,通用报文不包括跟随报文。Optionally, the general message does not include a following message.

可选地,第一控制字段包括时间戳插入位、时间戳操作位和时间戳保存位,响应于识别第一数据包的第一控制字段,在第一数据包的第二同步数据包中插入第一时间戳包括:在通用报文不包括跟随报文的情况下,响应于识别事件报文的第一控制字段,将时间戳插入位与时间戳操作位置位,并插入第一时间戳到事件报文的第二同步数据包。或者在通用报文包括跟随报文的情况下,响应于识别事件报文的第一控制字段,将时间戳保存位与时间戳操作位置位,并将第一时间戳保存到寄存器。响应于发送跟随报文,从寄存器中读取第一时间戳,并插入第一时间戳到跟随报文的第二同步数据包。Optionally, the first control field includes a timestamp insertion bit, a timestamp operation bit, and a timestamp storage bit. In response to identifying the first control field of the first data packet, inserting the first timestamp in the second synchronization data packet of the first data packet includes: in the case where the general message does not include a follow-up message, in response to identifying the first control field of the event message, setting the timestamp insertion bit and the timestamp operation bit, and inserting the first timestamp into the second synchronization data packet of the event message. Or in the case where the general message includes a follow-up message, in response to identifying the first control field of the event message, setting the timestamp storage bit and the timestamp operation bit, and saving the first timestamp to a register. In response to sending the follow-up message, reading the first timestamp from the register, and inserting the first timestamp into the second synchronization data packet of the follow-up message.

可选地,第二控制字段包括时间戳接收位,响应于增加第二控制字段到第一同步数据包,在第二控制字段中插入第二时间戳包括:响应于增加第二控制字段到第一同步数据包,将时间戳接收位与时间戳操作位置位,并插入第二时间戳到第二控制字段。Optionally, the second control field includes a timestamp reception bit, and in response to adding the second control field to the first synchronization data packet, inserting the second timestamp in the second control field includes: in response to adding the second control field to the first synchronization data packet, setting the timestamp reception bit and the timestamp operation bit, and inserting the second timestamp into the second control field.

可选地,控制字段包括数据方向位、通道ID位、数据类型位和备用位。其中,数据方向位用于控制第一数据包和第二数据包的传输方向。通道ID位用于记录端口地址。数据类型位用于限制与第一数据包以及第二数据包相对应的网络类型。以及备用位用于数据扩充或数据对齐。Optionally, the control field includes a data direction bit, a channel ID bit, a data type bit, and a spare bit. The data direction bit is used to control the transmission direction of the first data packet and the second data packet. The channel ID bit is used to record the port address. The data type bit is used to limit the network type corresponding to the first data packet and the second data packet. And the spare bit is used for data expansion or data alignment.

可选地,通过FPGA在第二同步数据包中插入第一时间戳,以及在第二控制字段中插入第二时间戳。Optionally, a first timestamp is inserted into the second synchronization data packet and a second timestamp is inserted into the second control field through the FPGA.

本公开的另一个方面提供了一种基于数据接口的同步处理装置,第一设备通过数据接口与多个第二设备通信,其中,第一设备运行有多个主时钟程序,装置包括:发送模块,用于向至少一个第二设备发送第一时间信息和第二时间信息,其中,第一时间信息表征主时钟程序发送第一数据包至数据接口的时刻,第二时间信息表征第二设备发送第一同步数据包至数据接口的时刻。标定模块,用于根据第一时间信息和第二时间信息,对多个第二设备进行时钟同步。其中,数据接口用于识别第一数据包中的控制字段,或者增加控制字段到第一同步数据包,得到第二数据包。控制字段用于控制数据接口对第一数据包和第二数据包进行打时间戳,以及记录第二设备的端口地址。Another aspect of the present disclosure provides a synchronization processing device based on a data interface, wherein a first device communicates with multiple second devices through a data interface, wherein the first device runs multiple master clock programs, and the device includes: a sending module, used to send first time information and second time information to at least one second device, wherein the first time information represents the moment when the master clock program sends a first data packet to the data interface, and the second time information represents the moment when the second device sends a first synchronization data packet to the data interface. A calibration module, used to perform clock synchronization on multiple second devices according to the first time information and the second time information. The data interface is used to identify a control field in a first data packet, or to add a control field to a first synchronization data packet to obtain a second data packet. The control field is used to control the data interface to timestamp the first data packet and the second data packet, and to record the port address of the second device.

本公开的另一方面提供了一种电子设备,包括:一个或多个处理器。存储器,用于存储一个或多个程序,其中,当一个或多个程序被一个或多个处理器执行时,使得一个或多个处理器执行上述任一项所述的基于数据接口的同步处理方法。Another aspect of the present disclosure provides an electronic device, comprising: one or more processors; and a memory for storing one or more programs, wherein when the one or more programs are executed by the one or more processors, the one or more processors execute any one of the above-mentioned synchronization processing methods based on the data interface.

附图说明BRIEF DESCRIPTION OF THE DRAWINGS

通过以下参照附图对本公开实施例的描述,本公开的上述以及其他目的、特征和优点将更为清楚,在附图中:The above and other objects, features and advantages of the present disclosure will become more apparent through the following description of the embodiments of the present disclosure with reference to the accompanying drawings, in which:

图1示意性示出了根据本公开实施例的基于数据接口的同步处理方法的应用场景图;FIG1 schematically shows an application scenario diagram of a synchronization processing method based on a data interface according to an embodiment of the present disclosure;

图2示意性示出了根据本公开实施例的基于数据接口的同步处理方法的流程图;FIG2 schematically shows a flow chart of a synchronization processing method based on a data interface according to an embodiment of the present disclosure;

图3示意性示出了根据本公开实施例的向第二设备发送时间信息的方法流程图;FIG3 schematically shows a flow chart of a method for sending time information to a second device according to an embodiment of the present disclosure;

图4示意性示出了根据本公开实施例的插入第一时间戳的方法流程图;FIG4 schematically shows a flow chart of a method for inserting a first timestamp according to an embodiment of the present disclosure;

图5示意性示出了根据本公开实施例的发送方向数据包的格式图;FIG5 schematically shows a format diagram of a data packet in a sending direction according to an embodiment of the present disclosure;

图6示意性示出了根据本公开实施例的插入第二时间戳的方法流程图;FIG6 schematically shows a flow chart of a method for inserting a second timestamp according to an embodiment of the present disclosure;

图7示意性示出了根据本公开实施例的接收方向数据包的格式图;FIG7 schematically shows a format diagram of a receiving direction data packet according to an embodiment of the present disclosure;

图8示意性示出了根据本公开实施例的收发数据包的流程图;FIG8 schematically shows a flow chart of sending and receiving data packets according to an embodiment of the present disclosure;

图9示意性示出了根据本公开实施例的基于数据接口的同步处理装置的结构框图;FIG9 schematically shows a structural block diagram of a synchronization processing device based on a data interface according to an embodiment of the present disclosure;

图10示意性示出了根据本公开实施例的适于实现基于数据接口的同步处理方法的电子设备的方框图。FIG10 schematically shows a block diagram of an electronic device suitable for implementing a synchronization processing method based on a data interface according to an embodiment of the present disclosure.

具体实施方式DETAILED DESCRIPTION

以下,将参照附图来描述本公开的实施例。但是应该理解,这些描述只是示例性的,而并非要限制本公开的范围。此外,在以下说明中,省略了对公知结构和技术的描述,以避免不必要地混淆本公开的概念。Hereinafter, embodiments of the present disclosure will be described with reference to the accompanying drawings. However, it should be understood that these descriptions are exemplary only and are not intended to limit the scope of the present disclosure. In addition, in the following description, descriptions of well-known structures and technologies are omitted to avoid unnecessary confusion of the concepts of the present disclosure.

在此使用的术语仅仅是为了描述具体实施例,而并非意在限制本公开。在此使用的术语“包括”、“包含”等表明了所述特征、步骤、操作和/或部件的存在,但是并不排除存在或添加一个或多个其他特征、步骤、操作或部件。The terms used herein are only for describing specific embodiments and are not intended to limit the present disclosure. The terms "include", "comprising", etc. used herein indicate the existence of the features, steps, operations and/or components, but do not exclude the existence or addition of one or more other features, steps, operations or components.

在此使用的所有术语(包括技术和科学术语)具有本领域技术人员通常所理解的含义,除非另外定义。应注意,这里使用的术语应解释为具有与本说明书的上下文相一致的含义,而不应以理想化或过于刻板的方式来解释。All terms (including technical and scientific terms) used herein have the meanings commonly understood by those skilled in the art unless otherwise defined. It should be noted that the terms used herein should be interpreted as having a meaning consistent with the context of this specification and should not be interpreted in an idealized or overly rigid manner.

附图中示出了一些方框图和/或流程图。应理解,方框图和/或流程图中的一些方框或其组合可以由计算机程序指令来实现。这些计算机程序指令可以提供给通用计算机、专用计算机或其他可编程数据处理装置的处理器,从而这些指令在由该处理器执行时可以创建用于实现这些方框图和/或流程图中所说明的功能/操作的装置。Some block diagrams and/or flow charts are shown in the accompanying drawings. It should be understood that some blocks or combinations thereof in the block diagrams and/or flow charts may be implemented by computer program instructions. These computer program instructions may be provided to a processor of a general-purpose computer, a special-purpose computer, or other programmable data processing device, so that these instructions, when executed by the processor, may create a device for implementing the functions/operations described in these block diagrams and/or flow charts.

因此,本公开的技术可以硬件和/或软件(包括固件、微代码等)的形式来实现。另外,本公开的技术可以采取存储有指令的计算机可读介质上的计算机程序产品的形式,该计算机程序产品可供指令执行系统使用或者结合指令执行系统使用。在本公开的上下文中,计算机可读介质可以是能够包含、存储、传送、传播或传输指令的任意介质。例如,计算机可读介质可以包括但不限于电、磁、光、电磁、红外或半导体系统、装置、器件或传播介质。计算机可读介质的具体示例包括:磁存储装置,如磁带或硬盘(HDD);光存储装置,如光盘(CD-ROM);存储器,如随机存取存储器(RAM)或闪存;和/或有线/无线通信链路。Therefore, the technology of the present disclosure can be implemented in the form of hardware and/or software (including firmware, microcode, etc.). In addition, the technology of the present disclosure can take the form of a computer program product on a computer-readable medium storing instructions, which can be used by an instruction execution system or in combination with an instruction execution system. In the context of the present disclosure, a computer-readable medium can be any medium that can contain, store, transmit, propagate, or transmit instructions. For example, a computer-readable medium can include, but is not limited to, an electrical, magnetic, optical, electromagnetic, infrared, or semiconductor system, device, device, or propagation medium. Specific examples of computer-readable media include: magnetic storage devices, such as magnetic tape or hard disk (HDD); optical storage devices, such as compact disk (CD-ROM); memory, such as random access memory (RAM) or flash memory; and/or wired/wireless communication links.

本公开的实施例提供了一种用于时钟同步的基于数据接口的同步处理方法。该方法包括向至少一个第二设备发送第一时间信息和第二时间信息,其中,第一时间信息表征主时钟程序发送第一数据包至数据接口的时刻,第二时间信息表征第二设备发送第一同步数据包至数据接口的时刻。根据第一时间信息和第二时间信息,对多个第二设备进行时钟同步。通过在第一同步数据包的前面增加记录有第二设备端口地址的控制字段,可以在多个第二设备共用网络接口的情况下,准确地将数据包发送到相应的第二设备,大大简化了网络连接关系。An embodiment of the present disclosure provides a data interface-based synchronization processing method for clock synchronization. The method includes sending first time information and second time information to at least one second device, wherein the first time information represents the moment when the master clock program sends a first data packet to the data interface, and the second time information represents the moment when the second device sends a first synchronization data packet to the data interface. Based on the first time information and the second time information, clock synchronization is performed on multiple second devices. By adding a control field recording the port address of the second device in front of the first synchronization data packet, the data packet can be accurately sent to the corresponding second device when multiple second devices share a network interface, which greatly simplifies the network connection relationship.

图1示意性示出了根据本公开实施例的基于数据接口的同步处理方法的应用场景图。FIG1 schematically shows an application scenario diagram of a synchronization processing method based on a data interface according to an embodiment of the present disclosure.

如图1所示,根据该实施例的应用场景100可以包括第一设备101,第一网络接口102,第二设备103、104、105和第二网络接口106、107、108。第一设备101例如为主时钟设备,包含多个主时钟程序1011、1012、1013,每个主时钟程序均可以独立作为时钟源对第二设备103、104、105进行时钟同步。As shown in Fig. 1, the application scenario 100 according to this embodiment may include a first device 101, a first network interface 102, second devices 103, 104, 105 and second network interfaces 106, 107, 108. The first device 101 is, for example, a master clock device, including multiple master clock programs 1011, 1012, 1013, each of which can independently serve as a clock source to synchronize the clocks of the second devices 103, 104, 105.

主时钟设备例如可以是硬件时钟服务器、软件时钟服务器和分布式时钟系统等。主时钟程序例如可以是支持NTP(网络时间协议)协议和PTP(精确时间协议)协议的程序。可以使用多个NTP或PTP服务器组成时钟集群,并使用特定的算法(如最佳主时钟算法)来选择最可靠和准确的时间源。此外,还可以实施心跳检测和故障切换机制,以确保在主时钟设备出现故障时,备用设备能够迅速接管并提供时间服务。The master clock device can be, for example, a hardware clock server, a software clock server, and a distributed clock system. The master clock program can be, for example, a program that supports the NTP (Network Time Protocol) protocol and the PTP (Precision Time Protocol) protocol. Multiple NTP or PTP servers can be used to form a clock cluster, and a specific algorithm (such as the best master clock algorithm) can be used to select the most reliable and accurate time source. In addition, heartbeat detection and failover mechanisms can be implemented to ensure that when the master clock device fails, the backup device can quickly take over and provide time services.

第二设备103、104、105例如为从时钟设备,可以是网络从时钟(如路由器、交换机、服务器等)、设备内置从时钟(如计算机、智能手机、平板电脑等)、专用从时钟设备(如在工业自动化系统中,可能需要使用具有高精度时间同步功能的从时钟设备来确保各个传感器、执行器等设备之间的时间一致性)和由多个从时钟设备组成的分布式从时钟系统。The second devices 103, 104, 105 are, for example, slave clock devices, which may be network slave clocks (such as routers, switches, servers, etc.), device built-in slave clocks (such as computers, smart phones, tablet computers, etc.), dedicated slave clock devices (such as in industrial automation systems, it may be necessary to use slave clock devices with high-precision time synchronization functions to ensure time consistency between various sensors, actuators and other devices) and distributed slave clock systems composed of multiple slave clock devices.

第一网络接口102和第二网络接口106、107、108,例如可以通过FPGA对第一设备101和第二设备103、104、105之间的数据包进行打时间戳,也可以采用其他设备,如网络接口卡(NIC),网络监控器、网络分析器等来对第一设备101和第二设备103、104、105之间的数据包进行打时间戳。其中,第一设备101和第二设备103、104、105之间的相关数据包中例如包含有目标端口地址和控制打时间戳操作的控制字段。FPGA或其他设备通过识别该控制字段来对经过的数据包打时间戳,并将其发送到目标设备。The first network interface 102 and the second network interface 106, 107, 108 can, for example, use an FPGA to timestamp the data packets between the first device 101 and the second devices 103, 104, 105, or other devices such as a network interface card (NIC), a network monitor, a network analyzer, etc. can be used to timestamp the data packets between the first device 101 and the second devices 103, 104, 105. Among them, the relevant data packets between the first device 101 and the second devices 103, 104, 105, for example, include a target port address and a control field for controlling the timestamping operation. The FPGA or other device timestamps the passing data packets by identifying the control field and sends them to the target device.

首先,对本公开实施例的相关名词术语作如下解释:First, the related terms of the embodiments of the present disclosure are explained as follows:

HPS(High Performance Switch)是一种高性能交换机,具有高速数据传输、低延迟、高可靠性等特点,常用于大规模数据中心、云计算、高性能计算等领域。HPS (High Performance Switch) is a high-performance switch with the characteristics of high-speed data transmission, low latency, and high reliability. It is often used in large-scale data centers, cloud computing, high-performance computing and other fields.

SFP(Small Form-factor Pluggable)是一种小型可插拔光模块,常用于光纤通信网络中。SFP模块是一种独立的标准封装,可以插入到交换机或其他设备的光纤模块插槽中,实现高速数据传输。SFP (Small Form-factor Pluggable) is a small pluggable optical module commonly used in fiber optic communication networks. The SFP module is an independent standard package that can be inserted into the fiber optic module slot of a switch or other device to achieve high-speed data transmission.

GMII(Gigabit Media Independent Interface)是一种以太网物理层接口规范,用于连接以太网物理层设备(如网卡)和以太网控制器。GMII采用8位并行数据传输方式,数据传输速率高达1000Mbps,支持全双工模式,可同时进行接收和发送数据。GMII定义了数据接口和物理接口两个方面的规范,其中数据接口包括数据线和控制线,用于传输数据和控制信号;物理接口包括TX(发送)和RX(接收)数据线、时钟线以及电源线等。通过GMII接口,以太网控制器可以与物理层设备进行高速数据传输,实现网络通信。GMII (Gigabit Media Independent Interface) is an Ethernet physical layer interface specification used to connect Ethernet physical layer devices (such as network cards) and Ethernet controllers. GMII uses 8-bit parallel data transmission, with a data transmission rate of up to 1000Mbps, supports full-duplex mode, and can receive and send data at the same time. GMII defines specifications for both data interface and physical interface. The data interface includes data lines and control lines for transmitting data and control signals; the physical interface includes TX (transmit) and RX (receive) data lines, clock lines, and power lines. Through the GMII interface, the Ethernet controller can perform high-speed data transmission with the physical layer device to achieve network communication.

Netlink是Linux中实现内核与用户空间通信的一种方法,数据以类似网络数据包的形式在两者间传输。它是一种异步全双工的通信方式,支持由内核态主动发起通信,内核为Netlink通信提供了一组特殊的API接口,用户态则基于socket API,内核发送的数据会保存在接收进程socket的接收缓存中,由接收进程处理。Netlink is a method for implementing communication between the kernel and user space in Linux. Data is transmitted between the two in the form of network packets. It is an asynchronous full-duplex communication method that supports active communication initiated by the kernel state. The kernel provides a set of special API interfaces for Netlink communication, and the user state is based on the socket API. The data sent by the kernel will be saved in the receiving process socket's receiving buffer and processed by the receiving process.

Ethernet包是用于在局域网中传输数据的包格式。它由一系列字段组成,包括目标地址、源地址、协议类型、数据等。Ethernet包的目标地址是数据包的目标MAC地址,源地址是数据包的源MAC地址,协议类型字段表示上层协议的类型,数据字段包含传输层和应用层的数据。The Ethernet packet is a packet format used to transmit data in a local area network. It consists of a series of fields, including the destination address, source address, protocol type, data, etc. The destination address of the Ethernet packet is the destination MAC address of the data packet, the source address is the source MAC address of the data packet, the protocol type field indicates the type of the upper layer protocol, and the data field contains the data of the transport layer and the application layer.

FPGA是Field Programmable Gate Array的简称,即现场可编程门阵列,它是在PAL、GAL、EPLD等可编程器件的基础上进一步发展的产物。它是作为专用集成电路(ASIC)领域中的一种半定制电路而出现的,既解决了定制电路的不足,又克服了原有可编程器件门电路有限的缺点。FPGA is the abbreviation of Field Programmable Gate Array, which is a further development of programmable devices such as PAL, GAL, EPLD, etc. It appears as a semi-custom circuit in the field of application-specific integrated circuits (ASICs), which not only solves the shortcomings of custom circuits, but also overcomes the shortcomings of limited gate circuits of original programmable devices.

以下将基于图1描述的场景,通过图2~图8对公开实施例的基于数据接口的同步处理方法进行详细描述。Based on the scenario described in FIG. 1 , the synchronization processing method based on the data interface of the disclosed embodiment will be described in detail below through FIGS. 2 to 8 .

图2示意性示出了根据本公开实施例的基于数据接口的同步处理方法的流程图。FIG2 schematically shows a flow chart of a synchronization processing method based on a data interface according to an embodiment of the present disclosure.

根据本公开的实施例,第一设备通过数据接口与多个第二设备通信,其中,第一设备运行有多个主时钟程序,如图2所示,该实施例的基于数据接口的同步处理方法例如包括操作S210~S220。According to an embodiment of the present disclosure, a first device communicates with multiple second devices via a data interface, wherein the first device runs multiple master clock programs, as shown in FIG. 2 . The synchronization processing method based on the data interface of this embodiment, for example, includes operations S210 to S220.

在操作S210,向至少一个第二设备发送第一时间信息和第二时间信息,其中,第一时间信息表征主时钟程序发送第一数据包至数据接口的时刻,第二时间信息表征第二设备发送第一同步数据包至数据接口的时刻。In operation S210, first time information and second time information are sent to at least one second device, wherein the first time information represents the moment when the master clock program sends a first data packet to the data interface, and the second time information represents the moment when the second device sends a first synchronization data packet to the data interface.

在操作S220,根据第一时间信息和第二时间信息,对多个第二设备进行时钟同步。其中,数据接口用于识别第一数据包中的控制字段,或者增加控制字段到第一同步数据包,得到第二数据包。控制字段用于控制数据接口对第一数据包和第二数据包进行打时间戳,以及记录第二设备的端口地址。In operation S220, clock synchronization is performed on multiple second devices according to the first time information and the second time information. The data interface is used to identify a control field in the first data packet, or to add a control field to the first synchronization data packet to obtain a second data packet. The control field is used to control the data interface to timestamp the first data packet and the second data packet, and to record the port address of the second device.

在一些实施例中,可以基于以太网的数据接口进行同步处理。In some embodiments, the synchronization process may be performed based on an Ethernet data interface.

例如,第一设备是一个数据中心的主服务器,它运行着两个主时钟程序:时钟A和时钟B。这台主服务器通过以太网接口与多个第二设备(如服务器、存储设备等)相连。For example, the first device is a main server in a data center, which runs two main clock programs: clock A and clock B. The main server is connected to multiple second devices (such as servers, storage devices, etc.) through an Ethernet interface.

发送时间信息:Sending time information:

时钟A在发送一个数据包到以太网接口(即第一网络接口)时,记录当前的时间戳t1(表征主时钟程序发送第一数据包至数据接口的时刻)。When sending a data packet to the Ethernet interface (ie, the first network interface), clock A records the current timestamp t 1 (indicating the time when the master clock program sends the first data packet to the data interface).

同时,当某个第二设备(如服务器S1)响应时钟A的请求,并发送一个同步数据包回以太网接口时,该接口识别到这是一个同步数据包,并记录当前的时间戳t4(表征第二设备发送第一同步数据包至数据接口的时刻)。At the same time, when a second device (such as server S1) responds to the request of clock A and sends a synchronization data packet back to the Ethernet interface, the interface recognizes that this is a synchronization data packet and records the current timestamp t4 (indicating the time when the second device sends the first synchronization data packet to the data interface).

时间戳和端口记录:Timestamp and port number:

以太网接口在数据包中识别或增加控制字段,该控制字段由特定的位组合表示,用于指示接口需要为数据包打时间戳。The Ethernet interface recognizes or adds a control field in the data packet, which is represented by a specific bit combination and is used to indicate that the interface needs to timestamp the data packet.

当数据包通过以太网接口时,接口不仅为数据包打上时间戳,还记录发送或接收该数据包的第二设备的MAC地址或IP地址,这些信息可以视为端口地址的替代。When a data packet passes through an Ethernet interface, the interface not only timestamps the data packet, but also records the MAC address or IP address of the second device that sends or receives the data packet. This information can be considered as a substitute for the port address.

时钟同步:Clock synchronization:

第二设备收集多次第一设备发送的同步数据包及其对应的时间戳信息。The second device collects synchronization data packets sent by the first device multiple times and their corresponding timestamp information.

使用这些时间戳信息,第二设备可以计算出网络延迟和时钟偏移,并据此调整时钟,实现与第一设备的时钟同步。Using these timestamp information, the second device can calculate the network delay and clock offset, and adjust the clock accordingly to achieve synchronization with the clock of the first device.

需要说明的是,在第一设备发送数据包到第二设备的网络接口(即第二网络接口)时,第二网络接口也会对到达的数据包打时间戳t2,以及第二设备向第一设备发送的数据包到达第二网络接口时,第二网络接口也会对到达的数据包打时间戳t3。第二设备根据t1、t2、t3、t4可以计算出网络延迟和时钟偏移,并据此调整时钟,实现与第一设备的时钟同步。由于t2、t3为第二设备自行记录的,因而不在上述操作中提出。It should be noted that when the first device sends a data packet to the network interface of the second device (i.e., the second network interface), the second network interface will also timestamp the arriving data packet with t 2 , and when the data packet sent by the second device to the first device arrives at the second network interface, the second network interface will also timestamp the arriving data packet with t 3 . The second device can calculate the network delay and clock offset based on t 1 , t 2 , t 3 , and t 4 , and adjust the clock accordingly to achieve clock synchronization with the first device. Since t 2 and t 3 are recorded by the second device itself, they are not mentioned in the above operation.

本公开的方法还可以基于串行接口进行数据同步。The method disclosed in the present invention can also perform data synchronization based on a serial interface.

在另一个场景中,第一设备例如是一个工业控制设备,它使用串行接口(如RS-485)与多个传感器和其他设备相连。In another scenario, the first device is, for example, an industrial control device that is connected to a plurality of sensors and other devices using a serial interface (eg, RS-485).

发送时间信息:Sending time information:

类似地,主时钟程序在发送数据到串行接口时记录时间戳t1,当接收到来自第二设备(如传感器S2)的同步数据包时,串行接口记录时间戳t4Similarly, the master clock program records a timestamp t 1 when sending data to the serial interface, and the serial interface records a timestamp t 4 when receiving a synchronization data packet from a second device (eg, sensor S2 ).

时间戳和端口记录:Timestamp and port number:

串行接口通过特定的控制信号或协议字段来识别同步数据包,并在数据包的开始或结束处打上时间戳。The serial interface identifies the synchronization data packet through specific control signals or protocol fields and timestamps the beginning or end of the data packet.

由于串行接口通常没有直接的端口地址概念,它可能使用设备的ID或序列号作为标识。Since a serial interface usually has no direct concept of a port address, it may use the device's ID or serial number as identification.

时钟同步:Clock synchronization:

第二设备收集时间戳信息,并据此调整为与第一设备的时钟同步。The second device collects the timestamp information and adjusts accordingly to synchronize with the clock of the first device.

以上两个实施例展示了基于不同数据接口的同步处理方法。无论是以太网接口还是串行接口,都包括发送时间信息、在数据接口处打时间戳和记录设备标识、以及利用这些信息来实现时钟同步。这种方法可以确保在多设备环境中时间的一致性,对于需要高精度时间同步的应用(如金融交易、网络通信、工业自动化等)尤为重要。The above two embodiments demonstrate synchronization processing methods based on different data interfaces. Whether it is an Ethernet interface or a serial interface, it includes sending time information, stamping timestamps and recording device identification at the data interface, and using this information to achieve clock synchronization. This method can ensure the consistency of time in a multi-device environment, which is particularly important for applications that require high-precision time synchronization (such as financial transactions, network communications, industrial automation, etc.).

除了包括上文参考图2描述的操作S210~S220之外,该实施例的方法例如还包括操作S311~S314。为了描述的简洁起见,这里省略对操作S210~S220的描述,后续相关方法实施例以此类推,不再赘述。In addition to operations S210 to S220 described above with reference to Fig. 2, the method of this embodiment also includes operations S311 to S314. For the sake of brevity, the description of operations S210 to S220 is omitted here, and the subsequent related method embodiments are similar and will not be repeated.

图3示意性示出了根据本公开实施例的向第二设备发送时间信息的方法流程图。FIG3 schematically shows a flow chart of a method for sending time information to a second device according to an embodiment of the present disclosure.

根据本公开的实施例,数据接口为硬件接口,用于对数据包进行时间戳打戳,如图3所示,例如通过操作S311~S314来向至少一个第二设备发送第一时间信息和第二时间信息。According to an embodiment of the present disclosure, the data interface is a hardware interface for timestamping a data packet, as shown in FIG. 3 , for example, by operating S311 to S314 to send first time information and second time information to at least one second device.

在操作S311,响应于识别第一数据包的第一控制字段,在第一数据包的第二同步数据包中插入第一时间戳。In operation S311, in response to identifying a first control field of a first data packet, a first time stamp is inserted into a second synchronization data packet of the first data packet.

在操作S312,根据端口地址,将包含第一时间戳的第二同步数据包发送到多个第二设备中的至少一个。In operation S312, a second synchronization data packet including a first timestamp is sent to at least one of the plurality of second devices according to the port address.

在操作S313,响应于增加第二控制字段到第一同步数据包,在第二控制字段中插入第二时间戳。以及In operation S313, in response to adding the second control field to the first synchronization data packet, inserting a second timestamp into the second control field.

在操作S314,根据端口地址,将包含第二时间戳的第二同步数据包发送到多个第二设备中的至少一个。In operation S314, a second synchronization data packet including a second timestamp is sent to at least one of the plurality of second devices according to the port address.

在一些实施例中,例如有一个主时钟设备(第一设备),它通过网络向多个从时钟设备(第二设备)同步时间。主时钟设备定期发送数据包,这些数据包包含时间同步所需的信息。In some embodiments, for example, there is a master clock device (first device) that synchronizes time to multiple slave clock devices (second devices) via a network. The master clock device periodically sends data packets that contain information required for time synchronization.

主时钟设备在发送的数据包中包含一个特定的控制字段,该字段用于标识这是一个时间同步数据包。例如,在第一数据包中,控制字段可能是一个特定的比特位或字节序列,如0x1234,表示这是一个时间同步请求。The master clock device includes a specific control field in the data packet sent, which is used to identify that this is a time synchronization data packet. For example, in the first data packet, the control field may be a specific bit or byte sequence, such as 0x1234, indicating that this is a time synchronization request.

当主时钟设备识别到第一数据包的控制字段时,它会在该数据包的后续部分(例如,第二同步数据包)中插入当前的时间戳。例如,如果第一数据包是一个TCP或UDP数据包,它可能包含多个段或数据块。主时钟设备在第二同步数据包(可能是该数据包的负载部分)中插入一个精确到微秒或纳秒的时间戳。When the master-clock device recognizes the control field of the first packet, it inserts the current timestamp in the subsequent portion of the packet (e.g., the second synchronization packet). For example, if the first packet is a TCP or UDP packet, it may contain multiple segments or blocks of data. The master-clock device inserts a timestamp with microsecond or nanosecond accuracy in the second synchronization packet (which may be the payload portion of the packet).

主时钟设备知道哪些从时钟设备需要接收时间同步信息,并根据这些信息将数据包发送到相应的端口或地址。例如,主时钟设备有一个从时钟设备的列表和它们各自的IP地址或MAC地址。它使用网络层(如IP层)和数据链路层(如以太网层)的功能将包含时间戳的数据包发送到这些设备的指定端口。The master clock device knows which slave clock devices need to receive time synchronization information, and sends data packets to the corresponding ports or addresses based on this information. For example, the master clock device has a list of slave clock devices and their respective IP addresses or MAC addresses. It uses the functions of the network layer (such as the IP layer) and the data link layer (such as the Ethernet layer) to send data packets containing timestamps to the specified ports of these devices.

在某些情况下,主时钟设备可能需要发送额外的同步信息或确认。它可以在从时钟设备返回的同步数据包中添加一个新的控制字段,并在这个字段中插入一个新的时间戳。例如,主时钟设备可能决定在发送了包含第一时间戳的数据包后,再发送一个包含确认或额外同步信息的数据包。这个新的数据包有一个不同的控制字段(如0x5678),并在其中插入了一个新的时间戳。In some cases, the master-clock device may need to send additional synchronization information or acknowledgments. It can do this by adding a new control field to the synchronization packet sent back from the slave-clock device and inserting a new timestamp in this field. For example, the master-clock device may decide to send a packet containing an acknowledgment or additional synchronization information after sending the packet containing the first timestamp. This new packet has a different control field (such as 0x5678) and a new timestamp inserted in it.

与发送第一时间戳类似,主时钟设备将包含新时间戳的数据包发送到需要它的从时钟设备。例如,主时钟设备使用网络协议和地址信息将包含新时间戳的确认数据包发送到从时钟设备。Similar to sending the first timestamp, the master-clock device sends a data packet containing the new timestamp to the slave-clock device that needs it. For example, the master-clock device sends an acknowledgment data packet containing the new timestamp to the slave-clock device using a network protocol and address information.

在这个示例中,详细描述了主时钟设备如何通过网络向从时钟设备发送时间同步信息。这包括在数据包中识别控制字段、插入时间戳、以及根据设备的地址信息发送数据包。通过这种方法,主时钟设备可以确保从时钟设备具有准确和同步的时间信息。In this example, it is described in detail how a master-clock device sends time synchronization information to a slave-clock device over a network. This includes identifying the control field in the data packet, inserting a timestamp, and sending the data packet based on the device's address information. In this way, the master-clock device can ensure that the slave-clock device has accurate and synchronized time information.

根据本公开的实施例,采用精确时间协议对第一设备和第二设备进行时钟同步,第一数据包包括事件报文和通用报文。According to an embodiment of the present disclosure, a precision time protocol is used to perform clock synchronization on a first device and a second device, and a first data packet includes an event message and a general message.

在一些实施例中,当采用精确时间协议(Precision Time Protocol, PTP)对第一设备(主时钟设备)和第二设备(从时钟设备)进行时钟同步时,控制字段和报文的使用在同步过程中起着关键作用。以下是一个基于PTP的同步方法的具体实施例。In some embodiments, when the Precision Time Protocol (PTP) is used to synchronize the clocks of a first device (master clock device) and a second device (slave clock device), the use of control fields and messages plays a key role in the synchronization process. The following is a specific embodiment of a synchronization method based on PTP.

在PTP中,有两种主要的报文类型:事件报文(Event Messages)和通用报文(General Messages)。事件报文用于时间戳的生成和传输,而通用报文则用于管理、配置和同步过程中的其他通信。In PTP, there are two main message types: Event Messages and General Messages. Event Messages are used for timestamp generation and transmission, while General Messages are used for management, configuration, and other communications during synchronization.

主时钟设备发送Sync报文到从时钟设备。Sync报文是PTP中的一个关键事件报文,用于触发从时钟设备上的时间戳记录。Sync报文包含了一个特定的控制字段,用于指定目标从时钟设备,以及在Sync报文中插入时间戳。当Sync报文到达从时钟设备时,从时钟设备在其数据接口处记录接收Sync报文的时间戳t2The master clock device sends a Sync message to the slave clock device. The Sync message is a key event message in PTP, which is used to trigger the timestamp recording in the slave clock device. The Sync message contains a specific control field, which is used to specify the target slave clock device and insert the timestamp in the Sync message. When the Sync message arrives at the slave clock device, the slave clock device records the timestamp t 2 of receiving the Sync message at its data interface.

在发送Sync报文之后,主时钟设备立即发送一个Follow_Up报文,其中包含Sync报文发送时的时间戳t1。这个报文是通用报文,用于传输与事件报文相关的时间信息。Follow_Up报文包含了一个控制字段,用于指定目标从时钟设备,以及在Follow_Up报文中插入时间戳t1。相应的从时钟设备接收Follow_Up报文后,可以获取到t1时间戳。After sending the Sync message, the master clock device immediately sends a Follow_Up message, which contains the timestamp t 1 when the Sync message was sent. This message is a general message used to transmit time information related to the event message. The Follow_Up message contains a control field for specifying the target slave clock device and inserting the timestamp t 1 in the Follow_Up message. After receiving the Follow_Up message, the corresponding slave clock device can obtain the t 1 timestamp.

在从时钟设备记录t2时间戳之后,它发送一个Delay_Req报文到主时钟设备,并记录发出时的时间戳t3。这个报文是另一个事件报文,用于触发主时钟设备上的时间戳记录。Delay_Req报文在到达主时钟设备时,会在其前面加入特定的控制字段,用于指定目标主时钟程序,以及在Delay_Req报文中插入时间戳t4After the slave clock device records the timestamp t 2 , it sends a Delay_Req message to the master clock device and records the timestamp t 3 when it is sent. This message is another event message used to trigger the timestamp recording on the master clock device. When the Delay_Req message arrives at the master clock device, a specific control field is added to the front of it to specify the target master clock program and insert the timestamp t 4 in the Delay_Req message.

在接收到Delay_Req报文后,主时钟设备发送一个Delay_Resp报文,其中包含Delay_Req报文到达时的时间戳t4。这个报文是通用报文,用于将从时钟设备请求的时间信息返回。Delay_Resp报文包含了一个控制字段,用于指定目标从时钟设备,以及在Delay_Resp报文中插入时间戳t4。从时钟设备接收Delay_Resp报文后,可以获取到t4时间戳。After receiving the Delay_Req message, the master clock device sends a Delay_Resp message, which contains the timestamp t 4 when the Delay_Req message arrives. This message is a general message used to return the time information requested by the slave clock device. The Delay_Resp message contains a control field for specifying the target slave clock device and inserting the timestamp t 4 in the Delay_Resp message. After receiving the Delay_Resp message, the slave clock device can obtain the t 4 timestamp.

从时钟设备根据四个时间戳t1、t2、t3和t4可以计算与主时钟设备之间的时间偏移量和网络延迟。根据时间偏移量和网络延迟,从时钟设备可以调整其本地时钟以与主时钟设备同步。The slave clock device can calculate the time offset and network delay between the slave clock device and the master clock device according to the four timestamps t 1 , t 2 , t 3 and t 4. According to the time offset and network delay, the slave clock device can adjust its local clock to synchronize with the master clock device.

通过结合PTP的事件报文和通用报文,以及利用数据接口对控制字段的操作来确定目标从时钟设备和传输时间戳信息,主时钟设备和从时钟设备之间可以实现精确的时钟同步。这种方法确保了从时钟设备可以准确地知道何时接收到Sync报文,并据此调整其本地时钟,从而与主时钟设备保持同步。By combining PTP's event messages and general messages, and using the data interface to operate the control field to determine the target slave clock device and transmit timestamp information, accurate clock synchronization can be achieved between the master clock device and the slave clock device. This method ensures that the slave clock device can accurately know when the Sync message is received and adjust its local clock accordingly to keep in sync with the master clock device.

根据本公开的实施例,通用报文不包括跟随报文。According to an embodiment of the present disclosure, the general message does not include a follow-up message.

在一些实施例中,当采用精确时间协议(Precision Time Protocol, PTP)对第一设备(主时钟设备)和第二设备(从时钟设备)进行时钟同步时,还可以采用单步方式来进行时间同步。In some embodiments, when the Precision Time Protocol (PTP) is used to perform clock synchronization on a first device (master clock device) and a second device (slave clock device), a single-step method may also be used to perform time synchronization.

例如,主时钟设备向从时钟设备发送Sync报文。Sync报文包含一个特定的控制字段,用于指定目标从时钟设备,以及在Sync报文中插入时间戳。当Sync报文到达从时钟设备时,从时钟设备在其数据接口处记录接收Sync报文的时间戳t2For example, the master clock device sends a Sync message to the slave clock device. The Sync message contains a specific control field for specifying the target slave clock device and inserting a timestamp in the Sync message. When the Sync message arrives at the slave clock device, the slave clock device records the timestamp t 2 of receiving the Sync message at its data interface.

在发送Sync报文时,主时钟设备会记录其发送的时间戳t1。这个时间戳对于后续计算偏移量和延迟是必要的,而且它会被直接包含在Sync报文中发送到从时钟设备。When sending a Sync message, the master clock device records the timestamp t 1 it sends. This timestamp is necessary for the subsequent calculation of offset and delay, and it will be directly included in the Sync message and sent to the slave clock device.

在从时钟设备记录t2时间戳之后,它发送一个Delay_Req报文到主时钟设备,并记录发出时的时间戳t3。这个报文是另一个事件报文,用于触发主时钟设备上的时间戳记录。当Delay_Req报文到达主时钟设备时,会在其前面加入特定的控制字段,用于指定目标主时钟程序,以及在Delay_Req报文中插入时间戳t4After the slave clock device records the timestamp t 2 , it sends a Delay_Req message to the master clock device and records the timestamp t 3 when it is sent. This message is another event message that is used to trigger the timestamp recording on the master clock device. When the Delay_Req message arrives at the master clock device, a specific control field is added to the front of it to specify the target master clock program and insert the timestamp t 4 in the Delay_Req message.

主时钟设备在接收到Delay_Req报文后,发送一个Delay_Resp报文到从时钟设备,其中包含Delay_Req报文到达主时钟设备时的时间戳t4。这个报文是通用报文,用于将从时钟设备请求的时间信息返回。Delay_Resp报文包含了一个控制字段,用于指定目标从时钟设备,以及在Delay_Resp报文中插入时间戳t4。从时钟设备接收Delay_Resp报文后,可以获取到t4时间戳。After receiving the Delay_Req message, the master clock device sends a Delay_Resp message to the slave clock device, which contains the timestamp t 4 when the Delay_Req message arrives at the master clock device. This message is a general message used to return the time information requested by the slave clock device. The Delay_Resp message contains a control field for specifying the target slave clock device and inserting the timestamp t 4 in the Delay_Resp message. After receiving the Delay_Resp message, the slave clock device can obtain the t 4 timestamp.

从时钟设备根据四个时间戳t1、t2、t3和t4可以计算与主时钟设备之间的时间偏移量和网络延迟。根据时间偏移量和网络延迟,从时钟设备可以调整其本地时钟以与主时钟设备同步。The slave clock device can calculate the time offset and network delay between the slave clock device and the master clock device according to the four timestamps t 1 , t 2 , t 3 and t 4. According to the time offset and network delay, the slave clock device can adjust its local clock to synchronize with the master clock device.

尽管通用报文不包含跟随报文,但主时钟设备和从时钟设备仍然可以通过各自记录的时间戳,以及事件报文和通用报文的交换,来精确计算时间偏移量和网络延迟,从而实现时钟同步。这种方法充分利用了PTP协议的设计,确保了时钟同步的准确性和可靠性。Although the general message does not contain a follow-up message, the master clock device and the slave clock device can still accurately calculate the time offset and network delay through the timestamps recorded by each, as well as the exchange of event messages and general messages, thereby achieving clock synchronization. This method makes full use of the design of the PTP protocol to ensure the accuracy and reliability of clock synchronization.

图4示意性示出了根据本公开实施例的插入第一时间戳的方法流程图。图5示意性示出了根据本公开实施例的发送方向数据包的格式图。Fig. 4 schematically shows a flow chart of a method for inserting a first timestamp according to an embodiment of the present disclosure. Fig. 5 schematically shows a format diagram of a data packet in a sending direction according to an embodiment of the present disclosure.

根据本公开的实施例,第一控制字段包括时间戳插入位、时间戳操作位和时间戳保存位,如图4所示,例如通过操作S4111~S4113来响应于识别第一数据包的第一控制字段,在第一数据包的第二同步数据包中插入第一时间戳。According to an embodiment of the present disclosure, the first control field includes a timestamp insertion bit, a timestamp operation bit and a timestamp preservation bit, as shown in Figure 4. For example, through operations S4111~S4113, in response to identifying the first control field of the first data packet, the first timestamp is inserted into the second synchronization data packet of the first data packet.

在操作S4111,在通用报文不包括跟随报文的情况下,响应于识别事件报文的第一控制字段,将时间戳插入位与时间戳操作位置位,并插入第一时间戳到事件报文的第二同步数据包。或者In operation S4111, when the general message does not include a follow-up message, in response to identifying the first control field of the event message, the timestamp insertion bit and the timestamp operation bit are set, and the first timestamp is inserted into the second synchronization data packet of the event message.

在操作S4112,在通用报文包括跟随报文的情况下,响应于识别事件报文的第一控制字段,将时间戳保存位与时间戳操作位置位,并将第一时间戳保存到寄存器。In operation S4112, when the general message includes a follow-up message, in response to the first control field of the recognition event message, a timestamp preservation bit and a timestamp operation bit are set, and the first timestamp is saved in a register.

在操作S4113,响应于发送跟随报文,从寄存器中读取第一时间戳,并插入第一时间戳到跟随报文的第二同步数据包。In operation S4113, in response to sending the follow-up message, the first timestamp is read from the register and the first timestamp is inserted into the second synchronization data packet of the follow-up message.

在一些实施例中,有一个网络设备,它处理来自不同源的数据包,并需要记录数据包的时间戳信息以进行性能分析或故障排查。设备接收到的数据包可能包括事件报文(即重要或需要特别处理的数据包)和通用报文(即常规流量)。In some embodiments, there is a network device that processes data packets from different sources and needs to record the timestamp information of the data packets for performance analysis or troubleshooting. The data packets received by the device may include event packets (i.e., data packets that are important or require special processing) and general packets (i.e., regular traffic).

当发送事件报文,且无跟随报文时,打时间戳的硬件接收到一个事件报文。识别该事件报文的第一控制字段。检查时间戳插入位和时间戳操作位是否已设置。如果未设置,则设置时间戳插入位和时间戳操作位。生成第一时间戳(例如,使用设备的内部时钟)。将该时间戳插入到事件报文的第二同步数据包中(这通常意味着在数据包的某个特定字段或报头中)。继续处理或转发数据包。The timestamping hardware receives an Event Message when an Event Message is sent and no following Message is sent. Identify the first control field of the Event Message. Check if the Timestamp Insertion Bit and the Timestamp Action Bit are set. If not set, set the Timestamp Insertion Bit and the Timestamp Action Bit. Generate the first timestamp (for example, using the device's internal clock). Insert the timestamp into the second sync packet of the Event Message (this usually means in a specific field or header of the packet). Continue processing or forwarding the packet.

当发送事件报文,且有跟随报文时,打时间戳的硬件先接收到该事件报文,并生成第一时间戳。不立即将第一时间戳插入到该事件报文中,而是将其保存到寄存器中。然后,接收该跟随报文。识别跟随报文的第一控制字段。检查时间戳保存位和时间戳操作位是否已设置。如果未设置,则设置时间戳保存位和时间戳操作位。从寄存器中读取之前保存的时间戳。将该时间戳插入到跟随报文的第二同步数据包中。继续处理或转发跟随报文。When an event message is sent and there is a following message, the timestamping hardware first receives the event message and generates a first timestamp. The first timestamp is not immediately inserted into the event message, but saved into a register. Then, the following message is received. The first control field of the following message is identified. Check whether the timestamp save bit and the timestamp operation bit are set. If not set, set the timestamp save bit and the timestamp operation bit. Read the previously saved timestamp from the register. Insert the timestamp into the second synchronization data packet of the following message. Continue to process or forward the following message.

插入时间戳的方法依赖于数据包的类型和是否存在跟随报文。对于事件报文(没有后续跟随报文的特殊数据包),时间戳被直接插入到数据包的同步数据包中。而对于后续有跟随报文的事件报文,时间戳首先被保存到寄存器中,然后在跟随报文到达时被插入。这种方法允许设备更灵活地处理时间戳,同时确保即使在数据包流中存在多个相关数据包时,也能准确地记录时间信息。The method of inserting the timestamp depends on the type of packet and whether there are following messages. For event messages (special packets without subsequent following messages), the timestamp is inserted directly into the synchronization packet of the packet. For event messages with subsequent following messages, the timestamp is first saved to a register and then inserted when the following message arrives. This method allows the device to handle timestamps more flexibly while ensuring that time information is accurately recorded even when there are multiple related packets in the packet stream.

例如,发送方向数据包可以是Sync报文、Follow_up报文、Delay_Req报文和Delay_Req报文。如图5所示,该发送方向数据包可以包含16字节的控制字段和1588数据包,其中,byte1:0x5a表示发送方向,byte2:channel id表示目标第二设备的地址,byte3~4:reserve表示备用位,byte5(bit0:ts_insert_reg)表示插入时间戳,(bit1:ts_flag)表示操作时间戳,(bit2:save_ts_reg)表示保存时间戳,byte6:sequence id表示顺序地址,byte7: tsoffset表示时间戳偏移量(即插在1588数据包中的位置),byte8~12:reserve表示备用位,byte13~14:0x0600表示数据包类型(如以太网2),byte15~16:reserve表示备用位,用于数据对齐。For example, the data packet in the sending direction may be a Sync message, a Follow_up message, a Delay_Req message, and a Delay_Req message. As shown in FIG5 , the data packet in the sending direction may include a 16-byte control field and a 1588 data packet, wherein byte1:0x5a indicates the sending direction, byte2:channel id indicates the address of the target second device, byte3~4:reserve indicates a spare bit, byte5 (bit0:ts_insert_reg) indicates an insertion timestamp, (bit1:ts_flag) indicates an operation timestamp, (bit2:save_ts_reg) indicates a save timestamp, byte6:sequence id indicates a sequential address, byte7:tsoffset indicates a timestamp offset (i.e., a position inserted in the 1588 data packet), byte8~12:reserve indicates a spare bit, byte13~14:0x0600 indicates a data packet type (such as Ethernet 2), and byte15~16:reserve indicates a spare bit for data alignment.

PTP master(主时钟设备)主要发送sync报文和follow-up报文以及delay_resp报文。The PTP master (master clock device) mainly sends sync messages, follow-up messages, and delay_resp messages.

单步模式下,master发送sync报文,软件在组包时将ts_flag和ts_insert_flag置位,通过FPGA将时间戳t1内嵌到报文中并发送到对应的端口。后续步骤与双步模式一致。In single-step mode, the master sends a sync message, the software sets ts_flag and ts_insert_flag when assembling the packet, embeds the timestamp t1 into the message through the FPGA and sends it to the corresponding port. The subsequent steps are the same as the double-step mode.

双步模式下,master发送sync报文,软件在组包时将save_ts_flag和ts_flag置位,发送方FPGA将时间戳t1保存到寄存器,软件组包发送follow-up报文时再读FPGA寄存器获取时间戳t1并组包发送到FPGA,然后FPGA根据channel ID发送到对应端口。以及Master接收delay_req报文,FPGA接收到delay_req报文时打t4时间戳,分包模块将时间戳添加到包头私有字段中,软件监听到对应端口数据后获取delay_req报文和私有字段的t4时间戳,并将t4时间戳组包到delay_resp中回复给slave。In dual-step mode, the master sends a sync message, and the software sets save_ts_flag and ts_flag when assembling the packet. The sender FPGA saves the timestamp t 1 to the register. When the software assembles the packet to send the follow-up message, it reads the FPGA register to obtain the timestamp t 1 and assembles the packet to send to the FPGA, and then the FPGA sends it to the corresponding port according to the channel ID. And the Master receives the delay_req message. When the FPGA receives the delay_req message, it adds the t 4 timestamp. The packetization module adds the timestamp to the private field of the packet header. After the software monitors the corresponding port data, it obtains the delay_req message and the t 4 timestamp of the private field, and assembles the t 4 timestamp into the delay_resp and replies to the slave.

图6示意性示出了根据本公开实施例的插入第二时间戳的方法流程图。图7示意性示出了根据本公开实施例的接收方向数据包的格式图。Fig. 6 schematically shows a flow chart of a method for inserting a second timestamp according to an embodiment of the present disclosure. Fig. 7 schematically shows a format diagram of a receiving direction data packet according to an embodiment of the present disclosure.

根据本公开的实施例,第二控制字段包括时间戳接收位,如图6所示,例如通过操作S6131来响应于增加第二控制字段到第一同步数据包,在第二控制字段中插入第二时间戳。According to an embodiment of the present disclosure, the second control field includes a timestamp reception bit, as shown in FIG. 6 , for example, in response to adding the second control field to the first synchronization data packet through operation S6131 , a second timestamp is inserted into the second control field.

在操作S6131,响应于增加第二控制字段到第一同步数据包,将时间戳接收位与时间戳操作位置位,并插入第二时间戳到第二控制字段。In operation S6131, in response to adding a second control field to the first synchronization data packet, a timestamp reception bit and a timestamp operation bit are set, and a second timestamp is inserted into the second control field.

在一些实施例中,例如打时间戳的硬件首先接收一个数据包(例如,PTP协议的Sync报文或Delay_Resp报文)。In some embodiments, for example, the timestamping hardware first receives a data packet (eg, a Sync message or a Delay_Resp message of the PTP protocol).

打时间戳的硬件检查数据包的类型和字段结构,以确定它是一个需要处理时间戳的数据包。如果数据包本身不包含第二控制字段或该字段用于时间戳插入的空间不足,打时间戳的硬件将创建一个新的第二控制字段或扩展现有字段以容纳时间戳信息。The timestamping hardware checks the packet type and field structure to determine that it is a packet that needs to be timestamped. If the packet itself does not contain a second control field or the field does not have enough space for timestamp insertion, the timestamping hardware will create a new second control field or extend the existing field to accommodate the timestamp information.

在增加或修改第二控制字段时,打时间戳的硬件将“时间戳接收位”和“时间戳操作位”置位。这些位标志告诉设备接下来要在这个字段中插入时间戳。打时间戳的硬件使用其内部的高精度时钟来生成一个准确的时间戳(第二时间戳)。在设置了相应的位标志之后,打时间戳的硬件将生成的第二时间戳插入到第二控制字段中预先定义的位置。这可能涉及将数据包的特定部分重新排列或替换以容纳时间戳。一旦时间戳被成功插入到第二控制字段中,数据包就可以被打时间戳的硬件进一步处理或转发到下一个网络节点。When adding or modifying the second control field, the timestamping hardware sets the "timestamp received bit" and the "timestamp operation bit". These bit flags tell the device to insert a timestamp in this field next. The timestamping hardware uses its internal high-precision clock to generate an accurate timestamp (the second timestamp). After setting the corresponding bit flags, the timestamping hardware inserts the generated second timestamp into the predefined position in the second control field. This may involve rearranging or replacing specific parts of the data packet to accommodate the timestamp. Once the timestamp is successfully inserted into the second control field, the data packet can be further processed by the timestamping hardware or forwarded to the next network node.

这种方法提供了一种灵活且准确的方式来跟踪数据包在网络中的时间信息,对于需要高精度时间同步或性能分析的应用场景特别有用。通过将时间戳插入到数据包的第二控制字段中,可以确保时间信息在数据包传输过程中保持完整和可访问。This method provides a flexible and accurate way to track the time information of data packets in the network, which is particularly useful for application scenarios that require high-precision time synchronization or performance analysis. By inserting the timestamp into the second control field of the data packet, it can ensure that the time information remains intact and accessible during the data packet transmission process.

例如,接收方向数据包也可以是Sync报文、Follow_up报文、Delay_Req报文和Delay_Req报文。如图7所示,该接收方向数据包可以包含16字节的控制字段和1588数据包,其中,byte1:0xb5表示接收方向,byte2:channel id表示目标第二设备的地址或者在有多个主时钟设备时,表示发包第一设备的地址,byte3~12:rx_ts表示接收时间戳,byte13~14:0x0600表示数据包类型(如以太网2),byte15~16:reserve表示备用位,用于数据对齐。For example, the receiving direction data packet may also be a Sync message, a Follow_up message, a Delay_Req message, and a Delay_Req message. As shown in FIG7 , the receiving direction data packet may include a 16-byte control field and a 1588 data packet, wherein byte1:0xb5 indicates the receiving direction, byte2:channel id indicates the address of the target second device or, when there are multiple master clock devices, indicates the address of the first device sending the packet, byte3~12:rx_ts indicates the receiving timestamp, byte13~14:0x0600 indicates the data packet type (such as Ethernet 2), and byte15~16:reserve indicates a spare bit for data alignment.

单步模式下,slave(从时钟设备)接收sync报文,FPGA在接收到sync报文时进行硬件时间戳打戳t2,并将t2添加到sync报文包头私有字段,软件解析FPGA添加了时间戳t2的重组报文,获取t1时间戳和t2时间戳。后续步骤与双步模式一致。In single-step mode, the slave (slave clock device) receives the sync message. When the FPGA receives the sync message, it performs a hardware timestamp t 2 and adds t 2 to the private field of the sync message header. The software parses the reassembled message with the FPGA adding the timestamp t 2 to obtain the timestamps t 1 and t 2. The subsequent steps are the same as the double-step mode.

双步模式下,slave接收sync报文,FPGA在接收到sync报文时进行硬件时间戳打戳t2,并将t2添加到sync报文包头私有字段,解析FPGA添加了时间戳t2的重组报文,获取t2时间戳。然后再接收Follow_up报文,并解析Follow_up报文中的时间戳t1In the dual-step mode, the slave receives the sync message. When the FPGA receives the sync message, it performs a hardware timestamp t 2 and adds t 2 to the private field of the sync message header. It parses the reassembled message with the timestamp t 2 added by the FPGA to obtain the timestamp t 2. Then it receives the Follow_up message and parses the timestamp t 1 in the Follow_up message.

发送delay_req报文,FPGA在发送完成delay_req报文时进行打戳t3,并记录在寄存器中。软件读取寄存器获取FPGA保存的t3时间戳。Send the delay_req message. The FPGA will stamp t 3 when sending the delay_req message and record it in the register. The software reads the register to obtain the t 3 timestamp saved by the FPGA.

最后,master发送的delay_resp报文中携带t4时间戳,slave解析该报文获取t4,进行offset(偏移量)的计算和调整,完成从时钟设备和主时钟设备的时间同步。Finally, the delay_resp message sent by the master carries the t 4 timestamp. The slave parses the message to obtain t 4 , calculates and adjusts the offset, and completes the time synchronization between the slave clock device and the master clock device.

需要说明的是,主时钟设备一侧的打时间戳的硬件例如可以是FPGA,而从时钟设备一侧的打时间戳的硬件例如可以是FPGA,也可以是其他硬件。由于主时钟设备与从时钟设备之间通过网线或光纤传输数据,因而被传输的只是1588数据包,即控制字段的作用是在1588数据包中插入时间戳,以及说明插入时间戳的位置。当从时钟设备一侧的打时间戳的硬件是其他硬件时,也可以不添加控制字段,而采用其他方式,如网络接口内置的打时间戳工具来打第二时间戳。It should be noted that the timestamping hardware on the master clock device side may be, for example, an FPGA, and the timestamping hardware on the slave clock device side may be, for example, an FPGA or other hardware. Since the data is transmitted between the master clock device and the slave clock device via a network cable or optical fiber, only the 1588 data packet is transmitted, that is, the function of the control field is to insert the timestamp in the 1588 data packet and to indicate the location of the inserted timestamp. When the timestamping hardware on the slave clock device side is other hardware, the control field may not be added, and other methods may be used, such as the timestamping tool built into the network interface, to perform the second timestamp.

根据本公开的实施例,控制字段例如还包括数据方向位、通道ID位、数据类型位和备用位。其中,数据方向位用于控制第一数据包和第二数据包的传输方向。通道ID位用于记录端口地址。数据类型位用于限制与第一数据包以及第二数据包相对应的网络类型。以及备用位用于数据扩充或数据对齐。According to an embodiment of the present disclosure, the control field, for example, further includes a data direction bit, a channel ID bit, a data type bit, and a spare bit. Among them, the data direction bit is used to control the transmission direction of the first data packet and the second data packet. The channel ID bit is used to record the port address. The data type bit is used to limit the network type corresponding to the first data packet and the second data packet. And the spare bit is used for data expansion or data alignment.

在一些实施例中,例如有一个工业自动化系统,其中包含一个主时钟设备(带有多个主时钟程序)和多个从时钟设备,它们通过同一个网络接口进行通信。主时钟设备负责提供准确的时间信息,而从时钟设备需要同步到主时钟的时间。In some embodiments, for example, there is an industrial automation system, which includes a master clock device (with multiple master clock programs) and multiple slave clock devices, which communicate through the same network interface. The master clock device is responsible for providing accurate time information, and the slave clock device needs to be synchronized to the time of the master clock.

当主时钟设备向从时钟设备发送时间同步数据包时,数据方向位被设置为“发送”(例如,0x5a)。When a master-clock device sends a time synchronization packet to a slave-clock device, the data direction bit is set to "transmit" (for example, 0x5a).

当从时钟设备响应主时钟设备的查询或确认同步成功时,数据方向位被设置为“接收”(例如,0xb5)。When a slave-clock device responds to a query from a master-clock device or confirms successful synchronization, the data direction bit is set to "Receive" (for example, 0xb5).

由于系统中有多个从时钟设备,每个从时钟设备都有一个唯一的端口地址(或称为通道ID)。当主时钟设备发送时间同步数据包时,它会将目标从时钟设备的通道ID包含在数据包的通道ID位中。从时钟设备在接收到数据包后,会检查通道ID位以确认数据包是否为自己所需。Since there are multiple slave clock devices in the system, each slave clock device has a unique port address (or channel ID). When the master clock device sends a time synchronization data packet, it includes the channel ID of the target slave clock device in the channel ID bit of the data packet. After receiving the data packet, the slave clock device checks the channel ID bit to confirm whether the data packet is what it needs.

在这个例子中,数据类型位用于表明传输的数据包适用的协议类型,如适用于以太网2的数据包。主时钟设备根据需求在数据类型位中设置相应的值,从时钟设备则根据该值进行相应的处理。In this example, the data type bit is used to indicate the protocol type applicable to the transmitted data packet, such as a data packet applicable to Ethernet 2. The master clock device sets the corresponding value in the data type bit according to the requirements, and the slave clock device performs corresponding processing according to the value.

在这个例子中,备用位可能用于未来的功能扩展或数据对齐。例如,如果未来需要增加额外的同步参数或控制信息,可以使用备用位进行扩展。In this example, the spare bits may be used for future functional expansion or data alignment. For example, if additional synchronization parameters or control information are required in the future, the spare bits can be used for expansion.

当系统启动时或新的从时钟设备加入网络时,主时钟设备会发送初始化同步数据包。数据包中的通道ID位设置为目标从时钟设备的ID,数据类型位设置为“0x0600”。从时钟设备在接收到数据包后,会将其内部时钟设置为数据包中的时间,并完成初始化过程。When the system starts or a new slave clock device joins the network, the master clock device sends an initialization synchronization data packet. The channel ID bit in the data packet is set to the ID of the target slave clock device, and the data type bit is set to "0x0600". After receiving the data packet, the slave clock device sets its internal clock to the time in the data packet and completes the initialization process.

为了保持时间同步的准确性,主时钟设备可以定期发送周期性同步数据包。数据包中的通道ID位和数据类型位与初始化同步时相同。从时钟设备在接收到数据包后,会根据其中的时间信息对自己的时钟进行微调。In order to maintain the accuracy of time synchronization, the master clock device can periodically send periodic synchronization data packets. The channel ID bit and data type bit in the data packet are the same as those during initial synchronization. After receiving the data packet, the slave clock device will fine-tune its own clock according to the time information in it.

为了监测从时钟设备的状态,主时钟设备可以定期发送心跳信号数据包。数据包中的通道ID位设置为从时钟设备的ID。从时钟设备在接收到数据包后,会回复一个确认信号表示其状态正常。In order to monitor the status of the slave clock device, the master clock device can periodically send a heartbeat signal data packet. The channel ID bit in the data packet is set to the ID of the slave clock device. After receiving the data packet, the slave clock device will reply with a confirmation signal to indicate that its status is normal.

通过合理设置控制字段中的各个位,可以实现基于同一个网络接口的主时钟设备与多个从时钟设备之间的精确时钟同步。这种方法不仅适用于工业自动化系统,也可以应用于其他需要高精度时间同步的场景中。By properly setting the bits in the control field, accurate clock synchronization can be achieved between a master clock device and multiple slave clock devices based on the same network interface. This method is not only suitable for industrial automation systems, but can also be applied to other scenarios that require high-precision time synchronization.

例如,ptp master和ptp slave注册各自的1588网口(单个或多个)和channel id到netlink里。HPS(High Performance Switch,高性能交换机)发送方向,netlink将所有的数据(包含通道ID)都发送到注册的网口上。HPS接收方向,netlink根据channel id发送不同的数据包到不同的ptp master和ptp slave。For example, ptp master and ptp slave register their own 1588 network ports (single or multiple) and channel IDs in netlink. In the HPS (High Performance Switch) sending direction, netlink sends all data (including channel ID) to the registered network port. In the HPS receiving direction, netlink sends different data packets to different ptp masters and ptp slaves according to the channel ID.

图8示意性示出了根据本公开实施例的收发数据包的流程图。FIG8 schematically shows a flow chart of sending and receiving data packets according to an embodiment of the present disclosure.

根据本公开的实施例,例如通过FPGA在第二同步数据包中插入第一时间戳,以及在第二控制字段中插入第二时间戳。According to an embodiment of the present disclosure, for example, a first timestamp is inserted into the second synchronization data packet through an FPGA, and a second timestamp is inserted into the second control field.

在一些实施例中,如图8所示,例如通过在普通ethernet包(1588数据包)的最前面添加16个字节的控制字段,来进行不同的ptp master和ptp slave通道的区分。通过时间戳的控制字段控制报文发送时,FPGA的时间戳打戳,从而减少时间误差,内核中使用netlink来进行数据的转发。其中,a表示接收数据包方向,b表示发送数据包方向。In some embodiments, as shown in FIG8 , for example, by adding a 16-byte control field at the front of a common Ethernet packet (1588 data packet), different PTP master and PTP slave channels are distinguished. When the message is sent through the control field of the timestamp, the FPGA timestamps, thereby reducing the time error, and the kernel uses netlink to forward data. Wherein, a represents the direction of receiving data packets, and b represents the direction of sending data packets.

可以理解的是,上述接收和发送是相对而言的,主时钟设备可以是发包设备,也可以是收包设备。同理,从时钟设备可以是发包设备,也可以是收包设备。发包设备与收包设备的控制字段有所区别,如图5和图7所示。It is understandable that the above-mentioned receiving and sending are relative. The master clock device can be a packet sending device or a packet receiving device. Similarly, the slave clock device can be a packet sending device or a packet receiving device. The control fields of the packet sending device and the packet receiving device are different, as shown in Figures 5 and 7.

例如,主时钟设备包含一个FPGA(现场可编程门阵列)芯片,用于处理时间同步相关的逻辑和数据包操作。主时钟设备通过同一个网络接口与多个从时钟设备进行通信。For example, the master clock device contains an FPGA (field programmable gate array) chip to handle time synchronization related logic and data packet operations. The master clock device communicates with multiple slave clock devices through the same network interface.

在系统启动或配置阶段,主时钟设备通过FPGA配置网络接口和时钟同步参数。这包括设置数据方向位、通道ID位、数据类型位和备用位等控制字段的值。主时钟设备为每个从时钟设备分配一个唯一的通道ID,并存储在FPGA的寄存器或内存中。During the system startup or configuration phase, the master clock device configures the network interface and clock synchronization parameters through the FPGA. This includes setting the values of control fields such as the data direction bit, channel ID bit, data type bit, and spare bit. The master clock device assigns a unique channel ID to each slave clock device and stores it in the register or memory of the FPGA.

当需要发送时间同步数据包时,主时钟设备的FPGA根据当前时间和从时钟设备的通道ID生成数据包。在数据包的第二同步数据包部分(如1588数据包),FPGA插入第一时间戳(t1和t4)。这个时间戳代表了数据包生成或接收时的精确时间。When a time synchronization packet needs to be sent, the FPGA of the master clock device generates a packet based on the current time and the channel ID of the slave clock device. In the second synchronization packet part of the packet (such as a 1588 packet), the FPGA inserts the first timestamp (t 1 and t 4 ). This timestamp represents the exact time when the packet was generated or received.

FPGA将生成的时间同步数据包发送到网络接口,通过网络接口传输到指定的从时钟设备。数据包中的通道ID位用于确保数据包发送到正确的从时钟设备。The FPGA sends the generated time synchronization data packet to the network interface, which is then transmitted to the specified slave clock device. The channel ID bit in the data packet is used to ensure that the data packet is sent to the correct slave clock device.

在从时钟设备一侧也采用FPGA来打时间戳时,该FPGA在收到数据包时,在其生成的第二控制字段中插入第二时间戳t2。从时钟设备通过网络接口接收到时间同步数据包后,解析数据包中的时间戳和控制字段信息。从时钟设备根据数据包中的通道ID位确认数据包是否为自己所需,并使用数据包中的时间戳信息来校准自己的时钟,实现与主时钟设备的同步。When the slave clock device also uses FPGA to timestamp, the FPGA inserts the second timestamp t 2 in the second control field generated by it when receiving the data packet. After receiving the time synchronization data packet through the network interface, the slave clock device parses the timestamp and control field information in the data packet. The slave clock device confirms whether the data packet is required by itself according to the channel ID bit in the data packet, and uses the timestamp information in the data packet to calibrate its own clock to achieve synchronization with the master clock device.

可以理解的是,从时钟设备发出数据包时的时间t3可以自行从寄存器中获取,而无需从数据包中提取。It is understandable that the time t3 when the slave clock device sends out the data packet can be obtained from the register by itself without being extracted from the data packet.

从时钟设备在成功同步后,可以发送一个确认数据包给主时钟设备,表示同步成功。主时钟设备接收到确认数据包后,可以记录同步状态或进行其他后续操作。After successful synchronization, the slave clock device can send a confirmation data packet to the master clock device to indicate successful synchronization. After receiving the confirmation data packet, the master clock device can record the synchronization status or perform other subsequent operations.

FPGA在时钟同步过程中起到了关键作用。它负责生成时间同步数据包,并在数据包中插入时间戳和控制字段信息。FPGA的并行处理能力和灵活性使得它能够高效、准确地处理时间同步相关的逻辑和数据包操作。通过FPGA的配置和编程,可以实现不同的时钟同步算法和策略,以满足不同应用场景的需求。FPGA plays a key role in the clock synchronization process. It is responsible for generating time synchronization packets and inserting timestamp and control field information into the packets. The parallel processing capability and flexibility of FPGA enable it to efficiently and accurately handle time synchronization related logic and packet operations. Through the configuration and programming of FPGA, different clock synchronization algorithms and strategies can be implemented to meet the needs of different application scenarios.

通过FPGA在第二同步数据包中插入第一时间戳,以及在第二控制字段中插入第二时间戳,可以实现基于同一个网络接口的主时钟设备与多个从时钟设备之间的精确时钟同步。这种方法利用了FPGA的高效性和灵活性,提高了时钟同步的准确性和可靠性。同时,通过控制字段的设置,可以实现对数据包传输方向、端口地址、网络类型和数据扩充等方面的灵活控制。By inserting the first timestamp in the second synchronization data packet and the second timestamp in the second control field through FPGA, accurate clock synchronization between the master clock device and multiple slave clock devices based on the same network interface can be achieved. This method takes advantage of the efficiency and flexibility of FPGA and improves the accuracy and reliability of clock synchronization. At the same time, by setting the control field, flexible control of data packet transmission direction, port address, network type and data expansion can be achieved.

基于上述基于数据接口的同步处理方法,本公开还提供了一种基于数据接口的同步处理装置。以下将结合图9对该基于数据接口的同步处理装置进行详细描述。Based on the above data interface-based synchronization processing method, the present disclosure further provides a data interface-based synchronization processing device. The following will describe the data interface-based synchronization processing device in detail in conjunction with FIG.

图9示意性示出了根据本公开实施例的基于数据接口的同步处理装置的结构框图。FIG. 9 schematically shows a structural block diagram of a synchronization processing device based on a data interface according to an embodiment of the present disclosure.

根据本公开的实施例,第一设备通过数据接口与多个第二设备通信,其中,第一设备运行有多个主时钟程序,如图9所示,该实施例的基于数据接口的同步处理装置900例如包括:发送模块910和标定模块920。该基于数据接口的同步处理装置900可以执行上面参考图2~图8描述的方法,以实现对主时钟设备和从时钟设备的时钟同步。According to an embodiment of the present disclosure, a first device communicates with a plurality of second devices via a data interface, wherein the first device runs a plurality of master clock programs, as shown in FIG9 , a synchronization processing device 900 based on a data interface of this embodiment, for example, includes: a sending module 910 and a calibration module 920. The synchronization processing device 900 based on a data interface can execute the method described above with reference to FIG2 to FIG8 to achieve clock synchronization of a master clock device and a slave clock device.

具体地,发送模块910用于向至少一个第二设备发送第一时间信息和第二时间信息,其中,第一时间信息表征主时钟程序发送第一数据包至数据接口的时刻,第二时间信息表征第二设备发送第一同步数据包至数据接口的时刻。在一实施例中,发送模块910可以用于执行前文描述的操作S210,在此不再赘述。Specifically, the sending module 910 is used to send the first time information and the second time information to at least one second device, wherein the first time information represents the moment when the master clock program sends the first data packet to the data interface, and the second time information represents the moment when the second device sends the first synchronization data packet to the data interface. In one embodiment, the sending module 910 can be used to perform the operation S210 described above, which will not be repeated here.

标定模块920用于根据第一时间信息和第二时间信息,对多个第二设备进行时钟同步。其中,数据接口用于识别第一数据包中的控制字段,或者增加控制字段到第一同步数据包,得到第二数据包。控制字段用于控制数据接口对第一数据包和第二数据包进行打时间戳,以及记录第二设备的端口地址。在一实施例中,标定模块920可以用于执行前文描述的操作S220,在此不再赘述。The calibration module 920 is used to perform clock synchronization on multiple second devices according to the first time information and the second time information. Among them, the data interface is used to identify the control field in the first data packet, or add the control field to the first synchronization data packet to obtain the second data packet. The control field is used to control the data interface to timestamp the first data packet and the second data packet, and record the port address of the second device. In one embodiment, the calibration module 920 can be used to perform the operation S220 described above, which will not be repeated here.

可以理解的是,发送模块910和标定模块920可以合并在一个模块中实现,或者其中的任意一个模块可以被拆分成多个模块。或者,这些模块中的一个或多个模块的至少部分功能可以与其他模块的至少部分功能相结合,并在一个模块中实现。根据本公开的实施例,发送模块910和标定模块920中的至少一个可以至少被部分地实现为硬件电路,例如现场可编程门阵列(FPGA)、可编程逻辑阵列(PLA)、片上系统、基板上的系统、封装上的系统、专用集成电路(ASIC),或可以以对电路进行集成或封装的任何其他的合理方式等硬件或固件来实现,或以软件、硬件以及固件三种实现方式的适当组合来实现。或者,发送模块910和标定模块920中的至少一个可以至少被部分地实现为计算机程序模块,当该程序被计算机运行时,可以执行相应模块的功能。It is understandable that the sending module 910 and the calibration module 920 can be combined in one module, or any one of the modules can be split into multiple modules. Alternatively, at least part of the functions of one or more of these modules can be combined with at least part of the functions of other modules and implemented in one module. According to an embodiment of the present disclosure, at least one of the sending module 910 and the calibration module 920 can be at least partially implemented as a hardware circuit, such as a field programmable gate array (FPGA), a programmable logic array (PLA), a system on a chip, a system on a substrate, a system on a package, an application-specific integrated circuit (ASIC), or can be implemented in hardware or firmware in any other reasonable way of integrating or packaging the circuit, or in a proper combination of software, hardware and firmware. Alternatively, at least one of the sending module 910 and the calibration module 920 can be at least partially implemented as a computer program module, and when the program is run by a computer, the function of the corresponding module can be executed.

图10示意性示出了根据本公开实施例的适于实现基于数据接口的同步处理方法的电子设备的方框图。FIG10 schematically shows a block diagram of an electronic device suitable for implementing a synchronization processing method based on a data interface according to an embodiment of the present disclosure.

如图10所示,根据本公开实施例的电子设备1000包括处理器1001,其可以根据存储在只读存储器(ROM)1002中的程序或者从存储部分1008加载到随机访问存储器(RAM)1003中的程序而执行各种适当的动作和处理。处理器1001例如可以包括通用微处理器(例如CPU)、指令集处理器和/或相关芯片组和/或专用微处理器(例如,专用集成电路(ASIC))等等。处理器1001还可以包括用于缓存用途的板载存储器。处理器1001可以包括用于执行根据本公开实施例的方法流程的不同动作的单一处理单元或者是多个处理单元。As shown in FIG10 , the electronic device 1000 according to an embodiment of the present disclosure includes a processor 1001, which can perform various appropriate actions and processes according to a program stored in a read-only memory (ROM) 1002 or a program loaded from a storage part 1008 into a random access memory (RAM) 1003. The processor 1001 may include, for example, a general-purpose microprocessor (e.g., a CPU), an instruction set processor and/or a related chipset and/or a dedicated microprocessor (e.g., an application-specific integrated circuit (ASIC)), etc. The processor 1001 may also include an onboard memory for caching purposes. The processor 1001 may include a single processing unit or multiple processing units for performing different actions of the method flow according to an embodiment of the present disclosure.

在RAM 1003中,存储有电子设备1000操作所需的各种程序和数据。处理器 1001、ROM 1002以及RAM 1003通过总线1004彼此相连。处理器1001通过执行ROM 1002和/或RAM1003中的程序来执行根据本公开实施例的方法流程的各种操作。需要注意,所述程序也可以存储在除ROM 1002和RAM 1003以外的一个或多个存储器中。处理器1001也可以通过执行存储在所述一个或多个存储器中的程序来执行根据本公开实施例的方法流程的各种操作。In RAM 1003, various programs and data required for the operation of electronic device 1000 are stored. Processor 1001, ROM 1002 and RAM 1003 are connected to each other via bus 1004. Processor 1001 performs various operations of the method flow according to the embodiment of the present disclosure by executing the program in ROM 1002 and/or RAM 1003. It should be noted that the program can also be stored in one or more memories other than ROM 1002 and RAM 1003. Processor 1001 can also perform various operations of the method flow according to the embodiment of the present disclosure by executing the program stored in the one or more memories.

根据本公开的实施例,电子设备1000还可以包括输入/输出(I/O)接口1005,输入/输出(I/O)接口1005也连接至总线1004。电子设备1000还可以包括连接至I/O接口1005的以下部件中的一项或多项:包括键盘、鼠标等的输入部分1006;包括诸如阴极射线管(CRT)、液晶显示器(LCD)等以及扬声器等的输出部分1007;包括硬盘等的存储部分1008;以及包括诸如LAN卡、调制解调器等的网络接口卡的通信部分1009。通信部分1009经由诸如因特网的网络执行通信处理。驱动器1010也根据需要连接至I/O接口1005。可拆卸介质1011’,诸如磁盘、光盘、磁光盘、半导体存储器等等,根据需要安装在驱动器1010上,以便于从其上读出的计算机程序根据需要被安装入存储部分1008。According to an embodiment of the present disclosure, the electronic device 1000 may further include an input/output (I/O) interface 1005, which is also connected to the bus 1004. The electronic device 1000 may further include one or more of the following components connected to the I/O interface 1005: an input portion 1006 including a keyboard, a mouse, etc.; an output portion 1007 including a cathode ray tube (CRT), a liquid crystal display (LCD), etc., and a speaker, etc.; a storage portion 1008 including a hard disk, etc.; and a communication portion 1009 including a network interface card such as a LAN card, a modem, etc. The communication portion 1009 performs communication processing via a network such as the Internet. A drive 1010 is also connected to the I/O interface 1005 as needed. A removable medium 1011', such as a magnetic disk, an optical disk, a magneto-optical disk, a semiconductor memory, etc., is installed on the drive 1010 as needed, so that a computer program read therefrom is installed into the storage portion 1008 as needed.

本公开还提供了一种计算机可读存储介质,该计算机可读存储介质可以是上述实施例中描述的设备/装置/系统中所包含的;也可以是单独存在,而未装配入该设备/装置/系统中。上述计算机可读存储介质承载有一个或者多个程序,当上述一个或者多个程序被执行时,实现根据本公开实施例的基于数据接口的同步处理方法。The present disclosure also provides a computer-readable storage medium, which may be included in the device/apparatus/system described in the above embodiment; or may exist independently without being assembled into the device/apparatus/system. The above computer-readable storage medium carries one or more programs, and when the above one or more programs are executed, the synchronization processing method based on the data interface according to the embodiment of the present disclosure is implemented.

根据本公开的实施例,计算机可读存储介质可以是非易失性的计算机可读存储介质,例如可以包括但不限于:便携式计算机磁盘、硬盘、随机访问存储器(RAM)、只读存储器(ROM)、可擦式可编程只读存储器(EPROM或闪存)、便携式紧凑磁盘只读存储器(CD-ROM)、光存储器件、磁存储器件、或者上述的任意合适的组合。在本公开中,计算机可读存储介质可以是任何包含或存储程序的有形介质,该程序可以被指令执行系统、装置或者器件使用或者与其结合使用。例如,根据本公开的实施例,计算机可读存储介质可以包括上文描述的ROM 1002和/或RAM 1003和/或ROM 1002和RAM 1003以外的一个或多个存储器。According to an embodiment of the present disclosure, a computer-readable storage medium may be a non-volatile computer-readable storage medium, for example, may include but is not limited to: a portable computer disk, a hard disk, a random access memory (RAM), a read-only memory (ROM), an erasable programmable read-only memory (EPROM or flash memory), a portable compact disk read-only memory (CD-ROM), an optical storage device, a magnetic storage device, or any suitable combination thereof. In the present disclosure, a computer-readable storage medium may be any tangible medium containing or storing a program, which may be used by or in combination with an instruction execution system, an apparatus, or a device. For example, according to an embodiment of the present disclosure, a computer-readable storage medium may include the ROM 1002 and/or RAM 1003 described above and/or one or more memories other than ROM 1002 and RAM 1003.

本公开的实施例还包括一种计算机程序产品,其包括计算机程序,该计算机程序包含用于执行流程图所示的方法的程序代码。当计算机程序产品在计算机系统中运行时,该程序代码用于使计算机系统实现本公开实施例所提供的基于数据接口的同步处理方法。The embodiment of the present disclosure also includes a computer program product, which includes a computer program, and the computer program contains program code for executing the method shown in the flowchart. When the computer program product is run in a computer system, the program code is used to enable the computer system to implement the synchronization processing method based on the data interface provided by the embodiment of the present disclosure.

在该计算机程序被处理器1001执行时执行本公开实施例的系统/装置中限定的上述功能。根据本公开的实施例,上文描述的系统、装置、模块、单元等可以通过计算机程序模块来实现。The above functions defined in the system/device of the embodiment of the present disclosure are performed when the computer program is executed by the processor 1001. According to the embodiment of the present disclosure, the system, device, module, unit, etc. described above can be implemented by a computer program module.

在一种实施例中,该计算机程序可以依托于光存储器件、磁存储器件等有形存储介质。在另一种实施例中,该计算机程序也可以在网络介质上以信号的形式进行传输、分发,并通过通信部分1009被下载和安装,和/或从可拆卸介质1011’被安装。该计算机程序包含的程序代码可以用任何适当的网络介质传输,包括但不限于:无线、有线等等,或者上述的任意合适的组合。In one embodiment, the computer program may be based on a tangible storage medium such as an optical storage device, a magnetic storage device, etc. In another embodiment, the computer program may also be transmitted and distributed in the form of a signal on a network medium, and downloaded and installed through the communication part 1009, and/or installed from a removable medium 1011'. The program code contained in the computer program may be transmitted using any appropriate network medium, including but not limited to: wireless, wired, etc., or any suitable combination of the above.

在这样的实施例中,该计算机程序可以通过通信部分1009从网络上被下载和安装,和/或从可拆卸介质1011’被安装。在该计算机程序被处理器1001执行时,执行本公开实施例的系统中限定的上述功能。根据本公开的实施例,上文描述的系统、设备、装置、模块、单元等可以通过计算机程序模块来实现。In such an embodiment, the computer program can be downloaded and installed from the network through the communication part 1009, and/or installed from the removable medium 1011'. When the computer program is executed by the processor 1001, the above functions defined in the system of the embodiment of the present disclosure are performed. According to the embodiment of the present disclosure, the system, device, apparatus, module, unit, etc. described above can be implemented by a computer program module.

根据本公开的实施例,可以以一种或多种程序设计语言的任意组合来编写用于执行本公开实施例提供的计算机程序的程序代码,具体地,可以利用高级过程和/或面向对象的编程语言、和/或汇编/机器语言来实施这些计算程序。程序设计语言包括但不限于诸如Java,C++,python,“C”语言或类似的程序设计语言。程序代码可以完全地在用户计算设备上执行、部分地在用户设备上执行、部分在远程计算设备上执行、或者完全在远程计算设备或服务器上执行。在涉及远程计算设备的情形中,远程计算设备可以通过任意种类的网络,包括局域网(LAN)或广域网(WAN),连接到用户计算设备,或者,可以连接到外部计算设备(例如利用因特网服务提供商来通过因特网连接)。According to an embodiment of the present disclosure, the program code for executing the computer program provided by the embodiment of the present disclosure can be written in any combination of one or more programming languages. Specifically, these computing programs can be implemented using high-level process and/or object-oriented programming languages, and/or assembly/machine languages. Programming languages include, but are not limited to, Java, C++, python, "C" language or similar programming languages. The program code can be executed entirely on the user computing device, partially on the user device, partially on the remote computing device, or entirely on the remote computing device or server. In the case of a remote computing device, the remote computing device can be connected to the user computing device through any type of network, including a local area network (LAN) or a wide area network (WAN), or can be connected to an external computing device (for example, using an Internet service provider to connect through the Internet).

附图中的流程图和框图,图示了按照本公开各种实施例的系统、方法和计算机程序产品的可能实现的体系架构、功能和操作。在这点上,流程图或框图中的每个方框可以代表一个模块、程序段、或代码的一部分,上述模块、程序段、或代码的一部分包含一个或多个用于实现规定的逻辑功能的可执行指令。也应当注意,在有些作为替换的实现中,方框中所标注的功能也可以以不同于附图中所标注的顺序发生。例如,两个接连地表示的方框实际上可以基本并行地执行,它们有时也可以按相反的顺序执行,这依所涉及的功能而定。也要注意的是,框图或流程图中的每个方框、以及框图或流程图中的方框的组合,可以用执行规定的功能或操作的专用的基于硬件的系统来实现,或者可以用专用硬件与计算机指令的组合来实现。The flow chart and block diagram in the accompanying drawings illustrate the possible architecture, function and operation of the system, method and computer program product according to various embodiments of the present disclosure. In this regard, each box in the flow chart or block diagram can represent a module, a program segment, or a part of a code, and the above-mentioned module, program segment, or a part of a code contains one or more executable instructions for realizing the specified logical function. It should also be noted that in some alternative implementations, the functions marked in the box can also occur in a different order from the order marked in the accompanying drawings. For example, two boxes represented in succession can actually be executed substantially in parallel, and they can sometimes be executed in the opposite order, depending on the functions involved. It should also be noted that each box in the block diagram or flow chart, and the combination of the boxes in the block diagram or flow chart can be implemented with a dedicated hardware-based system that performs a specified function or operation, or can be implemented with a combination of dedicated hardware and computer instructions.

本领域技术人员可以理解,本公开的各个实施例和/或权利要求中记载的特征可以进行多种组合或/或结合,即使这样的组合或结合没有明确记载于本公开中。特别地,在不脱离本公开精神和教导的情况下,本公开的各个实施例和/或权利要求中记载的特征可以进行多种组合和/或结合。所有这些组合和/或结合均落入本公开的范围。It will be appreciated by those skilled in the art that the features described in the various embodiments and/or claims of the present disclosure may be combined and/or combined in a variety of ways, even if such combinations and/or combinations are not explicitly described in the present disclosure. In particular, the features described in the various embodiments and/or claims of the present disclosure may be combined and/or combined in a variety of ways without departing from the spirit and teachings of the present disclosure. All of these combinations and/or combinations fall within the scope of the present disclosure.

以上对本公开的实施例进行了描述。但是,这些实施例仅仅是为了说明的目的,而并非为了限制本公开的范围。尽管在以上分别描述了各实施例,但是这并不意味着各个实施例中的措施不能有利地结合使用。本公开的范围由所附权利要求及其等同物限定。不脱离本公开的范围,本领域技术人员可以做出多种替代和修改,这些替代和修改都应落在本公开的范围之内。The embodiments of the present disclosure are described above. However, these embodiments are only for illustrative purposes and are not intended to limit the scope of the present disclosure. Although the embodiments are described above separately, this does not mean that the measures in the various embodiments cannot be used in combination to advantage. The scope of the present disclosure is defined by the attached claims and their equivalents. Without departing from the scope of the present disclosure, those skilled in the art may make a variety of substitutions and modifications, which should all fall within the scope of the present disclosure.

Claims (10)

1. A synchronous processing method based on a data interface, through which a first device communicates with a plurality of second devices, wherein the first device runs a plurality of master clock programs, the method comprising:
Transmitting first time information and second time information to at least one second device, wherein the first time information characterizes the moment when the master clock program transmits a first data packet to the data interface, and the second time information characterizes the moment when the second device transmits a first synchronous data packet to the data interface;
according to the first time information and the second time information, clock synchronization is carried out on the plurality of second devices;
The data interface is used for identifying a control field in the first data packet or adding the control field to the first synchronous data packet to obtain a second data packet;
The control field is used for controlling the data interface to timestamp the first data packet and the second data packet and recording the port address of the second device.
2. The method of claim 1, wherein the data interface is a hardware interface for time stamping data packets, and the transmitting first time information and second time information to at least one of the second devices comprises:
inserting a first timestamp in a second synchronization packet of the first data packet in response to identifying a first control field of the first data packet;
transmitting a second synchronization packet including the first timestamp to at least one of the plurality of second devices according to the port address;
Inserting a second timestamp in a second control field in response to adding the second control field to the first synchronization packet; and
And sending a second synchronous data packet containing the second timestamp to at least one of the plurality of second devices according to the port address.
3. The method of claim 2, wherein the first device and the second device are clocked using a precision time protocol, the first data packet comprising an event message and a generic message.
4. A method according to claim 3, wherein the generic message does not include a follow-up message.
5. The method of claim 3, wherein the first control field includes a timestamp insert bit, a timestamp operate bit, and a timestamp save bit, the inserting a first timestamp in a second synchronous data packet of the first data packet in response to identifying the first control field of the first data packet comprising:
In the case that the general message does not include a following message, responding to a first control field for identifying the event message, setting the timestamp inserting bit and the timestamp operating bit, and inserting the first timestamp into a second synchronous data packet of the event message; or alternatively
In the case that the general packet includes a follow packet, in response to identifying a first control field of the event packet, setting the timestamp holding bit and the timestamp operating bit, and holding the first timestamp in a register;
and in response to sending the following message, reading the first timestamp from the register, and inserting the first timestamp into a second synchronous data packet of the following message.
6. The method of claim 2, wherein the second control field comprises a timestamp receipt bit, the inserting a second timestamp in the second control field in response to adding a second control field to the first synchronization data packet comprising:
in response to adding a second control field to the first synchronization packet, the timestamp receiving bit and the timestamp operating bit are set and the second timestamp is inserted into the second control field.
7. The method of claim 2, wherein the control field comprises a data direction bit, a channel ID bit, a data type bit, and a spare bit;
wherein the data direction bit is used for controlling the transmission directions of the first data packet and the second data packet;
the channel ID bit is used for recording the port address;
the data type bit is used for limiting the network type corresponding to the first data packet and the second data packet; and
The spare bits are used for data expansion or data alignment.
8. The method according to any of claims 2-7, wherein the first timestamp is inserted in the second synchronization data packet and the second timestamp is inserted in the second control field by an FPGA.
9. A synchronous processing apparatus based on a data interface through which a first device communicates with a plurality of second devices, wherein the first device runs a plurality of master clock programs, the apparatus comprising:
A sending module, configured to send first time information and second time information to at least one second device, where the first time information characterizes a time when the master clock program sends a first data packet to the data interface, and the second time information characterizes a time when the second device sends a first synchronization data packet to the data interface;
the calibration module is used for carrying out clock synchronization on the plurality of second devices according to the first time information and the second time information;
The data interface is used for identifying a control field in the first data packet or adding the control field to the first synchronous data packet to obtain a second data packet;
The control field is used for controlling the data interface to timestamp the first data packet and the second data packet and recording the port address of the second device.
10. An electronic device, comprising:
One or more processors;
Storage means for storing one or more programs,
Wherein the one or more programs, when executed by the one or more processors, cause the one or more processors to perform the method of any of claims 1-8.
CN202410704307.3A 2024-05-31 2024-05-31 Synchronous processing method, device and electronic device based on data interface Pending CN118611810A (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN202410704307.3A CN118611810A (en) 2024-05-31 2024-05-31 Synchronous processing method, device and electronic device based on data interface

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN202410704307.3A CN118611810A (en) 2024-05-31 2024-05-31 Synchronous processing method, device and electronic device based on data interface

Publications (1)

Publication Number Publication Date
CN118611810A true CN118611810A (en) 2024-09-06

Family

ID=92552973

Family Applications (1)

Application Number Title Priority Date Filing Date
CN202410704307.3A Pending CN118611810A (en) 2024-05-31 2024-05-31 Synchronous processing method, device and electronic device based on data interface

Country Status (1)

Country Link
CN (1) CN118611810A (en)

Similar Documents

Publication Publication Date Title
US8879586B2 (en) Inband timestamping
US12316726B2 (en) One-step timestamping in network devices
CN112385183B (en) Apparatus, method and microcontroller for performing PHY level hardware timestamp and time synchronization
CN101595669B (en) Method and device for exchanging information for facilitating synchronization of time network
EP1525693B1 (en) Clock synchronizing method over fault-tolerant etherent
CN101496322A (en) Consistent Distributed Timestamp Counter
JP5127482B2 (en) Timing synchronization method, synchronization apparatus, synchronization system, and synchronization program
CN101404618A (en) System, apparatus and method for implementing transparent transmission clock in accurate clock synchronization protocol
WO2022052609A1 (en) Time delay compensation method, apparatus and device, and computer-readable storage medium
CN112583509B (en) Method and device for acquiring time stamp of data stream, storage medium and electronic device
US8036202B2 (en) Physical layer transceiver with integrated time synchronization
US20250016083A1 (en) Dynamic one-step/two-step timestamping per packet in network devices
CN113228564B (en) Stamping processing method and device
US20240430030A1 (en) Dynamic one-step/two-step timestamping per packet in network devices
CN118611810A (en) Synchronous processing method, device and electronic device based on data interface
CN214627000U (en) Network card equipment compatible with definable deterministic communication Ethernet
US12323235B2 (en) In-band signaling for ingress PTP packets at a master entity
CN119154982B (en) Time synchronization method and system based on time synchronization gateway
US20250358032A1 (en) Two-way time synchronization protocol on network device
US10374734B1 (en) Multi-tier time-synchronization architecture
CN115150017B (en) A PTP message return method and device
WO2025094238A1 (en) Communication system, communication method, and communication program
Suvorova et al. The Architecture of SpaceFibre Bridges, which Provides the Ability to Synchronize Time between Different Standards
WO2023161883A1 (en) Dynamic one-step/two-step timestamping per packet in network devices
TW202429845A (en) System and methods for network data processing

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