Network time synchronization system implementation method based on FPGA

By using the FPGA time synchronization module and PTP protocol in a multi-mainboard system, the problem of timing positioning board configuration in a multi-mainboard system is solved, and high-precision time synchronization and self-timekeeping functions are achieved, which is suitable for high-demand fields.

CN118869129APending Publication Date: 2024-10-29BEIJING INST OF COMP TECH & APPL
View PDF 0 Cites 4 Cited by

Patent Information

Application Number
CN202411062189.7
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2024-08-05
Publication Date
2024-10-29

AI Technical Summary

Technical Problem

In a multi-motherboard system, multiple motherboards cannot access the same timing positioning board through the PCI/PCIe bus, resulting in the need to configure a timing positioning board for each motherboard, which is not conducive to the miniaturization and low cost of the system. At the same time, the existing network time synchronization method The compatibility is low and it cannot keep time automatically when the external timing device fails.

Method used

A network time synchronization system based on FPGA is used to build a network channel with the switching board and main board through the FPGA time synchronization module to realize the transmission of PTP protocol messages. The FPGA module decodes and encodes time information. The main board runs the standard PTP protocol stack for time synchronization, and Reserve an asynchronous serial communication interface to configure variable parameters to ensure consistent system time.

Benefits of technology

The self-timekeeping function is implemented to ensure that the system maintains time consistency with a small error when external timing information is interrupted, reaching ten nanosecond-level time synchronization accuracy and microsecond-level self-timekeeping accuracy, and is suitable for fields with high real-time performance and reliability.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN118869129A_ABST
    Figure CN118869129A_ABST
Patent Text Reader

Abstract

The invention relates to a network time synchronization system implementation method based on an FPGA, and belongs to the field of network time synchronization. The system comprises a time synchronization module taking an FPGA as a core, a switch board and a plurality of mainboards, the switching board is used for constructing a network path between the time synchronization module and the main board and is used for transmitting a PTP protocol message; the time synchronization module with the FPGA as the core is used as the core of the system and is used for decoding time information including TOD, B codes and PTP protocols, encoding the time information into Ethernet messages of the PTP protocols through the FPGA on the time synchronization module and carrying out time service on other mainboards in the system, the mainboards only need to run a standard PTP protocol stack, time synchronization can be achieved, and the time synchronization efficiency is improved. And the time of each mainboard in the system is kept consistent with the input time. According to the invention, the time of the system can be maintained with a small error, time service can be carried out on each mainboard in the system, and the stability of the time in the system is ensured.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The invention belongs to the field of network time synchronization, and in particular relates to a method for realizing a network time synchronization system based on FPGA. Background Art

[0002] As an important foundation for the operation of various large-scale engineering systems, time synchronization technology has always been a research focus. Traditional time synchronization methods include the "TOD+second pulse" method, that is, a timing positioning board is set up in the system. The timing positioning board obtains the basic time (accurate to seconds) by decoding the external input TOD; and calculates the remaining time by sampling the second pulse. The mainboard that needs to be synchronized in the system can access the timing positioning board through the PCI / PCIe bus to obtain the current time. However, this solution has certain limitations. In a system with multiple mainboards, multiple mainboards cannot access the same timing positioning board through the PCI / PCIe bus. A timing positioning board must be configured for each mainboard, which is not conducive to the miniaturization and low cost of the system.

[0003] With the development of technology, some recent systems have gradually begun to use network time synchronization methods including PTP protocol for time synchronization. This solution does not require a time synchronization board. The external timing device directly synchronizes all the mainboards in the system through the network time synchronization protocol, or after synchronizing a certain mainboard, the mainboard synchronizes the other mainboards in the system. However, this method also has certain limitations. First of all, the system using this method only supports network synchronization, that is, it requires that the external time source must be input according to the network time synchronization protocol, and no longer supports the traditional timing method, which reduces the system compatibility; at the same time, since the system no longer has a timing positioning board, when the external timing device fails, the mainboards in the system cannot keep their own time. Summary of the invention

[0004] 1. Technical issues to be resolved

[0005] The technical problem to be solved by the present invention is how to provide a method for realizing a network time synchronization system based on FPGA, so as to solve the problem that in a system with multiple mainboards, multiple mainboards cannot access the same timing and positioning board through a PCI / PCIe bus, and a timing and positioning board needs to be configured for each mainboard, which is not conducive to the miniaturization and low cost of the system.

