2020-04-15 06:45 PM
Hi,
I'm trying to get PTP timestamp on STM32H743 Nucleo board. There is no proble with LwIP and ethernet driver so far except for PTP. I followed the instruction( 58.9.7 Programming guidelines for IEEE 1588 timestamping) on reference manual (RM0433) as follow.
CLEAR_BIT(heth->Instance->MACIER, ETH_MACIER_TSIE);
SET_BIT(heth->Instance->MACTSCR, ETH_MACTSCR_TSENA);
WRITE_REG(heth->Instance->MACSSIR, 20);
WRITE_REG(heth->Instance->MACTSAR, 0xcc);
SET_BIT(heth->Instance->MACTSCR, ETH_MACTSCR_TSADDREG);
while(READ_BIT(heth->Instance->MACTSCR, ETH_MACTSCR_TSADDREG));
SET_BIT(heth->Instance->MACTSCR, ETH_MACTSCR_TSCFUPDT);
WRITE_REG(heth->Instance->MACSTSUR, 0x00);
WRITE_REG(heth->Instance->MACSTNUR, 0x00);
SET_BIT(heth->Instance->MACTSCR, ETH_MACTSCR_TSINIT)
// TODO: configure pps
However, System time seconds register (ETH_MACSTSR) does not count and just loaded initial value in System time seconds update register (ETH_MACSTSUR). In reference maual there is no clear information about clock source for PTP. In STM32F7, there is a clock path for PTP as in image below in CubeMX clock configuraton page.
However there no clock path for PTP in STM32H7 as in image below.
Am I missing something about to get system time from the registers ETH_MACSTSR and ETH_MACSTNR ?
Thanks in advance.
ierturk
Solved! Go to Solution.
2020-04-18 12:56 AM
The problem comes from the Sub-second increment register (ETH_MACSSIR). The value to be incremented is stored in high word of the register as in the image below.
Everything runs as expected when changed the value as follow.
WRITE_REG(heth->Instance->MACSSIR, ((uint32_t)20)<<16);
2020-04-18 12:56 AM
The problem comes from the Sub-second increment register (ETH_MACSSIR). The value to be incremented is stored in high word of the register as in the image below.
Everything runs as expected when changed the value as follow.
WRITE_REG(heth->Instance->MACSSIR, ((uint32_t)20)<<16);