|
msp5438用25M晶振起振出问题,求救,程序如下,这个程序可以起振8M的!
[复制链接]
void InitSysCLK25M() //使用外部时钟初始化时钟到14M以上
{
P5SEL |= 0x0C; // Port select XT2
UCSCTL6 &= ~XT2OFF; // Enable XT2
UCSCTL3 |= SELREF_2; // FLLref = REFO
// Since LFXT1 is not used,sourcing FLL with LFXT1 can cause
// XT1OFFG flag to
UCSCTL4 |= SELA_2; // ACLK=REFO,SMCLK=DCO,MCLK=DCO
// Loop until XT1,XT2 & DCO stabilizes
do
{
UCSCTL7 &= ~(XT2OFFG + XT1LFOFFG + XT1HFOFFG + DCOFFG);
// Clear XT2,XT1,DCO fault flags
SFRIFG1 &= ~OFIFG; // Clear fault flags
}while (SFRIFG1&OFIFG); // Test oscillator fault flag
UCSCTL6 |= XT2DRIVE0+XT2DRIVE1; // Decrease XT2 Drive according to
// XT2DRIVE0 (0x4000u) XT2DRIVE1 (0x8000u)
//00 4M~8M 01 8M~16M 10 16M~24M 11 24M~32M 现在选10,TI说是在16M内,奇怪了
UCSCTL4 |= SELS__XT2CLK + SELM__XT2CLK; // SMCLK=MCLK=XT2
}
|
|