You are on page 1of 4

72

Computer Engineering and Applications

2013492

PTPd

SONG Shengjin, XU Yonghui, JIANG Shouda


150001
Automatic Test and Control Institute, Harbin Institute of Technology, Harbin 150001, China
SONG Shengjin, XU Yonghui, JIANG Shouda. Based on PTPd improved high-precision clock synchronization. Computer
Engineering and Applications, 2013, 49272-75.
AbstractIEEE1588 defines a Precision Clock SynchronizationPTPprotocol, widely used in distributed measurement and
control systems. The PTP protocol can be achieved by pure software or pure hardware. The pure software method can use the open
source PTPd code. It is simple but it can only obtain millisecond synchronization accuracy, while the pure hardware method
through the hardware programming can achieve the synchronization precision up to nanoseconds, but the development is difficult. In this paper, based on the open source PTPd, it reserves the upper portion of the agreement, and uses the DP83640 hardware to capture the timestamp at the bottom instead of the original one. The test proves that it greatly improves the PTPd synchronization accuracy to within 20 ns.
Key wordsIEEE1588; PTPd; DP83640; clock synchronization

IEEE1588 PTPPTP

PTPd
PTPd
DP83640 PTPd 20 ns
IEEE1588PTPdDP83640
A

TP368.6

doi10.3778/j.issn.1002-8331.1204-0071



IEEE1588Preci-

IEEE1588
IEEE1588

sion Time ProtocolPTP[1]

[4]

IEEE1588

T m1

T s1

IEEE1588

Follow_Up

PTPd

[2]

Sync

Delay_Req
T m2

T s2

MAC [3]

Delay_Resp

PTPd

IEEE1588

19881976
1964E-mailhitssj@163.com
2012-04-09

2012-09-06

CNKI 2012-10-31

1002-8331201302-0072-04

http://www.cnki.net/kcms/detail/11.2127.TP.20121031.0914.003.html

PTPd

2013492

73

2 s

Sync T m1

dostate tostate

Sync T s1
T m1 Follow_

handle

Up T m1

issue

T s1 offset
offset = T m1 - T s1

Delay_Req
T s2 Delay_Req
T m2 T m2 Delay_Resp
T m2 T s2
delay

2bmc.c IEEE1588
bmc

3dep/servo.c

PTPd
FIR

delay = (T m2 - T s2)/2

4 s 60 s

4dep/msg.c

5dep/net.c UDP

6dep/timer.c Sync

3 PTPd
3.1 PTPd
PTPd IEEE1588
SourceForge.Net PTPd
Version1 IEEE1588-2002Version2
IEEE1588-2008 PTPd1.0Version1
PTPd C 32 64
PTPd IEEE1588

PTPd Sync

PTPd TCP/IP

IEEE1588 PTPd
2 PTPd

Delay_Req
Sync
7dep/startup.c PTPd

3.2

DP83640
DP83640 [5]

IEEE1588
IEEE1588

8 ns
250 MHz NN 2~255
125 MHz 980.4 kHz
DP83640 PHY IEEE1588
IEEE1588 IEEE1588
3 MDIO
DP83640
IEEE1588 GPIO

/dep

PTPd

GPIO

Clock IEEE1588

IEEE1588

MDIO

IEEE1588

PTPd

1protocol.c IEEE1588

MAC
IEEE1588

MII
PHY

protocol

DP83640

DP83640

74

Computer Engineering and Applications

2013492

DP83640 32

DP83640 PTPd

30 2 32 ns

DP83640.h_DP83640.hDP83640.c

/ /

DP83640

[6]

DP83640

1Init_DP83640_1588 PTPd

DP83640 IEEE1588

netPath

MDIO PTP PTP_RESETPTP

PTP_ENABLE

TX_TS_ENRX_TS_EN

DP83640

void Init_DP83640_1588NetPath *netPath


2PTP_get_time DP83640

//

netPath

3.3

cmd PTP_GET_CUR

PTPd
PTPd LinuxuClinuxNetBSDFreeBSD

PTP_GET_TXTS PTP_

TI

GET_RXTS nanoseconds

DSP/BIOS[7] NDK[8] PTPd

seconds

/dep

void PTP_get_timeNetPath *netPathint cmdUInteger32 *secondsUInteger32 *nanoseconds

TI NDK

3PTP_set_time DP83640 IEEE1588

netPath

IEEE1588 PTPd

cmd PTP_SET_

DP8640 DP83640 PTPd

CURT_VAL PTP_SET_STEP_VAL

4 DP83640 IEEE1588

PTP_TMP_RATE_ADJ

PCF8583

nanoseconds seconds

PCF8583

PTPd

void PTP_set_timeNetPath *netPathint cmdUInteger32 *secondsUInteger32 *nanoseconds


4PTP_set_sync_enet
netPath

cmd PTP_SYNC_ENET_ENPTP_

SYNC_ENET_DIS
void PTP_set_sync_enetNetPath *netPathint cmd
PTPd

DSP/BIOS

DP83640

PCF8583

PTPd DP83640
1 ptpdStartup
DP83640 Init_DP83640_1588

IEEE1588

PCF8583


DP83640
2 PTPd

3.3.1

DP83640

PTPd

PTPd DP83640

netRecvEvent netSendEvent Linux ioctl SOICG-

DP83640 IEEE1588

STAMP PTP_get_time

PTP

PTP_GET_TXTS PTP_GET_RXTS

PTPd DP83640

DP83640

3 PTPd Linux

PTPd

2013492

75

gettimeofday settimeofday

PTP_get_time

Linux

PTP_backup

PTP_get_time

PTP_set_time PTP_GET_CUR PTP_SET_

CURT_VAL DP83640 IEEE1588

grandmaster_stratum 2

ptpdStartup PTP_set_time

PTPd ptpdStartup PTP_recover

PCF8583 PTP_set_time

PTP_set_time PTP_

SET_SETP_VAL
DP83640 16 ns

PTPd DP83640

PTPd DP83640

25 MHz

25 MHz

3.3.2

DM642

DP83640

DP83640

DM642

PTPd PCF8583

DP83640 IEEE1588

PPS

PPS

1970 1 1 0 0 0 0
5

PCF8583[9]

2568 bitRAMPTPd

PCF8583

PTPd

25 MHz

PCF8583 PCF8583

PPS [10]

PCF8583 4 BCD

1 6

UTC-

----- IEEE1588

PTP 1970 1 1

/s

/min

0 0 0 0 -

30

5.16

30

18.39106

/ms

1PTP_backup ptp_time
PTP utc_time
PCF8583 UTC
int PTP_backupTimeStamp *ptp_timeUTC_Time *utc_
time
2ptp_recover ptp_time
PTP utc_time
PCF8583 UTC
int PTP_recoverTimeStamp *ptp_timeUTC_Time *utc_
time

PTPd PCF8583 PTPd

20~20 ns

ptpdShutdown

GPS

85

You might also like