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.

MSP430F5438A: External crystal problem

Part Number: MSP430F5438A


Hi,

#include <msp430.h>

int main(void)
{
WDTCTL = WDTPW + WDTHOLD; // Stop watchdog timer

P11DIR = BIT1+BIT2+BIT0; // P11.1-2 to output direction
P11SEL |= BIT1+BIT2+BIT0; // P11.1-2 to output SMCLK,MCLK
P5SEL |= 0x0C; // Port select XT2

UCSCTL6 &= ~XT2OFF;

UCSCTL3 |= SELREF_2; 

UCSCTL4 |= SELA_2;


do
{
UCSCTL7 &= ~(XT2OFFG + XT1LFOFFG + XT1HFOFFG + DCOFFG);

SFRIFG1 &= ~OFIFG;

}while (SFRIFG1&OFIFG);

UCSCTL6 &= ~XT2DRIVE0; 

UCSCTL4 |= SELS_5 + SELM_5; 

while(1); 
}

This is my code for set External crystal (XT2=12MHZ)  ,here i debug the code  the external crystal is perfectly work.

But switch off the board and on(reset) the Clock goes to 1MHZ .

What the reason for this one problem?

  • Hi Anburaja A,

    I suggest you move the following code after XT2 crystal clock established:

    P11DIR = BIT1+BIT2+BIT0; // P11.1-2 to output direction
    P11SEL |= BIT1+BIT2+BIT0; // P11.1-2 to output SMCLK,MCLK

    Meanwhile, if the problem exists, I suggest you set XT2 as FLL reference, the current code is set REFOCLK as reference.

    Best Regards

    Sal

**Attention** This is a public forum