cancel
Showing results for 
Search instead for 
Did you mean: 

Getting timestamps for transmitted PTP datagrams

edgarj
Visitor

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.

1 ACCEPTED SOLUTION

Accepted Solutions
LCE
Principal II

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.

View solution in original post

1 REPLY 1
LCE
Principal II

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.