I am configuring the rtc module for timing function,
rtc_clk_config(RTC_DIV_DENOM_1024,32768);
I want to know what is the difference between RTC_DIV_DENOM_1024 and RTC_DIV_DENOM_1000, which configuration is more accurate?
thanks!
Keywords:
Device:
Hi zyosintek,
The RTC accuracy is closely depended on the clock source, which is the Low Power Clock (LPC). The LPC could be either an external crystal oscillator (XTAL32K) at 32768 Hz or the internal RCX (from 13KHz to 15KHz).
According to the datasheet, 100Hz required for the RTC block, which is the standard clock. For the 100Hz generation, RTC_DIV_INT (0x147 = 327) LPC cycles are required.
The LPC is : 1 / 32768 Hz = 0.000030517578125 seconds and the 100Hz is 0.01 seconds.
所以,100 hz的一代,0.01/0。000030517578125 = 327.68 LPC cycles.
According to the RTC_DIV_INT description, the integer part (327) will be used for the clock generation.
The fractional divisor part for RTC 100Hz generation ( RTC_DIV_FRAC) is 0x2A8 = 680. This is divided by RTC_DIV_DENOM. The default value is 1000 (RTC_DIV_DENOM_1000), so 680 / 1000 = 0.68
That value will be added to the integer part of the RTC_DIV_INT, so the value becomes 327.68.
If the 327.68 is divided by LPC (1/32768), then the RTC block will take exactly 100Hz.
Thanks, PM_Dialog
Thanks for your answers ,so I should choose this configuration (RTC_DIV_DENOM_1000)