MIMXRT1061C RTC accuracy with external chrystal

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

MIMXRT1061C RTC accuracy with external chrystal

136 次查看
JLa63
Contributor III

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

0 项奖励
回复
1 回复

51 次查看
Habib_MS
NXP Employee
NXP Employee

Hello @JLa63, sorry for the late reply.
Please make sure your oscillator meets the frequency specifications mentioned in Chapter 11, “External Input Clock Frequency,” of the datasheet.


Additionally, the “Clocks” chapter in the MIMXRT1050/MIMXRT1060 Hardware Design Guide provides recommendations to help avoid issues when using an external crystal.


On another note, the “HP Calibration Value” bits in the SNVS_HP Control Register (HPCR) can help you calibrate the RTC through software. You can find more details about this feature in section 20.3.3.1.1 “SNVS_HP Real Time Counter.”
Furthermore, you can measure the RTC frequency to determine the exact value your RTC is running at, and in based on this, see what the issue could be.
BR
Habib 

0 项奖励
回复