没有合适的资源?快使用搜索试试~ 我知道了~
STM32 HAL LL 库手册
5星 · 超过95%的资源 需积分: 50 110 下载量 33 浏览量
2018-09-04
14:01:22
上传
评论 1
收藏 41.29MB PDF 举报
温馨提示
试读
1880页
The HAL drivers were designed to offer a rich set of APIs and to interact easily with the application upper layers.
资源推荐
资源详情
资源评论
July 2017
DocID026526 Rev 7
1/1880
www.st.com
UM1786
User Manual
Description of STM32F3 HAL and low-layer drivers
Introduction
STMCube
TM
is an STMicroelectronics original initiative to make developers' lives easier by reducing
development effort, time and cost. STM32Cube covers the whole STM32 portfolio.
STM32Cube Version 1.x includes:
STM32CubeMX, a graphical software configuration tool that allows the generation of C initialization
code using graphical wizards.
A comprehensive embedded software platform, delivered per Series (such as STM32CubeF3 for
STM32F3 Series).
The STM32Cube HAL, STM32 abstraction layer embedded software ensuring maximized
portability across the STM32 portfolio
Low-layer APIs (LL) offering a fast light-weight expert-oriented layer which is closer to the
hardware than the HAL. LL APIs are available only for a set of peripherals.
A consistent set of middleware components such as RTOS, USB, TCP/IP, Graphics
All embedded software utilities, delivered with a full set of examples.
The HAL driver layer provides a generic multiinstance 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 line 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, manage data transfers in polling mode, handle interrupts
or DMA, and 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 such as basic timer, capture, or pulse width
modulation (PWM). 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 or USB).
The HAL and LL drivers 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.
HAL and LL source code is developed in Strict ANSI-C which makes it independent from the
development tools. It is checked with CodeSonar
TM
static analysis tool. It is fully documented and is
MISRA-C 2004 compliant.
Contents
UM1786
2/1880
DocID026526 Rev 7
Contents
1 Acronyms and definitions ............................................................. 28
2 Overview of HAL drivers ............................................................... 30
2.1 HAL and user-application files......................................................... 30
2.1.1 HAL driver files ................................................................................. 30
2.1.2 User-application files ........................................................................ 31
2.2 HAL data structures ........................................................................ 33
2.2.1 Peripheral handle structures ............................................................ 33
2.2.2 Initialization and configuration structure ........................................... 34
2.2.3 Specific process structures .............................................................. 34
2.3 API classification ............................................................................. 34
2.4 Devices supported by HAL drivers .................................................. 35
2.5 HAL driver rules .............................................................................. 39
2.5.1 HAL API naming rules ...................................................................... 39
2.5.2 HAL general naming rules ................................................................ 40
2.5.3 HAL interrupt handler and callback functions ................................... 41
2.6 HAL generic APIs ............................................................................ 42
2.7 HAL extension APIs ........................................................................ 43
2.7.1 HAL extension model overview ........................................................ 43
2.7.2 HAL extension model cases ............................................................. 44
2.8 File inclusion model ......................................................................... 46
2.9 HAL common resources .................................................................. 46
2.10 HAL configuration ............................................................................ 47
2.11 HAL system peripheral handling ..................................................... 48
2.11.1 Clock ................................................................................................. 48
2.11.2 GPIOs ............................................................................................... 49
2.11.3 Cortex NVIC and SysTick timer ........................................................ 50
2.11.4 PWR ................................................................................................. 51
2.11.5 EXTI .................................................................................................. 51
2.11.6 DMA .................................................................................................. 52
2.12 How to use HAL drivers .................................................................. 54
2.12.1 HAL usage models ........................................................................... 54
2.12.2 HAL initialization ............................................................................... 55
2.12.3 HAL IO operation process ................................................................ 57
2.12.4 Timeout and error management ....................................................... 60
3 Overview of low-layer drivers ....................................................... 64
UM1786
Contents
DocID026526 Rev 7
3/1880
3.1 Low-layer files ................................................................................. 64
3.2 Overview of low-layer APIs and naming rules ................................. 66
3.2.1 Peripheral initialization functions ...................................................... 66
3.2.2 Peripheral register-level configuration functions .............................. 69
4 Cohabiting of HAL and LL ............................................................ 71
4.1 Low-layer driver used in standalone mode ...................................... 71
4.2 Mixed use of low-layer APIs and HAL drivers ................................. 71
5 HAL System Driver ........................................................................ 72
5.1 HAL Firmware driver API description .............................................. 72
5.1.1 How to use this driver ....................................................................... 72
5.1.2 Initialization and de-initialization functions ....................................... 72
5.1.3 HAL Control functions....................................................................... 72
5.1.4 Detailed description of functions ...................................................... 73
5.2 HAL Firmware driver defines ........................................................... 77
5.2.1 HAL ................................................................................................... 77
6 HAL ADC Generic Driver ............................................................... 80
6.1 ADC Firmware driver registers structures ....................................... 80
6.1.1 __ADC_HandleTypeDef ................................................................... 80
6.2 ADC Firmware driver API description .............................................. 80
6.2.1 ADC peripheral features ................................................................... 80
6.2.2 How to use this driver ....................................................................... 81
6.2.3 Initialization and de-initialization functions ....................................... 85
6.2.4 IO operation functions ...................................................................... 85
6.2.5 Peripheral Control functions ............................................................. 86
6.2.6 Peripheral state and errors functions ............................................... 86
6.2.7 Detailed description of functions ...................................................... 86
6.3 ADC Firmware driver defines .......................................................... 92
6.3.1 ADC .................................................................................................. 92
7 HAL ADC Extension Driver ........................................................... 95
7.1 ADCEx Firmware driver registers structures ................................... 95
7.1.1 ADC_InitTypeDef .............................................................................. 95
7.1.2 ADC_ChannelConfTypeDef ............................................................. 97
7.1.3 ADC_InjectionConfTypeDef ............................................................. 98
7.1.4 ADC_InjectionConfigTypeDef ........................................................ 100
7.1.5 ADC_AnalogWDGConfTypeDef ..................................................... 101
7.1.6 ADC_MultiModeTypeDef ................................................................ 101
Contents
UM1786
4/1880
DocID026526 Rev 7
7.2 ADCEx Firmware driver API description ....................................... 102
7.2.1 Initialization and de-initialization functions ..................................... 102
7.2.2 IO operation functions .................................................................... 102
7.2.3 Peripheral Control functions ........................................................... 103
7.2.4 Detailed description of functions .................................................... 104
7.3 ADCEx Firmware driver defines .................................................... 110
7.3.1 ADCEx ............................................................................................ 110
8 HAL CAN Generic Driver ............................................................. 124
8.1 CAN Firmware driver registers structures ..................................... 124
8.1.1 CAN_InitTypeDef ............................................................................ 124
8.1.2 CAN_FilterConfTypeDef ................................................................. 125
8.1.3 CanTxMsgTypeDef ......................................................................... 126
8.1.4 CanRxMsgTypeDef ........................................................................ 126
8.1.5 CAN_HandleTypeDef ..................................................................... 127
8.2 CAN Firmware driver API description ............................................ 127
8.2.1 How to use this driver ..................................................................... 127
8.2.2 Initialization and de-initialization functions ..................................... 128
8.2.3 Peripheral State and Error functions .............................................. 129
8.2.4 Detailed description of functions .................................................... 129
8.3 CAN Firmware driver defines ........................................................ 132
8.3.1 CAN ................................................................................................ 132
9 HAL CEC Generic Driver ............................................................. 140
9.1 CEC Firmware driver registers structures ..................................... 140
9.1.1 CEC_InitTypeDef ............................................................................ 140
9.1.2 CEC_HandleTypeDef ..................................................................... 141
9.2 CEC Firmware driver API description ............................................ 142
9.2.1 How to use this driver ..................................................................... 142
9.2.2 Initialization and Configuration functions ........................................ 142
9.2.3 IO operation functions .................................................................... 142
9.2.4 Peripheral Control function ............................................................. 143
9.2.5 Detailed description of functions .................................................... 143
9.3 CEC Firmware driver defines ........................................................ 146
9.3.1 CEC ................................................................................................ 146
10 HAL COMP Generic Driver .......................................................... 155
10.1 COMP Firmware driver registers structures .................................. 155
10.1.1 COMP_InitTypeDef ........................................................................ 155
10.1.2 COMP_HandleTypeDef .................................................................. 156
UM1786
Contents
DocID026526 Rev 7
5/1880
10.2 COMP Firmware driver API description ........................................ 156
10.2.1 COMP Peripheral features ............................................................. 156
10.2.2 How to use this driver ..................................................................... 156
10.2.3 Initialization and de-initialization functions ..................................... 157
10.2.4 Start Stop operation functions ........................................................ 157
10.2.5 Peripheral Control functions ........................................................... 158
10.2.6 Peripheral State functions .............................................................. 158
10.2.7 Detailed description of functions .................................................... 158
10.3 COMP Firmware driver defines ..................................................... 161
10.3.1 COMP ............................................................................................. 161
11 HAL COMP Extension Driver ...................................................... 163
11.1 COMPEx Firmware driver defines ................................................. 163
11.1.1 COMPEx ......................................................................................... 163
12 HAL CORTEX Generic Driver ...................................................... 181
12.1 CORTEX Firmware driver registers structures .............................. 181
12.1.1 MPU_Region_InitTypeDef .............................................................. 181
12.2 CORTEX Firmware driver API description .................................... 182
12.2.1 How to use this driver ..................................................................... 182
12.2.2 Initialization and de-initialization functions ..................................... 182
12.2.3 Peripheral Control functions ........................................................... 183
12.2.4 Detailed description of functions .................................................... 183
12.3 CORTEX Firmware driver defines ................................................. 188
12.3.1 CORTEX ......................................................................................... 188
13 HAL CRC Generic Driver ............................................................. 191
13.1 CRC Firmware driver registers structures ..................................... 191
13.1.1 CRC_InitTypeDef ........................................................................... 191
13.1.2 CRC_HandleTypeDef ..................................................................... 192
13.2 CRC Firmware driver API description ........................................... 192
13.2.1 How to use this driver ..................................................................... 192
13.2.2 Initialization and de-initialization functions ..................................... 193
13.2.3 Peripheral Control functions ........................................................... 193
13.2.4 Peripheral State functions .............................................................. 193
13.2.5 Detailed description of functions .................................................... 193
13.3 CRC Firmware driver defines ........................................................ 195
13.3.1 CRC ................................................................................................ 195
14 HAL CRC Extension Driver ......................................................... 198
剩余1879页未读,继续阅读
weixin_42122981
- 粉丝: 0
- 资源: 2
上传资源 快速赚钱
- 我的内容管理 展开
- 我的资源 快来上传第一个资源
- 我的收益 登录查看自己的收益
- 我的积分 登录查看自己的积分
- 我的C币 登录后查看C币余额
- 我的收藏
- 我的下载
- 下载帮助
最新资源
- 操作简单的Mongodb网页web管理工具,基于Spring Boot2.0支持mongodb集群.zip
- tms-mongodb-web,提供访问mongodb数据的REST API和可灵活扩展的mongodb web 客户端.zip
- SpringBoot整合mongodb学习MongoTemplate和MongoRepository两种方式CRUD使用.zip
- SpringBoot整合MongoDB实现对数据库的CRUD小demo.zip
- Python操作MongoDB数据库的基本一些操作 .zip
- NOSQL数据库监控工具,目前实现了对Redis、MongoDB的监控功能 .zip
- mongoDB数据库的增删改查,以及所需要的配置.zip
- mongodb数据库idea测试.zip
- koa 分别 连接 mysql、mongodb数据库操作.zip
- 基于pytorch实现的人体部件分割源码+模型.zip
资源上传下载、课程学习等过程中有任何疑问或建议,欢迎提出宝贵意见哦~我们会及时处理!
点击此处反馈
安全验证
文档复制为VIP权益,开通VIP直接复制
信息提交成功
- 1
- 2
前往页