This thread has been locked.

If you have a related question, please click the "Ask a related question" button in the top right corner. The newly created question will be automatically linked to this question.

DP83640T-EVK: How to align DP83640 CLK_OUT phase from master 83640 to slave 83640? (AN-1729)

Part Number: DP83640T-EVK
Other Parts Discussed in Thread: ALP, DP83640

I have two DP83640-EVK and connect with CAT-5 cable.

I need get same phase CLK in two DP83640-EVK.  So I try to align CLK_OUT From PTP.

I try to use ALP to do Phase Alignment (from AN-1729 3.2 Phase Alignment)

I do following things in ALP:

1. Write 0x0000 to PHYCR2 (Page 0 Reg 0x1C) in Master DP83640 to enable CLK_OUT

2. Write 0x2000 to PHYCR2 (Page 0 Reg 0x1C) in Slave DP83640 to enable CLK_OUT and Enable Synchronous Ethernet.

3. Write 0x8019 to PTP_COC (Page 6 Reg 0x14) in both DP83640 , set CLK_OUT as 10MHz.

4. Write 0x0004 to PTP_CTL (Page 4 Reg 0x14) in both DP83640 , Enable PTP 1588.

And now the CLK_OUT between two DP83640 phase error is ~3.4ns. (Sometimes it will more than 40ns , 3.4ns is the best one)

Figure 1 Phase error

5. Write 0x1CE1 and then Write 0x5CE1 to PTP_EVNT (Page 5 Reg 0x15) in Slave DP83640

ALP shows me it self cleared, read back is 0x1C01 And 5C01.

6. Read PTP_ESTS (Page 4 Reg 0x1E),it is 0x00E1   , correct.

7. Read PTP_EDATA (Page 4 Reg 0x1F) four times, they are :  0xAD28,0x1BCA,0x0051,0x0000

 So I get PTP timestamp 0x0000_0051_1BCA_AD28  -> it mod 100 is 78. (or -22)

8. And then Do same things to Master DP83640.

Get 0x0000_06FD_07C8_2488 it mod 100 is 08.

9. Write PTP_TDR 78+16 = 0x005E to PTP_TDR

and Write 0x000C to PTP_CTL

Nothing happed... Two CLK_OUT still have phase error.

How can I adjust CLK_OUT phase?

My application need aligned phase clock feed.

Or I need use external devices to adjust phase? (Such as Altera/Intel FPGA built-in PLL)

I found some same thread in e2e, but no answers:

e2e.ti.com/.../620741

  • Hi Simba,

    Have you tried adding a step for loading the PTP_TDR clock correction?
    Please try adding PTP_LOAD_CLK after you set PTP_TDR and before you set PTP_STEP_CLK.
  • Hi Ross Pimente , thanks for answer

    I found a probably mistake:

    7. Read PTP_EDATA (Page 4 Reg 0x1F) four times, they are : 0xAD28,0x1BCA,0x0051,0x0000
    So I get PTP timestamp 0x0000_0051_1BCA_AD28 -> it mod 100 is 78. (or -22)

    The PTP_EDATA are 0xAD28,0x1BCA,0x0051,0x0000 

    Because nanosecond only have 29bits , how to align them (nanoseconds and seconds)

    Is it means PTP Timestamp 0x0000_14_5BCA_AD28 or 0x0000_0051_1BCA_AD28?
    The first one mod 100 is 28 , and the second one mod 100 is 08.

  • I try to Read EPL_v193_20091023\protocol\PTP\ptpControl.c
    Line 252 to 310 shows me how to phase align CLKOUT.


    But Line 307 only use ' ts.nanoseconds'
    it is:
    LINE 307 phaseError = clkOutPeriod - (ts.nanoseconds % clkOutPeriod) + 16;

    Which one is right?
  • Hi Simba,

    Seconds is ignored for phase error alignment because you reference clock is in the nS range.
    Only nS adjustments makes sense for phase error adjustments when you are in the nS range.
    If you were using the PPS then you would need to use the seconds feature.

    If you read the following out of PTP_EDATA:

    0xAD28
    0x1BCA
    0x0051
    0x0000

    Then 0x1BCAAD28 mod 100 = 32