STM32时钟系统(2)-时钟系统常用寄存器和库函数

STM32时钟系统

官方文档说明:

Three different clock sources can be used to drive the system clock (SYSCLK):

• HSI oscillator clock

• HSE oscillator clock

• PLL clock

The devices have the following two secondary clock sources:

• 40 kHz low speed internal RC (LSI RC) which drives the independent watchdog and

optionally the RTC used for Auto-wakeup from Stop/Standby mode.

• 32.768 kHz low speed external crystal (LSE crystal) which optionally drives the real-

time clock (RTCCLK)

Each clock source can be switched on or off independently when it is not used, to optimize

power consumption.

大概意思:

SYSCLK系统时钟的来源有三个

1.HSI oscillator clock (High Speed Internel)

2.HSE oscillator clock(High Speed External)

3.PLL clock(这个也是来自于HSE oscillator clock)

辅助时钟源有两个 (LSI RC和LSE crystal),晶振频率是40kHz和32.786kHz,

可以独立的打开和关闭,优化系统功耗。

HSE Clock

官方文档

The high speed external clock signal (HSE) can be generated from two possible clock sources:

• HSE external crystal/ceramic resonator

• HSE user external clock

In this mode, an external clock source must be provided. It can have a frequency of up to

50 MHz. You select this mode by setting the HSEBYP and HSEON bits in the Clock control register (RCC_CR). The external clock signal (square, sinus or triangle) with ~50% duty cycle has to drive the OSC_IN pin while the OSC_OUT pin should be left hi-Z. See(高阻态可做开路理解) Figure 12.

External crystal/ceramic resonator (HSE crystal)

The 3 to 25 MHz external oscillator has the advantage of producing a very accurate rate on the main clock.

The associated hardware configuration is shown in Figure 12. Refer to the electrical characteristics section of the datasheet for more details. The HSERDY flag in the Clock control register (RCC_CR) indicates if the high-speed external oscillator is stable or not. At startup, the clock is not released until this bit is set by hardware. An interrupt can be generated if enabled in the Clock interrupt register (RCC_CIR).

The HSE crystal can be switched on and off using the HSEON bit in the Clock control register (RCC_CR).

HSI clock

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.

解释:HSI时钟信号由内部8MHz的RC振荡器产生,可以直接作为系统时钟(SYSCLK)或在2分频后作为PLL输入时钟。

PLLs

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

Refer to Figure 11 and Clock control register (RCC_CR).

LSE clock

The LSE crystal is a 32.768 kHz Low Speed External crystal or ceramic resonator. It has the advantage providing a low-power but highly accurate clock source to the real-time clock peripheral (RTC) for clock/calendar or other timing functions.

LSE晶体是一个32.768 kHz低速外部晶体或陶瓷谐振器。 它具有为实时时钟外设(RTC)提供低功耗,高精度时钟源的优势,以实现时钟/日历或其他计时功能。

In this mode, an external clock source must be provided. It can have a frequency of up to 1 MHz. You select this mode by setting the LSEBYP and LSEON bits in the Backup domain control register (RCC_BDCR). The external clock signal (square, sinus or triangle) with ~50% duty cycle has to drive the OSC32_IN pin while the OSC32_OUT pin should be left

Hi-Z.

在这种模式下,必须提供一个外部时钟源。 它可以具有高达1 MHz的频率。 您可以通过将备份域控制寄存器(RCC_BDCR)中的LSEBYP和LSEON位置1来选择此模式。 占空比约为50%的外部时钟信号(正方形,正弦波或三角形)必须驱动OSC32_IN引脚,而OSC32_OUT引脚应保持为Hi-Z(悬空/高阻态)

LSI clock

The LSI RC acts as an low-power clock source that can be kept  running in Stop and Standby mode for the independent watchdog (IWDG) and Auto-wakeup unit (AWU). The clock frequency is around 40 kHz (between 30 kHz and 60 kHz).

LSI RC充当低功耗时钟源,可为独立看门狗(IWDG)和自动唤醒单元(AWU)保持在“停止”和“待机”模式下运行。 时钟频率约为40 kHz(介于30 kHz和60 kHz之间,因为内部的时钟源一般情况是不够稳定)。

Clock security system (CSS)

STM32内部的一个时钟安全检测系统,一旦检测到HSE时钟故障,则就会切换到内部RC振荡器作为时钟信号输入。

官方文档解释如下:

Clock Security System can be activated by software. In this case, the clock detector is enabled after the HSE oscillator startup delay, and disabled when this oscillator is stopped.