[0006] (II) Technical solution

[0007] In order to solve the above technical problems, the present invention proposes a method for implementing a network time synchronization system based on FPGA, the system comprising: a time synchronization module with FPGA as the core, a switching board and multiple main boards;

[0008] The switch board is used to build a network path between the time synchronization module and the main board, and is used for the transmission of PTP protocol messages;

[0009] The time synchronization module with FPGA as the core is the core of the system. It is used to decode time information including TOD, B code, and PTP protocol, and encode the time information into Ethernet messages of PTP protocol through the FPGA on the time synchronization module, and synchronize the time with other main boards in the system. The main board only needs to run the standard PTP protocol stack to synchronize the time, so that the time of each main board in the system is consistent with the input time. At the same time, the time synchronization module reserves an asynchronous serial communication interface UART. A main board can be set as the main control main board in the system to configure the variable parameters of the time synchronization module.

[0010] (III) Beneficial effects

[0011] The present invention proposes a method for implementing a network time synchronization system based on FPGA. The present invention provides a method for implementing a network time synchronization system based on FPGA. The time synchronization module relies on FPGA and a high-stability crystal oscillator to realize the self-timekeeping function, that is, when the external timing information input is interrupted, it can still maintain its own time with a small error and perform timing on each mainboard in the system to ensure the stability of the time in the system. The system has a time synchronization accuracy of tens of nanoseconds and a self-timekeeping accuracy of microseconds, and can be widely used in fields and scenarios such as aerospace that have high requirements for real-time performance and reliability. BRIEF DESCRIPTION OF THE DRAWINGS

[0012] Figure 1 This is a diagram of the network time synchronization system architecture based on FPGA of the present invention;

[0013] Figure 2 This is the hardware circuit design diagram for the time synchronization module;

[0014] Figure 3 This is the hardware circuit design diagram for the time synchronization module;

[0015] Figure 4 This is the principle diagram of the two-step request and response mechanism of the PTP protocol;

[0016] Figure 5 This is the FPGA logic structure diagram of the time synchronization module. DETAILED DESCRIPTION

[0017] In order to make the purpose, content and advantages of the present invention more clear, the specific implementation methods of the present invention are further described in detail below in conjunction with the drawings and examples.

[0018] The present invention relates to a method for realizing a network time synchronization system based on FPGA, and specifically to a system architecture and composition of a multi-network time synchronization system, a time synchronization method, an FPGA logic architecture of a time synchronization module, and an implementation principle.

[0019] The present invention relates to a method for realizing a network time synchronization system based on FPGA. The system is composed of a time synchronization module supporting a precise network time protocol (hereinafter referred to as PTP protocol) and a plurality of main boards supporting the PTP protocol. The time synchronization module serves as the master clock of the system, and each main board serves as a slave clock of the system. The time synchronization module obtains accurate time by parsing and selecting input time information (including GPS / Beidou general protocol (hereinafter referred to as TOD), B code, PTP protocol, etc.), and provides time to each main board through the PTP protocol. The main board only needs to run a standard PTP protocol stack to achieve time synchronization, so that the time of each main board in the system is consistent with the input time. Among them, FPGA, as the core of the time synchronization module, undertakes multiple functions such as decoding of various timing protocols, correction and compensation of time errors, construction of PTP protocol stack, Ethernet message transmission and reception, and encoding and decoding.

[0020] The FPGA-based network time synchronization system implementation method described in the present invention is a new time synchronization method proposed to address the shortcomings of the existing time synchronization system. The method supports an external timing device to perform time synchronization on a time synchronization module in the system through multiple different protocols such as TOD, B code, PTP protocol, etc. The time synchronization module performs time synchronization on each mainboard in the system through the PTP protocol. The time synchronization accuracy reaches ten nanoseconds, and when the external timing information input is interrupted, the system can still maintain time stability with a small error.

[0021] The invention provides a method for realizing a network time synchronization system based on FPGA. The network time synchronization system comprises: a time synchronization module with FPGA as the core, a switching board and a plurality of main boards.

