This thread has been locked.

If you have a related question, please click the "Ask a related question" button in the top right corner. The newly created question will be automatically linked to this question.

AM625: CPSW PTP timestamping all the packets

Part Number: AM625

Tool/software:

I am designing PTP (IEEE 1588-2019) system and I have a requirement to be able to implement PTP over MACSEC while keeping hardware based precise timestamping. In order to do so I need to be able to timestamp all the incoming and outgoing packets and not only PTP related packets as if all the traffic is encrypted, the CPSW won't know that the packets are PTP related.

Is there such option in CPSW to have all the incoming and outgoing packets timestamped?

Thanks!

Alexey.

  • Hi Alexey,

    Is there such option in CPSW to have all the incoming and outgoing packets timestamped?

    I believe this should be possible through the CPSW CPTS module. Specifically, AM62x TRM 12.3.1.4.7.2. CPTS Architecture section describes "Time stamp values for every packet transmitted or received on external port of the CPSW are recorded." You should take a look at this section of the TRM for more information about the CPTS.

    If you're using a Linux OS, this resource has some other information about CPSW CPTS in the context of Linux. https://software-dl.ti.com/processor-sdk-linux-rt/esd/AM62X/10_00_07_04/exports/docs/linux/Foundational_Components/Kernel/Kernel_Drivers/Network/CPSW3g.html?highlight=cpts#cpsw3g 

    Please let us know if you have additional follow-up questions!

    -Daolin

  • Hi Daolin,

    From further documentation reading, I've found that the CPTS indeed records timestamp for each packet and there are two options to get this timestamp by software. The first option to get it attached to every packet by DMA (this is the option I wanted to use), but according to AM62 and AM64 errata, this function has some bug. The second option is to get the timestamp from CPTS FIFO, but in order to do so, the CPTS should classify the packet as time sync packet, otherwise it won't be saved in FIFO. The question is it I can make the CPTS to classify every packet as time sync packet?

    Thanks!

    Alexey.

  • but according to AM62 and AM64 errata, this function has some bug.

    Correct. The feature is there but errata i2401 prevents using it in most cases. Debug and testing you can use it but in the presence of corrupted Ethernet traffic there is a risk of the Ethernet port locking up. In many environments there are no lockups but if you see Ethernet frames getting dropped because of CRC errors it is likely the lockup will hit.

    The second option is to get the timestamp from CPTS FIFO, but in order to do so, the CPTS should classify the packet as time sync packet, otherwise it won't be saved in FIFO. The question is it I can make the CPTS to classify every packet as time sync packet?

    No. The FIFO method will only classify IEEE1588 frames (all Annexes, so raw Ethernet, IPv4 UDP, IPv6 UDP) to put timestamps in the FIFO. Prior to AM6x generation this was the only method available, some test programs like https://github.com/ikhorn/plget used this for non PTP traffic. But the frame needs to be a IEEE1588 frame for the timestamps to show up in the FIFO.

    The AM64x family Ethernet ports using the ICSSG are not affected by the errata and can timestamp everything.