1. At time MasterSyncTime
n
the master sends the slave clock a Sync message. The slave receives
this message when its local clock is SlaveClockTime
n
and computes MasterClockTime
n
as:
MasterClockTime
n
= MasterSyncTime
n
+ MasterToSlaveDelay
n
2. The master clock count, MasterClockCount
n
, for the current Sync cycle is given by:
MasterClockCount
n
= MasterClockTime
n
- MasterClockTime
n-1
This assumes that the MasterToSlaveDelay is the same for Sync cycles n and n-1.
3. The slave clock count for current Sync cycle, SlaveClockCount
n
is given by:
SlaveClockCount
n
= SlaveClockTime
n
– SlaveClockTime
n – 1
4. The difference between the master and slave clock counts for the current Sync cycle,
ClockDiffCount
n
, is given by:
ClockDiffCount
n
= MasterClockCount
n
– SlaveClockCount
n
5. The frequency-scaling factor for the slave clock, FreqScaleFactor
n
is given by:
FreqScaleFactor
n
= (MasterClockCount
n
+ ClockDiffCount
n
) / SlaveClockCount
n
6. The frequency compensation value, FreqCompensationValue, to be written in the TSAR field
of the EMACTIMADD register is:
FreqCompensationValue
n
= FreqScaleFactor
n
* FreqCompensationValue
n – 1
In theory, this algorithm achieves lock in one Sync cycle; however, it may take several cycles,
because of changing network propagation delays and operating conditions. This algorithm is
self-correcting: if for any reason the slave clock is initially set to a value from the master that is
incorrect, the algorithm corrects it at the cost of more Sync cycles.
20.3.5.2 Transmit Timestamping
The MAC captures a timestamp when the Start Frame Delimiter (SFD) of a frame is sent. The
transmit frames are marked to indicate whether a timestamp should be captured for that frame and
written to the extended transmit descriptors that support timestamping. The MAC returns the
timestamp automatically to the corresponding transmit descriptor, thus connecting the timestamp
with the specific PTP frame. The 64-bit timestamp information is written to the TDES6 and TDES7
fields.
20.3.5.3 Receive Timestamping
The MAC captures the timestamp of all received frames. The MAC does not process the received
frames to identify the PTP frames in default timestamping mode (when Advanced Timestamp is
disabled). The MAC gives the timestamp and the corresponding status to the TX/RX Controller
along with the EOF data. The TX/RX Controller validates and indicates the availability of the
timestamp so that the DMA can return the timestamp to the corresponding receive descriptor. The
64-bit timestamp information is written to the RDES6 and RDES7 fields. The timestamp is written
only to the receive descriptor for which the Last Descriptor status field has been set to 1 (the EOF
marker). When the timestamp is not available (for example, because of an RX FIFO overflow), an
all '1s' pattern is written to the descriptors (RDES6 and RDES7), indicating that the timestamp is
not correct. If timestamping is disabled, the DMA does not alter RDES6 or RDES7. RDES0[7]
indicates whether the timestamp is updated in RDES6 and RDES7.
June 18, 20141444
Texas Instruments-Production Data
Ethernet Controller