cancel
Showing results for 
Search instead for 
Did you mean: 

STM32H5 HAL_ETH_PTP_SetTime() adds to the time instead of overwriting it

ben5050
Associate II

On line 1695 of stm32h5xx_hal_eth.c ETH_MACTSCR_TSUPDT is used to set the timestamp counter, however page 2934 of RM0481 says this bit is used to add or subtract from the timestamp counter instead:

ben5050_0-1778800470710.png

Based on the description of this function, and its use elsewhere, this function should instead use ETH_MACTSCR_TSINIT to overwrite the timestamp counter. As it is at the moment, the current time is added to the counter every time there is a PTP sync meaning the time fluctuates wildly over a century and a half span, and the time is never close enough to use fine adjustment methods.

Also consider adding a line to enable PLL1Q's output to the HAL Ethernet init function, that was another fun bug to track down...

0 REPLIES 0