当出现这个问题时,往往是因为你没有在RCC寄存器中把相关的时钟使能打开。

配置寄存器之前记得调用"RCC_AxxxPeriphClockCmd"先打开需要配置的时钟源,别调用了“RCC_AxxxPeriphResetCmd"。

相关函数定义源代码如下:

/**
* @brief Enables or disables the AHB peripheral clock.
* @param RCC_AHBPeriph: specifies the AHB peripheral to gates its clock.
*
* For @b STM32_Connectivity_line_devices, this parameter can be any combination
* of the following values:
* @arg RCC_AHBPeriph_DMA1
* @arg RCC_AHBPeriph_DMA2
* @arg RCC_AHBPeriph_SRAM
* @arg RCC_AHBPeriph_FLITF
* @arg RCC_AHBPeriph_CRC
* @arg RCC_AHBPeriph_OTG_FS
* @arg RCC_AHBPeriph_ETH_MAC
* @arg RCC_AHBPeriph_ETH_MAC_Tx
* @arg RCC_AHBPeriph_ETH_MAC_Rx
*
* For @b other_STM32_devices, this parameter can be any combination of the
* following values:
* @arg RCC_AHBPeriph_DMA1
* @arg RCC_AHBPeriph_DMA2
* @arg RCC_AHBPeriph_SRAM
* @arg RCC_AHBPeriph_FLITF
* @arg RCC_AHBPeriph_CRC
* @arg RCC_AHBPeriph_FSMC
* @arg RCC_AHBPeriph_SDIO
*
* @note SRAM and FLITF clock can be disabled only during sleep mode.
* @param NewState: new state of the specified peripheral clock.
* This parameter can be: ENABLE or DISABLE.
* @retval None
*/
void RCC_AHBPeriphClockCmd(uint32_t RCC_AHBPeriph, FunctionalState NewState)
{
/* Check the parameters */
assert_param(IS_RCC_AHB_PERIPH(RCC_AHBPeriph));
assert_param(IS_FUNCTIONAL_STATE(NewState)); if (NewState != DISABLE)
{
RCC->AHBENR |= RCC_AHBPeriph;
}
else
{
RCC->AHBENR &= ~RCC_AHBPeriph;
}
} /**
* @brief Enables or disables the High Speed APB (APB2) peripheral clock.
* @param RCC_APB2Periph: specifies the APB2 peripheral to gates its clock.
* This parameter can be any combination of the following values:
* @arg RCC_APB2Periph_AFIO, RCC_APB2Periph_GPIOA, RCC_APB2Periph_GPIOB,
* RCC_APB2Periph_GPIOC, RCC_APB2Periph_GPIOD, RCC_APB2Periph_GPIOE,
* RCC_APB2Periph_GPIOF, RCC_APB2Periph_GPIOG, RCC_APB2Periph_ADC1,
* RCC_APB2Periph_ADC2, RCC_APB2Periph_TIM1, RCC_APB2Periph_SPI1,
* RCC_APB2Periph_TIM8, RCC_APB2Periph_USART1, RCC_APB2Periph_ADC3,
* RCC_APB2Periph_TIM15, RCC_APB2Periph_TIM16, RCC_APB2Periph_TIM17,
* RCC_APB2Periph_TIM9, RCC_APB2Periph_TIM10, RCC_APB2Periph_TIM11
* @param NewState: new state of the specified peripheral clock.
* This parameter can be: ENABLE or DISABLE.
* @retval None
*/
void RCC_APB2PeriphClockCmd(uint32_t RCC_APB2Periph, FunctionalState NewState)
{
/* Check the parameters */
assert_param(IS_RCC_APB2_PERIPH(RCC_APB2Periph));
assert_param(IS_FUNCTIONAL_STATE(NewState));
if (NewState != DISABLE)
{
RCC->APB2ENR |= RCC_APB2Periph;
}
else
{
RCC->APB2ENR &= ~RCC_APB2Periph;
}
} /**
* @brief Enables or disables the Low Speed APB (APB1) peripheral clock.
* @param RCC_APB1Periph: specifies the APB1 peripheral to gates its clock.
* This parameter can be any combination of the following values:
* @arg RCC_APB1Periph_TIM2, RCC_APB1Periph_TIM3, RCC_APB1Periph_TIM4,
* RCC_APB1Periph_TIM5, RCC_APB1Periph_TIM6, RCC_APB1Periph_TIM7,
* RCC_APB1Periph_WWDG, RCC_APB1Periph_SPI2, RCC_APB1Periph_SPI3,
* RCC_APB1Periph_USART2, RCC_APB1Periph_USART3, RCC_APB1Periph_USART4,
* RCC_APB1Periph_USART5, RCC_APB1Periph_I2C1, RCC_APB1Periph_I2C2,
* RCC_APB1Periph_USB, RCC_APB1Periph_CAN1, RCC_APB1Periph_BKP,
* RCC_APB1Periph_PWR, RCC_APB1Periph_DAC, RCC_APB1Periph_CEC,
* RCC_APB1Periph_TIM12, RCC_APB1Periph_TIM13, RCC_APB1Periph_TIM14
* @param NewState: new state of the specified peripheral clock.
* This parameter can be: ENABLE or DISABLE.
* @retval None
*/
void RCC_APB1PeriphClockCmd(uint32_t RCC_APB1Periph, FunctionalState NewState)
{
/* Check the parameters */
assert_param(IS_RCC_APB1_PERIPH(RCC_APB1Periph));
assert_param(IS_FUNCTIONAL_STATE(NewState));
if (NewState != DISABLE)
{
RCC->APB1ENR |= RCC_APB1Periph;
}
else
{
RCC->APB1ENR &= ~RCC_APB1Periph;
}
}