a failure is detected on the HSE clock, the HSE Oscillator is automatically disabled, a clock failure event is sent to the break input of the TIM1 Advanced control timer and an interrupt is generated to inform the software about the failure (Clock Security System Interrupt CSSI), allowing the MCU to perform rescue operations.

If the HSE oscillator is used directly or indirectly as the system clock (indirectly means: it is used as PLL input clock directly or through PLL2, and the PLL clock is used as system clock), a detected failure causes a switch of the system clock to the HSI oscillator and the disabling of the external HSE oscillator. If the HSE oscillator clock (divided or not) is the clock entry of the PLL (directly or through PLL2) used as system clock when the failure occurs, the PLL is disabled too.

解释:

时钟安全系统可以通过软件激活。在这种情况下,时钟检测器在HSE振荡器启动延迟后启用,并在该振荡器停止时禁用。

在HSE时钟上检测到故障,HSE振荡器被自动禁用,时钟故障事件被发送到TIM1 Advanced控制计时器的中断输入,并产生中断来通知软件该故障(时钟安全系统中断CSSI ),允许MCU执行救援操作。

如果将HSE振荡器直接或间接用作系统时钟(间接表示:直接或通过PLL2用作PLL输入时钟,而PLL时钟用作系统时钟),则检测到的故障会导致系统时钟切换连接到HSI振荡器,并禁用外部HSE振荡器。如果发生故障时,HSE振荡器时钟(分频或非分频)是用作系统时钟的PLL的时钟输入(直接或通过PLL2),则PLL也被禁用。

Clock-out capability

微控制器时钟输出(MCO)功能允许将时钟输出到外部MCO引脚。

The microcontroller clock output (MCO) capability allows the clock to be output onto the external MCO pin. The configuration registers of the corresponding GPIO port must be programmed in alternate function mode. One of 8 clock signals can be selected as the MCO clock.

• SYSCLK

• HSI

• HSE

• PLL clock divided by 2 selected

• PLL2 clock selected

• PLL3 clock divided by 2 selected

• XT1 external 3-25 MHz oscillator clock selected (for Ethernet)

• PLL3 clock selected (for Ethernet)

The selected clock to output onto MCO must not exceed 50 MHz (the maximum I/O speed). The selection is controlled by the MCO[3:0] bits of the Clock configuration register(RCC_CFGR).

Watchdog clock

If the Independent watchdog (IWDG) is started by either hardware option or software access, the LSI oscillator is forced ON and cannot be disabled. After the LSI oscillator temporization, the clock is provided to the IWDG.

如果通过硬件选项或软件访问来启动独立看门狗(IWDG),则LSI振荡器被强制打开且无法禁用。 在对LSI振荡器进行温度调节后,将时钟提供给IWDG。

所有外设时钟均来自系统时钟(SYSCLK),但以下情况除外:

1.The USB OTG FS 48 MHz clock which is derived from the PLL VCO clock (2 ×PLLCLK), followed by a programmable prescaler (divide by 3 or 2). This selection is made through the OTGFSPRE bit in the RCC_CFGR register. For proper USB OTG FS

operation, the PLL should be configured to output 72 MHz or 48 MHz.

2.The Flash memory programming interface clock (FLITFCLK) is always the HSI clock(始终来自于HIS时钟)

3.The I2S2 and I2S3 clocks which can be derived from the system clock (SYSCLK) or the PLL3 VCO clock (2 × PLL3CLK). This selection is made through the I2SxSRC bit in the RCC_CFGR2 register. For more information on PLL3 and how to configure the I2S clock to achieve high-quality audio performance, please refer to Section 25.4.3: Clock generator.

I2S全称Inter-IC Sound, Integrated Interchip Sound,或简写IIS,是飞利浦在1986年定义(1996年修订)的数字音频传输标准,用于数字音频数据在系统内部器件之间传输,例如编解码器CODEC、DSP、数字输入/输出接口、ADC、DAC和数字滤波器等。除了都是由飞利浦定义外,I2S和I2C没有任何关系。

4.When the Ethernet is used, the AHB clock frequency must be at least 25 MHz.

AHB时钟总线,外设时钟使能寄存器

