HC32F460时钟系统简介
<h2 style="text-align:justify"><span style="font-size:16pt"><span style="173%"><span style="font-family:"等线 Light""><span style="font-family:宋体">概述 </span></span></span></span></h2><p style="text-indent:21.0pt; text-align:justify"><span style="font-size:10.5pt"><span style="font-family:等线"><span class="fontstyle21" style="font-family:宋体"><span style="color:black"><span style="font-weight:normal"><span style="font-style:normal"><span style="font-size:12.0pt">目前只是调试了 GPIO 和 UART,感觉很有必要把时钟这部分补充说明一下,之前的文章中提到 GPIO 口没有时钟的门控时钟,之前大学玩 ST 单片机时候,那个 GPIO 的端口初始化是需要使能 GPIO_PORT 的时钟,然后才是相应外设功能时钟的初始化。 </span></span></span></span></span></span></span></p>
<p style="text-indent:21.0pt; text-align:justify"><span style="font-size:10.5pt"><span style="font-family:等线"><span class="fontstyle21" style="font-family:宋体"><span style="color:black"><span style="font-weight:normal"><span style="font-style:normal"><span style="font-size:12.0pt">在 HC32 中的 GPIO_PORT 没有相应的门控时钟,有的是寄存器的写保护。外设功能部分是有的,在 PWR 寄存器的功能时钟控制 PWR_FCG0、PWR_FCG1、PWR_FCG2、PWR_FCG3,详细部分请查看用户手册,这里不一一叙述。</span></span></span></span></span></span></span></p>
<h2 style="text-align:justify"><span style="font-size:16pt"><span style="173%"><span style="font-family:"等线 Light"">时钟源</span></span></span></h2>
<h3 style="text-align:justify"><span style="font-size:14pt"><span style="173%"><span style="font-family:等线">系统时钟源(6个)</span></span></span></h3>
<p style="text-indent:21.0pt; text-align:justify"><span style="font-size:10.5pt"><span style="font-family:等线"><span class="fontstyle21" style="font-family:宋体"><span style="color:black"><span style="font-weight:normal"><span style="font-style:normal"><span lang="EN-US" style="font-size:12.0pt">HC32 </span></span></span></span></span><span class="fontstyle21" style="font-family:宋体"><span style="color:black"><span style="font-weight:normal"><span style="font-style:normal"><span style="font-size:12.0pt">的系统时钟源有 6 个,分别是下列六个(关于时钟的详细介绍在数据手册和用户手册中有讲解)。</span></span></span></span></span><span class="fontstyle21" style="font-family:宋体"><span style="color:black"><span style="font-weight:normal"><span style="font-style:normal"><span style="font-size:12.0pt"><span style="color:red">外部高速时钟源</span></span></span></span></span></span><span class="fontstyle21" style="font-family:宋体"><span style="color:black"><span style="font-weight:normal"><span style="font-style:normal"><span style="font-size:12.0pt">的选择范围是 4-24 MHz,低速的老样子是 32.768KHz。其中 MPLL 的</span></span></span></span></span><span class="fontstyle21" style="font-family:宋体"><span style="color:black"><span style="font-weight:normal"><span style="font-style:normal"><span style="font-size:12.0pt"><span style="color:red">输入时钟</span></span></span></span></span></span><span class="fontstyle21" style="font-family:宋体"><span style="color:black"><span style="font-weight:normal"><span style="font-style:normal"><span style="font-size:12.0pt">为</span></span></span></span></span><span class="fontstyle21" style="font-family:宋体"><span style="color:black"><span style="font-weight:normal"><span style="font-style:normal"><span style="font-size:12.0pt"><span style="color:red">外部高速时钟 / 内部高速时钟</span></span></span></span></span></span><span class="fontstyle21" style="font-family:宋体"><span style="color:black"><span style="font-weight:normal"><span style="font-style:normal"><span style="font-size:12.0pt">。PLL (倍频器)由下面章节中时钟系统框图所示,可以了解到UPLL 和MPLL的时钟输入源为内部高速时钟和外部高速时钟,由PLL_PLLCFGR 寄存器中的PLLSRC 位控制MPLL UPLL 的输入时钟选择。</span></span></span></span></span></span></span></p>
<p style="text-align:justify"><span style="font-size:10.5pt"><span style="font-family:等线"><span class="fontstyle01" style="font-family:TimesNewRomanPSMT,serif"><span style="color:black"><span style="font-weight:normal"><span style="font-style:normal"><span lang="EN-US" style="font-size:12.0pt"><span style="font-family:宋体">1) </span></span></span></span></span></span><span class="fontstyle21" style="font-family:宋体"><span style="color:black"><span style="font-weight:normal"><span style="font-style:normal"><span style="font-size:12.0pt">外部高速振荡器(</span></span></span></span></span><span class="fontstyle01" style="font-family:TimesNewRomanPSMT,serif"><span style="color:black"><span style="font-weight:normal"><span style="font-style:normal"><span lang="EN-US" style="font-size:12.0pt"><span style="font-family:宋体">XTAL</span></span></span></span></span></span><span class="fontstyle21" style="font-family:宋体"><span style="color:black"><span style="font-weight:normal"><span style="font-style:normal"><span style="font-size:12.0pt">)</span></span></span></span></span></span></span></p>
<p style="text-align:justify"><span style="font-size:10.5pt"><span style="font-family:等线"><span class="fontstyle01" style="font-family:TimesNewRomanPSMT,serif"><span style="color:black"><span style="font-weight:normal"><span style="font-style:normal"><span lang="EN-US" style="font-size:12.0pt"><span style="font-family:宋体">2) </span></span></span></span></span></span><span class="fontstyle21" style="font-family:宋体"><span style="color:black"><span style="font-weight:normal"><span style="font-style:normal"><span style="font-size:12.0pt">外部低速振荡器(</span></span></span></span></span><span class="fontstyle01" style="font-family:TimesNewRomanPSMT,serif"><span style="color:black"><span style="font-weight:normal"><span style="font-style:normal"><span lang="EN-US" style="font-size:12.0pt"><span style="font-family:宋体">XTAL32</span></span></span></span></span></span><span class="fontstyle21" style="font-family:宋体"><span style="color:black"><span style="font-weight:normal"><span style="font-style:normal"><span style="font-size:12.0pt">)</span></span></span></span></span></span></span></p>
<p style="text-align:justify"><span style="font-size:10.5pt"><span style="font-family:等线"><span class="fontstyle01" style="font-family:TimesNewRomanPSMT,serif"><span style="color:black"><span style="font-weight:normal"><span style="font-style:normal"><span lang="EN-US" style="font-size:12.0pt"><span style="font-family:宋体">3) MPLL </span></span></span></span></span></span><span class="fontstyle21" style="font-family:宋体"><span style="color:black"><span style="font-weight:normal"><span style="font-style:normal"><span style="font-size:12.0pt">时钟(</span></span></span></span></span><span class="fontstyle01" style="font-family:TimesNewRomanPSMT,serif"><span style="color:black"><span style="font-weight:normal"><span style="font-style:normal"><span lang="EN-US" style="font-size:12.0pt"><span style="font-family:宋体">MPLL</span></span></span></span></span></span><span class="fontstyle21" style="font-family:宋体"><span style="color:black"><span style="font-weight:normal"><span style="font-style:normal"><span style="font-size:12.0pt">)</span></span></span></span></span></span></span></p>
<p style="text-align:justify"><span style="font-size:10.5pt"><span style="font-family:等线"><span class="fontstyle01" style="font-family:TimesNewRomanPSMT,serif"><span style="color:black"><span style="font-weight:normal"><span style="font-style:normal"><span lang="EN-US" style="font-size:12.0pt"><span style="font-family:宋体">4) </span></span></span></span></span></span><span class="fontstyle21" style="font-family:宋体"><span style="color:black"><span style="font-weight:normal"><span style="font-style:normal"><span style="font-size:12.0pt">内部高速振荡器(</span></span></span></span></span><span class="fontstyle01" style="font-family:TimesNewRomanPSMT,serif"><span style="color:black"><span style="font-weight:normal"><span style="font-style:normal"><span lang="EN-US" style="font-size:12.0pt"><span style="font-family:宋体">HRC</span></span></span></span></span></span><span class="fontstyle21" style="font-family:宋体"><span style="color:black"><span style="font-weight:normal"><span style="font-style:normal"><span style="font-size:12.0pt">)</span></span></span></span></span></span></span></p>
<p style="text-align:justify"><span style="font-size:10.5pt"><span style="font-family:等线"><span class="fontstyle01" style="font-family:TimesNewRomanPSMT,serif"><span style="color:black"><span style="font-weight:normal"><span style="font-style:normal"><span lang="EN-US" style="font-size:12.0pt"><span style="font-family:宋体">5) </span></span></span></span></span></span><span class="fontstyle21" style="font-family:宋体"><span style="color:black"><span style="font-weight:normal"><span style="font-style:normal"><span style="font-size:12.0pt">内部中速振荡器(</span></span></span></span></span><span class="fontstyle01" style="font-family:TimesNewRomanPSMT,serif"><span style="color:black"><span style="font-weight:normal"><span style="font-style:normal"><span lang="EN-US" style="font-size:12.0pt"><span style="font-family:宋体">MRC</span></span></span></span></span></span><span class="fontstyle21" style="font-family:宋体"><span style="color:black"><span style="font-weight:normal"><span style="font-style:normal"><span style="font-size:12.0pt">)</span></span></span></span></span></span></span></p>
<p style="text-align:justify"><span style="font-size:10.5pt"><span style="font-family:等线"><span class="fontstyle01" style="font-family:TimesNewRomanPSMT,serif"><span style="color:black"><span style="font-weight:normal"><span style="font-style:normal"><span lang="EN-US" style="font-size:12.0pt"><span style="font-family:宋体">6) </span></span></span></span></span></span><span class="fontstyle21" style="font-family:宋体"><span style="color:black"><span style="font-weight:normal"><span style="font-style:normal"><span style="font-size:12.0pt">内部低速振荡器(</span></span></span></span></span><span class="fontstyle01" style="font-family:TimesNewRomanPSMT,serif"><span style="color:black"><span style="font-weight:normal"><span style="font-style:normal"><span lang="EN-US" style="font-size:12.0pt"><span style="font-family:宋体">LRC</span></span></span></span></span></span><span class="fontstyle21" style="font-family:宋体"><span style="color:black"><span style="font-weight:normal"><span style="font-style:normal"><span style="font-size:12.0pt">)</span></span></span></span></span> </span></span></p>
<h3 style="text-align:justify"><span style="font-size:14pt"><span style="173%"><span style="font-family:等线">其他时钟源(2个)</span></span></span></h3>
<p style="text-align:justify"><span style="font-size:10.5pt"><span style="200%"><span style="font-family:等线"><span class="fontstyle21" style="font-family:宋体"><span style="color:black"><span style="font-weight:normal"><span style="font-style:normal"><span lang="EN-US" style="font-size:12.0pt"><span style="200%">SWDT </span></span></span></span></span></span><span class="fontstyle21" style="font-family:宋体"><span style="color:black"><span style="font-weight:normal"><span style="font-style:normal"><span style="font-size:12.0pt"><span style="200%">专用内部低速振荡器,频率为 10KHz,看门狗专用时钟。</span></span></span></span></span></span></span></span></span></p>
<p style="text-align:justify"><span style="font-size:10.5pt"><span style="font-family:等线">UPLL 时钟。</span></span></p>
<h2 style="text-align:justify"><span style="font-size:16pt"><span style="173%"><span style="font-family:"等线 Light"">特殊外设时钟 </span></span></span></h2>
<p style="text-align:justify"><span style="font-size:10.5pt"><span style="200%"><span style="font-family:等线"><span class="fontstyle21" style="font-family:宋体"><span style="color:black"><span style="font-weight:normal"><span style="font-style:normal"><span lang="EN-US" style="font-size:12.0pt"><span style="200%">SWDT </span></span></span></span></span></span><span class="fontstyle21" style="font-family:宋体"><span style="color:black"><span style="font-weight:normal"><span style="font-style:normal"><span style="font-size:12.0pt"><span style="200%">专用内部低速振荡器,频率为 10KHz,看门狗专用时钟。</span></span></span></span></span></span></span></span></span></p>
<p style="text-align:justify"><span style="font-size:10.5pt"><span style="200%"><span style="font-family:等线"><span class="fontstyle01" style="font-family:TimesNewRomanPSMT,serif"><span style="color:black"><span style="font-weight:normal"><span style="font-style:normal"><span lang="EN-US" style="font-size:12.0pt"><span style="200%"><span style="font-family:宋体">USBFS </span></span></span></span></span></span></span><span class="fontstyle21" style="font-family:宋体"><span style="color:black"><span style="font-weight:normal"><span style="font-style:normal"><span style="font-size:12.0pt"><span style="200%">时钟 (</span></span></span></span></span></span><span class="fontstyle01" style="font-family:TimesNewRomanPSMT,serif"><span style="color:black"><span style="font-weight:normal"><span style="font-style:normal"><span lang="EN-US" style="font-size:12.0pt"><span style="200%"><span style="font-family:宋体">CMU_UFSCKCFGR</span></span></span></span></span></span></span><span class="fontstyle21" style="font-family:宋体"><span style="color:black"><span style="font-weight:normal"><span style="font-style:normal"><span lang="EN-US" style="font-size:12.0pt"><span style="200%">)</span></span></span></span></span></span></span></span></span></p>
<p style="text-align:justify"><span style="font-size:10.5pt"><span style="200%"><span style="font-family:等线"><span class="fontstyle01" style="font-family:TimesNewRomanPSMT,serif"><span style="color:black"><span style="font-weight:normal"><span style="font-style:normal"><span lang="EN-US" style="font-size:12.0pt"><span style="200%"><span style="font-family:宋体">AD/TRNG </span></span></span></span></span></span></span><span class="fontstyle21" style="font-family:宋体"><span style="color:black"><span style="font-weight:normal"><span style="font-style:normal"><span style="font-size:12.0pt"><span style="200%">时钟 (</span></span></span></span></span></span><span class="fontstyle01" style="font-family:TimesNewRomanPSMT,serif"><span style="color:black"><span style="font-weight:normal"><span style="font-style:normal"><span lang="EN-US" style="font-size:12.0pt"><span style="200%"><span style="font-family:宋体">CMU_PERICKSEL</span></span></span></span></span></span></span><span class="fontstyle21" style="font-family:宋体"><span style="color:black"><span style="font-weight:normal"><span style="font-style:normal"><span lang="EN-US" style="font-size:12.0pt"><span style="200%">)</span></span></span></span></span></span></span></span></span></p>
<p style="text-align:justify"><span style="font-size:10.5pt"><span style="200%"><span style="font-family:等线"><span class="fontstyle21" style="font-family:宋体"><span style="color:black"><span style="font-weight:normal"><span style="font-style:normal"><span style="font-size:12.0pt"><span style="200%">调试时钟 (</span></span></span></span></span></span><span class="fontstyle01" style="font-family:TimesNewRomanPSMT,serif"><span style="color:black"><span style="font-weight:normal"><span style="font-style:normal"><span lang="EN-US" style="font-size:12.0pt"><span style="200%"><span style="font-family:宋体">CMU_TPIUCKCFGR</span></span></span></span></span></span></span><span class="fontstyle21" style="font-family:宋体"><span style="color:black"><span style="font-weight:normal"><span style="font-style:normal"><span lang="EN-US" style="font-size:12.0pt"><span style="200%">)</span></span></span></span></span></span></span></span></span></p>
<p style="text-align:justify"><span style="font-size:10.5pt"><span style="200%"><span style="font-family:等线"><span class="fontstyle01" style="font-family:TimesNewRomanPSMT,serif"><span style="color:black"><span style="font-weight:normal"><span style="font-style:normal"><span lang="EN-US" style="font-size:12.0pt"><span style="200%"><span style="font-family:宋体">I2S </span></span></span></span></span></span></span><span class="fontstyle21" style="font-family:宋体"><span style="color:black"><span style="font-weight:normal"><span style="font-style:normal"><span style="font-size:12.0pt"><span style="200%">时钟 (</span></span></span></span></span></span><span class="fontstyle01" style="font-family:TimesNewRomanPSMT,serif"><span style="color:black"><span style="font-weight:normal"><span style="font-style:normal"><span lang="EN-US" style="font-size:12.0pt"><span style="200%"><span style="font-family:宋体">CMU_I2SCKSEL , </span></span></span></span></span></span></span><span class="fontstyle01" style="font-family:TimesNewRomanPSMT,serif"><span style="color:black"><span style="font-weight:normal"><span style="font-style:normal"><span style="font-size:12.0pt"><span style="200%"><span style="font-family:宋体">该寄存器的讲解在 I2S 篇章内</span></span></span></span></span></span></span><span class="fontstyle21" style="font-family:宋体"><span style="color:black"><span style="font-weight:normal"><span style="font-style:normal"><span lang="EN-US" style="font-size:12.0pt"><span style="200%">)</span></span></span></span></span></span></span></span></span></p>
<h2 style="text-align:justify"><span style="font-size:16pt"><span style="173%"><span style="font-family:"等线 Light""><span class="fontstyle21" style="font-family:宋体"><span style="color:black"><span style="font-weight:normal"><span style="font-style:normal"><b><span style="font-size:12.0pt"><span style="173%">基本外设时钟</span></span></b></span></span></span></span></span></span></span></h2>
<p style="text-indent:21.0pt; text-align:justify"><span style="font-size:10.5pt"><span style="font-family:等线">基本外设的时钟有 HCLK、EXCLK、PCLK0、 PCLK1、 PCLK2、 PCLK3 、PCLK4。所有的基本外设都是以上述的时钟为输入时钟(或者说外设的时钟源)。</span></span></p>
<p style="text-indent:21.0pt; text-align:justify"><span style="font-size:10.5pt"><span style="font-family:等线">根据时钟系统框图,稍加描述,就能对这个完整的时钟系统在自己的印象里有个工作的和配置的流程。</span></span></p>
<h2 style="text-align:justify"><span style="font-size:16pt"><span style="173%"><span style="font-family:"等线 Light"">时钟系统框图</span></span></span></h2>
<p style="text-indent:21.0pt; text-align:justify"><span style="font-size:10.5pt"><span style="font-family:等线">在时钟系统框图中红框标注的地方是不需要自己配置分频系数的,我理解的是已经内部确定有这么几个分频,只用在选择器中选择对应工作时钟所需的时钟频率即可。</span></span></p>
<p style="text-indent:21.0pt; text-align:justify"></p>
<h2 style="text-align:justify"><span style="font-size:16pt"><span style="173%"><span style="font-family:"等线 Light"">工作时钟</span></span></span></h2>
<p></p>
<h2 style="text-align:justify"><span style="font-size:16pt"><span style="173%"><span style="font-family:"等线 Light"">总结</span></span></span></h2>
<p style="text-indent:21.0pt; text-align:justify"><span style="font-size:10.5pt"><span style="font-family:等线">在时钟系统框图一章,在图片上标注了一个分屏器,这个分频器我个人理解的是内部硬件已经将其分频为需要的几种,然后通过<span style="color:red">时钟分频配置寄存器(CMU_SCFGR)</span>,选择相应的分频频率,上述也有提到。如果需要<span style="color:red">高频率的系统时钟</span>必须选择经PLL 倍频的 MPLL时钟的 P 时钟做为系统时钟源。</span></span></p>
<p style="text-indent:21.0pt; text-align:justify"><span style="font-size:10.5pt"><span style="font-family:等线">时钟大概是这样的深入了解的话,需要详细的再阅读数据手册和用户手册,由个人能力有限,难免出现错误,还请多多指教,欢迎大家一起交流。</span></span></p>
<p style="text-indent:21.0pt; text-align:justify"><span style="font-size:10.5pt"><span style="font-family:等线">最后说一句华大的片子个人觉得很好的,不是彩虹屁,之前用过中微的、 GD 的、 NXP的、ST的。ST 的易用性大家都知道了,华大的这个 DLL 库感觉和 ST 的 HAL 不相上下了,比 NXP 的库好(个人见解,嘿嘿)。等 MCU 价格降下来看能不能搞几片华大芯片玩玩。</span></span></p>
<p> </p>
<p>在图片上标注了一个分屏器 , 内部硬件已经将其分频为需要的几种 , 分频器在编程时实际对应某个寄存器的某几个bit位</p>
华大的与STM32最大区别在什么 火辣西米秀 发表于 2021-5-8 07:28
在图片上标注了一个分屏器 , 内部硬件已经将其分频为需要的几种 , 分频器在编程时实际对应某个寄存器的某 ...
<p>嗯嗯</p>
annysky2012 发表于 2021-5-8 20:44
华大的与STM32最大区别在什么
<p>华大外设丰富吧,你要说最关键的那就是国产中文,读文档快 哈哈。其实芯片性能够用就好,关键在上手速度上。像NXP(飞思卡尔) 的芯片性能嗷嗷叫,但是在消费级上依旧干不过ST,新出的RT的芯片超高性价比,一般的600MHz 的主频,RT1170的1GHz主频,感觉还是使用的较少,出现问题很难解的,这个也和芯片生态有关系吧。ST又涨价,国产芯片要把握好机会呀</p>
页:
[1]