world leader in high performance signal processing
Trace:

Differences

This shows you the differences between two versions of the page.

uclinux-dist:ptp [2012/07/12 04:55]
lliubbo [Precision Time Protocol (PTP)]
uclinux-dist:ptp [2012/11/13 05:00] (current)
lliubbo [Linuxptp]
Line 4: Line 4:
  
 The IEEE 1588 engine module (PTP_TSYNC) provides hardware assistance for the implementation of the IEEE 1588 standard on Blackfin processors. BF518 and BF609 processors include this module. The IEEE 1588 engine module (PTP_TSYNC) provides hardware assistance for the implementation of the IEEE 1588 standard on Blackfin processors. BF518 and BF609 processors include this module.
 +===== Old tools =====
  
 There are 2 versions of IEEE1588 protocols. PTPd open source project at [[http://ptpd.sourceforge.net/]] implements both of them in v1.0 and v2.0 releases. It doesn't support the Linux hardware timestamp API introduced since 2.6.30. Other projects branched from PTPd have hardware timestamp enabled. There are 2 versions of IEEE1588 protocols. PTPd open source project at [[http://ptpd.sourceforge.net/]] implements both of them in v1.0 and v2.0 releases. It doesn't support the Linux hardware timestamp API introduced since 2.6.30. Other projects branched from PTPd have hardware timestamp enabled.
Line 10: Line 11:
  
 PTPd from [[https://github.com/richardcochran/ptpd-phc.git]] supports IEEE1588 v2 as well as the hardware timestamp API. This project is only included in buildroot distribution for bf60x. PTPd from [[https://github.com/richardcochran/ptpd-phc.git]] supports IEEE1588 v2 as well as the hardware timestamp API. This project is only included in buildroot distribution for bf60x.
 +
 +===== New tools =====
 +After 2012R1 release, Linuxptp from [[linuxptp.sourceforge.net]] should be used to replace PTPd.
 +It also supports IEEE1588 v2 as the hardware timestamp API and is already included in buildroot distribution.
  
 <note> <note>
-Be sure all machines which run PTPd have different MAC address, otherwise PTP can't work correctly!+Be sure all machines which run PTPd/linuxptp have different MAC address, otherwise PTP can't work correctly!
 </note> </note>
  
 ===== Kernel Config ===== ===== Kernel Config =====
 +==== Old Config ====
  
 To enable hardware timestamp support in bf51x kernel config: To enable hardware timestamp support in bf51x kernel config:
Line 38: Line 44:
                [*] STMMAC ieee1588 hw timestamp support                [*] STMMAC ieee1588 hw timestamp support
 </code> </code>
 +==== New Config ====
 +Common parts
 +<code>
 +General setup  --->
 +    [*] Enable eventpoll support
 +    
 +[*] Networking support  ---> 
 +    Networking options  ---> 
 +    [*] Timestamping in PHY devices
 +    
 +Device Drivers  --->
 +    PPS support  ---> 
 +      <*> PPS support
 +    PTP clock support  --->
 +      <*> PTP clock support   
 +</code>
 +To enable hardware timestamp support in bf51x kernel config:
  
 +<code>
 +Device Drivers  -->
 +   [*] Network device support  --->
 +       [*] Ethernet (10 or 100Mbit) --->
 +           [*] Blackfin on-chip MAC support
 +           [*] Use IEEE 1588 hwstamp
 +</code>
 +
 +To enable hardware timestamp support in bf60x kernel config:
 +
 +<code>
 +Device Drivers  -->
 +   [*] Network device support  --->
 +       [*] Ethernet (10 or 100Mbit) --->  
 +           [*] STMicroelectronics devices
 +           [*] STMicroelectronics 10/100/1000 Ethernet driver
 +               [*] STMMAC platform bus support
 +               [*] STMMAC ieee1588 hw timestamp support
 +</code>
 ===== Userspace Config ===== ===== Userspace Config =====
 +==== Old Config ====
  
 ptpd is a daemon in blackfin Linux distribution. It can run as masters or slaves. ptpd is a daemon in blackfin Linux distribution. It can run as masters or slaves.
Line 57: Line 100:
     [*] ptpd v1     [*] ptpd v1
     [*] ptpd v2     [*] ptpd v2
 +</code>
 +
 +==== New Config ====
 +
 +<code>
 +Package Selection for the target  --->
 +    Networking applications  --->
 +    [*] linuxptp
 </code> </code>
  
Line 121: Line 172:
 (ptpd debug)offset from master:               0s         428ns (ptpd debug)offset from master:               0s         428ns
 (ptpd debug)observed drift:               13704 (ptpd debug)observed drift:               13704
 +
 </xterm> </xterm>
  
 <note warning>Turn on the debug print in ptpd source code to show above delay and offset information. <note warning>Turn on the debug print in ptpd source code to show above delay and offset information.
 </note> </note>
 +==== Linuxptp ====
 +=== Master ===
 +
 +<code>
 +root:~> date -s 2010.03.16-15:30
 +root:~> date
 +Thu Dec 21 02:17:54 UTC 2010
 +root:~> 
 +root:~> testptp -g
 +clock time: 3030.230430976 or Thu Jan  1 00:50:30 1970
 +root:/> 
 +root:/> testptp -s
 +set time okay
 +root:/> testptp -g
 +clock time: 1166667484.236271664 or Thu Dec 21 02:18:04 2010
 +root:/> 
 +root:/> ptp4l -i eth0 -q -v
 +ptp4l[3110.220]: selected /dev/ptp0 as PTP clock
 +ptp4l[3110.220]: m
 +ptp4l[3110.224]: driver rejected most general HWTSTAMP filter
 +ptp4l[3110.224]: port 1: INITIALIZING to LISTENING on INITIALIZE
 +ptp4l[3110.224]: port 0: INITIALIZING to LISTENING on INITIALIZE
 +ptp4l[3116.228]: port 1: LISTENING to MASTER on ANNOUNCE_RECEIPT_TIMEOUT_EXPIRES
 +</code>
 +
 +=== Slave ===
 +<code>
 +root:/> ptp4l -i eth0 -q -v -s 
 +ptp4l[3121.429]: selected /dev/ptp0 as PTP clock
 +ptp4l[3121.429]: m
 +ptp4l[3121.433]: driver rejected most general HWTSTAMP filter
 +ptp4l[3121.433]: port 1: INITIALIZING to LISTENING on INITIALIZE
 +ptp4l[3121.433]: port 0: INITIALIZING to LISTENING on INITIALIZE
 +ptp4l[3123.236]: port 1: new foreign master 00e022.fffe.fe8529-1
 +ptp4l[3127.244]: selected best master clock 00e022.fffe.fe8529
 +ptp4l[3127.244]: port 1: LISTENING to UNCALIBRATED on RS_SLAVE
 +ptp4l[3129.268]: master offset -1166664449861224856 s0 adj      +0 path delay      10008
 +ptp4l[3130.272]: master offset -1166664449861224728 s0 adj      +0 path delay      10008
 +ptp4l[3131.276]: master offset -1166664449861224372 s0 adj      +0 path delay      10052
 +ptp4l[3132.280]: master offset -1166664449861224048 s1 adj      +0 path delay      10048
 +ptp4l[3133.284]: master offset       -896 s2 adj    -896 path delay      10048
 +ptp4l[3133.284]: port 1: UNCALIBRATED to SLAVE on MASTER_CLOCK_SELECTED
 +ptp4l[3134.288]: master offset       5648 s2 adj   +5379 path delay      10048
 +ptp4l[3135.292]: master offset       6102 s2 adj   +7528 path delay      10026
 +ptp4l[3136.296]: master offset       3976 s2 adj   +7232 path delay      10216
 +ptp4l[3137.300]: master offset       2408 s2 adj   +6857 path delay      10216
 +ptp4l[3138.304]: master offset       1376 s2 adj   +6547 path delay      10240
 +ptp4l[3139.308]: master offset        432 s2 adj   +6016 path delay      10240
 +ptp4l[3140.312]: master offset        216 s2 adj   +5930 path delay      10216
 +ptp4l[3141.316]: master offset         16 s2 adj   +5795 path delay      10224
 +ptp4l[3142.320]: master offset       -100 s2 adj   +5683 path delay      10212
 +ptp4l[3143.324]: master offset       -246 s2 adj   +5507 path delay      10230
 +ptp4l[3144.328]: master offset        -55 s2 adj   +5625 path delay      10215
 +ptp4l[3145.332]: master offset         37 s2 adj   +5700 path delay      10219
 +</code>
 +
 +Then start phc2sys
 +<code>
 +root:~> date
 +Thu Jan  1 00:51:23 UTC 1970
 +root:~> phc2sys -s /dev/ptp0
 +phc   1557719 s1 1166667535.449552903 drift 0.00
 +phc   1580659 s2 1166667536.453552851 drift 0.00
 +phc   1577971 s3 1166667537.457552851 drift 0.00
 +phc   1588227 s4 1166667538.461552851 drift 10128.82
 +phc    -21552 s4 1166667539.463954496 drift 3663.22
 +phc      5511 s4 1166667540.467965879 drift 5316.52
 +phc      7037 s4 1166667541.471956749 drift 7427.62
 +phc      -104 s4 1166667542.475944360 drift 7396.42
 +phc      -982 s4 1166667543.479936986 drift 7101.82
 +phc     -8978 s4 1166667544.483930542 drift 4408.42
 +phc    -14327 s4 1166667545.487932393 drift 110.32
 +phc     22017 s4 1166667546.491942321 drift 6715.42
 +phc      7801 s4 1166667547.495920233 drift 9055.72
 +phc      1691 s4 1166667548.499905627 drift 9563.02
 +</code>
 +
 +Check the system time, should be the same as master
 +<code>
 +root:~> date
 +Thu Dec 21 02:19:05 UTC 2010
 +root:~> date
 +Thu Dec 21 02:19:06 UTC 2010
 +</code>
 +
 +
 ===== More information ===== ===== More information =====
  
   * [[wp>Precision_Time_Protocol]]   * [[wp>Precision_Time_Protocol]]
   * [[http://ptpd.sourceforge.net/|ptpd Sourceforge pages]]   * [[http://ptpd.sourceforge.net/|ptpd Sourceforge pages]]
 +  * [[http://linuxptp.sourceforge.net/|Linuxptp]]