1923 views|0 replies

1662

Posts

0

Resources
The OP
 

Can't the RTC of MSP430F6723 use the internal clock REFOCLK? [Copy link]

The clock configuration of 430F6723 is as follows:

UCSCTL4 &= ~(SELA0 | SELA1 | SELA2); // Ensure XT1 is ACLK source // (127+1) x 32768 = 4194304hz(4.19455)
UCSCTL4 |= SELA1;
UCSCTL3 |= SELREF__REFOCLK;
do
{
UCSCTL7 &= ~(XT2OFFG | XT1LFOFFG | DCOFFG);
// Clear XT2,XT1,DCO fault flags
SFRIFG1 &= ~OFIFG; // Clear fault flags
} while ((SFRIFG1 & OFIFG)&&(delay--)); // Test oscillator fault flag

///jackwei clock SMCLK becomes 4194304hz
__bis_SR_register(SCG0); // Disable FLL function
UCSCTL0 = 0x0000 ;
UCSCTL1 = DCORSEL_5; // DCO frequency is (2.5~6MHz) manual page 37
UCSCTL2 = FLLD_1 + 127; // Set DCO frequency to 4194304hz
__bic_SR_register(SCG0); // Enable FLL function

Set ACLK as REFOCLK clock source

The configuration of RTC is:

void rtc_init(void)
{
// RTCCTL1 = RTCTEVIE + RTCRDYIE + RTCMODE + RTCSSEL_0 + RTCTEV__MIN + RTCAIE; //
RTCCTL0_H = RTCKEY_H; // Unlock the RTC_C module
RTCCTL0_L = RTCTEVIE + RTCRDYIE + RTCAIE; // Enable RTC time event interrupt
RTCCTL13 = RTCTEV_3 + RTCMODE + RTCHOLD + RTCSSEL_0; // BCD mode, RTC hold, set RTCTEV to 12:00 minute alarm, 32khz RTCBCD++ RTCHOLD
// Event interrupt
RTCYEAR = 2020; // Year = 0x2020
RTCMON = 8; // Month = 0x10 = October
RTCDAY = 3; // Day = 0x07 = 7th
RTCDOW = 1; // Day of week = 0x05 = Friday
RTCHOUR = 5; // Hours = 0x11
RTCMIN = 59; // Minutes = 59
RTCSEC = 0; // Seconds = 0


RTCCTL13 &=~(RTCHOLD); //Start RTC calendar mode
RTCCTL0_H = 0; //Lock RTC_C module
RTCAHOUR = RTCAE + 6;
}

For some reason, the RTC interrupt takes a long time to enter. It enters the RTCIV_RTCRDYIFG interrupt once in about 50s.

Among them, RTCOFIFG = 1 in the interrupt source;
the time configured in TIMEARA is relatively accurate. I don’t know what causes the large difference in RTC.

This post is from Microcontroller MCU
 

Find a datasheet?

EEWorld Datasheet Technical Support

EEWorld
subscription
account

EEWorld
service
account

Automotive
development
circle

Copyright © 2005-2024 EEWORLD.com.cn, Inc. All rights reserved 京B2-20211791 京ICP备10001474号-1 电信业务审批[2006]字第258号函 京公网安备 11010802033920号
快速回复 返回顶部 Return list