AnsweredAssumed Answered

"addend register" value calculation (for PTP)

Question asked by _.andrew on Nov 16, 2015
Latest reply on Nov 24, 2015 by Oussema Hajjem
http://www.st.com/web/en/catalog/tools/FM147/CL1794/SC961/SS1743/PF257871?s_searchtype=keywordI am confused about "addend register" value calculation.

From reference manual:

addend = 2^32 / FreqDivisionRatio;

FreqDivisionRatio = HCLK / 50000000; //50MHz

From PTP demonstraion for STM32F107
(http://www.st.com/web/en/catalog/tools/FM147/CL1794/SC961/SS1743/PF257871?s_searchtype=keyword#)

Addend = 2^63 / SysClk / Increment
 

ethernetif.h:
...
  /* Examples of subsecond increment and addend values using SysClk = 72 MHz
   
   Addend * Increment = 2^63 / SysClk

    ptp_tick = Increment * 10^9 / 2^31
 
   +-----------+-----------+------------+
   | ptp tick  | Increment | Addend     |
   +-----------+-----------+------------+
   |  119 ns   |   255     | 0x1DF170C7 |
   |  100 ns   |   215     | 0x238391AA |
   |   50 ns   |   107     | 0x475C1B20 |
   |   20 ns   |    43     | 0xB191D856 |
   |   14 ns   |    30     | 0xFE843E9E |
   +-----------+-----------+------------+
  */

#define ADJ_FREQ_BASE_ADDEND      0xB191D856
#define ADJ_FREQ_BASE_INCREMENT   43
...

Which formula is right?




Outcomes