Chinaunix首页 | 论坛 | 博客
  • 博客访问: 233360
  • 博文数量: 84
  • 博客积分: 0
  • 博客等级: 民兵
  • 技术积分: 451
  • 用 户 组: 普通用户
  • 注册时间: 2013-04-05 13:45
个人简介

IT!

文章分类
文章存档

2013年(84)

我的朋友

分类: 嵌入式

2013-05-31 16:00:01

时钟树:

STM32学习时钟系统--2013.4.10

1. HSI振荡器时钟
The HSI clock signal is generated from an internal 8 MHz RC Oscillator and can be used directly as a system clock or divided by 2 to be used as PLL input. 
The HSI RC oscillator has the advantage of providing a clock source at low cost (no external 
components). It also has a faster startup time than the HSE crystal oscillator however, even 
with calibration the frequency is less accurate than an external crystal oscillator or ceramic resonator. 
HSI时钟信号由内部8MHz的RC振荡器产生,可直接作为系统时钟或在2分频后作为PLL输入。
HSI RC振荡器能够在不需要任何外部器件的条件下提供系统时钟。它的启动时间比HSE晶体振荡器短。然而,即使在校准之后它的时钟频率精度仍较差。

2. HSE振荡器时钟
The high speed external clock signal (HSE) can be generated from two possible clock 
sources:
   ● HSE external crystal/ceramic resonator 
   ● HSE user external clock
The resonator and the load capacitors have tobe placed as close as possible to the 
oscillator pins in order to minimize output distortion and startup stabilization time. The 
loading capacitance values must be adjusted according to the selected oscillator.
高速外部时钟信号(HSE)由以下两种时钟源产生:
  ● HSE外部晶体/陶瓷谐振器
  ● HSE用户外部时钟
为了减少时钟输出的失真和缩短启动稳定时间,晶体/陶瓷谐振器和负载电容器必须尽可能地靠
近振荡器引脚。负载电容值必须根据所选择的振荡器来调整。

4~16Mz外部振荡器可为系统提供更为精确的主时钟。

3. PLL时钟
The main PLL provides a frequency multiplier starting from one of the following clock 
sources:
  ● HSI clock divided by 2
  ● HSE or PLL2 clock through a configurable divider
PLL2 and PLL3 are clocked by HSE through a specific configurable divider. 
The configuration of each PLL (selection of clock source, predivision factor and 
multiplication factor) must be done before enabling the PLL. Each PLL should be enabled 
after its input clock becomes stable (ready flag). Once the PLL is enabled, these parameters 
can not be changed.
内部PLL可以用来倍频 HSI RC的输出时钟 或 HSE晶体输出时钟。
每个PLL的配置(时钟源的选择,分频、倍频因子)必须在其被激活前完成。当输入时钟稳定时每个pll被使能。一旦PLL被激活,这些参数就不能被改动。
When changing the entry clock source of the main PLL, the original clock source must be 
switched off only after the selection of the new clock source (done through bit PLLSRC in 
the Clock configuration register (RCC_CFGR)).

An interrupt can be generated when the PLL is ready if enabled in the Clock interrupt 
register (RCC_CIR).
如果PLL中断在时钟中断寄存器里被允许,当PLL准备就绪时,可产生中断申请。

4.LSE时钟
LSE晶体是一个32.768kHz的低速外部晶体或陶瓷谐振器。它为实时时钟或者其他定时功能提供
一个低功耗且精确的时钟源。
LSE晶体通过在备份域控制寄存器(RCC_BDCR)里的LSEON位启动和关闭。
在备份域控制寄存器(RCC_BDCR)里的LSERDY指示LSE晶体振荡是否稳定。在启动阶段,直到这个位被硬件置’1’后,LSE时钟信号才被释放出来。如果在时钟中断寄存器里被允许,可产生中断申请。

5.LSI时钟
LSI RC担当一个低功耗时钟源的角色,它可以在停机和待机模式下保持运行,为独立看门狗和
自动唤醒单元提供时钟。LSI时钟频率大约40kHz(在30kHz和60kHz之间)。
LSI RC可以通过控制/状态寄存器(RCC_CSR)里的LSION位来启动或关闭。
在控制/状态寄存器(RCC_CSR)里的LSIRDY位指示低速内部振荡器是否稳定。在启动阶段,直到这个位被硬件设置为’1’后,此时钟才被释放。如果在时钟中断寄存器(RCC_CIR)里被允许,将产生LSI中断申请。

系统时钟(SYSCLK)选择
系统复位后,HSI振荡器被选为系统时钟。当时钟源被直接或通过PLL间接作为系统时钟时,它将不能被停止。
只有当目标时钟源准备就绪了(经过启动稳定阶段的延迟或PLL稳定),从一个时钟源到另一个时钟源的切换才会发生。在被选择时钟源没有就绪时,系统时钟的切换不会发生。直至目标时钟源就绪,才发生切换。
在时钟控制寄存器(RCC_CR)里的状态位指示哪个时钟已经准备好了,哪个时钟目前被用作系统时钟。

HSI:上电默认启动,因精度不高所以先不采用,以后如果需要再使用

HSE:外部高速时钟,系统时钟一般采用它,经过PLL倍频作为系统同时钟

LSE:外部低速时钟,一般专门用于RTC(real time clock实时时钟),等到RTC模块时再使用

LSI:内部低速时钟,精度不高,一般用于IWDGCLK

阅读(1719) | 评论(0) | 转发(0) |
给主人留下些什么吧!~~