Hi,
We are using MIMXRT1061C MCU in our device with external 32.768 kHz crystal connected.
However it seems that RTC is ticking too fast, about 10 seconds in 18 hours at room temperature.
Related registers should be correctly set:
XTALOSC24M_MISC0 0x24008080
CCM_ANALOG_MISC0 0x24008080
Do anybody have any idea, what could be wrong? Our other devices with same external crystal used have perfectly accurate RTC.
RTC initialization is done the following way:
snvs_lp_srtc_config_t snvsSrtcConfig= {false, 0};
snvs_hp_rtc_config_t snvsRtcConfig = {false, 0U, 0U};
SNVS_HP_RTC_Init(SNVS, &snvsRtcConfig);
SNVS_LP_SRTC_Init(SNVS, &snvsSrtcConfig);
NVIC_ClearPendingIRQ(SNVS_HP_WRAPPER_IRQn);
DisableIRQ(SNVS_HP_WRAPPER_IRQn);
GPC_DisableIRQ(GPC, SNVS_HP_WRAPPER_IRQn);
bool lpsrtcEnabled = (SNVS->LPCR&SNVS_LPCR_SRTC_ENV_MASK) != 0;
/* Stop SRTC time counter */
SNVS->LPCR &= ~SNVS_LPCR_SRTC_ENV_MASK;
while ((SNVS->LPCR & SNVS_LPCR_SRTC_ENV_MASK))
{
}
/* Disable SRTC alarm interrupt */
SNVS->LPCR &= ~SNVS_LPCR_LPTA_EN_MASK;
while ((SNVS->LPCR & SNVS_LPCR_LPTA_EN_MASK))
{
}
// Was SRTC active on entry?
if (lpsrtcEnabled)
{
SNVS->LPCR |= SNVS_LPCR_SRTC_ENV_MASK;
while ((0U == (SNVS->LPCR & SNVS_LPCR_SRTC_ENV_MASK)))
{
}
}
/* Synchronize RTC time and date with SRTC and start RTC */
SNVS_HP_RTC_TimeSynchronize(SNVS);
SNVS_HP_RTC_StartTimer(SNVS);
Best regards,
Jukka