没有合适的资源?快使用搜索试试~ 我知道了~
首页STM32CubeMX用户手册.pdf
STM32CubeMX用户手册.pdf
需积分: 44 27 下载量 6 浏览量
更新于2023-03-03
评论 1
收藏 29.43MB PDF 举报
本手册将由浅入深,带领大家进入 STM32 的世界。本手册总共分为三篇:1,硬件篇,主 要介绍我们的实验平台;2,软件篇,主要介绍 STM32 开发软件的使用以及一些下载调试的技 巧,并详细介绍了几个常用的系统文件(程序);3,实战篇,主要通过 38 个实例(绝大部分是 直接操作 HAL 库完成的)带领大家一步步深入 STM32 的学习。 本手册为 ALIENTEK MiniSTM32 V3.0 开发板的配套教程,在开发板配套的光盘里面,有 详细原理图以及所有实例的完整代码,这些代码都有详细的注释,所有源码都经过我们严格测 试,不会有任何警告和错误,另外,源码有我们生成好的 hex 文件,大家只需要通过串口/仿真 器下载到开发板即可看到实验现象,亲自体验实验过程。
资源详情
资源评论
资源推荐
October 2019 UM1718 Rev 30 1/365
1
UM1718
User manual
STM32CubeMX for STM32 configuration
and initialization C code generation
Introduction
STM32CubeMX is a graphical tool for STM32 microcontrollers. It is part of the STM32Cube
initiative (see
Section 1) and is available either as a standalone application as well as in
STM32CubeIDE toolchain.
STM32CubeMX has the following key features:
• Easy microcontroller selection covering the whole STM32 portfolio
• Board selection from a list of STMicroelectronics boards
• Easy microcontroller configuration (pins, clock tree, peripherals, middleware) and
generation of the corresponding initialization C code
• Easy switching to another microcontroller by importing a previously-saved
configuration to a new MCU project
• Easy exporting of current configuration to a compatible MCU
• Generation of configuration reports
• Generation of embedded C projects for a selection of integrated development
environment tool chains. STM32CubeMX projects include the generated initialization C
code, MISRA 2004 compliant STM32 HAL drivers, the middleware stacks required for the
user configuration, and all the relevant files for opening and building the project in the
selected IDE.
• Power consumption calculation for a user-defined application sequence
• Self-updates allowing the user to keep STM32CubeMX up-to-date
• Download and update of STM32Cube embedded software required for user application
development (see Appendix E for details on the STM32Cube embedded software offer)
Although STM32CubeMX offers a user interface and generates C code compliant with
STM32 MCU design and firmware solutions, users need to refer to the product technical
documentation for details on actual implementations of microcontroller peripherals and
firmware.
The following documents are available from www.st.com:
• STM32 microcontroller reference manuals and datasheets
• STM32Cube HAL/LL driver user manuals for STM32F0 (UM1785), STM32F1
(UM1850), STM32F2 (UM1940), STM32F3 (UM1786), STM32F4 (UM1725), STM32F7
(UM1905), STM32G0 (UM2303), STM32G4 (UM2570), STM32H7 (UM2217),
STM32L0 (UM1749), STM32L1 (UM1816), STM32L4/L4+ (UM1884), STM32MP1
(https://wiki.st.com/stm32mpu) and STM32WB (UM2442).
www.st.com
Contents UM1718
2/365 UM1718 Rev 30
Contents
1 STM32Cube overview . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 17
2 Getting started with STM32CubeMX . . . . . . . . . . . . . . . . . . . . . . . . . . . 18
2.1 Principles . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 18
2.2 Key features . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 20
2.3 Rules and limitations . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 22
3 Installing and running STM32CubeMX . . . . . . . . . . . . . . . . . . . . . . . . . 23
3.1 System requirements . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 23
3.1.1 Supported operating systems and architectures . . . . . . . . . . . . . . . . . . 23
3.1.2 Memory prerequisites . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 23
3.1.3 Software requirements . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 23
3.2 Installing/uninstalling STM32CubeMX standalone version . . . . . . . . . . . 23
3.2.1 Installing STM32CubeMX standalone version . . . . . . . . . . . . . . . . . . . . 23
3.2.2 Installing STM32CubeMX from command line . . . . . . . . . . . . . . . . . . . 25
3.2.3 Uninstalling STM32CubeMX standalone version . . . . . . . . . . . . . . . . . 27
3.3 Launching STM32CubeMX . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 28
3.3.1 Running STM32CubeMX as standalone application . . . . . . . . . . . . . . . 28
3.3.2 Running STM32CubeMX in command-line mode . . . . . . . . . . . . . . . . . 28
3.4 Getting updates using STM32CubeMX . . . . . . . . . . . . . . . . . . . . . . . . . . 32
3.4.1 Updater configuration . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 33
3.4.2 Installing STM32 MCU packages . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 36
3.4.3 Installing STM32 MCU package patches . . . . . . . . . . . . . . . . . . . . . . . . 37
3.4.4 Installing embedded software packs . . . . . . . . . . . . . . . . . . . . . . . . . . . 37
3.4.5 Removing already installed embedded software packages . . . . . . . . . . 42
3.4.6 Checking for updates . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 44
4 STM32CubeMX user interface . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 45
4.1 Home page . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 46
4.1.1 File menu . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 47
4.1.2 Window menu and Outputs tabs . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 48
4.1.3 Help menu . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 50
4.1.4 Social links . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 50
4.2 New Project window . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 51
UM1718 Rev 30 3/365
UM1718 Contents
8
4.2.1 MCU selector . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 52
4.2.2 Board selector . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 56
4.2.3 Cross selector . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 56
4.3 Project page . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 59
4.4 Pinout & Configuration view . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 62
4.4.1 Component list . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 63
4.4.2 Component Mode panel . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 65
4.4.3 Pinout view . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 66
4.4.4 Pinout menu and shortcuts . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 67
4.4.5 Pinout view advanced actions . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 69
4.4.6 Keep Current Signals Placement . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 70
4.4.7 Pinning and labeling signals on pins . . . . . . . . . . . . . . . . . . . . . . . . . . . 71
4.4.8 Pinout for multi-bonding packages . . . . . . . . . . . . . . . . . . . . . . . . . . . . 72
4.4.9 System view . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 73
4.4.10 Component Configuration panel . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 76
4.4.11 User Constants configuration window . . . . . . . . . . . . . . . . . . . . . . . . . . 78
4.4.12 GPIO Configuration window . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 83
4.4.13 DMA Configuration window . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 85
4.4.14 NVIC Configuration window . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 87
4.4.15 FreeRTOS configuration panel . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 94
4.4.16 Graphics frameworks and simulator . . . . . . . . . . . . . . . . . . . . . . . . . . . 99
4.4.17 Setting HAL timebase source . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 101
4.5 Pinout & Configuration view for STM32MP1 Series . . . . . . . . . . . . . . . . 105
4.5.1 Run time configuration . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 106
4.5.2 Boot stages configuration . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 107
4.6 Pinout & Configuration view for STM32H7 dual-core product lines . . . . 108
4.7 Clock Configuration view . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .110
4.7.1 Clock tree configuration functions . . . . . . . . . . . . . . . . . . . . . . . . . . . . 111
4.7.2 Recommendations . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 115
4.7.3 STM32F43x/42x power-over drive feature . . . . . . . . . . . . . . . . . . . . . 116
4.7.4 Clock tree glossary . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 117
4.8 Project Manager view . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .118
4.8.1 Project tab . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 119
4.8.2 Code Generator tab . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 124
4.8.3 Advanced Settings tab . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 128
4.9 Import Project window . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 130
Contents UM1718
4/365 UM1718 Rev 30
4.10 Set unused / Reset used GPIOs windows . . . . . . . . . . . . . . . . . . . . . . . 136
4.11 Update Manager windows . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 138
4.12 Additional software component selection window . . . . . . . . . . . . . . . . . 139
4.12.1 Introduction on software components . . . . . . . . . . . . . . . . . . . . . . . . . 140
4.12.2 Filter panel . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 141
4.12.3 Packs panel . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 141
4.12.4 Component dependencies panel . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 143
4.12.5 Details and Warnings panel . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 143
4.12.6 Updating the tree view for additional software components . . . . . . . . 145
4.13 About window . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 147
5 STM32CubeMX tools . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 148
5.1 Power Consumption Calculator view . . . . . . . . . . . . . . . . . . . . . . . . . . . 148
5.1.1 Building a power consumption sequence . . . . . . . . . . . . . . . . . . . . . . 149
5.1.2 Configuring a step in the power sequence . . . . . . . . . . . . . . . . . . . . . 154
5.1.3 Managing user-defined power sequence and reviewing results . . . . . 157
5.1.4 Power sequence step parameters glossary . . . . . . . . . . . . . . . . . . . . . 160
5.1.5 Battery glossary . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 162
5.1.6 SMPS feature . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 162
5.1.7 BLE support (STM32WB Series only) . . . . . . . . . . . . . . . . . . . . . . . . . 168
5.1.8 Example feature (STM32MP1 and STM32H7 dual-core only) . . . . . . 169
5.2 DDR Suite (for STM32MP1 Series only) . . . . . . . . . . . . . . . . . . . . . . . . 171
5.2.1 DDR configuration . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 172
5.2.2 Connection to the target and DDR register loading . . . . . . . . . . . . . . . 176
5.2.3 DDR testing . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 179
5.2.4 DDR tuning . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 181
6 STM32CubeMX C Code generation overview . . . . . . . . . . . . . . . . . . . 185
6.1 STM32Cube code generation using only HAL drivers
(default mode) . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 185
6.2 STM32Cube code generation using Low Layer drivers . . . . . . . . . . . . . 187
6.3 Custom code generation . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 193
6.3.1 STM32CubeMX data model for FreeMarker user templates . . . . . . . . 193
6.3.2 Saving and selecting user templates . . . . . . . . . . . . . . . . . . . . . . . . . . 194
6.3.3 Custom code generation . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 194
6.4 Additional settings for C project generation . . . . . . . . . . . . . . . . . . . . . . 196
UM1718 Rev 30 5/365
UM1718 Contents
8
7 Code generation for dual-core MCUs
(STM32H7 dual-core product lines only) . . . . . . . . . . . . . . . . . . . . . . . 200
8 Device tree generation (STM32MP1 Series only) . . . . . . . . . . . . . . . . 202
8.1 Device tree overview . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 202
8.2 STM32CubeMX Device tree generation . . . . . . . . . . . . . . . . . . . . . . . . . 204
8.2.1 Device tree generation for Linux kernel . . . . . . . . . . . . . . . . . . . . . . . . 205
8.2.2 Device tree generation for U-boot . . . . . . . . . . . . . . . . . . . . . . . . . . . . 206
8.2.3 Device tree generation for TF-A . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 207
9 Support of additional software components using
CMSIS-Pack standard . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 208
10 Tutorial 1: From pinout to project C code generation
using an MCU of the STM32F4 Series . . . . . . . . . . . . . . . . . . . . . . . . . 211
10.1 Creating a new STM32CubeMX Project . . . . . . . . . . . . . . . . . . . . . . . . .211
10.2 Configuring the MCU pinout . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 213
10.3 Saving the project . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 216
10.4 Generating the report . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 217
10.5 Configuring the MCU clock tree . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 217
10.6 Configuring the MCU initialization parameters . . . . . . . . . . . . . . . . . . . . 220
10.6.1 Initial conditions . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 220
10.6.2 Configuring the peripherals . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 221
10.6.3 Configuring the GPIOs . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 223
10.6.4 Configuring the DMAs . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 225
10.6.5 Configuring the middleware . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 226
10.7 Generating a complete C project . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 230
10.7.1 Setting project options . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 230
10.7.2 Downloading firmware package and generating the C code . . . . . . . . 231
10.8 Building and updating the C code project . . . . . . . . . . . . . . . . . . . . . . . . 236
10.9 Switching to another MCU . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 241
11 Tutorial 2 - Example of FatFs on an SD card using
STM32429I-EVAL evaluation board . . . . . . . . . . . . . . . . . . . . . . . . . . . 242
12 Tutorial 3 - Using the Power Consumption Calculator
to optimize the embedded application consumption and more . . . . 250
剩余364页未读,继续阅读
小小码农正在搬砖中
- 粉丝: 63
- 资源: 3
上传资源 快速赚钱
- 我的内容管理 收起
- 我的资源 快来上传第一个资源
- 我的收益 登录查看自己的收益
- 我的积分 登录查看自己的积分
- 我的C币 登录后查看C币余额
- 我的收藏
- 我的下载
- 下载帮助
会员权益专享
最新资源
- ExcelVBA中的Range和Cells用法说明.pdf
- 基于单片机的电梯控制模型设计.doc
- 主成分分析和因子分析.pptx
- 共享笔记服务系统论文.doc
- 基于数据治理体系的数据中台实践分享.pptx
- 变压器的铭牌和额定值.pptx
- 计算机网络课程设计报告--用winsock设计Ping应用程序.doc
- 高电压技术课件:第03章 液体和固体介质的电气特性.pdf
- Oracle商务智能精华介绍.pptx
- 基于单片机的输液滴速控制系统设计文档.doc
- dw考试题 5套.pdf
- 学生档案管理系统详细设计说明书.doc
- 操作系统PPT课件.pptx
- 智慧路边停车管理系统方案.pptx
- 【企业内控系列】企业内部控制之人力资源管理控制(17页).doc
- 温度传感器分类与特点.pptx
资源上传下载、课程学习等过程中有任何疑问或建议,欢迎提出宝贵意见哦~我们会及时处理!
点击此处反馈
安全验证
文档复制为VIP权益,开通VIP直接复制
信息提交成功
评论0