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.

MSP430FR6922: Code is stuck in oscillator fault flag

Part Number: MSP430FR6922

Hello,

I use a MSP430FR6922 controller on  my board. I want to set ACLK as LFXTCLK=32.768kHz, MCLK=DCOCLK=16MHz,SMCLK=DCOCLK in my code. then SMCLK/4=4MHz...

My code is:-

#include "common.h"

/* Function to initialize device at internal crystal 16MHz and external 32.768khz*/
void dev_init_16M(void)
{
    PJSEL0 |= BIT4 | BIT5;                    // For XT1

    // Disable the GPIO power-on default high-impedance mode to activate
    // previously configured port settings
    PM5CTL0 &= ~LOCKLPM5;

    // Configure one FRAM wait state as required by the device data sheet for MCLK
    // operation beyond 8MHz _before_ configuring the clock system.
    FRCTL0 = FRCTLPW | NWAITS_1;

    // Clock System Setup
    CSCTL0_H = CSKEY >> 8;                    // Unlock CS registers
    CSCTL1 = DCOFSEL_4 | DCORSEL;            // Set DCO to 16MHz
    CSCTL2 = SELA__LFXTCLK | SELS__DCOCLK | SELM__DCOCLK; // Set SMCLK = MCLK = DCO=16Mhz,ACLK=LFXT=32.768kHZ
    CSCTL3 = DIVA__1 | DIVS__4 | DIVM__1;     // Set all dividers SMCLK/4=4MHz
    CSCTL4 &= ~LFXTOFF;
      do
      {
        CSCTL5 &= ~LFXTOFFG;                    // Clear XT1 fault flag
        SFRIFG1 &= ~OFIFG;
      }while (SFRIFG1&OFIFG);                   // Test oscillator fault flag

    // Now that osc is running enable fault interrupt
//    SFRIE1 |= OFIE;
//    __bis_SR_register(LPM0_bits);             // Wait in LPM0 for fault flag
    CSCTL0_H = 0;                             // Lock CS registers}
}

//
//#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
//{
//  do
//  {
//    // set a breakpoint on the line below to observe XT1 operating from VLO
//    // when the breakpoint is hit during a crystal fault
//    CSCTL5 &= ~LFXTOFFG;                    // Clear XT1 fault flag
//    SFRIFG1 &= ~OFIFG;
//    P1OUT |= BIT0;
//    __delay_cycles(25000);                  // time for flag to get set again
//  }while (SFRIFG1&OFIFG);                   // Test oscillator fault flag
//}

When I ran the code, I noticed that it was stuck at the last do-while loop, that checks for the oscillator fault flag.

What is the reason?? My code is wrong?? or it is because of hardware issue??

please help..its urgent

  • Hi Sayali,

    Your code looks fine - looks pretty much cut/paste from TI Resource Explorer examples, so this is good.

    Have you tried checking that the 32kHz crystal is actually oscillating?  Take an oscilloscope and look at the LFXTOUT pin.

    I don't have that specific part, but I can get one from that family and see if I get same issue.

  • Hi Sayali,

    It's been a few days since I have heard from you so I’m assuming you were able to resolve your issue.
    I will mark this posting as RESOLVED. If this isn’t the case, please click the "This did NOT resolve my issue" button and reply to this thread with more information.
    If this thread locks, please click the "Ask a related question" button and in the new thread describe the current status of your issue and any additional details you may have to assist us in helping to solve your issues.

**Attention** This is a public forum