没有合适的资源?快使用搜索试试~ 我知道了~
首页STM32F7HAL库函数开发手册
资源详情
资源评论
资源推荐

February 2017
DocID027932 Rev 3
1/1967
www.st.com
UM1905
User Manual
Description of STM32F7 HAL and Low-layer drivers
Introduction
STMCube
TM
is STMicroelectronics's original initiative to ease developers' life by reducing development
efforts, time and cost. STM32Cube covers the STM32 portfolio.
STM32Cube Version 1.x includes:
The STM32CubeMX, a graphical software configuration tool that allows generating C initialization
code using graphical wizards.
A comprehensive embedded software platform, delivered per series (such as STM32CubeF7 for
STM32F7 Series)
The STM32Cube Hardware Abstraction Layer (HAL), an STM32 abstraction layer embedded
software, ensuring maximized portability across the STM32 portfolio
A consistent set of middleware components such as RTOS, USB, TCP/IP, Graphics
The Low Layer APIs (LL) offering a fast, light-weight, expert-oriented layer which is closer to
the hardware than the HAL. The LL APIs are available only for a set of peripherals.
All embedded software utilities coming with a full set of examples.
The HAL driver layer provides a generic multi-instance simple set of APIs (application programming
interfaces) to interact with the upper layer (application, libraries and stacks).
The HAL driver APIs are split into two categories: generic APIs which provide common and generic
functions for all the STM32 series and extension APIs which include specific and customized functions
for a given family or part number. The HAL drivers include a complete set of ready-to-use APIs which
simplify the user application implementation. As an example, the communication peripherals contain
APIs to initialize and configure the peripheral, to manage data transfers based on polling, to handle
interrupts or DMA, and to manage communication errors.
The HAL drivers are feature-oriented instead of IP-oriented. As an example, the timer APIs are split into
several categories following the functions offered by the IP: basic timer, capture, pulse width modulation
(PWM), etc. The HAL driver layer implements run-time failure detection by checking the input values of
all functions. Such dynamic checking contributes to enhance the firmware robustness. Run-time
detection is also suitable for user application development and debugging.
The LL drivers offer hardware services based on the available features of the STM32 peripherals. These
services reflect exactly the hardware capabilities and provide atomic operations that must be called
following the programming model described in the product line reference manual. As a result, the LL
services are not based on standalone processes and do not require any additional memory resources to
save their states, counter or data pointers: all operations are performed by changing the associated
peripheral registers content. Contrary to the HAL, the LL APIs are not provided for peripherals for which
optimized access is not a key feature, or for those requiring heavy software configuration and/or
complex upper level stack (such as FSMC, USB, SDMMC).
The HAL and LL are complementary and cover a wide range of applications requirements:
The HAL offers high-level and feature-oriented APIs, with a high-portability level. They hide the
MCU and peripheral complexity to end-user.
The LL offers low-level APIs at registers level, with better optimization but less portability. They
require deep knowledge of the MCU and peripherals specifications.
The source code of HAL and LL drivers is developed in Strict ANSI-C which makes it independent from
the development tools. It is checked with CodeSonar™ static analysis tool. It is fully documented and is
MISRA-C 2004 compliant.

Contents
UM1905
2/1967
DocID027932 Rev 3
Contents
1 Acronyms and definitions ............................................................. 33
2 Overview of HAL drivers ............................................................... 35
2.1 HAL and user-application files......................................................... 35
2.1.1 HAL driver files ................................................................................. 35
2.1.2 User-application files ........................................................................ 36
2.2 HAL data structures ........................................................................ 38
2.2.1 Peripheral handle structures ............................................................ 38
2.2.2 Initialization and configuration structure ........................................... 39
2.2.3 Specific process structures .............................................................. 39
2.3 API classification ............................................................................. 39
2.4 Devices supported by HAL drivers .................................................. 40
2.5 HAL driver rules .............................................................................. 46
2.5.1 HAL API naming rules ...................................................................... 46
2.5.2 HAL general naming rules ................................................................ 47
2.5.3 HAL interrupt handler and callback functions ................................... 48
2.6 HAL generic APIs ............................................................................ 48
2.7 HAL extension APIs ........................................................................ 50
2.7.1 HAL extension model overview ........................................................ 50
2.7.2 HAL extension model cases ............................................................. 50
2.8 File inclusion model ......................................................................... 52
2.9 HAL common resources .................................................................. 53
2.10 HAL configuration ............................................................................ 53
2.11 HAL system peripheral handling ..................................................... 54
2.11.1 Clock ................................................................................................. 54
2.11.2 GPIOs ............................................................................................... 55
2.11.3 Cortex NVIC and SysTick timer ........................................................ 56
2.11.4 PWR ................................................................................................. 56
2.11.5 EXTI .................................................................................................. 57
2.11.6 DMA .................................................................................................. 58
2.12 How to use HAL drivers .................................................................. 59
2.12.1 HAL usage models ........................................................................... 59
2.12.2 HAL initialization ............................................................................... 60
2.12.3 HAL IO operation process ................................................................ 63
2.12.4 Timeout and error management ....................................................... 66
3 Overview of Low Layer drivers ..................................................... 70

