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.

ACLK takes over?

Other Parts Discussed in Thread: MSP430G2553

Hello,

I am using the MSP430G2553 and I'm having trouble with the external crystal oscillator. It seems that whenever I set even the ACLK divider alone, my SMCLK immediately stops being sourced from DCO and instead becomes fed by the XT.

I set up a simple timer-based LED blinking program to visualize this issue. I am trying to blink the LED in 0.5 s intervals, with the timer being sourced from SMLCK, which in turn is supposed to be powered by DCO:

#define   COUNT 50
int counter=50;

void main(void)
{
  WDTCTL = WDTPW + WDTHOLD;
  
  if (CALBC1_1MHZ ==0xFF || CALDCO_1MHZ == 0xFF)                                     
  {  
    while(1);                               // If calibration constants erased
                                            // do not load, trap CPU!!
  }

  BCSCTL1 = CALBC1_1MHZ;                    // Set range
  DCOCTL = CALDCO_1MHZ;                     // Set DCO step + modulation */

  P1DIR |= 0x01;    //P1.0 - LED1

  BCSCTL2 = SELM_0 | DIVM_0 | DIVS_0;   //Master clock from DCO, MCLK/1, SMCLK/1
  BCSCTL2 &= ~SELS;                     //SMCLK from DCO

  TA0CTL = TASSEL_2 |MC_2 | ID_0 | TAIE;    // SMCLK, continuous mode up to 0xffff, div 1      
  TA0R=0xFFFF + 1 - 0x2710;      // 1 second

  __bis_SR_register(LPM1_bits + GIE);       // Enter LPM3 w/ int until Byte RXed
}

#pragma vector=TIMER0_A1_VECTOR
__interrupt void Timer_A1 (void)
{
switch( TA0IV )
 {   
   case  2: break;                          // CCR1 not used
   case  4: break;                          // CCR2 not used
   case 10: TA0R=0xFFFF + 1 - 0x2710;
            counter--; 
            if (counter == 0) {
              P1OUT ^= 0x01;
              counter = COUNT;
            }
            break;
 }
}

The above code runs just fine, toggling the LED at 0.5 s intervals.

However, if I insert the two following lines (even just the first one alone):

  BCSCTL1 = DIVA_0;                     //ACLK/1
  BCSCTL3 = LFXT1S_0 | XCAP_1; //enable LFXTAL

the intervals get significantly bigger, as if ACLK somehow forced itself as the timer source, even though it is still set to be SMCLK (DCO).

What is the way to have both DCO-sourced MCLK/SMCLK and XT-fed ACLK in one program?

**Attention** This is a public forum