没有合适的资源?快使用搜索试试~ 我知道了~
首页HAL固件库驱动详解stm32f407
资源详情
资源评论
资源推荐
UM1725
Contents
DocID025834 Rev 1
1/865
UM1725
User Manual
Description of STM32F4xx HAL drivers
Introduction
STM32Cube
TM
is an STMicroelectronics original initiative to ease developers life by reducing
development efforts, time and cost. STM32Cube
TM
covers STM32 portfolio.
STM32Cube
TM
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 STM32CubeF4 for
STM32F4 series)
The STM32Cube HAL, an STM32 abstraction layer embedded software, ensuring maximized
portability across STM32 portfolio
A consistent set of middleware components such as RTOS, USB, TCP/IP, Graphics
All embedded software utilities coming with a full set of examples.
The HAL drivers layer provides a generic multi instance simple set of APIs (application programming
interfaces) to interact with the upper layer (application, libraries and stacks). It is composed of generic
and extension APIs. It is directly built around a generic architecture and allows the built-upon layers,
such as the middleware layer, to implement their functions without knowing in-depth how to use the
MCU. This structure improves the library code reusability and guarantees an easy portability on other
devices.
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 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 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 drivers 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.
The HAL drivers 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.
This user manual is structured as follows:
Overview of the HAL drivers
Detailed description of each peripheral driver: configuration structures, functions, and how to use
the given API to build your application.
May 2014
Contents
UM1725
2/865
DocID025834 Rev 1
Contents
1 Acronyms and definitions ............................................................. 26
2 Overview of HAL drivers ............................................................... 28
2.1 HAL and user application files ......................................................... 28
2.1.1 HAL driver files ................................................................................. 28
2.1.2 User-application files ........................................................................ 29
2.2 HAL data structures ........................................................................ 31
2.2.1 Peripheral handle structures ............................................................ 31
2.2.2 Initialization and configuration structure ........................................... 32
2.2.3 Specific process structures .............................................................. 33
2.3 API classification ............................................................................. 33
2.4 Devices supported by HAL drivers .................................................. 34
2.5 HAL drivers rules ............................................................................. 37
2.5.1 HAL API naming rules ...................................................................... 37
2.5.2 HAL general naming rules ................................................................ 38
2.5.3 HAL interrupt handler and callback functions ................................... 39
2.6 HAL generic APIs ............................................................................ 39
2.7 HAL extension APIs ........................................................................ 41
2.7.1 HAL extension model overview ........................................................ 41
2.7.2 HAL extension model cases ............................................................. 41
2.8 File inclusion model ......................................................................... 43
2.9 HAL common resources .................................................................. 44
2.10 HAL configuration ............................................................................ 45
2.11 HAL system peripheral handling ..................................................... 46
2.11.1 Clock ................................................................................................. 46
2.11.2 GPIOs ............................................................................................... 47
2.11.3 Cortex NVIC and SysTick timer ........................................................ 49
2.11.4 PWR ................................................................................................. 49
2.11.5 EXTI .................................................................................................. 50
2.11.6 DMA .................................................................................................. 50
2.12 How to use HAL drivers .................................................................. 52
2.12.1 HAL usage models ........................................................................... 52
2.12.2 HAL initialization ............................................................................... 53
2.12.3 HAL IO operation process ................................................................ 55
2.12.4 Timeout and error management ....................................................... 58
UM1725
Contents
DocID025834 Rev 1
3/865
3 HAL common driver ...................................................................... 62
3.1 HAL Firmware driver API description .............................................. 62
3.1.1 How to use this driver ....................................................................... 62
3.1.2 Initialization and de-initialization functions ....................................... 62
3.1.3 HAL Control functions....................................................................... 62
3.1.4 Initialization and de-initialization Functions ...................................... 63
3.1.5 HAL Control functions....................................................................... 64
3.2 HAL Firmware driver defines ........................................................... 69
3.2.1 HAL ................................................................................................... 69
4 HAL ADC Generic Driver ............................................................... 70
4.1 ADC Firmware driver registers structures ....................................... 70
4.1.1 ADC_HandleTypeDef ....................................................................... 70
4.1.2 ADC_InitTypeDef .............................................................................. 70
4.1.3 ADC_ChannelConfTypeDef ............................................................. 72
4.1.4 ADC_AnalogWDGConfTypeDef ....................................................... 72
4.1.5 ADC_Common_TypeDef .................................................................. 73
4.1.6 ADC_TypeDef .................................................................................. 73
4.2 ADC Firmware driver API description .............................................. 75
4.2.1 ADC Peripheral features................................................................... 75
4.2.2 How to use this driver ....................................................................... 75
4.2.3 Initialization and de-initialization functions ....................................... 77
4.2.4 IO operation functions ...................................................................... 77
4.2.5 Peripheral Control functions ............................................................. 77
4.2.6 Peripheral State and errors functions ............................................... 78
4.2.7 Initialization and de-initialization functions ....................................... 78
4.2.8 IO operation functions ...................................................................... 79
4.2.9 Peripheral Control functions ............................................................. 84
4.2.10 ADC Peripheral State functions ........................................................ 85
4.3 ADC Firmware driver defines .......................................................... 86
4.3.1 ADC .................................................................................................. 86
5 HAL ADC Extension Driver ........................................................... 95
5.1 ADCEx Firmware driver registers structures ................................... 95
5.1.1 ADC_InjectionConfTypeDef ............................................................. 95
5.1.2 ADC_MultiModeTypeDef .................................................................. 96
5.2 ADCEx Firmware driver API description ......................................... 96
5.2.1 How to use this driver ....................................................................... 96
5.2.2 Extended features functions ............................................................. 98
Contents
UM1725
4/865
DocID025834 Rev 1
5.2.3 Extended features functions ............................................................. 98
5.3 ADCEx Firmware driver defines .................................................... 103
5.3.1 ADCEx ............................................................................................ 103
6 HAL CAN Generic Driver ............................................................. 110
6.1 CAN Firmware driver registers structures ..................................... 110
6.1.1 CAN_HandleTypeDef ..................................................................... 110
6.1.2 CAN_InitTypeDef ............................................................................ 110
6.1.3 CAN_FilterConfTypeDef ................................................................. 111
6.1.4 CAN_FIFOMailBox_TypeDef ......................................................... 112
6.1.5 CAN_FilterRegister_TypeDef ......................................................... 113
6.1.6 CAN_TxMailBox_TypeDef ............................................................. 113
6.1.7 CAN_TypeDef ................................................................................ 114
6.2 CAN Firmware driver API description ............................................ 115
6.2.1 How to use this driver ..................................................................... 115
6.2.2 Initialization and de-initialization functions ..................................... 116
6.2.3 IO operation functions .................................................................... 117
6.2.4 Peripheral State and Error functions .............................................. 117
6.2.5 Initialization and de-initialization functions ..................................... 117
6.2.6 IO operation functions .................................................................... 119
6.2.7 Peripheral State and Error functions .............................................. 123
6.3 CAN Firmware driver defines ........................................................ 123
6.3.1 CAN ................................................................................................ 123
7 HAL CORTEX Generic Driver ...................................................... 133
7.1 CORTEX Firmware driver API description .................................... 133
7.1.1 How to use this driver ..................................................................... 133
7.1.2 Initialization and de-initialization functions ..................................... 134
7.1.3 Peripheral Control functions ........................................................... 134
7.1.4 Initialization and de-initialization functions ..................................... 134
7.1.5 Peripheral Control functions ........................................................... 137
7.2 CORTEX Firmware driver defines ................................................. 140
7.2.1 CORTEX ......................................................................................... 140
8 HAL CRC Generic Driver ............................................................. 142
8.1 CRC Firmware driver registers structures ..................................... 142
8.1.1 CRC_HandleTypeDef ..................................................................... 142
8.1.2 CRC_TypeDef ................................................................................ 142
8.2 CRC Firmware driver API description ........................................... 143
8.2.1 How to use this driver ..................................................................... 143
UM1725
Contents
DocID025834 Rev 1
5/865
8.2.2 Initialization and de-initialization functions ..................................... 143
8.2.3 Peripheral Control functions ........................................................... 143
8.2.4 Peripheral State functions .............................................................. 143
8.2.5 Initialization and de-initialization functions ..................................... 144
8.2.6 Peripheral Control functions ........................................................... 145
8.2.7 Peripheral State functions .............................................................. 146
8.3 CRC Firmware driver defines ........................................................ 146
8.3.1 CRC ................................................................................................ 146
9 HAL CRYP Generic Driver ........................................................... 147
9.1 CRYP Firmware driver registers structures ................................... 147
9.1.1 CRYP_HandleTypeDef................................................................... 147
9.1.2 CRYP_InitTypeDef ......................................................................... 148
9.1.3 CRYP_TypeDef .............................................................................. 148
9.2 CRYP Firmware driver API description ......................................... 151
9.2.1 How to use this driver ..................................................................... 151
9.2.2 Initialization and de-initialization functions ..................................... 152
9.2.3 AES processing functions .............................................................. 152
9.2.4 DES processing functions .............................................................. 153
9.2.5 TDES processing functions ............................................................ 153
9.2.6 DMA callback functions .................................................................. 153
9.2.7 CRYP IRQ handler management ................................................... 154
9.2.8 Peripheral State functions .............................................................. 154
9.2.9 Initialization and de-initialization functions ..................................... 154
9.2.10 AES processing functions .............................................................. 155
9.2.11 DES processing functions .............................................................. 164
9.2.12 TDES processing functions ............................................................ 169
9.2.13 DMA callback functions .................................................................. 174
9.2.14 CRYP IRQ handler management ................................................... 175
9.2.15 Peripheral State functions .............................................................. 176
9.3 CRYP Firmware driver defines ...................................................... 176
9.3.1 CRYP .............................................................................................. 176
10 HAL DAC Generic Driver ............................................................. 180
10.1 DAC Firmware driver registers structures ..................................... 180
10.1.1 DAC_HandleTypeDef ..................................................................... 180
10.1.2 DAC_ChannelConfTypeDef ........................................................... 180
10.1.3 DAC_TypeDef ................................................................................ 181
10.2 DAC Firmware driver API description ............................................ 182
剩余864页未读,继续阅读
yesname
- 粉丝: 1
- 资源: 6
上传资源 快速赚钱
- 我的内容管理 收起
- 我的资源 快来上传第一个资源
- 我的收益 登录查看自己的收益
- 我的积分 登录查看自己的积分
- 我的C币 登录后查看C币余额
- 我的收藏
- 我的下载
- 下载帮助
会员权益专享
最新资源
- c++校园超市商品信息管理系统课程设计说明书(含源代码) (2).pdf
- 建筑供配电系统相关课件.pptx
- 企业管理规章制度及管理模式.doc
- vb打开摄像头.doc
- 云计算-可信计算中认证协议改进方案.pdf
- [详细完整版]单片机编程4.ppt
- c语言常用算法.pdf
- c++经典程序代码大全.pdf
- 单片机数字时钟资料.doc
- 11项目管理前沿1.0.pptx
- 基于ssm的“魅力”繁峙宣传网站的设计与实现论文.doc
- 智慧交通综合解决方案.pptx
- 建筑防潮设计-PowerPointPresentati.pptx
- SPC统计过程控制程序.pptx
- SPC统计方法基础知识.pptx
- MW全能培训汽轮机调节保安系统PPT教学课件.pptx
资源上传下载、课程学习等过程中有任何疑问或建议,欢迎提出宝贵意见哦~我们会及时处理!
点击此处反馈
安全验证
文档复制为VIP权益,开通VIP直接复制
信息提交成功
评论20