2020-04-15 01:30 PM
Hi,
I am using RTC in WakeUp mode to wake the MCU to save energy.
The problem is that the RTC time base is not accurate as I am using LSI on the RTC.
Is there any way to make RTC more accurate using LSI as a clock source?.
CLK_PeripheralClockConfig(CLK_Peripheral_RTC, ENABLE);
CLK_RTCClockConfig(CLK_RTCCLKSource_LSI, CLK_RTCCLKDiv_1);
RTC_WakeUpCmd(DISABLE);
if( RTC_GetFlagStatus(RTC_FLAG_WUTF) == SET )
{
RTC_ClearITPendingBit(RTC_IT_WUT);
}
// LSI = 38kHz (LSI)
// LSI/16 = 2375kHz (Preescaler 16)
// Timer_Resolution = 1/(2375kHz) = 421,0526us
// periodicEvent = Timer_Resolution*238 (100ms)
RTC_SetWakeUpCounter(238); // 100ms
RTC_WakeUpClockConfig(RTC_WakeUpClock_RTCCLK_Div16);
RTC_WakeUpCmd(ENABLE);