[0022] The switch board is used to build a network path between the time synchronization module and the main board, and is used for the transmission of PTP protocol messages;

[0023] The time synchronization module with FPGA as the core is the core of the system. It is used to decode time information including TOD, B code, PTP protocol, etc., and encode the time information into Ethernet messages of PTP protocol through the FPGA on the time synchronization module, and synchronize the time with other main boards in the system. The main board only needs to run the standard PTP protocol stack to synchronize the time, so that the time of each main board in the system is consistent with the input time. At the same time, the time synchronization module reserves an asynchronous serial communication interface (hereinafter referred to as UART). A main board can be set as the main control main board in the system to configure the variable parameters of the time synchronization module. The system architecture is as follows: Figure 1 shown.

[0024] The core elements of the present invention include the hardware circuit design of the time synchronization module as the core of the system and the logic design of the FPGA, in addition to the above-mentioned system architecture and the time synchronization operation mode.

[0025] 1. Hardware circuit design

[0026] The hardware circuit of the time synchronization module is mainly composed of the minimum system of FPGA+DDR+QSPI FLASH. Two DDR3 memory chips are connected to the PS end of the FPGA chip. Each DDR3 has a capacity of 512M bytes, forming a 32-bit data bandwidth. A 128Mb QSPI FLASH is connected to the PS end of the FPGA chip to store the configuration files and other user data of the FPGA chip. The overall hardware composition is as follows Figure 2 shown.

[0027] The FPGA uses Fudan Microelectronics' FMQL20S400, which is a fully programmable fusion chip that integrates a quad-core cortex-A7 processor (PS) and programmable logic (PL) in a single chip. The chip has rich logic resources. The PS side can lead to various types of interfaces such as Gigabit Ethernet, SPI, and UART, and can run embedded operating systems such as Linux. The PL side has a total of 85K logic units, 4.9Mb of BlockRAM, and 125 configurable IO pins, which can expand logic functions according to needs. For its configuration chip SPI flash, Fudan Microelectronics' EFM25F128A is selected. This chip has 128MB of storage space to meet the storage requirements of FPGA configuration files. In addition, the PS side of the FPGA mounts a total of 1GBytes of DDR3 SDRAM as the memory of the microprocessor, and two SM41K256M16M chips from Guowei are selected to achieve this. The single-chip storage capacity of this chip is 4Gbit.

[0028] In terms of power design, under the premise of ensuring that the power and ripple meet the requirements, Shenzhen Guowei's SM4644MPY is used as the power module. The minimum peripheral configuration of this module only requires 5 external low ESR ceramic capacitors and ceramic capacitors and 4 voltage loop feedback resistors to output four channels and independently adjust the power output between 0.6V and 5.5V. Use two pieces of this module to convert the input 12V voltage into 1.0V, 1.2V, 1.5V, 1.8V, 2.5V, 3.3V and other voltages for various devices on the board.

[0029] In terms of clock, the time synchronization module requires two frequency crystal oscillators. The 33MHz clock is used to connect to the PS end of the FPGA as the main clock of the PS; the 100MHz high-stability crystal oscillator is connected to the PL end of the FPGA for time-related logic work.

[0030] In terms of network, the network design of the time synchronization module is mainly divided into two parts. The first part is connected to the FPGA via the HJ30J-18 connector through the network transformer and the PHY chip, which is used to receive the timing of the external timing device; the second part is connected to the VPX connector via the PHY chip from the FPGA, which is used to time the mainboard inside the system. The PHY chip is SM88E1111 from Guowei Company. This chip supports 10 / 100 / 1000Mbps network transmission rate and communicates data with the MAC layer of the FMQL system through the RGMII interface; supports MDI / MDX adaptation, various speed adaptation, Master / Slave adaptation; supports MDIO bus for PHY register management. The network transformer uses the T31Q1102BM from Shaanxi Changling Magotan. It is used for external network port isolation and transformation. The structure of the network part is as follows Figure 3 Shown

[0031] As for other interfaces, the time synchronization module leads out two RS422 interfaces for receiving TOD, second pulse, B code, etc. from external timing equipment. The RS422 transceiver is SMUM2682 from SMIT. At the same time, one RS232 interface is led out for the time synchronization module to communicate with the main control motherboard and receive the configuration information of the main control motherboard. The RS232 transceiver is SM3232 from SMIT.

