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.

MSP430F2417配置时钟时发生复位

Other Parts Discussed in Thread: MSP430F2417

MSP430F2417 XT2连接一个外部的8M晶振,代码如下:

/* Stop the watchdog. */
WDTCTL = WDTPW + WDTHOLD;

/* Stop the XT1 */
SetOSCOFF();

/* switch on XT2 */
BCSCTL1 &= ~XT2OFF; //启动XT2高速时钟模块
BCSCTL2 |= SELM1; //MCLK主时钟选XT2为时钟源.TX2输入不分频.
BCSCTL3 |= XT2S1;

/* waiting for XT2 to operate */
do
{
IFG1 &= ~OFIFG;
for ( delay = 0xFF; delay > 0; delay-- );
}
while ((IFG1 & OFIFG) != 0);

/* select internal clock as ACLK and divider for 1(12k) */
BCSCTL3 |= LFXT1S_2;

/* select XT2 as SMCLK and divider for 2(8M) */
BCSCTL2 |= SELS;

程序运行到 SetOSCOFF()发生复位,SetOSCOFF()是汇编代码,如下:

SetOSCOFF
                       bis.w #0x20, SR
                       RET

如果把SetOSCOFF屏蔽掉,程序就一直停在等待XT2运行的代码里面,如下

/* waiting for XT2 to operate */
do
{
IFG1 &= ~OFIFG; 
for ( delay = 0xFF; delay > 0; delay-- );
}
while ((IFG1 & OFIFG) != 0);
请帮忙分析一下什么问题,谢谢。