You can enable the timestamp feature by setting Bit 0 of the MAC_Timestamp_Control Register. However, it is essential that the timestamp counter be initialized after this bit is set. Complete the following steps during Ethernet module initialization:
- Mask the Timestamp Trigger interrupt by clearing the bit 16 of MAC_Interrupt_Enable Register.
- Set Bit 0 of MAC_Timestamp_Control Register to enable timestamping.
- Program MAC_Sub_Second_Increment Register based on the PTP clock frequency.
- If you are using the Fine Correction approach, program MAC_Timestamp_Addend and set Bit 5 of MAC_Timestamp_Control Register.
- Poll the MAC_Timestamp_Control Register until Bit 5 is cleared.
- Program Bit 1 of MAC_Timestamp_Control Register to select the Fine Update method (if required).
- Program MAC_System_Time_Seconds_Update Register and
MAC_System_Time_Nanoseconds_Update Register with the appropriate time
value.
- Set Bit 2 in MAC_Timestamp_Control Register. The timestamp counter starts
operation as soon as the counter is initialized with the value written in the
Timestamp Update registers. If one-step timestamping is enabled:
- To enable one-step timestamping, program Bit 27 of the
TDES3 Context Descriptor.
- Program registers MAC_Timestamp_Ingress_Asym_Corr and
MAC_Timestamp_Egress_Asym_Corr to update the correction field in
PDelay_Req PTP messages.
- Enable the MAC receiver and transmitter for proper timestamping.