# Adding PTP to FreeRTOS+UDP (IEEE-1588)

**URL:** <https://forums.freertos.org/t/adding-ptp-to-freertos-udp-ieee-1588/2834>\
**Category:** Kernel\
**Created:** [January 22, 2015, 3:55pm UTC](https://forums.freertos.org/t/adding-ptp-to-freertos-udp-ieee-1588/2834 "2015-01-22T15:55:00Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![system](https://d2v6vdsk2p900z.cloudfront.net/original/1X/7fc8fdb729c645aab5b20282bbe34e57cb407be6.jpeg) [@system](https://forums.freertos.org/u/system)\
**Post date:** [January 22, 2015, 3:55pm UTC](https://forums.freertos.org/t/adding-ptp-to-freertos-udp-ieee-1588/2834/1 "2015-01-22T15:55:00Z")

</div>

**[hollenweger](https://sourceforge.net/u/hollenweger/)** wrote on [Thursday, January 22, 2015](https://sourceforge.net/p/freertos/discussion/382005/thread/7f4d34f9/#171d):

I’m evaluation to use FreeRTOS+UDP for a new project (probably based on a LPC18xx or LPC43xx). The project needs a precise time synchronization. I would like to use PTP (IEEE-1588). Has somebody experience with integrating PTP in FreeRTOS+UDP? Or is there another possibility?

---

<div class="post-metadata">

**Author:** ![rtel](https://d3iykfbgfh8zhg.cloudfront.net/user_avatar/forums.freertos.org/rtel/32/31_2.png) [@rtel](https://forums.freertos.org/u/rtel)\
**Post date:** [January 22, 2015, 7:51pm UTC](https://forums.freertos.org/t/adding-ptp-to-freertos-udp-ieee-1588/2834/2 "2015-01-22T19:51:58Z")

</div>

**[rtel](https://sourceforge.net/u/rtel/)** wrote on [Thursday, January 22, 2015](https://sourceforge.net/p/freertos/discussion/382005/thread/7f4d34f9/#e01a):

FreeRTOS+UDP (and FreeRTOS+TCP) use standard sockets interfaces, so if you have FreeRTOS+UDP running, and you have some PTP code compiling (I believe there are some open source libraries around) then stitching the two together should be simple. I’ve never done it myself though.

Regards.

---

<div class="post-metadata">

**Author:** ![htibosch](https://d3iykfbgfh8zhg.cloudfront.net/user_avatar/forums.freertos.org/htibosch/32/62_2.png) [@htibosch](https://forums.freertos.org/u/htibosch)\
**Post date:** [January 23, 2015, 1:03am UTC](https://forums.freertos.org/t/adding-ptp-to-freertos-udp-ieee-1588/2834/3 "2015-01-23T01:03:27Z")

</div>

**[heinbali01](https://sourceforge.net/u/heinbali01/)** wrote on [Friday, January 23, 2015](https://sourceforge.net/p/freertos/discussion/382005/thread/7f4d34f9/#136e):

Hi Martin,

I did some testing with the Precision Time Protocol (PTP) on a LAN, using FreeRTOS+TCP.

My aim was to use PTP to synchronise playing audio between various MCU’s.

These MCU’s have their clock from a HCM49, which provides a typical audio frequency of 11.2896 MHz, which finally translates to 44100 Hz.  
That also dictates the precision that I hoped to reach, deviations less than 22 us (1/F).

My conclusion: PTP can easily be implemented but I encountered a hardware problem: every XTAL’s is slightly different, some are faster and others are slower. I can synchronise the clocks but at the end of a 5-minute song the difference had become too big already.

Regards.

---

<div class="post-metadata">

**Author:** ![Pilot](https://avatars.discourse-cdn.com/v4/letter/p/da6949/32.png) [@Pilot](https://forums.freertos.org/u/Pilot)\
**Post date:** [September 8, 2020, 9:16pm UTC](https://forums.freertos.org/t/adding-ptp-to-freertos-udp-ieee-1588/2834/4 "2020-09-08T21:16:22Z")

</div>

Hein,

Sorry to revive such an old thread, but I was wondering if you could share a little more detail on your PTP implementation on FreeRTOS+TCP.

I’m just starting on an implementation on a PIC32MZ. The PIC32 doesn’t have any hardware assist for PTP, though my PHY does have basic SOF Detect.

Was your implementation purely software based, or did you have hardware resources available?

Thanks!
