我使用clk_switch例程修改的,始终都切换失败,总是卡死在Clk_SwitchTo(ClkXTH),用内部震荡是能工作的,但项目要求较高,需用外部晶振。
int32_t main(void)
{ volatile uint32_t u32Val = 0;
LED_init();
//RCH 22.12MHz
Clk_SwitchTo(ClkRCL);
Clk_SetRCHFreq(ClkFreq22_12Mhz);
Clk_SwitchTo(ClkRCH);
u32Val = Clk_GetHClkFreq();
LED_enable; //点灯
delay1ms(200);
LED_disable; //熄灯
delay1ms(1200);
//XTH
Clk_SwitchTo(ClkXTH);
u32Val = Clk_GetHClkFreq();
LED_enable; //点灯
delay1ms(1200);
LED_disable; //熄灯
while (1);
}
|