[0032] 2. FPGA logic design

[0033] In the system of the present invention, when the time synchronization module internally provides time to each main board, it mainly uses the PTP protocol. At this time, the time synchronization module is the master clock of the PTP protocol, and each main board is equivalent to a slave clock; when the time synchronization module receives external time, it can use three methods: "TOD+second pulse", B code, and PTP protocol. When the PTP protocol method is adopted, the time synchronization module is equivalent to the slave clock of the external timing device. Therefore, in the FPGA logic design, the situation of being both a master and a slave node must be considered at the same time.

[0034] The principle of the so-called PTP protocol can be briefly described as the periodic release of Ethernet messages containing the PTP time synchronization protocol and time information by the master clock, and the slave clock receives the timestamp information sent by the master clock, and calculates the time delay and time difference of the master-slave line based on this, and uses this information to adjust the local time. The PTP protocol has multiple clock synchronization modes, including a single-step request response mechanism, a two-step request response mechanism, and an end delay mechanism. As for the most commonly used two-step request response mechanism, its principle is as follows: Figure 4 shown.

[0035] After the master clock sends the sync message, it records the sending timestamp of the message, and then sends the follow_up message, the payload of which contains the timestamp t1 of the sending of the sync message; after the slave clock receives the follow_up message, it records the timestamp t2; the slave clock then sends the delay_req message and records the sending timestamp t3; after the master clock receives the delay_req message, it records the timestamp t4 and puts it in the payload of the delay_resp message and sends it. At this point, the slave clock has obtained the time of the master clock and can calculate the delay in network communication through four timestamps:

[0036]

[0037] The correction of local time can be calculated and the local time can be calibrated.

[0038] Based on the above principles, the logical structure of FPGA is as follows Figure 5 The FPGA logic mainly includes three functions, namely, receiving external timing, maintaining its own time, and timing within the system; in addition, it also includes an auxiliary function, namely, accepting the parameter configuration function logic of the main control motherboard.

[0039] (1) Logic design of receiving external timing function

[0040] Taking into account the universal design requirements, full compatibility design has been carried out on the function of receiving external time synchronization. The time synchronization module can accept time synchronization from three time sources.

[0041] When the input time source is in the form of TOD+second pulse or B code, the working principle of FPGA is as follows:

[0042] S11, the TOD+PPS decoding submodule or the B code decoding submodule first makes a qualification judgment on the input time information, mainly to judge whether the information content format of the TOD complies with the protocol, whether the check bit is correct, and whether the pulse width and period of the second pulse are within the allowable error range; or to judge whether the format of the B code protocol is correct and whether the correct time information can be restored.

[0043] S12. After judging that the time information is qualified, the TOD+PPS decoding submodule or the B code decoding submodule decodes the time information according to the protocol (TOD or B code). This operation can obtain the rough time (more than seconds) contained in the input time information. While parsing the data content, the TOD+PPS decoding submodule or the B code decoding submodule will also determine the zero time of the second according to a specific mark, that is, the rising edge of the second pulse or two consecutive P code sources in the B code, and restore a trigger signal marking the zero time of the second.

[0044] S13. After decoding is completed, the above information is sent to the time maintenance submodule for time calibration and maintenance.

[0045] When the timing device uses the PTP protocol to provide timing to the time synchronization module, the FPGA acts as a slave clock of the PTP protocol. Its working principle is as follows:

[0046] S21, at the receiving end, after the time synchronization module receives the sync, follow_up, delay_resp and other messages, the slave clock data receiving submodule converts the RGMII format data into GMII format data. When the slave clock data decoding submodule receives the GMII format data transmitted from the slave clock data receiving submodule, it reads the timestamp of the time maintenance submodule and parses the received Ethernet message. After the parsing is completed, the message content is transmitted to the PS end through the DMA controller.

[0047] S22, at the transmitting end, when the time synchronization module sends messages such as delay_req to the timing device, the PS end master control submodule organizes the sending content and transmits it to the slave clock data encoding submodule. The slave clock data encoding submodule packages the sending content together with the current timestamp into Ethernet messages and sends them to the slave clock data sending submodule. The slave clock data sending submodule converts the GMII format data into the RGMII format Ethernet data for sending.

