Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Second try at adding PTP support #462

Open
wants to merge 35 commits into
base: master
Choose a base branch
from

Conversation

HarishgunaS
Copy link

@HarishgunaS HarishgunaS commented Oct 10, 2023

Background

The company that I am working at requires PTP leader/follower support on an STM32 H7 series microcontroller. This PR adds PTP support for the H7. It is a revised version of #444.

Description

All the PTP related features that have been added in this PR are completely feature gated, so that use without the PTP feature is completely unaffected.

There are three major parts of this implementation.

  1. Modifying the Ethernet driver to provide ingress/egress hardware timestamping capabilities.
  2. Adding a PTP driver that assists with timekeeping in the Ethernet PTP peripheral.
  3. Adding a PTP frame buffer and accessor methods to the EthernetDMA, since smoltcp would drop any PTP frames on interface.poll.

The author of a related PR on a different repo had concerns about the Rx pipeline being stalled due to timestamps being stored in a context descriptor that is owned by the application and blocking the DMA. To minimize concerns regarding this, I ran a ping flood against the microcontroller using the ptp-take2 branch HAL as well as the main branch HAL, and the results were basically identical.

Validation

Wireshark output of packets emitted by the micro, showing timestamped PTP followup packets.
Screenshot 2024-02-06 at 5 00 10 PM
Ping flooding the micro with no packet loss.
Screenshot 2024-02-06 at 5 01 12 PM

@HarishgunaS HarishgunaS marked this pull request as ready for review November 6, 2023 17:37
@HarishgunaS
Copy link
Author

Hey @richardeoin, this PR is ready. Please review if and when you have time. Thanks!

@jmgrosen
Copy link

@richardeoin I'd love if you could review and merge this as well!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants