Skip to main content
Explorer
October 29, 2025
Solved

Getting timestamps for transmitted PTP datagrams

  • October 29, 2025
  • 1 reply
  • 184 views

Hi,

I am implementing PTP slave on bare metal H743II with firmware 1.12.1 and LwIP 2.1.2.

Timestamps for transmitted PTP datagrams can be received by implemented a callback function HAL_ETH_TxPtpCallback(). The callback is called from stm32h7xx_hal_eth.c:HAL_ETH_ReleaseTxPacket(). There was no call to HAL_ETH_ReleaseTxPacket(), so I added a call to it after calling udp_sendto().

The callback function was never called because HAL_ETH_ReleaseTxPacket() never found a packet in use with timestamp in the descriptor. I copied the timestamp handling from HAL_ETH_ReleaseTxPacket() to HAL_ETH_Transmit(). That seems to work, but is a workaround that probably conflicts with the design.

Any suggestion for a better solution is appreciated.

Best answer by LCE

All info for H723 .. H735 family:

For TX timestamps, you have to set a flag in a TX descriptor (DESC2 |= ETH_DMATXNDESCRF_TTSE).

Then check at TX interrupt for last segment sent and if a timestamp is available (DESC3 & ETH_DMATXNDESCWBF_TTSS).

I don't know if HAL is doing that for you, I built my own ETH driver.

1 reply

LCE
LCEBest answer
Principal II
October 29, 2025

All info for H723 .. H735 family:

For TX timestamps, you have to set a flag in a TX descriptor (DESC2 |= ETH_DMATXNDESCRF_TTSE).

Then check at TX interrupt for last segment sent and if a timestamp is available (DESC3 & ETH_DMATXNDESCWBF_TTSS).

I don't know if HAL is doing that for you, I built my own ETH driver.