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.

MSP430F5171: 32KHz crystal

Part Number: MSP430F5171

My circuit works faithfully with its internal REFO of 32Khz, from wich i obtain a clock of 24.576Mhz.

I've seen that internal 32K reference has a precision of 1.5% and it is too much for a particular application.

Using a higher frequency crystal as external reference(for ex. 24.576MHz) is not advisable for its power consumption, so i'm planning

to use a 32KHz chrystal. I think that i need only to change the input to FLL:

 UCSCTL3 = SELREF_2;          to    XT1CLK       

set XCAP and leave all as it is.

Is that correct?    

  

  • Starting up a crystal is more complex than that (you have to check and clear the oscillator fault flag in a loop); see the example programs for details.

    What exactly do you need a precise clock for?
  • Exuse me for my poor explanation; in fact now i'm doing this:
    SetVcoreUp (0x01);
    SetVcoreUp (0x02);
    SetVcoreUp (0x03);

    // configure clocks
    UCSCTL3 = SELREF_2; // Set DCO FLL reference = REFO
    UCSCTL4 |= SELA_2; // Set ACLK = REFO error +/- 1.5%

    __bis_SR_register(SCG0); // Disable the FLL control loop
    UCSCTL0 = 0x0000; // Set lowest possible DCOx, MODx
    UCSCTL1 = DCORSEL_7; // Select DCO range 50MHz operation
    UCSCTL2 = FLLD_1 + 749; // Set DCO Multiplier for 24.576MHz
    // (N + 1) * FLLRef = Fdco
    // (749 + 1) * 32768 = 24.576MHzMHz
    // Set FLL Div = fDCOCLK/2
    __bic_SR_register(SCG0); // re-enable the FLL control loop

    // Worst-case settling time for the DCO when the DCO range bits have been
    // changed is n x 32 x 32 x f_MCLK / f_FLL_reference. See UCS chapter in 5xx
    // UG for optimization.
    // 32 x 32 x 24 MHz / 32,768 Hz = 750000 = MCLK cycles for DCO to settle
    __delay_cycles(782000);

    //for(i=0; i<100000; i++);;

    // Loop until XT1 fault flag is cleared
    do
    {
    UCSCTL7 &= ~(XT1LFOFFG + XT1HFOFFG+ DCOFFG);
    // Clear XT1,DCO fault flags
    SFRIFG1 &= ~OFIFG; // Clear fault flags
    }while (SFRIFG1&OFIFG); // Test oscillator fault flag

    to get the 24.576MHz frequency

**Attention** This is a public forum