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.

external quartz not working

Hi to everybody,

I'm new at this forum, but I need to ask a question because I repeatedly tried to use the external crystal (32 KHz)  for ACLK with no results. 

I have a MSP430  F2272.

The strange thing is that at the beginning the  OFIFG is set (and this is ok), than I unset it at the beginning, 

but when the program is in execution, there is no OFIFG and also LFXT1OF and XT2OF are both unset, but ACLK not work. 

I settled the clock system with this code:

        __bis_SR_register(OSCOFF);	 //turn off the LF oscillator so the OFIFG does not fault 
        do 
        {
          IFG1 &= ~OFIFG;                           // Clear OSCFault flag 
          __delay_cycles(1000);
        } 
        while ((IFG1 & OFIFG));                   // OSCFault flag still set? 
  
        if (CALBC1_1MHZ==0xFF)		// If calibration constant erased	
	{											
		while(1);                               // do not load, trap CPU!!	
	}
	// Setting MCLK = 1MHz
	DCOCTL = 0;                               // Select lowest DCOx and MODx settings
	BCSCTL1 = CALBC1_1MHZ|DIVA_3;      // Set DCO to 1MHz
	DCOCTL = CALDCO_1MHZ;
        BCSCTL1 &= ~XTS;

	// Setting SMCLK = 1MHz
	BCSCTL2 &= ~SELS;                         // SMCLK 1 Mhz
        
        //IFG1 &= ~OFIFG; //CLR OSCILLATOR FAULT

	// Setting ACLK with source of XTAL = 32kHz and divided by 8.
	// Setting ACLK at 4096 Hz
	BCSCTL3 &= ~LFXT1S0+XCAP0+XCAP1;

  • Result of this line most probably is not what you expect:

    BCSCTL3 &= ~LFXT1S0+XCAP0+XCAP1;

    If in doubt, you can check it in debugger. Most probably you did mean something like this:

    BCSCTL3 &= ~(LFXT1S0 | XCAP0 | XCAP1);

    or

    BCSCTL3 &= ~LFXT1S0;

    BCSCTL3 |= XCAP0 | XCAP1;

**Attention** This is a public forum