29.01.2015 Views

STM32F101xx, STM32F102xx, STM32F103xx, STM32F105xx and ...

STM32F101xx, STM32F102xx, STM32F103xx, STM32F105xx and ...

STM32F101xx, STM32F102xx, STM32F103xx, STM32F105xx and ...

SHOW MORE
SHOW LESS

You also want an ePaper? Increase the reach of your titles

YUMPU automatically turns print PDFs into web optimized ePapers that Google loves.

RM0008<br />

Ethernet (ETH): media access control (MAC) with DMA controller<br />

Figure 307. System time update using the Fine correction method<br />

Addend register<br />

Addend update<br />

+<br />

Accumulator register<br />

Constant value<br />

Increment Subsecond<br />

register<br />

+<br />

Subsecond register<br />

Increment Second register<br />

Second register<br />

ai15670<br />

The system time update logic requires a 50 MHz clock frequency to achieve 20 ns accuracy.<br />

The frequency division is the ratio of the reference clock frequency to the required clock<br />

frequency. Hence, if the reference clock (HCLK) is, let us say, 66 MHz, the ratio is calculated<br />

as 66 MHz/50 MHz = 1.32. Hence, the default addend value to be set in the register is<br />

2 32 /1.32, which is equal to 0xC1F0 7C1F.<br />

If the reference clock drifts lower, to 65 MHz for example, the ratio is 65/50 or 1.3 <strong>and</strong> the<br />

value to set in the addend register is 2 32 /1.30 equal to 0xC4EC 4EC4. If the clock drifts<br />

higher, to 67 MHz for example, the addend register must be set to 0xBF0 B7672. When the<br />

clock drift is zero, the default addend value of 0xC1F0 7C1F (2 32 /1.32) should be<br />

programmed.<br />

In Figure 307, the constant value used to increment the subsecond register is 0d43. This<br />

makes an accuracy of 20 ns in the system time (in other words, it is incremented by 20 ns<br />

steps).<br />

The software has to calculate the drift in frequency based on the Sync messages, <strong>and</strong> to<br />

update the Addend register accordingly. Initially, the slave clock is set with<br />

FreqCompensationValue0 in the Addend register. This value is as follows:<br />

FreqCompensationValue0 = 2 32 / FreqDivisionRatio<br />

If MasterToSlaveDelay is initially assumed to be the same for consecutive Sync messages,<br />

the algorithm described below must be applied. After a few Sync cycles, frequency lock<br />

occurs. The slave clock can then determine a precise MasterToSlaveDelay value <strong>and</strong> resynchronize<br />

with the master using the new value.<br />

Doc ID 13902 Rev 9 875/995

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!