UM1905
Contents
DocID027932 Rev 3
3/1967
3.1 Low Layer files ................................................................................ 70
3.2 Overview of Low Layer APIs and naming rules ............................... 72
3.2.1 Peripheral initialization functions ...................................................... 72
3.2.2 Peripheral register-level configuration functions .............................. 75
4 Cohabiting of HAL and LL ............................................................ 78
4.1 Low Layer driver used in standalone mode ..................................... 78
4.2 Mixed use of Low Layer APIs and HAL drivers ............................... 78
5 HAL System Driver ........................................................................ 79
5.1 HAL Firmware driver API description .............................................. 79
5.1.1 How to use this driver ....................................................................... 79
5.1.2 Initialization and de-initialization functions ....................................... 79
5.1.3 HAL Control functions....................................................................... 79
5.1.4 Detailed description of functions ...................................................... 80
5.2 HAL Firmware driver defines ........................................................... 85
5.2.1 HAL ................................................................................................... 85
6 HAL ADC Generic Driver ............................................................... 88
6.1 ADC Firmware driver registers structures ....................................... 88
6.1.1 ADC_InitTypeDef .............................................................................. 88
6.1.2 ADC_ChannelConfTypeDef ............................................................. 89
6.1.3 ADC_AnalogWDGConfTypeDef ....................................................... 90
6.1.4 ADC_HandleTypeDef ....................................................................... 90
6.2 ADC Firmware driver API description .............................................. 91
6.2.1 ADC Peripheral features................................................................... 91
6.2.2 How to use this driver ....................................................................... 91
6.2.3 Initialization and de-initialization functions ....................................... 93
6.2.4 IO operation functions ...................................................................... 94
6.2.5 Peripheral Control functions ............................................................. 94
6.2.6 Peripheral State and errors functions ............................................... 94
6.2.7 Detailed description of functions ...................................................... 95
6.3 ADC Firmware driver defines ........................................................ 100
6.3.1 ADC ................................................................................................ 100
7 HAL ADC Extension Driver ......................................................... 107
7.1 ADCEx Firmware driver registers structures ................................. 107
7.1.1 ADC_InjectionConfTypeDef ........................................................... 107
7.1.2 ADC_MultiModeTypeDef ................................................................ 108
7.2 ADCEx Firmware driver API description ....................................... 109

Contents
UM1905
4/1967
DocID027932 Rev 3
7.2.1 How to use this driver ..................................................................... 109
7.2.2 Extended features functions ........................................................... 110
7.2.3 Detailed description of functions .................................................... 111
7.3 ADCEx Firmware driver defines .................................................... 114
7.3.1 ADCEx ............................................................................................ 114
8 HAL CAN Generic Driver ............................................................. 116
8.1 CAN Firmware driver registers structures ..................................... 116
8.1.1 CAN_InitTypeDef ............................................................................ 116
8.1.2 CAN_FilterConfTypeDef ................................................................. 117
8.1.3 CanTxMsgTypeDef ......................................................................... 118
8.1.4 CanRxMsgTypeDef ........................................................................ 118
8.1.5 CAN_HandleTypeDef ..................................................................... 119
8.2 CAN Firmware driver API description ............................................ 119
8.2.1 How to use this driver ..................................................................... 119
8.2.2 Initialization and de-initialization functions ..................................... 120
8.2.3 IO operation functions .................................................................... 121
8.2.4 Peripheral State and Error functions .............................................. 121
8.2.5 Detailed description of functions .................................................... 121
8.3 CAN Firmware driver defines ........................................................ 125
8.3.1 CAN ................................................................................................ 125
9 HAL CEC Generic Driver ............................................................. 133
9.1 CEC Firmware driver registers structures ..................................... 133
9.1.1 CEC_InitTypeDef ............................................................................ 133
9.1.2 CEC_HandleTypeDef ..................................................................... 134
9.2 CEC Firmware driver API description ............................................ 135
9.2.1 How to use this driver ..................................................................... 135
9.2.2 Initialization and Configuration functions ........................................ 135
9.2.3 IO operation functions .................................................................... 136
9.2.4 Peripheral Control function ............................................................. 136
9.2.5 Detailed description of functions .................................................... 136
9.3 CEC Firmware driver defines ........................................................ 139
9.3.1 CEC ................................................................................................ 139
10 HAL CORTEX Generic Driver ...................................................... 148
10.1 CORTEX Firmware driver registers structures .............................. 148
10.1.1 MPU_Region_InitTypeDef .............................................................. 148
10.2 CORTEX Firmware driver API description .................................... 149
10.2.1 How to use this driver ..................................................................... 149

