RT1170:The time of PTP is not accurate

cancel
Showing results for 
Search instead for 
Did you mean: 

RT1170:The time of PTP is not accurate

194 Views
wangbaozeng90
Contributor II

SDK:
SDK_2.10.1_MIMXRT1170-EVK
board:
MIMXRT1176DVMAA
Driver:
fsl_enet.c

api:
ENET_Ptp1588SetTimer

I start a 1s timer. The FreeRTOS system time acquisition is accurate, but the PTP time acquisition is inaccurate.

PTP time has 20 millisecond error.


[Timer] sys_time 102002000000, ptp_time 100313219076 ␊
[Timer] sys_time 103002000000, ptp_time 101296477960 ␊
[Timer] sys_time 104002000000, ptp_time 102279757098 ␊
[Timer] sys_time 105002000000, ptp_time 103394836640 ␊
[Timer] sys_time 106002000000, ptp_time 104246329027 ␊
[Timer] sys_time 107002000000, ptp_time 105229594061 ␊
[Timer] sys_time 108002000000, ptp_time 106212862170 ␊

Tags (2)
0 Kudos
4 Replies

160 Views
wangbaozeng90
Contributor II

Hi,

Is there any way to prove that PTP timer/ENET_Ptp1588GetTimer is accurate? not pps is accurate.

0 Kudos

150 Views
kerryzhou
NXP TechSupport
NXP TechSupport

Hi @wangbaozeng90 ,

   About the ptp timer correct, just as I told you, I use the compare to toggle the pin, then use the oscilloscope to test the pin wave, it can demonstrate the correct or not.

  ENET_Ptp1588GetTimer, about your test method, I think each time,before you call:

ENET_Ptp1588GetTimer(EXAMPLE_ENET, &g_handle, &ptpTime1);
SDK_DelayAtLeastUs(1000000SDK_DEVICE_MAXIMUM_CPU_CLOCK_FREQUENCY);
ENET_Ptp1588GetTimer(EXAMPLE_ENET, &g_handle, &ptpTime2);
 
You can clear the ATVR register, just let it counts from 0.
BTW, make sure no other interrupt happens when you call SDK_DelayAtLeastUs, just make sure this 1s is correct.
 

Best Regards,

Kerry

0 Kudos

175 Views
kerryzhou
NXP TechSupport
NXP TechSupport

Hi @wangbaozeng90 ,

    Thanks for your interest in the NXP MIMXRT product, I would like to provide service for you.

   I think it is related to the testing method, I don't know which detail data you output, seems the timer counter.

  When you test the ptp_time, make sure it is not interrupted by other higher interrupt, then it will influence the test result.

  In the previous time, I even can use the IEEE 1588 output 1us pulse.

  So, I think you also can use the timer compare output to test it.

 

Wish it helps you!

Best Regards,

Kerry

0 Kudos

169 Views
wangbaozeng90
Contributor II

Hi,

The ptptime interval is not accurate - not 1 second.

Example:

evkmimxrt1170_enet_txrx_ptp1588_transfer_cm7

Log:

ENET PTP 1588 example start.␍␊

Wait for PHY init...␍␊

Wait for PHY link up...␍␊

0 second, 27716 nanosecond ␍␊

0 second, 987503655 nanosecond ␍␊

1 second, 974939209 nanosecond ␍␊

2 second, 962420888 nanosecond ␍␊

3 second, 949911300 nanosecond ␍␊

Code:

/* Check if the timestamp is running */
enet_ptp_time_t ptpTime1, ptpTime2, ptpTime3, ptpTime4, ptpTime5;
ENET_Ptp1588GetTimer(EXAMPLE_ENET, &g_handle, &ptpTime1);
SDK_DelayAtLeastUs(1000000, SDK_DEVICE_MAXIMUM_CPU_CLOCK_FREQUENCY);

ENET_Ptp1588GetTimer(EXAMPLE_ENET, &g_handle, &ptpTime2);
SDK_DelayAtLeastUs(1000000, SDK_DEVICE_MAXIMUM_CPU_CLOCK_FREQUENCY);

ENET_Ptp1588GetTimer(EXAMPLE_ENET, &g_handle, &ptpTime3);
SDK_DelayAtLeastUs(1000000, SDK_DEVICE_MAXIMUM_CPU_CLOCK_FREQUENCY);

ENET_Ptp1588GetTimer(EXAMPLE_ENET, &g_handle, &ptpTime4);
SDK_DelayAtLeastUs(1000000, SDK_DEVICE_MAXIMUM_CPU_CLOCK_FREQUENCY);

ENET_Ptp1588GetTimer(EXAMPLE_ENET, &g_handle, &ptpTime5);
SDK_DelayAtLeastUs(1000000, SDK_DEVICE_MAXIMUM_CPU_CLOCK_FREQUENCY);

PRINTF(" %d second,", (uint32_t)ptpTime1.second);
PRINTF(" %d nanosecond \r\n", ptpTime1.nanosecond);

PRINTF(" %d second,", (uint32_t)ptpTime2.second);
PRINTF(" %d nanosecond \r\n", ptpTime2.nanosecond);

PRINTF(" %d second,", (uint32_t)ptpTime3.second);
PRINTF(" %d nanosecond \r\n", ptpTime3.nanosecond);

PRINTF(" %d second,", (uint32_t)ptpTime4.second);
PRINTF(" %d nanosecond \r\n", ptpTime4.nanosecond);

PRINTF(" %d second,", (uint32_t)ptpTime5.second);
PRINTF(" %d nanosecond \r\n", ptpTime5.nanosecond);
0 Kudos