![](https://img-blog.csdnimg.cn/img_convert/259acc13e3a2bb765ce4b69436991cf1.png)
![](https://img-blog.csdnimg.cn/img_convert/50df6c647f2db7fd652422203f691362.png)
![](https://img-blog.csdnimg.cn/img_convert/52e3a34f347e82281d234aeb060c6135.png)
![](https://img-blog.csdnimg.cn/img_convert/4ae19b5d67854b2ea0d71df6a45d8b08.png)
![](https://img-blog.csdnimg.cn/img_convert/2803727c4ed988a984ff9a4d83ef0df8.png)
![](https://img-blog.csdnimg.cn/img_convert/ada3ae411f020a1ffe1a8f985c7f876f.png)
![](https://img-blog.csdnimg.cn/img_convert/c57a9880eaad1aae5040765cc349e690.png)
![](https://img-blog.csdnimg.cn/img_convert/dd3de17149c028444e25f70de0a81cfa.png)
红字是配置顺序
![](https://img-blog.csdnimg.cn/img_convert/41afc6307b69620c02c52a4636e2550d.png)
红字
![](https://img-blog.csdnimg.cn/img_convert/aaa94bd7c476002ea1d514dc886af555.png)
面试要求
代码部分↓
![](https://img-blog.csdnimg.cn/img_convert/5bd192405039e0c87cb68de9a5be0be6.png)
![](https://img-blog.csdnimg.cn/img_convert/f7725165ea584405b9c7acf78958e6fa.png)
![](https://img-blog.csdnimg.cn/img_convert/c1519dfbe5126b6d351f5de76f1ec43f.png)
![](https://img-blog.csdnimg.cn/img_convert/ac38f3f85940a0f685184503b73ae881.png)
配置时先选择好分频因子才能使能,使能后就不能再选分频因子
![](https://img-blog.csdnimg.cn/img_convert/b408c95d3dcef269ae403be1b269d8c1.png)
![](https://img-blog.csdnimg.cn/img_convert/2f827edb504494b578bdb459d02fad6c.png)
![](https://img-blog.csdnimg.cn/img_convert/1b5adb99910bf1fe6fc7c0eaa72f4723.png)
下面是从头写一遍的过程
![](https://img-blog.csdnimg.cn/img_convert/5b5b0544c94d7fb858197838c4b8b3b2.png)
新建
![](https://img-blog.csdnimg.cn/img_convert/3505d7ebfdf70cea7b515ef3db5f5fc7.png)
![](https://img-blog.csdnimg.cn/img_convert/e9107605b11127f93477e03f2548a5d6.png)
![](https://img-blog.csdnimg.cn/img_convert/0853263f9ebf8561550c909bf551778f.png)
![](https://img-blog.csdnimg.cn/img_convert/5d0f00e0707c7d2976731790413e2f22.png)
![](https://img-blog.csdnimg.cn/img_convert/e6bf3d6afb4ccad81c4493e08a9852f0.png)
![](https://img-blog.csdnimg.cn/img_convert/d3f1d62b22c658031886dd0dc19314b2.png)
漏说了StarUpCounter是超时时间,可要可不要
![](https://img-blog.csdnimg.cn/img_convert/ab7c32a6d40d574168a2713a8fd3786c.png)
不同频率选不同等待时间,等待时间就是下图的FLASH_ACR_LATENCY_x,72M是最高的稳定频率,实际最高是128M
![](https://img-blog.csdnimg.cn/img_convert/0b8f260baa5ec7000d55dad86f6111ed.png)
设置等待时间,设置分频因子
![](https://img-blog.csdnimg.cn/img_convert/8776b7942a79ca62227ddb832c2991f7.png)
![](https://img-blog.csdnimg.cn/img_convert/5fbc33166b9a1d7379bbe24cf8f709d0.png)
把c里写完的函数名放h里声明
![](https://img-blog.csdnimg.cn/img_convert/d3e5f8f69c0a6dabb00c03a0886b463f.png)
再到main里引用h
![](https://img-blog.csdnimg.cn/img_convert/bd2c32616b3182dcd46cab1f2eedf17b.png)
现象是底下的delay时间会随频率改变
下面是把时钟改为HSI,相差不大
![](https://img-blog.csdnimg.cn/img_convert/814ccf72775bc8f756e2fbaef44e5079.png)
![](https://img-blog.csdnimg.cn/img_convert/eda52568a8400708073058221bff49ad.png)
![](https://img-blog.csdnimg.cn/img_convert/4a8bc8c088ad2789ed1f5c5a9f29d301.png)
![](https://img-blog.csdnimg.cn/img_convert/84de0f0a43e969503da30b98d0ab9b7d.png)
使用HSI作为锁相环的来源(PLLMUL)必须经过二分频,这点区别于HSE
后面都不用改了