[0048] S23, the master control submodule on the PS side is responsible for data exchange with the DMA controller on the PL side. The time calibration calculation submodule calculates its own error through the received time information and other data to obtain the time correction value, and feeds the correction value back to the master control submodule, which sends the correction value to the time maintenance submodule on the PL side.

[0049] This design method is used because the efficiency and real-time performance of the quad-core cortex-A7 processor on the PS side are lower than the hardware logic method of the PL after running the operating system. Therefore, the tasks with high real-time requirements, such as obtaining timestamps, are all implemented on the PL side using hardware logic resources, and only the tasks that are not suitable for hardware description languages, such as delay algorithms, are implemented on the PS side. After adopting this design method, when the time synchronization module receives the PTP protocol time, its accuracy can theoretically reach the sampling period of the crystal oscillator on the PL side, that is, 10ns.

[0050] (2) Logic design of self-time maintenance function

[0051] The time maintenance submodule is mainly used to maintain the time of the time synchronization module. Since the module supports three timing modes, the time information of each mode is different, so different processing methods will be adopted.

[0052] When choosing to accept TOD or B code timing, the time maintenance submodule obtains the time information including year, month, day, hour, minute, second and a zero time mark from the TOD+PPS decoding submodule or the B code decoding submodule. In the system, the time synchronization module uses PTP to provide time to other mainboards, and the basic time unit of the PTP protocol is seconds and nanoseconds. Therefore, the time maintenance submodule needs to convert the time information into seconds according to the time origin of the PTP protocol, and correct its own nanosecond value according to the zero time mark.

[0053] When choosing to accept the timing of the PTP protocol, the time maintenance submodule obtains the correction values ​​of seconds and nanoseconds from the PS side, so it only needs to add or subtract corrections to its own time according to the correction values.

[0054] When there is no external timing source or all timing sources are judged to be unqualified, the time maintenance submodule can rely on the high-stable crystal oscillator outside the FPGA to add its own time, so that it can maintain a higher time accuracy for a certain period of time. The accuracy is related to the error range of the high-stable crystal oscillator and has nothing to do with the frequency. For every 1ppm increase in the error range, the self-timekeeping error increases by 1us / s.

[0055] (3) Design of the timing function logic within the system

[0056] This part of the function is mainly for the time synchronization module to use its own time to synchronize the time of other mainboards in the system, so that the time of each mainboard in the combination is consistent with the time of the external timing device. The timing method is to synchronize the network through the PTP protocol. When implementing this part of the function, the FPGA serves as the master clock of the PTP protocol. This part of the function is implemented by another group of logic submodules, such as Figure 5As shown in the upper part, its front end, i.e., the master clock data sending, receiving, encoding, and decoding submodules, are similar to the submodule group used when receiving the external timing function, i.e., the slave clock data sending, receiving, encoding, and decoding submodules. The difference is that the PTP protocol stack of this part of the function runs completely on the PL side, and this part of the function is implemented by the fixed message sending submodule and the response message sending submodule.

[0057] The fixed message sending submodule is mainly responsible for the encoding of PTP protocol messages such as announce, sync, follow_up and other Ethernet fixed messages. Such messages are sent at a fixed period, and the fixed message sending submodule needs to obtain the time from the time maintenance submodule, and store all information including MAC address, IP address, and load in the cache at the specified time, and the master clock data encoding submodule compiles it into an Ethernet format message. Among them, when sending the follow_up message, it is also necessary to obtain the timestamp of the sync message from the master clock data decoding submodule and place it in the corresponding position in the load.

[0058] The reply message sending submodule is mainly responsible for the encoding of PTP protocol messages such as delay_resp and other reply-type Ethernet messages. After receiving the corresponding request message, this type of message needs to store all the information of the reply message in the cache, and the master clock data encoding submodule compiles it into an Ethernet format message. Among them, when sending the delay_resp message, it is also necessary to obtain the timestamp of the delay_req message reception from the master clock data decoding submodule and place it in the corresponding position in the load.

[0059] (4) Parameter configuration function logic design

