National Semiconductor Application Note 2006 Patrick O'Farrell May 27, 2010 1.0 Introduction 2. The IEEE 1588 Precision Time Protocol (PTP) provides a means of synchronizing the time between multiple nodes using standard Ethernet connections. In many applications, telecommunications in particular, synchronization of the local time base is essential to system performance. In these applications, a GPS receiver is typically used to synchronize remote sites. This method, however, is expensive due to the cost of the providing a GPS receiver at each remote site. An alternate method is to utilize a single GPS receiver as the time base for an IEEE 1588 Master and synchronize the remote sites using the Ethernet and the IEEE 1588 Precision Time Protocol. This application note discusses methods of synchronizing the PTP clock to a GPS receiver using the DP83640 Precision PHYTER®. 2.0 Synchronization Methods Synchronization can be accomplished using a DP83640 clock reference that is independent of the GPS receiver clock or that is dependent upon the GPS receiver clock source. The DP83640 reference clock for the Pulse Per Second Synchronization described below is independent of the GPS reciever. The Direct Reference Connection simplifies the control loop by taking advantage of the GPS receiver output clock. 2.1 Pulse Per Second Synchronization The Pulse Per Second Synchronization method, shown in Figure 1, assumes that the GPS receiver is operating as a valid time reference. A general outline of the steps required to synchronize the Precision Time Protocol clock to the GPS clock is as follows: 1. Initialize the Precision Time Protocol (PTP) clock in the DP83640. Configure a GPIO as an event monitor to detect the rising edge of the PPS output from the GPS receiver. 3. Upon detection of the first PPS event, A. Capture the timestamp of the event. B. Read the time from the GPS unit. C. Calculate the difference between the GPS time and the PTP time and use a step adjustment to correct the PTP time. 4. Since the PPS output of the GPS receiver will occur at 1second intervals, it should not be necessary to poll the GPS receiver for the time with each captured timestamp. However, to ensure continued accuracy of the system, the GPS and PTP times should be checked and verified periodically. NOTE: The initial PPS event captured will most likely result in a large (> 1 second) delta between the GPS time and the local time of the DP83640. After the initial time adjustment, subsequent timestamps should be within a 1 second error and allow for temporary rate adjustments to further adjust the time of the PTP clock. With this configuration, the 25 MHz reference used for the DP83640 will not track the reference of the GPS source exactly. As a result, the PTP clock will require rate corrections to compensate for differences in the reference clock rates. The rate correction can be calculated based on the difference in time stamps between sequential PPS edges. In the case where the 25 MHz reference to the DP83640 is a voltage-controlled oscillator, it is possible to adjust the oscillator frequency based on the needed rate correction as an alternative to performing the rate correction to the PTP clock. In this instance, care should be taken in selecting a D/A converter that will provide sufficient voltage resolution to meet the system clock accuracy requirements. Synchronizing a DP83640 PTP Master to a GPS Receiver Synchronizing a DP83640 PTP Master to a GPS Receiver 30106501 FIGURE 1. Block diagram using 25 MHz reference not connected to the GPS source AN-2006 © 2010 National Semiconductor Corporation 301065 www.national.com AN-2006 4. Since the 25 MHz reference to the DP83640 is based on the 10 MHz output from the GPS source, there should be no drift of the PTP clock relative to the GPS clock reference. As such, there is no need to adjust the PTP clock using temporary rate adjustments. 5. With this configuration, there are still benefits to checking the PPS timestamps for accuracy. Since the resolution of the event timestamps is 8 ns, an improvement to the accuracy of the timing could be achieved by averaging sequential timestamps. Periodically checking the PTP clock against the GPS source can also guard against the possibility of a discontinuity in time from the Master. NOTE: The initial PPS event captured will most likely result in a large (> 1 second) delta between the GPS time and the local time of the DP83640. After the initial time adjustment, subsequent timestamps should be within a 1 second error and no further adjustments to the time of the PTP clock should be required. 2.2 Direct Reference Connection The Direct Reference Connection method, shown in Figure 2, assumes that the GPS receiver is operating as a valid time reference. Initialization of the DP83640 PTP clock for the Direct Reference Connection is the same as for the Pulse Per Second Synchronization. However, with the GPS 10 MHz time base output used as the basis for the 25 MHz reference to the DP83640, the need to continually perform rate adjustments to the PTP clock is eliminated. To minimize reference clock jitter, the National LMK03000 device is recommended. 1. Initialize the PTP clock in the DP83640. 2. Configure a GPIO as an event monitor to detect the rising edge of the PPS output from the GPS receiver. 3. Upon detection of the first PPS event, A. Capture the timestamp of the event. B. Read the time from the GPS unit. C. Calculate the difference between the GPS time and the PTP time and use a step adjustment. 30106502 FIGURE 2. Block diagram using 25 MHz reference connected to the GPS source 3.0 Summary 4.0 References This application note presented two methods of synchronizing the IEEE 1588 PTP clock to a GPS clock source. Both methods provide an efficient means of synchronizing remote sites without the additional cost of a GPS receiver at each site. The Pulse Per Second method achieves synchronization using a minimized hardware configuration supported by rate correction. The Direct Reference Connection method achieves synchronization without the need for continuous rate correction through the addition of an LMK03000 device. Although both of the methods described above will allow the PTP clock to be synchronized to the GPS clock, the Direct Reference Connection method also allows the PHY to be a master for Synchronous Ethernet operation with the transmit clock frequency being the same as the IEEE 1588 reference clock frequency. Additional information related to the programming and synchronization of the DP83640 is provided in the references section. DP83640 Precision PHYTER - IEEE 1588 Precision Time Protocol Transceiver. Application Note 1728: IEEE 1588 Precision Time Protocol Time Synchronization Performance. Application Note 1729: DP83640 IEEE 1588 PTP Synchronized Clock Output. Application Note 1730: DP83640 Synchronous Ethernet Mode: Achieving Sub-nanosecond Accuracy in PTP Applications. National Semiconductor Ethernet PHYTER - Software Development Guide. www.national.com 2 AN-2006 3 www.national.com Synchronizing a DP83640 PTP Master to a GPS Receiver Notes For more National Semiconductor product information and proven design tools, visit the following Web sites at: www.national.com Products Design Support Amplifiers www.national.com/amplifiers WEBENCH® Tools www.national.com/webench Audio www.national.com/audio App Notes www.national.com/appnotes Clock and Timing www.national.com/timing Reference Designs www.national.com/refdesigns Data Converters www.national.com/adc Samples www.national.com/samples Interface www.national.com/interface Eval Boards www.national.com/evalboards LVDS www.national.com/lvds Packaging www.national.com/packaging Power Management www.national.com/power Green Compliance www.national.com/quality/green Switching Regulators www.national.com/switchers Distributors www.national.com/contacts LDOs www.national.com/ldo Quality and Reliability www.national.com/quality LED Lighting www.national.com/led Feedback/Support www.national.com/feedback Voltage References www.national.com/vref Design Made Easy www.national.com/easy www.national.com/powerwise Applications & Markets www.national.com/solutions Mil/Aero www.national.com/milaero PowerWise® Solutions Serial Digital Interface (SDI) www.national.com/sdi Temperature Sensors www.national.com/tempsensors SolarMagic™ www.national.com/solarmagic PLL/VCO www.national.com/wireless www.national.com/training PowerWise® Design University THE CONTENTS OF THIS DOCUMENT ARE PROVIDED IN CONNECTION WITH NATIONAL SEMICONDUCTOR CORPORATION (“NATIONAL”) PRODUCTS. NATIONAL MAKES NO REPRESENTATIONS OR WARRANTIES WITH RESPECT TO THE ACCURACY OR COMPLETENESS OF THE CONTENTS OF THIS PUBLICATION AND RESERVES THE RIGHT TO MAKE CHANGES TO SPECIFICATIONS AND PRODUCT DESCRIPTIONS AT ANY TIME WITHOUT NOTICE. NO LICENSE, WHETHER EXPRESS, IMPLIED, ARISING BY ESTOPPEL OR OTHERWISE, TO ANY INTELLECTUAL PROPERTY RIGHTS IS GRANTED BY THIS DOCUMENT. TESTING AND OTHER QUALITY CONTROLS ARE USED TO THE EXTENT NATIONAL DEEMS NECESSARY TO SUPPORT NATIONAL’S PRODUCT WARRANTY. EXCEPT WHERE MANDATED BY GOVERNMENT REQUIREMENTS, TESTING OF ALL PARAMETERS OF EACH PRODUCT IS NOT NECESSARILY PERFORMED. NATIONAL ASSUMES NO LIABILITY FOR APPLICATIONS ASSISTANCE OR BUYER PRODUCT DESIGN. BUYERS ARE RESPONSIBLE FOR THEIR PRODUCTS AND APPLICATIONS USING NATIONAL COMPONENTS. PRIOR TO USING OR DISTRIBUTING ANY PRODUCTS THAT INCLUDE NATIONAL COMPONENTS, BUYERS SHOULD PROVIDE ADEQUATE DESIGN, TESTING AND OPERATING SAFEGUARDS. EXCEPT AS PROVIDED IN NATIONAL’S TERMS AND CONDITIONS OF SALE FOR SUCH PRODUCTS, NATIONAL ASSUMES NO LIABILITY WHATSOEVER, AND NATIONAL DISCLAIMS ANY EXPRESS OR IMPLIED WARRANTY RELATING TO THE SALE AND/OR USE OF NATIONAL PRODUCTS INCLUDING LIABILITY OR WARRANTIES RELATING TO FITNESS FOR A PARTICULAR PURPOSE, MERCHANTABILITY, OR INFRINGEMENT OF ANY PATENT, COPYRIGHT OR OTHER INTELLECTUAL PROPERTY RIGHT. LIFE SUPPORT POLICY NATIONAL’S PRODUCTS ARE NOT AUTHORIZED FOR USE AS CRITICAL COMPONENTS IN LIFE SUPPORT DEVICES OR SYSTEMS WITHOUT THE EXPRESS PRIOR WRITTEN APPROVAL OF THE CHIEF EXECUTIVE OFFICER AND GENERAL COUNSEL OF NATIONAL SEMICONDUCTOR CORPORATION. As used herein: Life support devices or systems are devices which (a) are intended for surgical implant into the body, or (b) support or sustain life and whose failure to perform when properly used in accordance with instructions for use provided in the labeling can be reasonably expected to result in a significant injury to the user. A critical component is any component in a life support device or system whose failure to perform can be reasonably expected to cause the failure of the life support device or system or to affect its safety or effectiveness. National Semiconductor and the National Semiconductor logo are registered trademarks of National Semiconductor Corporation. All other brand or product names may be trademarks or registered trademarks of their respective holders. AN-2006 Copyright© 2010 National Semiconductor Corporation For the most current product information visit us at www.national.com National Semiconductor Americas Technical Support Center Email: [email protected] Tel: 1-800-272-9959 www.national.com National Semiconductor Europe Technical Support Center Email: [email protected] National Semiconductor Asia Pacific Technical Support Center Email: [email protected] National Semiconductor Japan Technical Support Center Email: [email protected]