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.

Problems selecting MCLK source with a MSP430F2619T

Other Parts Discussed in Thread: MSP430F2618

Hi folks,

I've got a problem selecting VLOCLK or LFXT1CLK as source for MCLK. Selecting VLOCLK and LFXT1CLK for ACLK works just fine, but as soon as i select them for MCLK, the msp430 uses the DCO. I also tried to turn the DCO off, but then it also didn't use the selected source, as proposed in  the thread "Can MSP430F2618 LFXT1 use 16MHz crystal for MCLK?"  but I didn't worked out so far. Hope someone can help me here.

#include "msp430x26x.h"

void main(void)
{
    volatile unsigned int i;
    WDTCTL = WDTPW + WDTHOLD;

    BCSCTL1 = XT2OFF + XTS+RSEL0+RSEL1+RSEL2+DIVA_0;

    BCSCTL3 = LFXT1S_3 + XCAP_0;

//    BCSCTL1=XT2OFF+XTS+RSEL0+RSEL1+RSEL2+DIVA_0;

//      BCSCTL3=LFXT1S_2+XCAP_0;

     // Wait for xtal to stabilize
          do
          {
          IFG1 &= ~OFIFG;                           // Clear OSCFault flag
          __bis_SR_register(SCG1 + SCG0);  //Disable DCO
          for (i = 0x47FF; i > 0; i--);             // Time for flag to set
          }
          while ((IFG1 & OFIFG));                   // OSCFault flag still set?

          BCSCTL2 |= SELM_2;

    // PORT INIT
    P1DIR = 0xFF;                             // All P1.x outputs
    P2DIR = 0xFF;                             // All P2.x outputs
    P3DIR = 0xFF;                             // All P3.x outputs
    P4DIR = 0xFF;                             // All P4.x outputs
    //P5DIR = 0xFF;                             // All P5.x outputs
    P5DIR |= 0x78;                            // P5.6,5,4,3 outputs
    P5SEL |= 0x70;                            // P5.6,5,4 options
    P6DIR = 0xFF;                             // All P6.x outputs

    P1OUT = 0x00;                                // All P1.x reset
    P2OUT = 0x00;                                // All P2.x reset
    P3OUT = 0x00;                                // All P3.x reset
    P4OUT = 0x00;                                // All P4.x reset

    P6OUT = 0x00;                                // All P6.x reset


  while(1)
  {
      P1OUT = 0x00;
      P1OUT = 0x01;

   // __bis_SR_register(LPM4_bits + GIE);     // Enter LPM3, enable interrupts

  }
}


  • Sven D said:
              do
              {
              IFG1 &= ~OFIFG;                           // Clear OSCFault flag
              __bis_SR_register(SCG1 + SCG0);  //Disable DCO
              for (i = 0x47FF; i > 0; i--);             // Time for flag to set
              }
              while ((IFG1 & OFIFG));                   // OSCFault flag still set?

              BCSCTL2 |= SELM_2;

    You cannot switch the DCO off if MCLK is still configured to it. In your code, you try to switch the DCO off, and at the end switch MCLK to VLO. That won't work in this order

    Also, SELM_2 only switches to VLOCLK if the chip does not have an XT2 circuitry. "XT2 oscillator not present on chip" means the oscillator electronics, not the absence of a crystal on XT2. (I don't have the 2619 datasheet at thand to confirm whether it has or not.)

    Then:

    settign XTS bit turns XT1 into HF mode. Which disables the fallback of XT1 to VLO when no LF crystal is attached. This also means that MCLK, when switched to LFXT1, won't get VLOCLK, but will fallback again to DCO.

    SCG1+SCG0 inside the waiting loop won't help, The two bits, once set, won't be celared automatically (except if inside an ISR). So you can set them before the loop. However, if oyu have an oscillator fault on XT1 (which you have, if there is no HF crystal), the loop will never exit.

**Attention** This is a public forum