[0060] This part of the function mainly includes building various control and status registers. The main control motherboard configures some optional parameters of the time synchronization module by accessing the registers. The configuration path between the main control motherboard and the time synchronization module is the UART interface, so the parameter configuration module needs to have the encoding and decoding function of the UART protocol. The key registers of the parameter configuration module are shown in Table 1.

[0061] Table 1 List of key registers of parameter configuration module

[0062]

[0063]

[0064]

[0065] Embodiment 1:

[0066] The present invention is described in detail below by using a system that has been applied in engineering practice. This example is only used as a further explanation of the present invention and is not intended to limit the present invention.

[0067] Specifically, this product contains 4 main boards, 1 switch board, and 1 time synchronization module, which are plugged into the baseboard together. Among them, the time synchronization module's external interface to the product includes 2 RS422 level interfaces for receiving TOD and second pulses or B codes sent by external timing equipment; 1 Ethernet interface for receiving PTP protocol timing from external timing equipment. Inside the product, the switch board builds a network path between the time synchronization module and the main board, which is used for the transmission of PTP protocol messages and time synchronization. In addition, there is an asynchronous serial communication protocol (UART) interface between one of the main boards as the main control main board and the time synchronization module, which is used to configure some variable parameters of the time synchronization module.

[0068] After the product is powered on, before external time information is input, the main control motherboard can send its own BIOS time to the time synchronization module through the UART interface. The time synchronization module uses this time as the basis for self-timekeeping and synchronizes the time of each motherboard through the PTP protocol.

[0069] When the external time information is input, each decoding submodule in the time synchronization module will judge and decode the legitimacy of the time information according to its type (TOD, B code or PTP), and store the legitimacy status of each type of time information in the specified register. The main control motherboard can access the register and select one of the time information as the benchmark, or let the time synchronization module select the time information with the highest priority among all the legal time information as the benchmark according to the preset priority.

[0070] When the benchmark is selected, the time maintenance submodule in the time synchronization module corrects its own time according to this time, and relies on a high-stability crystal oscillator to maintain the operation of the time; each network control submodule can obtain a timestamp from the time maintenance submodule for encoding and decoding of PTP protocol messages to achieve external time synchronization. At the same time, each mainboard runs the PTP time synchronization service supported by its own operating system, realizes time synchronization through PTP message interaction with the time synchronization module, and changes the system time.

[0071] When the external input time information does not exist or is illegal for some reason, due to the existence of the high-stability crystal oscillator on the time synchronization module, it can still keep time for a certain period of time with a small error, and use the self-keeping time to perform PTP timing for each mainboard in the product. The self-keeping error is related to the accuracy of the selected high-stability crystal oscillator. The 1ppm crystal oscillator selected in this product has a maximum self-keeping error of 1us / s.

[0072] After the product is powered on, the various default parameters in the time synchronization module meet its working requirements. If you want to change certain types of parameters (such as IP address, PTP synchronization mode, etc.), you can run the driver software for parameter configuration on the main control motherboard and modify it through the UART interface.

[0073] The present invention provides a method for implementing a network time synchronization system based on FPGA. The time synchronization module relies on FPGA and a high-stability crystal oscillator to realize the self-timekeeping function, that is, when the external timing information input is interrupted, it can still maintain its own time with a small error and perform timing on each mainboard in the system to ensure the stability of the time in the system. The time synchronization accuracy of the system is at the ten nanosecond level, and the self-timekeeping accuracy is at the microsecond level. It can be widely used in fields and scenarios such as aerospace that have high requirements for real-time performance and reliability.

[0074] The above is only a preferred embodiment of the present invention. It should be pointed out that for ordinary technicians in this technical field, several improvements and modifications can be made without departing from the technical principles of the present invention. These improvements and modifications should also be regarded as the scope of protection of the present invention.

Claims

1. A method for implementing a network time synchronization system based on FPGA, characterized in that: The system includes: a time synchronization module with FPGA as the core, a switch board and multiple main boards; The switch board is used to build a network path between the time synchronization module and the main board, and is used for the transmission of PTP protocol messages; The time synchronization module with FPGA as the core is the core of the system. It is used to decode time information including TOD, B code, and PTP protocol, and encode the time information into Ethernet messages of PTP protocol through the FPGA on the time synchronization module, and synchronize the time with other main boards in the system. The main board only needs to run the standard PTP protocol stack to synchronize the time, so that the time of each main board in the system is consistent with the input time. At the same time, the time synchronization module reserves an asynchronous serial communication interface UART. A main board can be set as the main control main board in the system to configure the variable parameters of the time synchronization module.

