时钟初始化是这样的:
芯片用的是MSP430F435IPM
void ClockInit(void)
{
uInt i;
// set load capacitance for 32k xtal
FLL_CTL0 |= XCAP18PF;
// clear bit = high freq xtal on
FLL_CTL1 = FLL_CTL1 & ~XT2OFF;
// test high freq oscillator fault flag
do // loop until flag is clear
{
FLL_CTL0 = FLL_CTL0 & ~XT2OF; // clear high freq oscillator fault flag
for (i = 50000; i; i--); // delay for crystal to start and FLL to lock
}
while (FLL_CTL0 & XT2OF); // test high freq oscillator fault flag
// switch MCLK SMCLK = HF xtal
FLL_CTL1=SELS+SELM_XT2;
P1DIR = 0x32; // P1.1, P1.4 & P1.5 to outputs
P1SEL = 0x32; // P1.1, P1.4 & P1.5 functions to output
}
我测量P1.4是32.768KHZ(肯定是正确的)
P1.5是4MHZ (肯定也是正确的)
P1.1是1MHZ (肯定是不正确的!!!!!)
观察FLL_CTL1的值为0x14,也就是说选择肯定是对的,为什么MCLK会工作在DCO上呢?
请大虾帮忙看看! |