2015-11-15 10:49 PM
http://www.st.com/web/en/catalog/tools/FM147/CL1794/SC961/SS1743/PF257871?s_searchtype=keyword
I 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 | +-----------+-----------+------------+ */ &sharpdefine ADJ_FREQ_BASE_ADDEND 0xB191D856 &sharpdefine ADJ_FREQ_BASE_INCREMENT 43 ... Which formula is right? #ptp-ptpd-stm32f1072015-11-24 03:11 AM
Hi Andrew,
It's the same formula :),Just in the reference manual we are fixing the tick accuracy to 20ns But in the PTP demonstration the formula is general for different ptp tick values.you can check this by replacing the ptp_tick by 20 ns in the equation and you'll find the same result as described in the reference manual.Best Regards,LEO