A PTP hardware timestamp processing method based on FPGA

Through the FPGA hardware timestamp processing method, the problem of the processor not obtaining the timestamp in time in a multi-PTP node environment is solved, high-throughput and reliable PTP timing is achieved, and delay processing and splitting the timestamp data ensure that it follows the message transmitted to the application layer.

CN114844590BActive Publication Date: 2024-10-15INNOVATION ACAD FOR PRECISION MEASUREMENT SCI & TECH CAS
View PDF 4 Cites 0 Cited by

Patent Information

Application Number
CN202210459786.8
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2022-04-24
Publication Date
2024-10-15
Estimated Expiration
2042-04-24

AI Technical Summary

Technical Problem

In a multi-PTP node environment, the processor fails to obtain the timestamp data of the network event message in time, resulting in the timestamp being replaced and a large time error occurring, making it impossible to achieve high throughput and reliable PTP timing.

Method used

The hardware timestamp processing method is implemented through FPGA. The interface signal processing unit and the hardware timestamp unit are driven by the receiving clock to delay processing of the received data valid signal and other signals, and generate 64-bit timestamp data on the rising edge of the received data valid signal. , divided into 8-bit timestamp segments to ensure that the timestamp data is transmitted to the application layer following the message.

Benefits of technology

It achieves a one-to-one correspondence between timestamp data and messages, avoids the problem of timestamp data loss caused by slow processing speed, and achieves high throughput and reliable PTP timing.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN114844590B_ABST
    Figure CN114844590B_ABST
Patent Text Reader

Abstract

The invention discloses a processing method of PTP hardware timestamp based on FPGA. The hardware timestamp unit performs hardware timestamp on data frames from PHY under the driving of receiving clock, and provides timestamp data to interface signal processing unit at any time; the interface signal processing unit detects the receiving data valid signal, conflict detection signal, carrier detection signal, receiving data error signal and 8-bit receiving data from PHY under the driving of receiving clock, and sends them to MAC with a delay of 1 receiving clock. After all the receiving data sent by PHY are transmitted to MAC, the interface signal processing unit sends the timestamp data to MAC as receiving data. The invention can realize that each message from Ethernet and the hardware timestamp data corresponding thereto are transmitted to the application layer in real time, and the PTP protocol stack is processed according to actual needs, so as to realize high throughput and reliable IEEE1588 timing.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The invention relates to the technical field of time and frequency synchronization, and in particular to a method for processing a PTP hardware timestamp based on FPGA, which is applicable to a timing network system based on the PTP technology. Background Art

[0002] PTP (Precision Time Protocol), also known as IEEE1588, is a high-precision network timing protocol. With the vigorous development of Ethernet technology, the PTP technology protocol developed based on Ethernet adopts the hardware timestamp method, overcomes the bottleneck of NTP technology, and improves the clock synchronization accuracy to the sub-microsecond level. Therefore, it is widely used in military and civilian fields such as measuring instruments, intelligent rail transportation, smart grid, and communication engineering.

[0003] PTP hardware solutions have long been popular. The more common hardware timestamp marking on the market usually uses the PTP function of the physical layer PHY chip, or uses the timestamp unit constructed by FPGA to mark the timestamp and cache it in the FIFO for retrieval. These can realize all the functions of PTP; of course, there are also some solutions that use the PTP function based on the processor integrated MAC to achieve accurate timing, but usually only support some functions of PTP, and cannot realize all the functions of PTP.

[0004] In the above-mentioned several full-function PTP implementation schemes, the timestamp data of the PTP event message from the network is first cached and then waits for the processor running the PTP protocol stack to obtain the timestamp data. When facing many PTP node clocks, the arrival of a large number of PTP event messages will cause the processor to be replaced by new timestamp data before it has time to obtain the corresponding "cached" timestamp data, resulting in a large time error. The processing method of hardware timestamp marking of messages from the network described in the present invention can effectively avoid the situation where the timestamp data cannot correspond, thereby achieving high throughput and reliable PTP timing. Summary of the invention

[0005] The purpose of the present invention is to provide a method for processing PTP hardware timestamp based on FPGA in view of the above problems existing in the prior art.

[0006] In order to achieve the above object, the present invention adopts the following technical solution:

[0007] A method for processing PTP hardware timestamp based on FPGA, comprising the following steps:

[0008] Step 1. The interface signal processing unit and the hardware timestamp unit are driven by the receiving clock RX_CLK generated by PHY. After the interface signal processing unit detects the rising edge of the receiving data valid signal RX_DV sent by PHY, the receiving data valid signal RX_DV, the conflict detection signal COL, the carrier detection signal CRS, the receiving data error signal RX_ER and the 8-bit receiving data RXD[7:0] from PHY are delayed by 1 receiving clock RX_CLK to generate the corresponding receiving data valid delay signal SP_RX_DV, the conflict detection signal COL, the carrier detection signal CRS, the receiving data error signal RX_ER and the 8-bit receiving data RXD[7:0] The delay signal SP_COL, the carrier detection delay signal SP_CRS, the received data error delay signal SP_RX_ER and the delayed received data SP_RXD[7:0] are sent to the MAC; after the hardware timestamp unit detects the rising edge of the received data valid signal RX_DV from the PHY, it generates a 64-bit timestamp data TS[63:0]; the interface signal processing unit reads the 64-bit timestamp data TS[63:0] at the rising edge of the second receive clock RX_CLK after the received data valid signal RX_DV of the PHY is pulled high;

