logo资料库

STM32CubeMX用户手册中文版.pdf

第1页 / 共293页
第2页 / 共293页
第3页 / 共293页
第4页 / 共293页
第5页 / 共293页
第6页 / 共293页
第7页 / 共293页
第8页 / 共293页
资料共293页,剩余部分请下载后查看
1_STM32Cube_overview
2_Getting_started_with_STM32CubeMX
2.1_Principles
2.2_Key_features
2.3_Rules_and_limitations
3_Installing_and_running_STM32CubeMX
3.1_System_requirements
3.1.1_Supported_operating_systems_and_ar
3.1.2_Memory_prerequisites
3.1.3_Software_requirements
3.2_Installing/uninstalling_STM32CubeMX_
3.2.1_Installing_STM32CubeMX_standalone_
3.2.2_Installing_STM32CubeMX_from_comman
Interactive_mode
Auto-install_mode
3.2.3_Uninstalling_STM32CubeMX_standalon
Uninstalling_STM32CubeMX_on_MacOS
Uninstalling_STM32CubeMX_on_Linux
Uninstalling_STM32CubeMX_on_Windows
3.3_Installing_STM32CubeMX_plug-in_versi
3.3.1_Downloading_STM32CubeMX_plug-in_in
3.3.2_Installing_STM32CubeMX_as_an_Eclip
3.3.3_Uninstalling_STM32CubeMX_as_Eclips
3.4_Launching_STM32CubeMX
3.4.1_Running_STM32CubeMX_as_standalone_
3.4.2_Running_STM32CubeMX_in_command-lin
Table_1._Command_line_summary
3.4.3_Running_STM32CubeMX_plug-in_from_E
3.5_Getting_STM32Cube_updates
3.5.1_Updater_configuration
3.5.2_Downloading_new_libraries
3.5.3_Downloading_new_library_patches
3.5.4_Removing_libraries
3.5.5_Checking_for_updates
4_STM32CubeMX_User_Interface
4.1_Welcome_page
Table_2._Welcome_page_shortcuts
4.2_New_project_window
4.3_Main_window
4.4_Toolbar_and_menus
4.4.1_File_menu
Table_3._File_menu_functions
4.4.2_Project_menu
Table_4._Project_menu
4.4.3_Pinout_menu
Table_5._Pinout_menu
4.4.4_Window_menu
Table_6._Window_menu
4.4.5_Help_menu
Table_7._Help_menu
4.4.6_Social_links
4.5_Output_windows
4.5.1_MCUs_selection_pane
4.5.2_Output_pane
4.6_Import_Project_window
4.7_Set_unused_/_Reset_used_GPIOs_window
4.8_Project_Settings_window
4.8.1_Project_tab
4.8.2_Code_Generator_tab
STM32Cube_Firmware_Library_Package_optio
Generated_files_options
HAL_settings_options
Custom_code_template_options
4.8.3_Advanced_Settings_tab
Ordering_initialization_function_calls
Disabling_calls_to_initialization_functi
Choosing_between_HAL_and_LL_based_code_g
4.9_Update_Manager_windows
4.10_About_window
4.11_Pinout_view
4.11.1_Peripheral_and_Middleware_tree_pa
Table_8._Peripheral_and_Middleware_tree_
4.11.2_Chip_view
Tips_and_tricks
Icons_and_color_schemes
Table_9._STM32CubeMX_Chip_view_-_Icons_a
Tooltips
4.11.3_Chip_view_advanced_actions
Manually_modifying_pin_assignments
Manually_remapping_a_function_to_another
Manual_remapping_with_destination_pin_am
Resolving_pin_conflicts
4.11.4_Keep_Current_Signals_Placement
Keep_Current_Signals_Placement_is_unchec
Keep_Current_Signals_Placement_is_checke
Tip
4.11.5_Pinning_and_labeling_signals_on_p
4.11.6_Setting_HAL_timebase_source
Example_of_configuration_using_SysTick_w
Example_of_configuration_using_SysTick_a
Example_of_configuration_using_TIM2_as_H
4.12_Configuration_view
Table_10._Peripheral_and_middleware_conf
4.12.1_Peripherals_and_Middleware_Config
Table_11._Peripheral_and_Middleware_Conf
4.12.2_User_Constants_configuration_wind
Creating/editing_user_constants
Deleting_user_constants
Searching_for_user_constants
4.12.3_GPIO_Configuration_window
4.12.4_DMA_Configuration_window
4.12.5_NVIC_Configuration_window
Enabling_interruptions_using_the_NVIC_ta
Code_generation_options_for_interrupt_ha
4.12.6_FreeRTOS_middleware_configuration
Tasks_and_Queues_Tab
Timers,_Mutexes_and_Semaphores
FreeRTOS_heap_usage
4.13_Clock_tree_configuration_view
4.13.1_Clock_tree_configuration_function
External_clock_sources
Peripheral_clock_configuration_options
Table_12._Clock_tree_view_widget
4.13.2_Recommendations
4.13.3_STM32F43x/42x_power-over_drive_fe
Table_13._Voltage_scaling_versus_power_o
Table_14._Relations_between_power_over-d
4.13.4_Clock_tree_glossary
Table_15._Glossary
4.14_Power_Consumption_Calculator_view
4.14.1_Building_a_power_consumption_sequ
Selecting_a_VDD_value
Selecting_a_battery_model_(optional)
Power_sequence_default_view
Managing_sequence_steps
Adding_a_step
Editing_a_step
Moving_a_step
Deleting_a_step
Using_the_transition_checker
4.14.2_Configuring_a_step_in_the_power_s
Using_interpolation
Importing_pinout
Selecting/deselecting_all_peripherals
4.14.3_Managing_user-defined_power_seque
Managing_the_whole_sequence_(load,_save_
Managing_the_results_charts_and_display_
Overview_of_the_Results_summary_area
4.14.4_Power_sequence_step_parameters_gl
4.14.5_Battery_glossary
4.14.6_SMPS_feature
5_STM32CubeMX_C_Code_generation_overview
5.1_STM32Cube_code_generation_using_only
5.2_STM32Cube_code_generation_using_Low_
Table_16._LL_versus_HAL_code_generation:
Table_17._LL_versus_HAL_code_generation:
Table_18._LL_versus_HAL:_STM32CubeMX_gen
Table_19._LL_versus_HAL:_STM32CubeMX_gen
5.3_Custom_code_generation
5.3.1_STM32CubeMX_data_model_for_FreeMar
5.3.2_Saving_and_selecting_user_template
5.3.3_Custom_code_generation
5.4_Additional_settings_for_C_project_ge
Possible_entries_and_syntax
.extSettings_file_example_and_generated_
[Groups]
[Others]
6_Tutorial_1:_From_pinout_to_project_C_c
6.1_Creating_a_new_STM32CubeMX_Project
6.2_Configuring_the_MCU_pinout
6.3_Saving_the_project
6.4_Generating_the_report
6.5_Configuring_the_MCU_Clock_tree
6.6_Configuring_the_MCU_initialization_p
Reminder
6.6.1_Initial_conditions
6.6.2_Configuring_the_peripherals
6.6.3_Configuring_the_GPIOs
6.6.4_Configuring_the_DMAs
6.6.5_Configuring_the_middleware
6.7_Generating_a_complete_C_project
6.7.1_Setting_project_options
6.7.2_Downloading_firmware_package_and_g
6.8_Building_and_updating_the_C_code_pro
6.9_Switching_to_another_MCU
7_Tutorial_2_-_Example_of_FatFs_on_an_SD
8_Tutorial_3_-_Using_the_Power_Consumpti
8.1_Tutorial_overview
8.2_Application_example_description
8.3_Using_the_Power_Consumption_Calculat
8.3.1_Creating_a_power_sequence
8.3.2_Optimizing_application_power_consu
Step_1_(Run)
Step_4_(Run,_RTC)
Step_5_(Run,_ADC,_DMA,_RTC)
Step_6_(Sleep,_DMA,_ADC,RTC)
Step_7_(Run,_DMA,_RTC,_USART)
Step_8_(Stop_0,_USART)
Step_10_(RTC,_USART)
9_Tutorial_4_-_Example_of_UART_communica
9.1_Tutorial_overview
9.2_Creating_a_new_STM32CubeMX_project_a
9.3_Selecting_the_features_from_the_Pino
9.4_Configuring_the_MCU_clock_tree_from_
9.5_Configuring_the_peripheral_parameter
9.6_Configuring_the_project_settings_and
9.7_Updating_the_project_with_the_user_a
9.8_Compiling_and_running_the_project
9.9_Configuring_Tera_Term_software_as_se
10_Tutorial_5:_exporting_current_project
11_FAQ
11.1_On_the_Pinout_configuration_pane,_w
11.2_How_can_I_manually_force_a_function
11.3_Why_are_some_pins_highlighted_in_ye
11.4_Why_do_I_get_the_error_“Java_7_upda
11.5_Why_does_the_RTC_multiplexer_remain
11.6_How_can_I_select_LSE_and_HSE_as_clo
11.7_Why_STM32CubeMX_does_not_allow_me_t
11.8_Ethernet_Configuration:_why_cannot_
Appendix_A_STM32CubeMX_pin_assignment_ru
A.1_Block_consistency
Example_of_block_mapping_with_a_STM32F10
Example_of_block_remapping_with_a_STM32F
A.2_Block_inter-dependency
Example_of_block_remapping_of_SPI_in_ful
A.3_One_block_=_one_peripheral_mode
Example_of_STM32F107x_MCU
A.4_Block_remapping_(STM32F10x_only)
A.5_Function_remapping
Example_using_STM32F415x
A.6_Block_shifting_(only_for_STM32F10x_a
Example
A.7_Setting_and_clearing_a_peripheral_mo
A.8_Mapping_a_function_individually
A.9_GPIO_signals_mapping
Appendix_B_STM32CubeMX_C_code_generation
B.1_STM32CubeMX_generated_C_code_and_use
B.2_STM32CubeMX_design_choices_for_perip
B.3_STM32CubeMX_design_choices_and_limit
B.3.1_Overview
B.3.2_USB_Host
B.3.3_USB_Device
B.3.4_FatFs
B.3.5_FreeRTOS
B.3.6_LwIP
B.3.7_Libjpeg
Appendix_C_STM32_microcontrollers_naming
Appendix_D_STM32_microcontrollers_power_
D.1_Power_modes
D.1.1_STM32L1_Series
D.1.2_STM32F4_Series
D.1.3_STM32L0_Series
D.2_Power_consumption_ranges
D.2.1_STM32L1_Series_feature_3_VCORE_ran
D.2.2_STM32F4_Series_feature_several_VCO
D.2.3_STM32L0_Series_feature_3_VCORE_ran
Appendix_E_STM32Cube_embedded_software_p
12_Revision_history
Table_20._Document_revision_history_(con
UM1718 用户手册 介绍 STM32CubeMX用于STM32的配置和初始化C 代码生成 STM32CubeMX是32位ARM®Cortex®STM32微控制器的图形工具。 它是STMCube™计划的一部分 (请参阅第一节),可以作为独立的应用程序使用,也可以作为集成开发环境(IDE)中集成 的Eclipse插件使用。 STM32CubeMX具有以下主要特点:  简单的微控制器选择涵盖整个STM32系列  从意法半导体电路板上选择电路板  简单的微控制器配置(引脚,时钟树,外设,中间件)并生成相应的初始化C代码  通过将以前保存的配置导入到新的MCU项目,轻松切换到另一个微控制器  轻松导出当前配置到兼容的MCU  生成配置报告  为选择集成的开发环境工具链生成嵌入式C项目。 STM32CubeMX项目包括生成的初始化C 代码,兼容MISRA 2004的STM32 HAL驱动程序,用户配置所需的中间件堆栈以及用于在所 选IDE中打开和构建项目的所有相关文件。  用户定义应用程序的功耗计算  自更新允许用户保持STM32CubeMX的最新状态  下载和更新用户应用程序开发所需的STM32Cube嵌入式软件(请参阅附录E:STM32Cube嵌 入式软件包 有关STM32Cube嵌入式软件产品的详细信息) 虽然STM32CubeMX提供了一个用户界面,并生成符合STM32 MCU设计和固件解决方案的C代码, 但建议参考产品技术文档以获取有关微控制器外设和固件实际实现的详细信息。 以下文件可从http://www.st.com: STM32微控制器参考手册和数据表   用于STM32F0(UM1785),STM32F1(UM1850),STM32F2(UM1940),STM32F3 (UM1786),STM32F4(UM1725),STM32F7(UM1905),STM32L0(UM1749),STM32L1 (UM1816),STM32L4 / L4 +(UM1884)和STM32H7(UM2217)。 2017年9月 www.st.com DocID025776 Rev 22 1/277
Contents 内容 1 2 3 UM1718 STM32Cube概述 .................................................. 14 STM32CubeMX入门 ................................................ 15 2.1 原则 ............................................................ 15 2.2 主要特征 ........................................................ 17 2.3 规则和限制 ...................................................... 18 安装和运行STM32CubeMX ........................................... 19 3.1 系统要求 ........................................................ 19 3.1.1 支持的操作系统和体系结构 ...................................... 19 3.1.2 内存先决条件 .................................................. 19 3.1.3 软件要求 ...................................................... 19 3.2 安装/卸载STM32CubeMX独立版本 .................................... 19 3.2.1 安装STM32CubeMX独立版本 ....................................... 19 3.2.2 从命令行安装STM32CubeMX ....................................... 20 3.2.3 卸载STM32CubeMX独立版本 ....................................... 23 3.3 安装STM32CubeMX插件版本 ......................................... 24 3.3.1 下载STM32CubeMX插件安装包 ..................................... 24 3.3.2 安装STM32CubeMX作为Eclipse IDE插件 ............................ 24 3.3.3 卸载STM32CubeMX作为Eclipse IDE插件 ............................ 25 3.4 启动STM32CubeMX ................................................. 27 3.4.1 运行STM32CubeMX作为独立的应用程序 ............................. 27 3.4.2 以命令行模式运行STM32CubeMX ................................... 27 3.4.3 从Eclipse IDE运行STM32CubeMX插件 .............................. 30 3.5 获取STM32Cube更新 ............................................... 31 3.5.1 更新程序配置 .................................................. 33 3.5.2 下载新库 ...................................................... 36 3.5.3 下载新的库补丁 ................................................ 38 3.5.4 删除库 ........................................................ 38 3.5.5 查询更新 ...................................................... 40 2/277 DocID025776 Rev 22
STM32CubeMX用户界面............................................. 41 4.1 欢迎页面 ........................................................ 41 Contents 4.2 新的项目窗口 .................................................... 43 4.3 主窗口 .......................................................... 48 4.4 工具栏和菜单 .................................................... 51 4.4.1 文件菜单 ...................................................... 51 4.4.2 项目菜单 ...................................................... 52 4.4.3 引脚分布菜单 .................................................. 52 4.4.4 窗口菜单 ...................................................... 55 4.4.5 帮助菜单 ...................................................... 55 4.4.6 社交链接 ...................................................... 55 4.5 输出窗口 ........................................................ 56 4.5.1 MCUs选择窗格 .................................................. 56 4.5.2 输出窗格 ...................................................... 56 4.6 导入项目窗口 .................................................... 57 4.7 设置未使用/重置使用的GPIO窗口 ................................... 63 4.8 项目设置窗口 .................................................... 65 4.8.1 项目选项卡 .................................................... 67 4.8.2 代码生成器标签 ................................................ 70 4.8.3 高级设置选项卡 ................................................ 73 4.9 更新管理器窗口 .................................................. 74 4.10 关于窗口 ........................................................ 75 4.11 引脚视图 ........................................................ 75 4.11.1 外设和中间件树窗格 ............................................ 77 4.11.2 芯片视图 ...................................................... 78 4.11.3 芯片查看高级操作 .............................................. 81 4.11.4 保持当前的信号布局 ............................................ 83 4.11.5 在引脚上固定和标记信号 ........................................ 84 4.11.6 设置HAL时基源 ................................................. 85 4.12 配置视图 ........................................................ 91 4.12.1 外围设备和中间件配置窗口 ...................................... 93 4.12.2 用户常量配置窗口 .............................................. 96 4.12.3 GPIO配置窗口 ................................................. 101 DocID025776 Rev 22 3/277 UM1718 4
Contents UM1718 4.12.4 4.12.5 4.12.6 DMA配置窗口 .................................................. 104 NVIC配置窗口 ................................................. 107 FreeRTOS中间件配置视图 ....................................... 115 4.13 时钟树配置视图 ................................................. 122 4.13.1 时钟树配置功能 ............................................... 122 4/277 DocID025776 Rev 22
UM1718 Contents 4.13.2 建议 ........................................................ 127 4.13.3 STM32F43x / 42x供电驱动功能 .................................. 128 4.13.4 时钟树术语表 ................................................. 130 4.14 功耗计算器视图 ................................................. 130 4.14.1 建立功耗顺序 ................................................. 131 4.14.2 在电源序列中配置一个步骤 ..................................... 138 4.14.3 管理用户定义的电源顺序并查看结果 ............................. 142 4.14.4 功率序列步骤参数术语表 ....................................... 145 4.14.5 电池词汇表 ................................................... 148 4.14.6 SMPS功能 ..................................................... 148 STM32CubeMX C代码生成概 述. . . . . . . . . . . . . . . . . . . STM32Cube代码生成只使用HAL驱动程序 5.1 (默认模 式). . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 5.2 使用低层驱动程序生成STM32Cube代 码. . . . . . . . . . . . . 5.3 自定义代码生 成. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 153 153 155 161 5.3.1 STM32CubeMX数据模型的FreeMarker用户模板 ...................... 161 5.3.2 保存并选择用户模板 ........................................... 161 5.3.3 自定义代码生成 ............................................... 162 5.4 C项目生成的其他设置 ............................................ 165 5 6 教程1:从引脚到项目C代码生成 使用STM32F4 MCU ............................................... 169 6.1 创建一个新的STM32CubeMX项目 .................................... 169 6.2 配置MCU引脚 .................................................... 172 6.3 保存项目 ....................................................... 173 6.4 生成报告 ....................................................... 174 6.5 配置MCU时钟树 .................................................. 174 6.6 配置MCU初始化参数 .............................................. 177 6.6.1 初始条件 ..................................................... 177 6.6.2 配置外围设备 ................................................. 178 DocID025776 Rev 22 5/277
Contents 6.6.3 配置GPIO ..................................................... 181 6.6.4 配置DMA...................................................... 182 6.6.5 配置中间件 ................................................... 183 UM1718 6.7 生成一个完整的C项目 ............................................ 186 6.7.1 设置项目选项 ................................................. 186 6/277 DocID025776 Rev 22
UM1718 Contents 6.7.2 下载固件包并生成C代码 ........................................ 188 6.8 构建和更新C代码项目 ............................................193 6.9 切换到另一个MCU ................................................ 198 教程2 - 使用SD卡的FatFs示例STM32429I-EVAL评估板 200 教程3 - 使用功耗计算器 优化嵌入式应用程序的消耗等等 .................................. 207 8.1 教程概述 ....................................................... 207 8.2 应用实例说明 ................................................... 208 8.3 使用功耗计算器 ................................................. 208 8.3.1 创建一个电源序列 ............................................. 208 8.3.2 优化应用程序功耗 ............................................. 211 教程4 - 与UART通信的例子STM32L053xx Nucleo 板 . . . . . . . . . . . . . . . . . . . . 219 9.1 教程概述. . . . . . . . . . 9.2 创建一个新的STM32CubeMX项目和选择Nucleo板 9.3 从“引脚分布”视图中选择要 素. . . . . . . . . . . . . . . . . . . . . . 9.4 从“时钟配置”视图配置MCU时钟树. . . . 9.5 从“配置”视图中配置外围参数. . . 9.6 配置项目设置并生成项目. . . . . . . . . . 9.7 使用用户应用程序代码更新项 目. . . . . . . . . . . . . . . 9.8 编译和运行项 目. . . . . . . . . . . . . . . . . . . 9.9 将Tera Term软件配置为串行通信 在PC上的客户端. . . . . . . . . . . . . . . 219 219 221 223 224 227 228 229 229 教程5:导出当前的项目配置 兼容的MCU ..................................................... 231 7 8 9 10 11 常问问 235 题 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . DocID025776 Rev 22 7/277
Contents 11.1 在引脚配置面板上,为什么STM32CubeMX 当我添加一个新的外设模式时移动一些功 能? . . . . . . . . . . 11.2 我如何手动强制重新映射功能? . . . . . . . . . UM1718 235 235 11.3 为什么芯片视图中一些引脚以黄色或浅绿色突出显示? 为 什么我不能改变一些功能 引脚(当我点击一些引脚,没有任何反应)? ....................... 235 11.4 为什么安装时会出现“Java 7 update 45”错误? “Java 7更新45”还是更新版本的JRE? ............................ 235 11.5 为什么RTC多路复用器在时钟树视图中保持不活动状态? 236 11.6 如何选择LSE和HSE作为时钟源 改变频率? ..................................................... 237 11.7 为什么STM32CubeMX不允许我配置PC13, 其中一个为PC14,PC15和PI8作为输出 已经配置为输出? ............................................... 237 11.8 以太网配置:为什么在某些情况下我不能指定DP83848或LAN8742A? .... 238 附录A STM32CubeMX引脚分配规则 .................................... 239 A.1 块一致性 ....................................................... 239 A.2 阻止相互依赖 ................................................... 243 A.3 一个块=一个外设模式 ............................................ 246 A.4 块重映射(仅限STM32F10x) ...................................... 246 A.5 功能重新映射 ................................................... 247 A.6 块移位(仅适用于STM32F10x和何时 “保持当前信号的位置”未被选中) ............................... 248 A.7 设置和清除外设模式。 ........................................... 249 A.8 单独映射功能 ................................................... 249 A.9 GPIO信号映射 ................................................... 249 附录B STM32CubeMX C代码生成设计 选择和限制 ................................................. 250 B.1 B.2 B.3 STM32CubeMX生成C代码和用户部分 ................................. 250 STM32CubeMX设计用于外设初始化的选择 ............................ 250 STM32CubeMX的设计选择和局限性 中间件初始化 ................................................... 251 B.3.1 概观 ........................................................ 251 8/277 DocID025776 Rev 22
分享到:
收藏