Skip to main content
Associate II
May 14, 2026
Question

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

  • May 14, 2026
  • 1 reply
  • 145 views

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...

1 reply

STOne-32
Technical Moderator
May 16, 2026

Dear @ben5050,

Thank you very much for escalating this issue, as you can see here: stm32n6xx-hal-driver/Src/stm32n6xx_hal_eth.c at cf84d98ae66419c7bfdc25f6c65954585a4e3811 · STMicroelectronics/stm32n6xx-hal-driver · GitHub it is working as expected.   we logged this defect in our internal system with reference CDM0062696 for future tracking.  Much appreciated and wish you a great day.

Regards,

STOne-32.