2. The method for implementing a network time synchronization system based on FPGA as claimed in claim 1, characterized in that: The hardware circuit of the time synchronization module includes: FPGA, DDR and QSPIFLASH; two DDR3 storage chips are connected to the PS end of the FPGA chip, each DDR3 has a capacity of 512M bytes, forming a 32-bit data bandwidth; a 128Mb QSPIFLASH is connected to the PS end of the FPGA chip to store the configuration file of the FPGA chip and other user data.

3. The method for implementing a network time synchronization system based on FPGA as claimed in claim 1, characterized in that: The FPGA uses FMQL20S400 from Fudan Microelectronics. FMQL20S400 is a fully programmable fusion chip that integrates a quad-core cortex-A7 processor PS and programmable logic PL in a single chip. The time synchronization module requires two crystal oscillators, of which the 33MHz clock is used to connect to the PS end of the FPGA as the main clock of the PS; the 100MHz high-stability crystal oscillator is connected to the PL end of the FPGA for time-related logic work.

4. The method for implementing a network time synchronization system based on FPGA as claimed in claim 3, characterized in that: The time synchronization module is connected to the FPGA via the HJ30J-18 connector through the network transformer and the PHY chip, and is used to receive the timing of the external timing device. The FPGA is connected to the VPX connector via the PHY chip, and is used to provide timing for the mainboard inside the system. The time synchronization module leads out two RS422 interfaces for receiving TOD, second pulse, and B code from the external timing device, and at the same time leads out one RS232 interface for the time synchronization module to communicate with the main control mainboard and receive the configuration information of the main control mainboard.

5. The method for implementing a network time synchronization system based on FPGA according to any one of claims 1 to 4, characterized in that: The network time synchronization system uses the PTP protocol when the time synchronization module internally provides time to each main board. At this time, the time synchronization module is the master clock of the PTP protocol, and each main board is equivalent to a slave clock; when the time synchronization module receives external time, it uses three methods: "TOD+second pulse", B code, and PTP protocol. When the PTP protocol method is adopted, the time synchronization module is equivalent to the slave clock of the external timing device; the FPGA logic includes: logic for accepting external timing, logic for maintaining its own time, logic for timing within the system, and logic for accepting parameter configuration function of the main control main board.

6. The method for implementing a network time synchronization system based on FPGA as claimed in claim 5, characterized in that: After the master clock sends the sync message, it records the sending timestamp of the message and then sends the follow_up message, the payload of which contains the timestamp t1 of the sending of the sync message; after the slave clock receives the follow_up message, it records the timestamp t2; the slave clock then sends the delay_req message and records the sending timestamp t3; after the master clock receives the delay_req message, it records the timestamp t4 and puts it in the payload of the delay_resp message and sends it; at this point, the slave clock obtains the time of the master clock and calculates the delay in network communication through four timestamps: The correction of local time can be calculated and the local time can be calibrated.

