Hi all,
I´m working with MSP430f5438A and I´ve some problems about RTC and clocks. I´ve installed a 32768Hz crystal (6pF load capacitance and 20ppm accuracy) as XT1. Then I´ve selected XT1 as ACLK.
I ´ve implemented several devices with the same components (MSP430f5438A, crystal…) and same software but there are different behavior about RTC. After a few days (5 or 6), some devices start to get a drift (only a bit of seconds). I´m worried about the drift because it isn’t lineal, every day is greater the difference, becoming several minutes only in ten days (Finally, some devices loses up to 15 minutes each day).
I noticed two wrongs settings: 1- XCAP was set up to 12pF (XCAP_3) instead of 6pF (XCAP_1). 2- I haven´t included the code for clear XT1 fault flags and test oscillator fault flag (Loop until XT1,XT2 & DCO stabilizes). Is it possible that the big drift is due to this? The rest of my program uses SMCK and MCLK were configured as DCOCLK.
It´s the code to configure the RTC, based on MSP430_WARE.
RTC_calendarInit(__MSP430_BASEADDRESS_RTC__, currentTime, RTC_FORMAT_BINARY);
RTC_setCalendarEvent(__MSP430_BASEADDRESS_RTC__,RTC_CALENDAREVENT_MINUTECHANGE);
RTC_enableInterrupt(__MSP430_BASEADDRESS_RTC__, RTCRDYIE + RTCTEVIE + RTCAIE);
RTC_startClock(__MSP430_BASEADDRESS_RTC__);
Also I decided to measure the RTCCLK signal for calibrate the frequency. I obtained a 512,03277 Hz (generating 512Hz), it supposes 64ppm which can be calibrate each 64 minutes witch appropriates registers:RTCCALS would be cleared, and RTCCAL would be set to 16 (64/4). If I decide don´t set this calibration, it supposes a drift of 64 ppm each 64 minutes so in a month a get a drift of 1.31s. (1month x 30days x 24hours x 60 minutes) / 64 minutes x 64 ppm / 32768 Hz = 1.31s ). Is it correct?
Thank you for your time