最近给stm32项目改个boot程序,忘记硬件上面,外部晶振被改变了。结果出现许多莫名其妙的问题。如:串口收发数据不准确等。
因为调试程序的时候没有想到是晶振的问题,浪费了很多时间,后来通过逻辑分析仪才发现的。仅以此作为记录,提醒自己以后注意。
程序:
修改点1:
/* In the following line adjust the value of External High Speed oscillator (HSE)
used in your application */
将 #define HSE_Value ((u32)8000000) /* Value of the External oscillator in Hz*/
改成 #define HSE_Value ((u32)12000000) /* Value of the External oscillator in Hz*/
修改点2:
RCC_Configuration里面将
RCC_PLLConfig(RCC_PLLSource_HSE_Div1, RCC_PLLMul_9);/////外部晶振启动、倍频9倍 即 8MHZ *9 = 72MHZ
改成RCC_PLLConfig(RCC_PLLSource_HSE_Div1, RCC_PLLMul_6);/////外部晶振启动、倍频6倍 即 12MHZ *6 = 72MHZ
修改点3:
MDK平台还需在Target标签下面设置 外接晶振参数 8MhZ----->12MHZ.
9630

被折叠的 条评论
为什么被折叠?



