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.

32kHz crystal and MSP430F2274

Other Parts Discussed in Thread: MSP430F2274, MSP-TS430DA38, MSP430F2232

Hello all,

 

I need some suggestions on how to get a stable clock from a 32kHz crsytal on MSP430F2274 using MSP-TS430DA38 target board. I am using the code as below:

The crystal I am using is a tuning fork crystal which requires a 12.5pf load. I am setting the internal cap. to be 10 pf.

#include "msp430x22x4.h"
int sec;
char one,two,three,four,five;
void send_data(int datas);
void main(void)
{
  WDTCTL = WDTPW + WDTHOLD;                 // Stop WDT
 
  BCSCTL1 = CALBC1_8MHZ;                    //BIT0 
  DCOCTL = CALDCO_8MHZ;
  BCSCTL2 |=0x40;                           // Set MCLK to 8 MHz and SMCLK to 8Mhz
  BCSCTL3 |= XCAP_2 + LFXT1S_0;
  P1DIR |= 0x01;                            // P1.0 output
  P2DIR |= BIT0;
  // Loop until 32kHz crystal stabilizes
  do
  {
    IFG1 &= ~OFIFG;                         // Clear oscillator fault flag
     __delay_cycles(500000000);             // Delay
  }
  while (IFG1 & OFIFG);                     // Test osc fault flag
  P2SEL |= BIT0;
                        

       //*******************************************************//
 
  TACCTL0 = CCIE;                           // TACCR0 interrupt enabled
  TACCR0 = 31250 - 1;
  TACTL = TASSEL_1 + MC_1;                  // ACLK, upmode

  __bis_SR_register(GIE);       // interrupt
  for(;;);
}

// Timer A0 interrupt service routine
#pragma vector=TIMERA0_VECTOR
__interrupt void Timer_A (void)
{
  P1OUT ^= 0x01;                            // Toggle P1.0
  sec++;
 }

 

I am routing the ACLK on one of the port pins. When i measure the frequency on that pin i get about 31.8kHz for some time and then it will drop to a very low frequency like 133 Hz or something close to it. So, I know that the crystal works for some time and then it fails.

Please advice on how to get a stable clock.

  • Hi,

    have you tried to change the XCAP setting to 1 (5.5pF)?

    For a crystal with 12.5pF load capacitance you usually use two 6pF caps. If you consider the parasitic on the board maybe even a smaller one.... 

    I assume that the target board you are using do not have an optimal layout for the crystal. That's mainly caused by the socket.

    I would try to reduce the selected cap (XCAP)....

  • Thanks for the reply,

    I will try to change the xcap value and see if it  works.

  • Have you resolved the problem yet?

    Unless you have a very poor pcb layout I would expect setting the load to 8.5pF or 11pF would be fine (values taken from the 22x2/22x4 datasheet).  I changed the load on my MSP430F2232 and measured the frequency for all 4 XCAP load settings.  I found the frequency changed by only a few Hertz between settings.  I'd be very surprised if changing the load causes the oscillator to become as unstable as you have described - if does appear to be the problem I'd be very interested to hear about it!!

  • Thank you for showing interest in my problem. I am using the target board provided by TI ( MSP TS430 DA38), so I think the layout should not be a problem.

    I am not sure what is the cause of sudden failure of the clock, I am trying to test the caps first and then will try something else. I know that the clock starts and is stable for about a minute or so then it wil drop down to about 133 Hz or in that range . And at that it does not have a 50 % duty cycle. I think the duty cycle drops down to 25 % or lower.(up time).

    BTW have not got a chance to work on it yet....

    Will try to do it tomorrow, and post the results here.

  • The problem has been resolved. It appears that the debugger was interfering with the crystal.

     I am not sure how and why it was doing that. I was using the USB to FET debugger and target board was powered from the debugger.

    At first it appeared that my Laptop’s touchpad was the problem. While having the debugger connected, whenever I ran the program the clock will start going and then as soon as I touched the touchpad it will drop dead. Then I just disconnected the debugger and powered the board using a battery pack. It didn’t had any problem after that and the clock was stable. So I think the debugger was the main source of trouble.

    Like Chris said, xcap values did not affected the stability of the clock and the frequency only changed by a few Hz.

      

**Attention** This is a public forum