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.

430f5418外部晶振接

Other Parts Discussed in Thread: MSP430F5438

我用的是430f5418,XIN和XOUT引脚接的外部晶振接是40KHz,可运行几小时就变成了32.768KHz,是不是外部晶振只能接32.768KHz?

  • 您好,

    不知道您是怎么测试的?是直接用示波器打的晶振?还是通过将ACLK通过17引脚输出测试?OFIFG的值是多少?

  • 用示波器测过晶振引脚和ACLK输出引脚始终是40KHz,但我在示波器上看定时器时间推下来频率从40KHz最后就成了32.768KHz。OFIFG的值应该是0不然晶振就初始化不过去。

  • 用示波器测过晶振引脚和ACLK输出引脚始终是40KHz,但我在示波器上看定时器时间推下来频率从40KHz最后就成了32.768KHz。OFIFG的值应该是0不然晶振就初始化不过去

  • rong xiao您好,

    那估计与你的外部晶振没有关系。默认情况下ACLK是由XT1LF驱动的。

    Timer的时钟信号是哪个?5418内部有REFOCLK,它的频率是32768Hz。

    能否将初始化代码贴上来,大家一起讨论?

  • 能否留个联系方式,比如QQ。

    ///////////////初始化晶振////////////////////////////////

    UCSCTL6 &= ~XT1DRIVE_3;                   // Lowest drive strength

     UCSCTL6 |= XCAP_3 ;                       // Internal load cap    

     UCSCTL4  |= SELA__XT1CLK;  

    while ( (SFRIFG1 &OFIFG))

     {    

       UCSCTL7 &= ~(XT1LFOFFG + DCOFFG);

       SFRIFG1 &= ~OFIFG;

     }  

     UCSCTL0 = 0x00;                           // Set lowest possible DCOx, MODx

     UCSCTL1 = DCORSEL_7;

     UCSCTL2 =449;                          

     UCSCTL4 = SELS_3 + SELM_3;

    TimerA 1s中断一次和TimerB 0.5ms中断一次,时钟信号都是ACLK,是不是中断冲突了?

  • 能简单描述一下你的时钟初配置吗?同时TI有关于5系列430的UCS模块的驱动库,在编程时可以使用驱动库。链接如下:www.ti.com.cn/.../litabsmultiplefilelist.tsp

  • 40K变成32.768K应该是系统检测到外部晶体失效,自动切到内部的32.768时钟上去了。

    同意楼上的说法,用TI的标准库,先排除软件设置问题。

  • 9494,我软件已经关DCOFFG了,后面又置1了,我怎么才能关掉DCOFFG?

  • 您好,

    将40KHz的晶体换成32.768KHz的晶体。

  • 不行,我们外部必须用40KHz的,在软件了我怎么才能关掉DCOFFG??

  • 不行,我们外部必须用40KHz的,在软件里我怎么才能关掉DCOFFG??

  • 40Khz crystal 是能够支持的.

    有些糊涂了。

    DCOFFG是指DCO=0 或者31,同样会让OFIFG置位。

    但DCOFFG不会影响XT1的。如果是DCOFFG出现,那就是另外一个问题了。

    你指的是XT1LFOFFG?

    我看你的代码MCLK=18M,TACLK=TBCLK=ACLK?

    你用下面的代码测试下,看看是什么结果?

    //******************************************************************************

    //  MSP430F54x Demo - LFXT1 Oscillator Fault Detection

    //

    //  Description: System runs normally in LPM3 with with basic timer clocked by

    //  32kHz ACLK with a 1 second interrupt. P1.0 is normally toggled every

    //  1 second inside basic timer interrupt. If an LFXT1 oscillator fault occurs,

    //  NMI is requested forcing exit from LPM3. P1.0 is toggled rapidly by

    //  software as long as LFXT1 oscillator fault is present. Assuumed only

    //  LFXT1 as NMI source - code does not check for other NMI sources.

    //  ACLK = LFXT1 = 32768Hz, MCLK = SMCLK = default DCO = 32 x ACLK = 1048576Hz

    //  //* An external watch crystal between XIN & XOUT is required for ACLK *//

    //

    //

    //           MSP430F5438

    //         -----------------

    //    /|\ |              XIN|-

    //     |  |                 | 32kHz

    //     ---|RST          XOUT|-

    //        |                 |

    //        |             P1.0|-->LED

    //

    //   M Smertneck / M. Mitchell / W. Goh

    //   Texas Instruments Inc.

    //   September 2008

    //   Built with CCE Version: 3.2.2 and IAR Embedded Workbench Version: 4.11B

    //******************************************************************************

    #include "msp430x54x.h"

    volatile unsigned int i;

    void main(void)

    {

     WDTCTL = WDTPW + WDTHOLD;                 // Stop WDT

     // Set up XT1

     P7SEL |= 0x03;                            // Analog function for XT1 Pins

     UCSCTL6 &= ~(XT1OFF);                     // XT1 On

     UCSCTL6 |= XCAP_3;                        // Internal load cap

     P1DIR |= BIT0;                            // P1.0 output

     RTCCTL01 = RTCTEV_3;

     RTCPS0CTL = RT0PSDIV_7;                   // Set RTPS0 to /256

     RTCPS1CTL = RT1IP_6 + RT1PSIE + RT1SSEL_3;// Set RT1IP to /4, enable

                                               // RT1PS interrupt and select

                                               // RTOPS output as clock

     SFRIE1 = OFIE;                            // Enable osc fault interrupt

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

     __no_operation();                         // For debugger

    }

    // RTC Interrupt Service Routine

    #pragma vector=RTC_VECTOR

    __interrupt void RTC_ISR(void)

    {

     P1OUT ^= 0x01;                            // Toggle P1.0

     RTCCTL01 &= ~RTCTEVIFG;

     RTCPS1CTL &= ~RT1PSIFG;

    }

    #pragma vector=UNMI_VECTOR

    __interrupt void UNMI_ISR(void)

    {

     do

     {

       UCSCTL7 &= ~(XT1LFOFFG + DCOFFG);       // Clear XT1 & DCO fault flags

       SFRIFG1 &= ~OFIFG;                      // Clear OSC Fault flag

       for (i = 0xFFFF; i > 0; i--);           // Time for flag to set

       P1OUT ^= BIT0;                          // Toggle P1.0 using exclusive-OR

     }while ( (SFRIFG1 & OFIFG) );

    }