7. The method for implementing a network time synchronization system based on FPGA as claimed in claim 5, characterized in that: The logic design for accepting external timing includes: When the input time source is in the form of TOD+second pulse or B code, the working principle is as follows: S11, the TOD+PPS decoding submodule or the B code decoding submodule firstly performs a qualification judgment on the input time information, including: judging whether the information content format of the TOD complies with the protocol, whether the check bit is correct, and whether the pulse width and period of the second pulse are within the allowable error range; or judging whether the format of the B code protocol is correct and whether the correct time information can be restored; S12. After judging that the time information is qualified, the TOD+PPS decoding submodule or the B code decoding submodule decodes the time information according to the protocol. This operation can obtain the rough time contained in the input time information. While parsing the data content, the TOD+PPS decoding submodule or the B code decoding submodule will also determine the zero time of the second according to a specific mark, i.e., the rising edge of the second pulse or two consecutive P code sources in the B code, and restore a trigger signal marking the zero time of the second. S13. After decoding is completed, the above information is sent to the time maintenance submodule for time calibration and maintenance; When the timing device uses the PTP protocol to provide timing to the time synchronization module, the FPGA acts as a slave clock of the PTP protocol. The working principle is as follows: S21, at the receiving end, after the time synchronization module receives the sync, follow_up, delay_resp messages, the slave clock data receiving submodule converts the RGMII format data into GMII format data; when the slave clock data decoding submodule receives the GMII format data transmitted from the slave clock data receiving submodule, it reads the timestamp of the time maintenance submodule, and parses the received Ethernet message, and after the parsing is completed, transmits the message content to the PS end through the DMA controller; S22, at the transmitting end, when the time synchronization module sends the delay_req message to the timing device, the PS end master control submodule organizes the sending content and transmits it to the slave clock data encoding submodule; the slave clock data encoding submodule packages the sending content together with the current timestamp into an Ethernet message, and sends it to the slave clock data sending submodule for sending; the slave clock data sending submodule converts the GMII format data into the RGMII format Ethernet data for sending; S23, the master control submodule on the PS side is responsible for data exchange with the DMA controller on the PL side; the time calibration calculation submodule calculates its own error through the received time information data, obtains the time correction value, and feeds the correction value back to the master control submodule, which sends the correction value to the time maintenance submodule on the PL side.

8. The method for implementing a network time synchronization system based on FPGA as claimed in claim 7, characterized in that: The self-time maintenance logic design includes: When choosing to accept TOD or B code timing, the time maintenance submodule obtains the time information including year, month, day, hour, minute, second and a zero time mark from the TOD+PPS decoding submodule or the B code decoding submodule; because in the system, the time synchronization module uses PTP to provide time to other mainboards, and the basic time unit of the PTP protocol is second value and nanosecond value, the time maintenance submodule needs to convert the time information into second value according to the time origin of the PTP protocol, and correct its own nanosecond value according to the zero time mark; When choosing to accept the timing of the PTP protocol, the time maintenance submodule obtains the correction values ​​of seconds and nanoseconds from the PS end, so it only needs to add or subtract corrections to its own time according to the correction values; When there is no external timing source or all timing sources are judged to be unqualified, the time maintenance submodule relies on the high-stability crystal oscillator outside the FPGA to add its own time so that it maintains a high time accuracy for a certain period of time.

9. The method for implementing a network time synchronization system based on FPGA as claimed in claim 7, characterized in that: The timing logic design in the system includes: The time synchronization module uses its own time to synchronize time with other mainboards in the system, so that the time of each mainboard in the combination is consistent with that of the external timing device. The timing is synchronized through the PTP protocol for network timing. When implementing this part of the function, FPGA serves as the master clock of the PTP protocol. The PTP protocol stack of this part of the function runs completely on the PL side and is implemented by the fixed message sending submodule and the response message sending submodule. The fixed message sending submodule is responsible for encoding announce, sync, follow_up protocol messages and other Ethernet fixed messages. Such messages are sent at a fixed period. The fixed message sending submodule needs to obtain the time from the time maintenance submodule and store all information including MAC address, IP address and load in the cache at the specified time. The master clock data encoding submodule compiles it into an Ethernet format message. Among them, when sending the follow_up message, it is also necessary to obtain the timestamp of the sync message from the master clock data decoding submodule and place it in the corresponding position in the load. The reply message sending submodule is responsible for encoding the delay_resp protocol message and other reply types of Ethernet messages. After receiving the corresponding request message, this type of message needs to store all the information of the reply message in the cache, and the master clock data encoding submodule will compile it into an Ethernet format message. Among them, when sending the delay_resp message, it is also necessary to obtain the delay_req message reception timestamp from the master clock data decoding submodule and place it in the corresponding position in the load.

10. The method for implementing a network time synchronization system based on FPGA as claimed in claim 7, characterized in that: The logic design of the parameter configuration function of the main control motherboard includes: building various control and status registers, and the main control motherboard configures some optional parameters of the time synchronization module by accessing the registers; the configuration path between the main control motherboard and the time synchronization module is the UART interface.

Citation Information

Cited By

  • Time synchronization device

    CN119254376A

  • A time synchronization device

    CN119254376B

  • System and method for synchronizing B code time and TSN sensitive network time based on FPGA

    CN120238231A

  • Programmable multi-mode precision time triggering system and method based on PTP

    CN122437626A