求教:MSP430F5638XT132k晶振不起振
代码如下:void System_Clock_Init(void)
{
/*UCSCTL6设置*/
//XT2BYPASS=0:XT2不被旁路
//XT2OFF=1:XT2如果不用作ACLK、SMCLK或MCLK则关闭
//XTS=0:XT1低频模式
//XCAPx=3:设置XT1内部负载电容
//SMCLKOFF=0:SMCLK工作
//XT1OFF=0:XT1打开
UCSCTL6=XT2OFF+XCAP_3;
/*UCSCTL3设置*/
//SELREFx=0:FLLref=XT1CLK
//FLLREFDIVx=0:FLLREFDIV=1
UCSCTL3=SELREF_0+FLLREFDIV_0;
/*UCSCTL4设置*/
//SELAx=0:ACLK=XT1CLK
//SELSx=3:SMCLK=DCOCLK
//SELMx=3:MCLK=DCOCLK
UCSCTL4=SELA_0+SELS_3+SELM_3;
//关闭FLL控制回路
MSP430_FLL_OFF();
/*UCSCTL0设置*/
//UCSCTL0默认值不变
UCSCTL0=0x0000;
/*UCSCTL1设置*/
//DCOx=7:设置DCO振荡范围
//DISMOD=0设:允许Modulation
UCSCTL1=DCORSEL_7;
/*UCSCTL2设置*/
//Fdcoclkdiv=(FLLN+1)×FLLRef/FLLD=(602+1)×32768/1=19 759 104Hz
UCSCTL2=FLLD_0+UCS_FLL_Factor;
//UCSCTL2=FLLD__1+UCS_FLL_Factor;
/*UCSCTL5设置*/
//UCSCTL5默认值不变:ACLK输出不分频、ACLK不分频、SMCLK不分频、MCLK不分频
UCSCTL5=DIVPA_0+DIVA_0+DIVS_0+DIVM_0;
//打开FLL控制回路
MSP430_FLL_ON();
MSP430_Delay_Cycles(1024000);
/*循环直至XT1、XT2、DCO稳定*/
do
{
UCSCTL7&=~(XT2OFFG+XT1LFOFFG+XT1HFOFFG+DCOFFG);
SFRIFG1&=~OFIFG;
}
while(SFRIFG1&OFIFG);
}
调试时观察寄存器UCSCTL7,其中XT1LFOFFG始终为1,不变为0,请教高手是什么问题? XT1用到的IO口要SEL置位吧
页:
[1]