UM1905
Contents
DocID027932 Rev 3
5/1967
10.2.2 Initialization and de-initialization functions ..................................... 149
10.2.3 Peripheral Control functions ........................................................... 150
10.2.4 Detailed description of functions .................................................... 150
10.3 CORTEX Firmware driver defines ................................................. 155
10.3.1 CORTEX ......................................................................................... 155
11 HAL CRC Generic Driver ............................................................. 158
11.1 CRC Firmware driver registers structures ..................................... 158
11.1.1 CRC_InitTypeDef ........................................................................... 158
11.1.2 CRC_HandleTypeDef ..................................................................... 159
11.2 CRC Firmware driver API description ........................................... 159
11.2.1 CRC How to use this driver ............................................................ 159
11.2.2 Initialization and de-initialization functions ..................................... 159
11.2.3 Peripheral Control functions ........................................................... 160
11.2.4 Peripheral State functions .............................................................. 160
11.2.5 Detailed description of functions .................................................... 160
11.3 CRC Firmware driver defines ........................................................ 162
11.3.1 CRC ................................................................................................ 162
12 HAL CRC Extension Driver ......................................................... 165
12.1 CRCEx Firmware driver API description ....................................... 165
12.1.1 CRC Extended features functions .................................................. 165
12.1.2 Detailed description of functions .................................................... 165
12.2 CRCEx Firmware driver defines .................................................... 166
12.2.1 CRCEx ............................................................................................ 166
13 HAL CRYP Generic Driver ........................................................... 168
13.1 CRYP Firmware driver registers structures ................................... 168
13.1.1 CRYP_InitTypeDef ......................................................................... 168
13.1.2 CRYP_HandleTypeDef................................................................... 168
13.2 CRYP Firmware driver API description ......................................... 169
13.2.1 How to use this driver ..................................................................... 169
13.2.2 Initialization and de-initialization functions ..................................... 170
13.2.3 AES processing functions .............................................................. 170
13.2.4 DES processing functions .............................................................. 171
13.2.5 TDES processing functions ............................................................ 171
13.2.6 DMA callback functions .................................................................. 172
13.2.7 CRYP IRQ handler management ................................................... 172
13.2.8 Peripheral State functions .............................................................. 172
剩余1966页未读,继续阅读

遥望1415984987
- 粉丝: 196
- 资源: 3
上传资源 快速赚钱
我的内容管理 收起
我的资源 快来上传第一个资源
我的收益
登录查看自己的收益我的积分 登录查看自己的积分
我的C币 登录后查看C币余额
我的收藏
我的下载
下载帮助

会员权益专享
最新资源
- Xilinx SRIO详解.pptx
- Informatica PowerCenter 10.2 for Centos7.6安装配置说明.pdf
- 现代无线系统射频电路实用设计卷II 英文版.pdf
- 电子产品可靠性设计 自己讲课用的PPT,包括设计方案的可靠性选择,元器件的选择与使用,降额设计,热设计,余度设计,参数优化设计 和 失效分析等
- MPC5744P-DEV-KIT-REVE-QSG.pdf
- 通信原理课程设计报告(ASK FSK PSK Matlab仿真--数字调制技术的仿真实现及性能研究)
- ORIGIN7.0使用说明
- 在VMware Player 3.1.3下安装Redhat Linux详尽步骤
- python学生信息管理系统实现代码
- 西门子MES手册 13 OpcenterEXCR_PortalStudio1_81RB1.pdf
资源上传下载、课程学习等过程中有任何疑问或建议,欢迎提出宝贵意见哦~我们会及时处理!
点击此处反馈



安全验证
文档复制为VIP权益,开通VIP直接复制

评论0