title: IEEE 1588 PTP Clock Source in STM32H743
body: <p>I'm trying to get <code>PTP</code> timestamp on <code>STM32H743 Nucleo</code> board. There is no proble with <code>LwIP</code> and ethernet driver so far except for <code>PTP</code>. I followed the instruction( 58.9.7 Programming guidelines for <code>IEEE 1588 timestamping</code>) on reference manual (<code>RM0433</code>) as follow.</p>
  
  <pre><code>  CLEAR_BIT(heth-&gt;Instance-&gt;MACIER, ETH_MACIER_TSIE);
    SET_BIT(heth-&gt;Instance-&gt;MACTSCR, ETH_MACTSCR_TSENA);
    WRITE_REG(heth-&gt;Instance-&gt;MACSSIR, 20);
    WRITE_REG(heth-&gt;Instance-&gt;MACTSAR, 894784853);    // 2^63 / 20 / 480M
    SET_BIT(heth-&gt;Instance-&gt;MACTSCR, ETH_MACTSCR_TSADDREG);
    while(READ_BIT(heth-&gt;Instance-&gt;MACTSCR, ETH_MACTSCR_TSADDREG));
    SET_BIT(heth-&gt;Instance-&gt;MACTSCR, ETH_MACTSCR_TSCFUPDT);
    WRITE_REG(heth-&gt;Instance-&gt;MACSTSUR, 0x01);
    WRITE_REG(heth-&gt;Instance-&gt;MACSTNUR, 0x02);
    SET_BIT(heth-&gt;Instance-&gt;MACTSCR, ETH_MACTSCR_TSINIT); // If one-step timestamping is required follow reference manual
    // TODO: configure pps
  </code></pre>
  
  <p>However, System time seconds register (<code>ETH_MACSTSR</code>) does not count and just loaded initial value in System time seconds update register (<code>ETH_MACSTSUR</code>). In reference maual there is no clear information about clock source for <code>PTP</code>. In <code>STM32F7</code>, there is a clock path for <code>PTP</code> as in image below in <code>CubeMX</code> clock configuraton page.</p>
  
  <p><a href="https://i.stack.imgur.com/wMC3B.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/wMC3B.png" alt="enter image description here"></a></p>
  
  <p>However there no clock path for <code>PTP</code> in <code>STM32H7</code> as in image below.</p>
  
  <p><a href="https://i.stack.imgur.com/19cM9.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/19cM9.png" alt="enter image description here"></a></p>
  
  <p>Am I missing something about to get system time from the registers <code>ETH_MACSTSR</code> and <code>ETH_MACSTNR</code>?</p>