Hard Processor System Technical Reference Manual: Agilex™ 5 SoCs

ID 814346
Date 7/19/2024
Public

A newer version of this document is available. Customers should click here to go to the newest version.

Document Table of Contents

5.1.7.16.1. Initialization Guidelines for System Time Generation

You can enable the timestamp feature by setting Bit 0 of the MAC_Timestamp_Control register. However, it is essential that the timestamp counter must be initialized after this bit is set. Complete the following steps during EMAC initialization:

  1. Mask the timestamp trigger interrupt by clearing the bit 12 of MAC_Interrupt_Enable register.
  2. Set bit 0 of MAC_Timestamp_Control register to enable timestamping.
  3. Program MAC_Sub_Second_Increment register based on the PTP clock frequency.
  4. You can use either the Coarse Correction Method or the Fine-Correction Method to update the time.
  5. Program MAC_System_Time_Seconds_Update register and MAC_System_Time_Nanoseconds_Update register with the appropriate time value.
  6. Set bit 2 in MAC_Timestamp_Control register. The timestamp counter starts operation as soon as it is initialized with the value written in the timestamp update registers. If one-step timestamping is enabled:
    1. To enable one-step timestamping, program bit 27 of the TDES3 context descriptor.
    2. Program the registers MAC_Timestamp_Ingress_Asym_Corr and MAC_Timestamp_Egress_Asym_Corr to update the correction field in PDelay_Req PTP messages.
  7. Enable the MAC receiver and transmitter for proper timestamping.
Note: If timestamp operation is disabled by clearing bit 0 of MAC_Timestamp_Control register, you need to repeat all these steps to restart the timestamp operation.