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.

MSP430F2370 EXTERNAL CLOCK

Other Parts Discussed in Thread: MSP430F2370

I am trying to use a 16 MHz external clock on PIN 2 for the MSP430F2370 micro. Here is my init code:

// Set the 16 MHz oscillator as the input clock on XIN

BCSCTL1 &= ~(XT2OFF); // XT2 OSCILLATOR - clear the bit

BCSCTL1 |= XTS; // LFXT1 - High frequency mode

BCSCTL2 |= SELM_3 + SELS; // MCLK = LFXT1CLK, SCLK = LFXT1CLK,

BCSCTL3 = LFXT1S_3 + XCAP_0; // XT1 11 Digital external clock source on PIN 2

// SET PIN 8 AS SMCLK OUTPUT - P1.4

P1SEL |= 0x10; // SET primary peripheral function SMCK

P1DIR |= 0x10; // P1.4 output

 

I single step through the above code and I can see the BCSCTLx registers are set up according to the code above but I cannot see SMCLK on P1.4. I can see the 16 MHz clock on pin 2 as the input for XIN.

I am suspicious of MCLK running as well. I am using SPI to send some data and the SPI clock is missing. SPI is configured as master.

I am using CCSv5.

 

Can somebody help me figure out what is going on?

  • Hello Istvan,

    Some quick notes on your initialization:

    1) BCSCTL1 &= ~(XT2OFF); is unnecessary since XT2 is not available on the MSP430F2370.

    2)  Set BCSCTL3 after BCSCTL1, check the OSCFault flag, and then set BCSCTL2, like so:

      BCSCTL1 |= XTS;                           // LFXT1 - High frequency mode
      BCSCTL3 |= LFXT1S_3 + XCAP_0;             // XT1 11 Digital external clock source on PIN 2
    
      do
      {
        IFG1 &= ~OFIFG;                         // Clear OSCFault flag
        for (i = 0xFF; i > 0; i--);             // Time for flag to set
      }
      while (IFG1 & OFIFG);                     // OSCFault flag still set?
    
      BCSCTL2 |= SELM_3 + SELS;                 // MCLK = LFXT1CLK, SCLK = LFXT1CLK,

    Otherwise your implementation seems correct.  You should definitely be able to see SMCLK on P1.4, not being able to indicates an oscillator fault condition.  Please make the changes I outlined and let me know if while in the debugger your code gets stuck on the OSCFault loop.

    Regards, Ryan

  • Hi Istvan,

    Are you still having any problems with your external clock?

    Regards,
    Ryan

**Attention** This is a public forum