STM32 STM32F4 寄存器怎么配置不上, 无法往寄存器写入数据的更多相关文章

  1. spark读取hdfs上的文件和写入数据到hdfs上面

    def main(args: Array[String]): Unit = { val conf = new SparkConf() conf.set("spark.master" ...

  2. STM32时钟系统的配置寄存器和源码分析

    一.时钟系统 概述 时钟是单片机运行的基础,时钟信号推动单片机内各个部分执行相应的指令,时钟系统就是CPU的脉搏,决定cpu速率. STM32有多个时钟来源的选择,为什么 STM32 要有多个时钟源呢 ...

  3. STM32的外部中断配置及使用

    STM32的外部中断配置及使用 配置1:GPIO: 配置外部中断为输入模式: 配置2:EXTI: 配置外部中断线和触发模式: 配置3:NVIC: 配置外部中断源和中断优先级: 需要注意的是:RCC_A ...

  4. USB2.0学习笔记连载(十八):keil实现寄存器的配置及相关函数讲解(二)

    其实之前也有提及过,Cypress公司提供的官方文件和应用手册真的可以解决很多问题.做的也很人性化,操作也及其简单,几乎只要在 TD_int()里面配置一些常用的参数即可,其他都可以不用操作. 作为一 ...

  5. USB2.0学习笔记连载(十七):keil实现寄存器的配置及相关函数讲解(一)

    首先要实现对寄存器的配置,可以参考手册<Development kit  User Guide>,如下图所示: 此文件包含在 文件中.上述的应用文档详细介绍了如何利用KEIL实现对固件程序 ...

  6. USB2.0学习笔记连载(五):EZ-USB重要寄存器的配置

    本篇博客主要讲解EZ-USB一些重要寄存器的配置,首先对于本篇博客所讲的内容,读者应该到官网上去下载相关的手册,其中包括<EZ-USB Technical Reference Manual> ...

  7. STM32 GPIO口的配置和应用

    STM32F103ZET6 一共有7组IO口(有FT的标识是可以识别5v的) 每组IO口有16个IO 一共16*7=112个IO 4种输入模式: (1) GPIO_Mode_AIN 模拟输入 (2) ...

  8. 关于editor网页编辑器ueditor.config.js 配置图片上传

    最近公司项目在做一个门户网站,其中新闻和简介等部分使用到了ueditor编辑器,但是上级明确指示需要图片上传这个功能,这时却发现图片上传功能不能正常使用,上传时一直报错,网上收了好几个处理办法,都说的 ...

  9. STM32F4系统时钟配置及描述

    STM32F4系统时钟配置及描述 stm32f407时钟配置方法(感觉很好,分享一下) STM32F4_RCC系统时钟配置及描述 STM32F4时钟设置分析 stm32f4 - 时钟树分析配置

随机推荐

  1. Algo: Binary search

    二分查找的基本写法: #include <vector> #include <iostream> int binarySearch(std::vector<int> ...

  2. 如何定义一个BUG

    一.划分一个bug的等级 bug等级主要分为致命.严重.一般.轻微或者建议四个等级: 1.致命错误:系统无法执行.崩溃或严重资源不足.应用模块无法启动或异常退出.无法测试.造成系统不稳定.价值较高功能 ...

  3. shell脚本将命令的结果赋值给变量的2种写法

    Shell 也支持将命令的执行结果赋值给变量,常见的有以下两种方式: variable=`command`variable=$(command) 第一种方式把命令用反引号` `(位于 Esc 键的下方 ...

  4. js数据访问的艺术

    数据访问js无时不刻所要做的事情,提高对数据的访问效率对一般的小的程序来说,对性能并不会有明显的改善.但是对像淘宝这样项目巨大,访问量巨大的网站来说,一个数据访问效率的提高对性能来说可能产生很大提升. ...

  5. Java——面向对象的特征三:多态性

    2.5面向对象的特征三:多态性 2.5.1 关于java语言中的向上转型和向下转型 ①向上转型(upcasting) :  子--->父(自动类型转换) ②向下转型(downcasting) : ...

  6. PDO基础

    //PDO:数据访问抽象层 $dsn = "mysql:dbname=mydb;host=localhost";//造PDO对象 $pdo = new PDO($dsn," ...

  7. NX二次开发-char*转换成CString,多字节转换成Unicode使用方法

    //定义一个结构体记录 struct group { CString text; //定义一个CString std::vector<tag_t> boudaries; std::vect ...

  8. 其它课程中的python---3、numpy总结(非常全)

    其它课程中的python---3.numpy总结(非常全) 一.总结 一句话总结: 学习方式应该是:听课+总结:-->找总结博客+再总结 需要始终记住:凭借,继承,复用 1.numpy的主要功能 ...

  9. Ubuntu下安装fcitx+搜狗输入法

    转载自:http://www.linuxidc.com/Linux/2013-07/87062.htm 目标:在Ubuntu 13.04以及基于Ubuntu的发行版上安装fcitx小企鹅输入法,并安装 ...

  10. 记一次java简单的if语句使用多态重构

    场景描述: 一个controller中,部门领导有布置任务,查看任务整体情况,查看部门成员,查看部门成员完成情况,导出任务详情,如下: @RestController @RequestMapping( ...