09.12.2012 Views

RM0090: Reference manual - STMicroelectronics

RM0090: Reference manual - STMicroelectronics

RM0090: Reference manual - STMicroelectronics

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.

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

The accumulator and the addend are 32-bit registers. Here, the accumulator acts as a highprecision<br />

frequency multiplier or divider. Figure 343 shows this algorithm.<br />

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

Addend update<br />

Addend register<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 and 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 343, 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, and 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 and resynchronize<br />

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

937/1416 Doc ID 018909 Rev 3<br />

+<br />

Accumulator register<br />

Increment Subsecond<br />

register<br />

Constant value<br />

+<br />

Subsecond register<br />

Increment Second register<br />

Second register<br />

ai15670

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

Saved successfully!

Ooh no, something went wrong!