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.

CCS/EK-TM4C1294XL: 1588 PTP Implementation on TM4C1294XL LaunchPad

Part Number: EK-TM4C1294XL
Other Parts Discussed in Thread: EK-TM4C129EXL

Tool/software: Code Composer Studio

Hi,

I am using EK-TM4C1294XL LaunchPad for sending some samples over Ethernet. I want to implement 1588 PTP Time Synchronization on this board. Please help me how to proceed.

Thank You.

  • While there is no pre-made example for TM4C129 with 1588 PTP, it should (in theory) not be too difficult to implement. It's just a matter of finding the right pieces and putting them together. This has been on my to-do list for some time now. In fact what I'd like to do is a test where two EK-TM4C129EXL boards would communicate via Ethernet, synchronize via 1588 PTP, and each generate a square wave, where the two waves would be synchronized, using an oscilloscope to measure drift, jitter, etc. But, as I haven't had the free cycles to work on 1588 yet, this remains on my to-do list.

    The way 1588 PTP works on the TM4C129 family is as follows: Most of the 1588 depends on software, not hardware, for the following reason: 1588 can be implemented as software only, but then you have latencies and jitter of the software TCP/IP stack, followed by those of hardware. This reduces the accuracy of clock synchronization across devices. Hardware support has been implemented to record the time as close "to the wire" as possible, to eliminate these sources of jitter. To accomplish this, the built-in Ethernet hardware monitors all data coming in and going out; when it "sees" a UDP datagram that matches the format of a 1588 PTP message, it records the timestamp. On reception of such a packet, it records the time of reception; on transmission, it places the time of transmission in the correct place of the UDP datagram. There is also a 64-bit clock, which can be adjusted by either a "course" or a "fine" adjustment. This is the clock used by the 1588 hardware.

    In order to make this work, you need:

    (1) to configure the PTP hardware correctly. For example, register EMACTIMSTCTRL.PTPVER2 will determine if the Ethernet hardware expects / processes IEEE 1588-2002 "version 1" or IEEE 1588-2008 "version 2" PTP protocol. Clearly this must match the format of datagrams that your system will use.

    (2) software that implements the PTP protocol and adjusts the clock. This is really the key piece because, again, the hardware only waits for these packets to come and go, then it acts by recording the time. I came across some matches for "1588 PTP" on github and you may find others across the Internet. Some appear more useful than others. For example, code implemented in Python probably won't help you much on TM4C, unless you run an embedded Python interpreter. Alternatively you can try to implement your own, but I would recommend using something already implemented as a starting point. I can't point you to a specific implementation because frankly I haven't spent enough time researching this myself to be able to pick one.

    (3) code to adjust the 64-bit clock mentioned above

    I recommend reading the relevant sections of the TM4C129 datasheet that pertain to IEEE 1588 PTP to get an idea of what hardware support is provided, keeping in mind that most of the implementation relies on software.
  • Hi,

    Actually I am sending the samples over ethernet physical layer directly. Can I implement 1588 PTP on this board which sends the PTP packets directly over physical layer without the help of UDP and TCP/IP stack? Please help.

    Thank you.

  • Hi,

    Presently I have only one board. So, I want to send some PTP messages from this board and observe those in wireshark in my pc . So, do I require any other device to communicate or it can be done with the single board which sends some PTP messages to my PC. Do I need to integrate TCP/IP with the ptpd library provided by the TivaWare series. How can I proceed.

    Thank You.
  • Hi,
    As mentioned by Twelve12pm, there is no TivaWare example with IEEE 1588 PTP. However, the EMAC hardware on the device does support 1588 PTP.

    Can your PC act as a grandmaster to send out synchronization clock? You will need to find out as I'm not an expert in this protocol. There are NTP+PTP Network Time Server on the market that does just the purpose so I'm not sure if your PC can do it too.

    Also the PTP is based on the UDP transport layer so you will need the UDP/IP stack.