I am trying to synchronize a clock from DP83630 (mounted on DP83630-EVK) with a GrandMaster Clock.
Through Ethernet port on DP83630-EVK I am receiving correct PTPv2 Ethernet frames. Checked by WireShark.
I am using a small part of EPL C library (epl_1588.c functions) to program DP83630. I am trying to extract the GrandMaster-Clock-seconds information from the incoming Ethernet frames. I am doing this by using PTPGetReceiveTimestamp() function from epl_1588.c. Instead of returning a value from the frame (Epoch: ~13800000), which corresponds to GrandMaster Clock, this function returns the number of seconds from the moment I have programed the DP83630.
- Am I wrong to expect the function PTPGetReceiveTimestamp() to return the number of seconds from GrandMaster Clock from the incoming Ethernet frame?
- What is the easiest way to sync DP83630 to a GrandMaster Clock?
- Do I need to be able to transmit timestamps for synchronization?
- I am programming the DP83630 by an FPGA based embedded system through MDIO interface
- I have been able to: read and write the DP83630 registers, read and set the clock, enable triggers
PTPEnable( pEPL_HANDLE, FALSE); PTPClockSetRateAdjustment( pEPL_HANDLE, 0, FALSE, FALSE); PTPClockSet( pEPL_HANDLE, 1, 0); PTPSetClockConfig( pEPL_HANDLE, CLKOPT_CLK_OUT_EN, 0x0A, 0x00, 8); PTPEnable( pEPL_HANDLE, TRUE); flags = TRGOPT_PERIODIC|TRGOPT_NOTIFY_EN|RXOPT_TS_APPEND|TRGOPT_TRG_IF_LATE; PTPSetTriggerConfig ( pEPL_HANDLE, 1, flags, 2); PTPArmTrigger( pEPL_HANDLE, 1, 2, 0, FALSE, FALSE, 500000000, 0); flags = TXOPT_TS_EN | TXOPT_IPV4_EN | TXOPT_L2_EN; PTPSetTransmitConfig(pEPL_HANDLE, flags, 2, 0, 0); flags = RXOPT_RX_L2_EN|RXOPT_RX_TS_EN|RXOPT_RX_SLAVE|RXOPT_ACC_UDP|RXOPT_ACC_CRC|RXOPT_RX_IPV4_EN; PTPSetReceiveConfig(pEPL_HANDLE, flags, &myRxCfg);