十二翼天使 发表于 2015-3-11 20:15:25

关于STM32F107中的时钟配置寄存器RCC_CFGR2

如题,在STM32F10X参考手册中没有找到时钟配置寄存器RCC_CFGR2,在配置时钟时,没有资料可以参考,开发板的外部晶振是25M,想配置72M的主频,想求助一下大家!参考手册顺便附上。

wambob 发表于 2015-3-11 20:47:14

本帖最后由 wambob 于 2015-3-11 21:09 编辑

Status bits in the Clock
control register (RCC_CR) indicate which clock(s) is (are) ready and which clock is currently
used as system clock.

在时钟控制寄存器(RCC_CR)里的状态位指示哪个时钟已经准备好了,哪个时钟目前被用作系统
时钟。


时钟配置寄存器(RCC_CFGR)

这2个寄存器就可以了

你的RCC_CFGR2在是那个手册里的 啊







十二翼天使 发表于 2015-3-11 21:20:06

wambob 发表于 2015-3-11 20:47
Status bits in the Clock
control register (RCC_CR) indicate which clock(s) is (are) ready and which...

这个手册里没有RCC_CFGR2的资料,我也不知道在哪里可以找到关于这个寄存器的资料

十二翼天使 发表于 2015-3-11 21:20:49

wambob 发表于 2015-3-11 20:47
Status bits in the Clock
control register (RCC_CR) indicate which clock(s) is (are) ready and which...

ST的官网上有吗?

wambob 发表于 2015-3-11 21:28:28

本帖最后由 wambob 于 2015-3-11 21:31 编辑

十二翼天使 发表于 2015-3-11 21:20
这个手册里没有RCC_CFGR2的资料,我也不知道在哪里可以找到关于这个寄存器的资料 ...

你那个程序是从哪找来的,写程序参考相应芯片的参考手册就可以了 ,比如你用的107,就用10XX的
程序不是通用的,但思路是一样的,要学会思考。不能光看代码一样不一样

十二翼天使 发表于 2015-3-11 21:29:33

wambob 发表于 2015-3-11 20:47
Status bits in the Clock
control register (RCC_CR) indicate which clock(s) is (are) ready and which...

stm32f10x.h中没有关于RCC_CFGR2的定义

十二翼天使 发表于 2015-3-11 21:51:35

wambob 发表于 2015-3-11 21:28
你那个程序是从哪找来的,写程序参考相应芯片的参考手册就可以了 ,比如你用的107,就用10XX的
程序不是 ...

我也看过时钟树,在外部晶振为25M的情况下不可能配置出72M的时钟,而且源代码里的一些解释也我一头雾水的,例如PREDIV1,我就不知道从哪儿来的,而且找不到它的定义,问题中提到的RCC_CFGR2寄存器也是一样,找不到它的定义。

wambob 发表于 2015-3-11 21:58:19

typedef struct
{
__IO uint32_t CR;         /*!< RCC clock control register,                                  Address offset: 0x00 */
__IO uint32_t CFGR;       /*!< RCC clock configuration register,                            Address offset: 0x04 */
__IO uint32_t CIR;      /*!< RCC clock interrupt register,                              Address offset: 0x08 */
__IO uint32_t APB2RSTR;   /*!< RCC APB2 peripheral reset register,                        Address offset: 0x0C */
__IO uint32_t APB1RSTR;   /*!< RCC APB1 peripheral reset register,                        Address offset: 0x10 */
__IO uint32_t AHBENR;   /*!< RCC AHB peripheral clock register,                           Address offset: 0x14 */
__IO uint32_t APB2ENR;    /*!< RCC APB2 peripheral clock enable register,                   Address offset: 0x18 */
__IO uint32_t APB1ENR;    /*!< RCC APB1 peripheral clock enable register,                   Address offset: 0x1C */
__IO uint32_t BDCR;       /*!< RCC Backup domain control register,                        Address offset: 0x20 */
__IO uint32_t CSR;      /*!< RCC clock control & status register,                         Address offset: 0x24 */
__IO uint32_t AHBRSTR;    /*!< RCC AHB peripheral reset register,                           Address offset: 0x28 */
__IO uint32_t CFGR2;      /*!< RCC clock configuration register 2,                        Address offset: 0x2C */
__IO uint32_t CFGR3;      /*!< RCC clock configuration register 3,                        Address offset: 0x30 */
__IO uint32_t CR2;      /*!< RCC clock control register 2,                              Address offset: 0x34 */
} RCC_TypeDef;


wambob 发表于 2015-3-11 22:12:28

本帖最后由 wambob 于 2015-3-11 22:14 编辑

请看下STM32F0XX手册就明白了,你用的107芯片,却用的0XX的程序,肯定不对了 ,参考手册不一样的

十二翼天使 发表于 2015-3-11 22:23:28

wambob 发表于 2015-3-11 21:58
typedef struct
{
__IO uint32_t CR;         /*!< RCC clock control register,                        ...

真是太谢谢你了,我刚刚受你的启发,我在stm32f10x.h中也找到了相关的定义,只是和你给的稍有不同
页: [1] 2
查看完整版本: 关于STM32F107中的时钟配置寄存器RCC_CFGR2