STM32时钟系统(1)-时钟框图解释相关推荐

  1. 什么是系统时钟?什么是时钟系统?时钟系统有什么作用?

    1.Q:什么是系统时钟?什么是时钟系统? A:通常所说的系统时钟就是指时钟系统,它是由振荡器(信号源).定时唤醒器.分频器等组成的电路.常用的信号源有晶体振荡器和RC振荡器. 2.Q:时钟系统有什么作 ...

  2. 一文读懂STM32时钟树(时钟系统)(以STM32F767为例)

    STM32时钟系统 导读 时钟系统的构成 总结 导读 我在刚开始接触STM32/单片机的时候看到它的时钟系统/时钟树,都会感觉懵懵的,这是个啥?它想要告诉我哪方面的数据?特此一文记录一下学习心得. 时 ...

  3. IMX6ULL学习笔记(19)——时钟系统

    一.时钟系统简介 I.MX6U 的系统主频为 528MHz,有些型号可以跑到 696MHz,但是默认情况下内部 boot rom 会将 I.MX6U 的主频设置为 396MHz.我们在使用 I.MX6 ...

  4. STC16f40k128——时钟系统

    目录 时钟系统简介 时钟配置相关的寄存器 CKSEL CLKDIV IRC24MCR​编辑 IRC32KCR PLLCR​编辑 时钟配置源程序 采用内部高精度IRC 采用内部PLL输出,PLL以内部2 ...

  5. msp430f5529学习笔记(2)时钟系统

    写在前~本章将会详细的讲解msp430f5529单片机的时钟系统及其使用方法.如有不妥的地方欢迎各位大佬斧正!!! 目录 什么是时钟系统和时钟源 MSP430f5529时钟源和时钟系统介绍 产生时钟信 ...

  6. 基础——MCU的电源,复位和时钟系统(STM32为例)

    目录 1. 电源供电 2. 上电复位和手动复位 2.1 硬件复位 2.2 软件复位 3.1 晶振 3.2 内部时钟和外部时钟的不同 3.3 HSE和LSE外部电路的硬件设计 3.4 时钟具体理解 4. ...

  7. STM32开发 -- 时钟系统详解

    如需转载请注明出处:https://blog.csdn.net/qq_29350001/article/details/81558649 上一篇文章讲了RTC,里面其实已经包含了时钟系统的介绍了.这篇 ...

  8. 【STM32标准库】【基础知识】时钟系统

    文章目录 时钟 时钟的作用 时钟的产生 F4系列的时钟系统 时钟源 总线 标准库的时钟设置 内部高速时钟设置 外部高速时钟设置 AHB时钟设置 APB1/2时钟设置 默认值 文章基于适用于STM32F ...

  9. 【STM32】时钟系统RCC

    目录 一.时钟树 1.时钟源 2.高速外部时钟信号(HSE) 3.低速外部时钟信号(LSE) 4.系统时钟(SYSCLK) 5.时钟输出(MCO) 6.AHB 参考文献 一.时钟树 本文以STM32F ...

最新文章

  1. Vue的v-for中列表项拖拽排序详细方法
  2. android上垂直跑马灯,android textview 垂直滚动and水平跑马灯
  3. 机器学习霸占高薪榜、区块链偃旗息鼓?2020 年软件工程师状况解读!
  4. 转:使用NSOperationQueue简化多线程开发
  5. 如何利用极致业务基础平台构建一个通用企业ERP之十三盘点单设计
  6. The Art of Memory Forensics-Windows取证(Virut样本取证)
  7. jboss-remoting服务
  8. php文字如何排版,文字如何实现完美UI?文本排版设计告诉你
  9. 元宇宙营销新时代| 元宇宙数字营销峰会于7月29日在上海淳大万丽酒店盛大开幕!
  10. JavaScript冒泡排序(升序排列)
  11. SQL中rand和order by rand()用法
  12. 太阳直射点纬度计算公式_离太阳更近应该更热,可为什么海拔上升反而使温度更低...
  13. 安装EEGLAB以及创建电极位置
  14. Javascript 实现一个分钟秒钟倒计时器
  15. 【NIPS 2016图神经网络论文解读】Variational Graph Auto-Encoders (VGAE) 基于VAE的图变分自编码器
  16. Ubuntu中安装Python h5py
  17. Android系统的定制
  18. 《场景式500主题会话10000单词完全掌握》[PDF]
  19. Redis相关命令及使用场景介绍
  20. EtherCAT总线伺服电机/一体化伺服电机IO线端子对应定义

热门文章

  1. python实现糖果小游戏
  2. html实现文本的查找与替换,搜索替换神器(Search and Replace)
  3. java令牌化_令牌化如何工作?
  4. 一篇NS SAR ADC的学习记录
  5. 警告: 未提供 -tsa 或 -tsacert, 此 jar 没有时间戳。如果没有时间戳, 则在签名者证书的到期
  6. ArcGIS从全国县界中提取江浙沪皖县界图
  7. 单片机叮咚c语言,基于单片机的叮咚门铃.pdf
  8. Beyond compare 生成word版本的对比报告
  9. 华为测试软件csfb分析,华为完成创新语音解决方案Ultra-Flash CSFB 的端到端测试
  10. java中检测输入是否合法的方法