[STM32F4] 开头配置

[复制链接]
1014|11
 楼主| ousj 发表于 2019-6-16 14:55 | 显示全部楼层 |阅读模式
  /* Enable Power Control clock */
  __HAL_RCC_PWR_CLK_ENABLE();
  
  /* The voltage scaling allows optimizing the power consumption when the device is
     clocked below the maximum system frequency, to update the voltage scaling value
     regarding system frequency refer to product datasheet.  */
  __HAL_PWR_VOLTAGESCALING_CONFIG(PWR_REGULATOR_VOLTAGE_SCALE1);
发现例子都有这两句开头配置,不知道是对应哪个东西啊,在手册里的时钟系统,没看到这个概念啊。
 楼主| ousj 发表于 2019-6-16 14:58 | 显示全部楼层
如果只是照葫芦画瓢,每次抄来的话,心里不踏实。求高人赐教。
airwill 发表于 2019-6-16 15:10 | 显示全部楼层
导入例子工程,编译后就能通过导航找到宏的具体定义,可以看一下
hanzhen654 发表于 2019-6-16 19:25 | 显示全部楼层
都是改人家的代码,自己用
小灵通2018 发表于 2019-6-16 22:23 | 显示全部楼层
给芯片上电呢。
天灵灵地灵灵 发表于 2019-6-16 22:42 | 显示全部楼层
看看对应函数原型
gongche 发表于 2019-6-22 14:27 | 显示全部楼层
  /* Enable Power Control clock */
  __HAL_RCC_PWR_CLK_ENABLE();

  /* The voltage scaling allows optimizing the power consumption when the device is
     clocked below the maximum system frequency, to update the voltage scaling value
     regarding system frequency refer to product datasheet.  */
  __HAL_PWR_VOLTAGESCALING_CONFIG(PWR_REGULATOR_VOLTAGE_SCALE1);
从469系列单片机的例子看,也是有的,说明就是固定套路。
huwr 发表于 2019-6-22 14:30 | 显示全部楼层
__HAL_RCC_PWR_CLK_ENABLE();开启或使能电源控制接口外设时钟
RCC_APB1ENR@PWREN: Power interface clock enable
This bit is set and cleared by software.
0: Power interface clock disabled     1: Power interface clock enable
huanghuac 发表于 2019-6-22 14:33 | 显示全部楼层
__HAL_PWR_VOLTAGESCALING_CONFIG;
对内部主稳压器输出电压进行配置,以实现不同工作电压和最高工作频率的选择,使功耗和性能得到合理优化。 具体请参看STM32相关系列参考手册的power supplies 和寄存器pwr_cr的VOS位之描述,部分数据可以查看芯片数据手册。
happy_10 发表于 2019-6-22 14:36 | 显示全部楼层
这个是库函数封装的电源配置,具体你看F12进去看看
 楼主| ousj 发表于 2019-6-22 14:41 | 显示全部楼层

哦,那我就知道怎么回事了,多谢大家,结贴了哈
玛尼玛尼哄 发表于 2019-6-22 21:42 | 显示全部楼层
我从来没想过这个问题,楼主想的好。
您需要登录后才可以回帖 登录 | 注册

本版积分规则

712

主题

7557

帖子

1

粉丝
快速回复 在线客服 返回列表 返回顶部