为了浮点数运算买了块k60fx512的芯片,系统频率设置出来恰好是预设值的一半,颇为郁闷……
去飞思卡尔官方社区终于找到问题所在,原来是这类120/150M单片机多了个自动的二分频,着实让人无语。
另外,120/150M单片机的pll设置底层与K60D 100M系列有些不同,可参考官方源代码,貌似我不能上传附件啊,需要的话自行去这里下载KINETIS_120MHZ_SC吧:http://www.freescale.com/zh-Hans/webapp/sps/site/prod_summary.jsp?code=K60_120&nodeId=01624698C9DE2DDDAF&fpsp=1&tab=Design_Tools_Tab。
下面是来自https://community.freescale.com/thread/110760的相关说明:
I would check carefully the valid frequency ranges when using the K60/K70 120 or 150MHz FPU part since they are different to the K60 100M parts, for example.
Whereas the K60 100MHz part can divide the 50MHz clock first down to 2MHz (it needs 2MHz..4MHz) this is not in the valid frequency range for the K70 120MHz/150MHz, which requires it to be between 8 and 16MHz. The K70 120M/150M parts also have an extra divide at the output of their VCO.
To run the K70 120MHz part at its maximum 120MHz system speed and generate 48MHz for USB the typical method is to divide the 50MHz PHY clock by 5 to 10MHz. Then multiply this by 24 to get 240MHz VCO output frequency (must be between 180MHz and 360MHz). The VCO output is automatically divided by 2 to give a 120MHz system clock.
Using the MCGPLL0CLK as source to derive the USB clock it requires a divide value of 4 in the SIM's CLKDIV2 setting with fractional flag set. That is 0x00000009 -> 120MHz * 2/(5) = 48MHz.
Regards
Mark
|