我用的是430f5418,XIN和XOUT引脚接的外部晶振接是40KHz,可运行几小时就变成了32.768KHz,是不是外部晶振只能接32.768KHz?
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,XIN和XOUT引脚接的外部晶振接是40KHz,可运行几小时就变成了32.768KHz,是不是外部晶振只能接32.768KHz?
能否留个联系方式,比如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
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) );
}