This thread has been locked.
If you have a related question, please click the "Ask a related question" button in the top right corner. The newly created question will be automatically linked to this question.
Hi
I am implementing RTC in MSP430F5335. For that i have written my code to configure the clocks as follows
UCSCTL4 = 0x0044; // select ACLK source as XT1 clk UCSCTL6 = 0xC1CC; // XT1 on in bit 0 while(ucsctrl7 & 0x0002) { ucsctrl7 &= ~(0x0003); to clear XT1LFOFFG,DCOFFG sfrintflag &= ~(0x0002); to clear OFIFG } ucsctrl6 |= 0x00CC;
but after downloding my code in to the controller the RTCOFIFG is always set. At the same time OFIFG is set in SFRIFG1 register and XTLFOFIFG in UCSCTL7 also set. So that i can't able to run RTC.
I tried with the OFIFG interruptservice routine code to clear OFIFG. The code as follows
#pragma vector=UNMI_VECTOR __interrupt void UNMI_ISR(void) { volatile unsigned int i; do { UCSCTL7 &= ~(XT1LFOFFG + DCOFFG); // Clear XT1 & DCO fault flags SFRIFG1 &= ~OFIFG; // Clear OSC Fault flag //for (i = 0x0FFF; i > 0; i--); // Time for flag to set???? P1OUT ^= BIT0; // Toggle P1.0 }while ( (SFRIFG1 & OFIFG) );
but still the problem persists in my code. I have referred the discussion in the link
http://e2e.ti.com/support/microcontrollers/msp430/f/166/t/203270.aspx
As per that the backup power system LOCKBAK bit clear is applicable for MSP430F5335 also.
Could anyone clarify why the problem is occurs? Is there any reference available to LPM3 with RTC alrm implementation.
Thanks in advance.
I’m not 100% sure, but you might need to configure the SVS and the battery backup system properly, or the crystal won’t run.
p.s.: please use the bit definitions when configuring control registers or checking flags. Hex values are a pain to verify.
Thanks Jens,
Jens-Michael Gross said:I’m not 100% sure, but you might need to configure the SVS and the battery backup system properly
Is any sample codes available for that? Also, in my case the crystal is running sometimes but not all times. can you please give any clue to implement low power mode 3 with RTC alarm wakeup.
Thanks
Sorry, I don’t know about sample code. Doesn’t mean there is none. Check MSP430Ware.
If the crystal is only sometimes running, it may be related to the load capacitors. Check the crystal datasheet for the required load capacitance. Then check the settings you use (or the default settings if you don’t do any configuration). If they don’t match, the crystal may have problems starting or run instable or at a somewhat different frequency.
Also, entering LPM3 may stop the crystal, if it is only used to source SMCLK (which is off). I dimly remember someone noticing this on 5438A while on the 5438 non-A the crystal kept running with the same firmware.
Well, if the RTC is active, the crystal is in use and shouldn’t be disabled by LPM3.
**Attention** This is a public forum