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

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

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

  1. /**
  2. * @brief Enables or disables the AHB peripheral clock.
  3. * @param RCC_AHBPeriph: specifies the AHB peripheral to gates its clock.
  4. *
  5. * For @b STM32_Connectivity_line_devices, this parameter can be any combination
  6. * of the following values:
  7. * @arg RCC_AHBPeriph_DMA1
  8. * @arg RCC_AHBPeriph_DMA2
  9. * @arg RCC_AHBPeriph_SRAM
  10. * @arg RCC_AHBPeriph_FLITF
  11. * @arg RCC_AHBPeriph_CRC
  12. * @arg RCC_AHBPeriph_OTG_FS
  13. * @arg RCC_AHBPeriph_ETH_MAC
  14. * @arg RCC_AHBPeriph_ETH_MAC_Tx
  15. * @arg RCC_AHBPeriph_ETH_MAC_Rx
  16. *
  17. * For @b other_STM32_devices, this parameter can be any combination of the
  18. * following values:
  19. * @arg RCC_AHBPeriph_DMA1
  20. * @arg RCC_AHBPeriph_DMA2
  21. * @arg RCC_AHBPeriph_SRAM
  22. * @arg RCC_AHBPeriph_FLITF
  23. * @arg RCC_AHBPeriph_CRC
  24. * @arg RCC_AHBPeriph_FSMC
  25. * @arg RCC_AHBPeriph_SDIO
  26. *
  27. * @note SRAM and FLITF clock can be disabled only during sleep mode.
  28. * @param NewState: new state of the specified peripheral clock.
  29. * This parameter can be: ENABLE or DISABLE.
  30. * @retval None
  31. */
  32. void RCC_AHBPeriphClockCmd(uint32_t RCC_AHBPeriph, FunctionalState NewState)
  33. {
  34. /* Check the parameters */
  35. assert_param(IS_RCC_AHB_PERIPH(RCC_AHBPeriph));
  36. assert_param(IS_FUNCTIONAL_STATE(NewState));
  37.  
  38. if (NewState != DISABLE)
  39. {
  40. RCC->AHBENR |= RCC_AHBPeriph;
  41. }
  42. else
  43. {
  44. RCC->AHBENR &= ~RCC_AHBPeriph;
  45. }
  46. }
  47.  
  48. /**
  49. * @brief Enables or disables the High Speed APB (APB2) peripheral clock.
  50. * @param RCC_APB2Periph: specifies the APB2 peripheral to gates its clock.
  51. * This parameter can be any combination of the following values:
  52. * @arg RCC_APB2Periph_AFIO, RCC_APB2Periph_GPIOA, RCC_APB2Periph_GPIOB,
  53. * RCC_APB2Periph_GPIOC, RCC_APB2Periph_GPIOD, RCC_APB2Periph_GPIOE,
  54. * RCC_APB2Periph_GPIOF, RCC_APB2Periph_GPIOG, RCC_APB2Periph_ADC1,
  55. * RCC_APB2Periph_ADC2, RCC_APB2Periph_TIM1, RCC_APB2Periph_SPI1,
  56. * RCC_APB2Periph_TIM8, RCC_APB2Periph_USART1, RCC_APB2Periph_ADC3,
  57. * RCC_APB2Periph_TIM15, RCC_APB2Periph_TIM16, RCC_APB2Periph_TIM17,
  58. * RCC_APB2Periph_TIM9, RCC_APB2Periph_TIM10, RCC_APB2Periph_TIM11
  59. * @param NewState: new state of the specified peripheral clock.
  60. * This parameter can be: ENABLE or DISABLE.
  61. * @retval None
  62. */
  63. void RCC_APB2PeriphClockCmd(uint32_t RCC_APB2Periph, FunctionalState NewState)
  64. {
  65. /* Check the parameters */
  66. assert_param(IS_RCC_APB2_PERIPH(RCC_APB2Periph));
  67. assert_param(IS_FUNCTIONAL_STATE(NewState));
  68. if (NewState != DISABLE)
  69. {
  70. RCC->APB2ENR |= RCC_APB2Periph;
  71. }
  72. else
  73. {
  74. RCC->APB2ENR &= ~RCC_APB2Periph;
  75. }
  76. }
  77.  
  78. /**
  79. * @brief Enables or disables the Low Speed APB (APB1) peripheral clock.
  80. * @param RCC_APB1Periph: specifies the APB1 peripheral to gates its clock.
  81. * This parameter can be any combination of the following values:
  82. * @arg RCC_APB1Periph_TIM2, RCC_APB1Periph_TIM3, RCC_APB1Periph_TIM4,
  83. * RCC_APB1Periph_TIM5, RCC_APB1Periph_TIM6, RCC_APB1Periph_TIM7,
  84. * RCC_APB1Periph_WWDG, RCC_APB1Periph_SPI2, RCC_APB1Periph_SPI3,
  85. * RCC_APB1Periph_USART2, RCC_APB1Periph_USART3, RCC_APB1Periph_USART4,
  86. * RCC_APB1Periph_USART5, RCC_APB1Periph_I2C1, RCC_APB1Periph_I2C2,
  87. * RCC_APB1Periph_USB, RCC_APB1Periph_CAN1, RCC_APB1Periph_BKP,
  88. * RCC_APB1Periph_PWR, RCC_APB1Periph_DAC, RCC_APB1Periph_CEC,
  89. * RCC_APB1Periph_TIM12, RCC_APB1Periph_TIM13, RCC_APB1Periph_TIM14
  90. * @param NewState: new state of the specified peripheral clock.
  91. * This parameter can be: ENABLE or DISABLE.
  92. * @retval None
  93. */
  94. void RCC_APB1PeriphClockCmd(uint32_t RCC_APB1Periph, FunctionalState NewState)
  95. {
  96. /* Check the parameters */
  97. assert_param(IS_RCC_APB1_PERIPH(RCC_APB1Periph));
  98. assert_param(IS_FUNCTIONAL_STATE(NewState));
  99. if (NewState != DISABLE)
  100. {
  101. RCC->APB1ENR |= RCC_APB1Periph;
  102. }
  103. else
  104. {
  105. RCC->APB1ENR &= ~RCC_APB1Periph;
  106. }
  107. }

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. h5 input无法输入问题 屏蔽长按事件

    开发h5 app中突然发现在手机上长按文本会出现复制粘贴菜单,只要是文本长按都会出现这种情况确实有些不太符合交互,为此特意去翻了一下博客,得到了已下解决方案: 将所有元素的系统默认菜单禁用掉 *{ - ...

  2. Android中的Parcel机制(上)

    一.先从Serialize说起 我们都知道JAVA中的Serialize机制,译成串行化.序列化--,其作用是能将数据对象存入字节流当中,在需要时重新生成对象.主要应用是利用外部存储设备保存对象状态, ...

  3. 关于移动端使用swiper做图片文字轮播的思考

    最近做移动端网页的时候,需要在首页添加一个公告的模块,用来轮播公告消息标题并且能链接到相应的详情页面,最开始用的是swiper插件,在安卓上测试完全没有问题,但是在苹果机上就没有那么灵敏了,来回切换首 ...

  4. NX二次开发-UFUN返回当前图纸页的Tag函数UF_DRAW_ask_current_drawing

    除了UF_DRAW_ask_current_drawing这个函数外,用UF_DRAW_ask_drawings也可以获得tag.UF_DRAW_ask_current_drawing只能获得当前这一 ...

  5. NX二次开发-UFUN关闭STL文件函数UF_STD_close_stl_file

    NX9+VS2012 #include <uf.h> #include <uf_obj.h> #include <uf_modl.h> #include <u ...

  6. KEIL, MDK 关于C99结构体变量初始化

    C99:here 例如声明了这样的结构体 void test1() { tt_t t1 ={ .a = , .d = 'd', .b = , .c = }; static tt_t t2 = { ,, ...

  7. 牛客练习赛26 A 平面(结论题)

    题目链接:https://ac.nowcoder.com/acm/contest/907/A 思路:结论题,当做2n条直线,参考资料https://blog.csdn.net/qq_34131212/ ...

  8. xml初步,DTD和Schema约束

    XML 可扩展的标记语言(!!!可扩展) 作用 1.存放数据 2.配置文件 语法 文档声明 <?xml version="1.0" encoding="UTF-8& ...

  9. Spring Boot 启动,1 秒搞定!

    Java技术栈 www.javastack.cn 优秀的Java技术公众号 原文: dev.to 翻译: ImportNew.com - 唐尤华译文: http://www.importnew.com ...

  10. 8张图带你轻松温习Java知识

    年初四好,一图胜千言,下面图解均来自Program Creek 网站,目前它们拥有最多的票选. 如果图解没有阐明问题,那么你可以借助它的标题来一窥究竟. 1 字符串不变性 下面这张图展示了这段代码做了 ...