Correct RTCDR value in MCF52235

取消
显示结果 
显示  仅  | 搜索替代 
您的意思是: 

Correct RTCDR value in MCF52235

1,689 次查看
flashtoo
Contributor I

The MCF52235 documentation for the Clock module list the RTCDR value as:

The Real Time Clock Divide Register is a 32 bit read/write register that divides down the oscillator clock
to a 1 Hz clock for the Real Time Clock module. If this register is programmed with zero then the clock to
the Real Time Clock module is disabled, otherwise the oscillator clock is divided by one more than the
value written to the register field (between 2 and 4,294,967,296).

Since 1 is added to the register, it seems that the correct value for a 25Mhz oscilator would be 24999999. Yet, all the examples I have seen use a even number of 25000000.  I know it is only a small error but am I correct?

FlashToo

标签 (1)
0 项奖励
2 回复数

411 次查看
rocco
Senior Contributor II
Hi, FlashToo:

I believe you are correct, but the 25,000,000 value is much more obvious to someone reading the code. And you are also correct in that the difference is very small.

To add a little perspective, a good, temperature-compensated oscillator may give you frequency stability around two-parts per million. The value of 25,000,000 versus 24,999,999 is .04 parts per million, or fifty-times smaller.

So if it was an inadvertent mistake, you can understand why it was never discovered before.
0 项奖励

411 次查看
flashtoo
Contributor I
Thanks,
Just want to make sure I understood this... And to add perspective, even if the error in the crystal was 0 the shift in time caused by the RTCDR error would only be about 1.26 seconds per year.
 
FlashToo
0 项奖励