[0009] Step 2: After the interface signal processing unit detects the falling edge of the receive data valid signal RX_DV sent by the PHY, it continues to keep the receive data valid delay signal SP_RX_DV at a high level, and divides the 64-bit timestamp data TS[63:0] obtained from the hardware timestamp unit into each 8-bit timestamp segment data. The interface signal processing unit sends each timestamp segment data as delayed receive data SP_RXD[7:0] to MAC in sequence; after 8 receive clocks RX_CLK, the 64-bit timestamp data TS[63:0] is transmitted from the interface signal processing unit to the MAC, and the interface signal processing unit sets SP_RX_DV to a low level;

[0010] Step 3: After the interface signal processing unit detects the falling edge of the carrier detection signal CRS sent by the PHY, it continues to maintain the high level of SP_CRS. After 8 receiving clocks RX_CLK, the interface signal processing unit sets the carrier detection delay signal SP_CRS to a low level.

[0011] Through the above processing, the Ethernet messages received by the MAC side all include the corresponding 64-bit hardware timestamp data, which will be transmitted to the application layer along with the message for use by the application layer PTP protocol stack.

[0012] Compared with the prior art, the present invention has the following beneficial effects:

[0013] The hardware timestamp data accompanying the message has a one-to-one correspondence. The application layer PTP protocol stack processes it according to actual needs. There is no longer a problem of one-to-one correspondence between the timestamp data and the message due to slow processing speed, thereby achieving high-throughput and reliable PTP timing. BRIEF DESCRIPTION OF THE DRAWINGS

[0014] Figure 1 It is a schematic diagram of the principle in the embodiment.

[0015] Figure 2 Schematic diagram of the timing relationship of each signal in the embodiment. DETAILED DESCRIPTION

[0016] In order to facilitate those skilled in the art to understand and implement the present invention, the present invention is further described in detail below in conjunction with embodiments. It should be understood that the implementation examples described herein are only used to illustrate and explain the present invention and are not used to limit the present invention.

[0017] A PTP hardware timestamp processing method system based on FPGA comprises MAC, an interface signal processing unit, a hardware timestamp unit and PHY.

[0018] Figure 1 PHY is a physical layer transceiver chip, and MAC is a media access controller. Since the present invention only involves marking and processing the hardware timestamp of the message from the Ethernet end, and does not involve the process of marking and processing the hardware timestamp of the message sent to the Ethernet end, the principle diagram only includes the receiving end signal of the GMII interface. As a preferred solution, the interface signal processing unit and the hardware timestamp unit are both implemented in the FPGA and are located between the PHY and the MAC. The interface signal processing unit detects and processes the conflict detection signal COL, carrier detection signal CRS, received data error signal RX_ER, 8-bit received data RXD[7:0] and received data valid signal RX_DV from PHY under the drive of the receiving clock RX_CLK, and then outputs them to MAC; the conflict detection signal COL, carrier detection signal CRS, received data error signal RX_ER, 8-bit received data RXD[7:0] and received data valid signal RX_DV after delay processing are respectively called conflict detection delay signal SP_COL, carrier detection delay signal SP_CRS, delayed received data SP_RXD[7:0], received data error delay signal SP_RX_ER and received data valid delay signal SP_RX_DV. The hardware timestamp unit detects and marks the received data valid signal RX_DV under the drive of the receiving clock RX_CLK, and provides 64-bit timestamp data TS[63:0] to the interface signal processing unit at any time.

[0019] Figure 2 The figure shows the timing relationship between the conflict detection signal COL, carrier detection signal CRS, 8-bit received data RXD[7:0], received data error signal RX_ER, received clock RX_CLK and received data valid signal RX_DV entering the interface signal processing unit and the conflict detection delay signal SP_COL, carrier detection delay signal SP_CRS, delayed received data SP_RXD[7:0], received data error delay signal SP_RX_ER and received data valid delay signal SP_RX_DV output after being processed by the interface signal processing unit.

[0020] A method for processing PTP hardware timestamp based on FPGA, comprising the following steps:

[0021] Step 1: The interface signal processing unit and the hardware timestamp unit are driven by the receiving clock RX_CLK generated by the PHY. According to the GMII interface protocol, whenever the PHY receives a new Ethernet data packet, it will pull up the receiving data valid signal RX_DV until the data packet is received and then pull down the receiving data valid signal RX_DV. After the interface signal processing unit detects the rising edge of the receive data valid signal RX_DV sent by PHY, the receive data valid signal RX_DV, the conflict detection signal COL, the carrier detection signal CRS, the receive data error signal RX_ER and the 8-bit receive data RXD[7:0] from PHY are delayed by 1 receive clock RX_CLK, and the corresponding receive data valid delay signal SP_RX_DV, conflict detection delay signal SP_COL, carrier detection delay signal SP_CRS, receive data error delay signal SP_RX_ER and delayed receive data SP_RXD[7:0] are generated and sent to MAC; after the hardware timestamp unit detects the rising edge of the receive data valid signal RX_DV from PHY, it generates 64-bit timestamp data TS[63:0] waiting for the interface signal processing unit to obtain; the interface signal processing unit reads the 64-bit timestamp data TS[63:0] at the rising edge of the second receive clock RX_CLK after the receive data valid signal RX_DV of PHY is pulled high.

[0022] Step 2, after the interface signal processing unit detects the falling edge of the receive data valid signal RX_DV sent by the PHY, it continues to keep the receive data valid delay signal SP_RX_DV at a high level, and divides the 64-bit timestamp data TS[63:0] obtained from the hardware timestamp unit into 8 bytes of timestamp segmented data, namely TS[63:56], TS[55:48], TS[47:40], TS[39:32], TS[31:24], TS[23:16], TS[15:8], and TS[7:0]. The interface signal processing unit sends each timestamp segmented data as delayed receive data SP_RXD[7:0] to the MAC in sequence; after 8 receive clocks RX_CLK, the divided 64-bit timestamp data TS[63:0] (i.e., each timestamp segmented data) is transmitted from the interface signal processing unit to the MAC, and the interface signal processing unit sets SP_RX_DV to a low level;

[0023] Step 3. After the interface signal processing unit detects the falling edge of the carrier detection signal CRS sent by PHY, it continues to maintain the SP_CRS high level. Under normal circumstances, the carrier detection signal CRS is consistent with the received data valid signal, that is, the carrier detection signal CRS and the received data valid signal RX_DV are synchronously set high and low. After 8 receiving clocks RX_CLK (that is, the 64-bit timestamp data TS[63:0] is transmitted), the interface signal processing unit sets the carrier detection delay signal SP_CRS to a low level.

[0024] It should be noted that, in the present invention, no matter whether MAC and PHY adopt GMII / MII interface or RGMII / RMII interface, the processing process is the same. Therefore, the present invention only takes GMII interface as an example to describe the processing process in detail.

[0025] The specific embodiments described herein are merely examples of the present invention. Those skilled in the art may make various modifications, additions or substitutions to the specific implementation cases described, but they will not deviate from the essence of the present invention or exceed the scope defined by the appended claims.

Claims

1. A method for processing PTP hardware timestamp based on FPGA, characterized in that: The following steps are involved: Step 1. The interface signal processing unit and the hardware timestamp unit are driven by the receiving clock RX_CLK generated by PHY. After the interface signal processing unit detects the rising edge of the receiving data valid signal RX_DV sent by PHY, the receiving data valid signal RX_DV, the conflict detection signal COL, the carrier detection signal CRS, the receiving data error signal RX_ER and the 8-bit receiving data RXD[7:0] from PHY are delayed by 1 receiving clock RX_CLK to generate the corresponding receiving data valid delay signal SP_RX_DV, the conflict detection signal COL, the carrier detection signal CRS, the receiving data error signal RX_ER and the 8-bit receiving data RXD[7:0] The delay signal SP_COL, the carrier detection delay signal SP_CRS, the received data error delay signal SP_RX_ER and the delayed received data SP_RXD[7:0] are sent to the MAC; after the hardware timestamp unit detects the rising edge of the received data valid signal RX_DV from the PHY, it generates a 64-bit timestamp data TS[63:0]; the interface signal processing unit reads the 64-bit timestamp data TS[63:0] at the rising edge of the second receive clock RX_CLK after the received data valid signal RX_DV of the PHY is pulled high; Step 2: After the interface signal processing unit detects the falling edge of the receive data valid signal RX_DV sent by the PHY, it continues to keep the receive data valid delay signal SP_RX_DV at a high level, and divides the 64-bit timestamp data TS[63:0] obtained from the hardware timestamp unit into 8 8-bit timestamp segmented data. The interface signal processing unit sends the 8 timestamp segmented data to the MAC in sequence as delayed receive data SP_RXD[7:0]; after 8 receive clocks RX_CLK, the interface signal processing unit sets SP_RX_DV to a low level; Step 3: After the interface signal processing unit detects the falling edge of the carrier detection signal CRS sent by the PHY, it continues to maintain the high level of SP_CRS. After 8 receiving clocks RX_CLK, the interface signal processing unit sets the carrier detection delay signal SP_CRS to a low level.

Citation Information

Patent Citations

  • Ethernet MAC module realization device and Ethernet MAC module realization method used for IEEE 1588v2 protocol

    CN108429596A

  • System for implements PTP network card under FPGA

    CN109150355A

  • Multi-channel synchronous high-speed data collection device

    CN113535620A

  • Timestamp generating method, device and system

    WO2014173267A1