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.
Moderator Edit: this post has been split from the following thread: https://e2e.ti.com/support/microcontrollers/msp430/f/166/p/448828/1617520
Hello Jace H,
I am also getting a kind of issue with this i am getting continuously oscillator fault flag without enabling it.
RTCOFIE is zero though RTCOFIFG interrupt comes regularly and hence i can not get into ISR as it is at highest priority may i have any masking to make it zero.
Or any register configuration to clear this flag?
Thanks
Regards
Abhishek Parikh
Hi Abhishek,
Have you tried following one of the code examples from www.ti.com/tool/tidm-aux-module ?
-Katie
Hello @Jace H and Katie Pier ,
I have connected external AUXVCC3 and checked for output but result is same.
What can be the problem?
Infect I am going in its interrupt service routine but though value of RTCCTL0 remains as it is. Means I am receiving interrupt RTCOFIFG this flag doesn't goes off though I have gone to its isr.
I am really stuck at this point.. any one reply soon.
Thanks
Regards,
Abhishek Parikh
Hi Abhishek,
Do you have the datasheet for the crystal that you use? It should list a required capacitance - what does it say (do you have a link or could provide a screenshot?) You should also check that all guidelines in the document www.ti.com/lit/pdf/slaa322 are followed to make sure you have a robust crystal layout on your board - short, symmetric traces, guard ring, etc as noted in the document, as well as the caps being the correct value per the calculation for effective load capacitance to match what is specified in your crystal datasheet.
You can't always tell if you are having a crystal oscillator fault simply from looking at ACLK - this is because if ACLK fails I believe it will fall back to the REFO on this part that is also 32kHz (see www.ti.com/lit/pdf/slau208 section 5.2.12 UCS Module Fail-Safe Operation, where it says when a fault occurs for ACLK,
"If ACLKis sourced from XT1 in LF mode, an oscillator fault causes ACLK to be automatically switched to the REFO for its clock source (REFOCLK)".
To check if your crystal is having issues, you could enable the NMI for OFIFG and make an interrupt service routine. If you are going to this ISR, you will know that you are having an unstable crystal. You could try simply running this code example (if you use external caps, please comment out the line that sets XCAP_3):
/* --COPYRIGHT--,BSD_EX * Copyright (c) 2013, Texas Instruments Incorporated * All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions * are met: * * * Redistributions of source code must retain the above copyright * notice, this list of conditions and the following disclaimer. * * * Redistributions in binary form must reproduce the above copyright * notice, this list of conditions and the following disclaimer in the * documentation and/or other materials provided with the distribution. * * * Neither the name of Texas Instruments Incorporated nor the names of * its contributors may be used to endorse or promote products derived * from this software without specific prior written permission. * * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; * OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR * OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, * EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. * ******************************************************************************* * * MSP430 CODE EXAMPLE DISCLAIMER * * MSP430 code examples are self-contained low-level programs that typically * demonstrate a single peripheral function or device feature in a highly * concise manner. For this the code may rely on the device's power-on default * register values and settings such as the clock configuration and care must * be taken when combining code from several examples to avoid potential side * effects. Also see www.ti.com/grace for a GUI- and www.ti.com/msp430ware * for an API functional library-approach to peripheral configuration. * * --/COPYRIGHT--*/ //****************************************************************************** // MSP430F67791A Demo - LFXT1 Oscillator Fault Detection // // Description: System runs normally in LPM3 with basic timer clocked by // 32kHz ACLK with a 1 second interrupt. P1.0 is normally toggled every // 1 second inside basic timer interrupt. If an LFXT1 oscillator fault occurs, // NMI is requested forcing exit from LPM3. P1.0 is toggled rapidly by // software as long as LFXT1 oscillator fault is present. Assumed only // LFXT1 as NMI source - code does not check for other NMI sources. // ACLK = LFXT1 = 32768Hz, MCLK = SMCLK = default DCO = 32 x ACLK = 1048576Hz // //* An external watch crystal between XIN & XOUT is required for ACLK *// // // // MSP430F67791A // ----------------- // /|\ | XIN|- // | | | 32kHz // ---|RST XOUT|- // | | // | P1.0|-->LED // // E. Chen // Texas Instruments Inc. // January 2014 // Built with CCS Version: 5.5.0 and IAR Embedded Workbench Version: 5.52 //****************************************************************************** #include <msp430.h> void main(void) { WDTCTL = WDTPW | WDTHOLD; // Stop WDT // Setup P1.0 output P1DIR |= BIT0; // Set P1.0 to output direction P1OUT &= ~BIT0; // Clear P1.0 // Set up XT1 UCSCTL6 &= ~(XT1OFF); // XT1 On UCSCTL6 |= XCAP_3; // Internal load cap // Setup RTC RTCCTL0_H = RTCKEY_H; // Unlock RTC_C module RTCCTL1 = RTCTEV_3; // Time event every day at noon RTCPS0CTL = RT0IP_7; // Set RT0IP to /256 RTCPS1CTL = RT1IP_6 | RT1PSIE; // Set RT1IP to /4 // Enable RT1PS interrupt // Setup SFR SFRIE1 = OFIE; // Enable oscillator fault interrupt __bis_SR_register(LPM3_bits | GIE); // Enter LPM3 w/ interrupts __no_operation(); // For debugger } // RTC Interrupt Service Routine #if defined(__TI_COMPILER_VERSION__) || defined(__IAR_SYSTEMS_ICC__) #pragma vector=RTC_VECTOR __interrupt void RTC_ISR(void) #elif defined(__GNUC__) void __attribute__ ((interrupt(RTC_VECTOR))) RTC_ISR (void) #else #error Compiler not supported! #endif { P1OUT ^= 0x01; // Toggle P1.0 RTCCTL0 &= ~RTCTEVIFG; RTCPS1CTL &= ~RT1PSIFG; } // UNMI Interrupt Service Routine #if defined(__TI_COMPILER_VERSION__) || defined(__IAR_SYSTEMS_ICC__) #pragma vector=UNMI_VECTOR __interrupt void UNMI_ISR(void) #elif defined(__GNUC__) void __attribute__ ((interrupt(UNMI_VECTOR))) UNMI_ISR (void) #else #error Compiler not supported! #endif { // Loop until XT1 & DCO fault flag is cleared do { UCSCTL7 &= ~(XT1LFOFFG | DCOFFG); // Clear XT1 & DCO fault flags SFRIFG1 &= ~OFIFG; // Clear OSC Fault flag __delay_cycles(0xFFFF); // Time for flag to set P1OUT ^= BIT0; // Toggle P1.0 } while (SFRIFG1 & OFIFG); // Test oscillator fault flag }
Regards,
Katie
Hello Katie Pier (1555997) ,
Thanks for your continuous support.
Well when i run that code it is not going into ISR of RTC but going into ISR of UNMI.
And here is my schematic
Thank you
Regards
Abhishek Parikh
ABHISHEK PARIKH said:Well when i run that code it is not going into ISR of RTC but going into ISR of UNMI.
Hi Abhishek,
If it is going always into the UNMI ISR that means that you are seeing a crystal fault that is not clearing, so this is where we should probably focus. So was it going into the UNMI ISR even with no caps connected, since that code example sets XCAP = 3 (12pF)? Your schematic shows 2 12pF caps for the crystal, which is incorrect. Per the calculation in www.ti.com/lit/pdf/slaa322 for the capacitors, you need effective load capacitance around 12pF which means you need to use 22pF on both XIN and XOUT if you use external caps (alternately remove all external caps and just use the internal XCAP_3 setting). The app note also explains how you can perform a test on your crystal design for stability - see the section on the oscillation allowance test. You want to see if your crystal design has a good safety margin to ensure it is stable, because right now you are going to the UNMI ISR which makes it sound like your crystal is not stable.
If you look in the design guide for the TIDM-AUX-MODULE TI Design, http://www.ti.com/lit/pdf/tidu452 Table 3 has a set of code example descriptions. Which scenario best matches what you are trying to implement? - would it be maybe MSP430F6779_AUX_05.c or MSP430F6779_06.c - both of those have AUXVCC3 only being used (no use for AUXVCC1 or 2) and only power the RTC off of AUXVCC3. The difference between the two is whether you want the RTC to always be powered from the battery, or have the RTC powered from DVCC when it is available.
Regards,
Katie
No I believe that the 32kHz crystal is the only source for the RTC_C module. In addition, if you want an accurate real-time clock it needs the accuracy that a crystal provides.
Since it does sound like you've narrowed it down to the crystal stability as the root cause, the next steps will be to diagnose the issues with the crystal circuit. Because you seem to have tried the correct load caps, the issue may be related instead to layout requiring you to do a new spin of your board. The application note www.ti.com/lit/pdf/slaa322 provides information on how to test the stability of your crystal (oscillation allowance/safety factor tests) as well as providing a lot of detailed information about what things to watch out for in crystal layout and all precautions to take for a good crystal layout. You could also see if using a higher drive strength setting in your software helps as well.
Would you have a TI target socket board for this device that you could run code on in the meantime, and use as a comparison?
Regards,
Katie
Hello Jace H,
I don't have any line crossing at Xtal underside my pcb.
I had tried MSPWARE code MSP430F6779_AUX_05.c , MSP430F6779_AUX_06.c and msp430f677xA_of_lfxt_1nmi.c month ago when Katie pier said me to do so.
When I run that code it is not going into ISR of RTC but going into ISR of UNMI.
I have tried again but it is giving me same type of problem.
Regards
Abhishek Parikh
**Attention** This is a public forum