I ported the embedded NTP stratum 1 server that I originally wrote for the stm32f407. It uses the 1588 ethernet hardware for RX and TX timestamps. I'm also using the 1588 event input capture to measure the reference PPS in hardware.
My first task was to get the clock synchronized with my reference GPS module's PPS. I'm using a PID controller to keep them in sync.
Once I have the local clock synchronized, I can then start serving the time to clients. I compared the teensy's clock to my stm32mp1-based NTP stratum 1 server. The green and blue lines represent the request and response latency, and the purple line is the offset between the two clocks. This is a 23 microsecond round trip time and an offset of 570 nanoseconds. There's a small change in the graph at the end where I turned on adjustments for the published latency figured for the PHY (105ns TX delay, 350ns RX delay).
This is better than my original platform of the stm32f407 (below), because the Teensy's crystal is much better.
Code is here: https://github.com/ddrown/teensy-ntp
And I'm using my own version of the Teensy lwip library, with 1588 timestamping support: https://github.com/ddrown/teensy41_ethernet
My first task was to get the clock synchronized with my reference GPS module's PPS. I'm using a PID controller to keep them in sync.
Once I have the local clock synchronized, I can then start serving the time to clients. I compared the teensy's clock to my stm32mp1-based NTP stratum 1 server. The green and blue lines represent the request and response latency, and the purple line is the offset between the two clocks. This is a 23 microsecond round trip time and an offset of 570 nanoseconds. There's a small change in the graph at the end where I turned on adjustments for the published latency figured for the PHY (105ns TX delay, 350ns RX delay).
This is better than my original platform of the stm32f407 (below), because the Teensy's crystal is much better.
Code is here: https://github.com/ddrown/teensy-ntp
And I'm using my own version of the Teensy lwip library, with 1588 timestamping support: https://github.com/ddrown/teensy41_ethernet