ST STM32F2 User Manual

ST STM32F2 User Manual

Description of stm32f2 hal and low layer drivers
Hide thumbs Also See for STM32F2:
Table of Contents

Advertisement

Quick Links

Description of STM32F2 HAL and Low Layer drivers

Introduction
TM
STMCube
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 asSTM32CubeF2
forSTM32F2 series)
The STM32Cube Hardware Abstraction Layer (HAL), an STM32 abstraction layer embedded
software, ensuring maximized portability across the STM32 portfolio
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.
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 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 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 FMC, 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.
March 2017
DocID028236 Rev 2
UM1940
User Manual
1/1371
www.st.com

Advertisement

Table of Contents
loading
Need help?

Need help?

Do you have a question about the STM32F2 and is the answer not in the manual?

Questions and answers

Subscribe to Our Youtube Channel

Summary of Contents for ST STM32F2

  • Page 1 UM1940 User Manual Description of STM32F2 HAL and Low Layer drivers Introduction STMCube 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.
  • Page 2: Table Of Contents

    Contents UM1940 Contents Acronyms and definitions ............. 26 Overview of HAL drivers ............... 28 HAL and user-application files............28 2.1.1 HAL driver files ................. 28 2.1.2 User-application files ................ 30 HAL data structures ................ 31 2.2.1 Peripheral handle structures ............31 2.2.2 Initialization and configuration structure ...........
  • Page 3: Table Of Contents

    UM1940 Contents Low Layer files ................61 Overview of Low Layer APIs and naming rules ....... 63 3.2.1 Peripheral initialization functions ............63 3.2.2 Peripheral register-level configuration functions ......67 Cohabiting of HAL and LL ............69 Low Layer driver used in standalone mode ........69 Mixed use of Low Layer APIs and HAL drivers .......
  • Page 4: Table Of Contents

    Contents UM1940 7.2.1 How to use this driver ............... 98 7.2.2 Extended features functions ............. 99 7.2.3 Detailed description of functions ............ 100 ADCEx Firmware driver defines ............ 103 7.3.1 ADCEx .................... 103 HAL CAN Generic Driver ............. 105 CAN Firmware driver registers structures ........105 8.1.1 CAN_InitTypeDef ................
  • Page 5: Table Of Contents

    UM1940 Contents 10.2.4 Peripheral State functions .............. 133 10.2.5 Detailed description of functions ............ 133 10.3 CRC Firmware driver defines ............135 10.3.1 CRC ....................135 HAL CRYP Generic Driver ............136 11.1 CRYP Firmware driver registers structures ........136 11.1.1 CRYP_InitTypeDef .................
  • Page 6: Table Of Contents

    Contents UM1940 13.1.1 How to use this driver ..............171 13.1.2 Extended features functions ............171 13.1.3 Detailed description of functions ............ 171 13.2 DACEx Firmware driver defines ............ 175 13.2.1 DACEx .................... 175 HAL DCMI Generic Driver ............177 14.1 DCMI Firmware driver registers structures ........
  • Page 7: Table Of Contents

    UM1940 Contents 17.1 ETH Firmware driver registers structures ........203 17.1.1 ETH_InitTypeDef ................203 17.1.2 ETH_MACInitTypeDef ..............203 17.1.3 ETH_DMAInitTypeDef ..............206 17.1.4 ETH_DMADescTypeDef..............207 17.1.5 ETH_DMARxFrameInfos ..............208 17.1.6 ETH_HandleTypeDef ..............208 17.2 ETH Firmware driver API description ..........209 17.2.1 How to use this driver ..............
  • Page 8: Table Of Contents

    Contents UM1940 19.3 FLASHEx Firmware driver defines ..........256 19.3.1 FLASHEx ..................256 HAL GPIO Generic Driver............259 20.1 GPIO Firmware driver registers structures ........259 20.1.1 GPIO_InitTypeDef ................259 20.2 GPIO Firmware driver API description .......... 259 20.2.1 GPIO Peripheral features ............... 259 20.2.2 How to use this driver ..............
  • Page 9: Table Of Contents

    UM1940 Contents 23.2.1 How to use this driver ..............280 23.2.2 Initialization and de-initialization functions ........281 23.2.3 IO operation functions ..............281 23.2.4 Peripheral Control functions ............281 23.2.5 Peripheral State functions .............. 281 23.2.6 Detailed description of functions ............ 281 23.3 HCD Firmware driver defines ............
  • Page 10: Table Of Contents

    Contents UM1940 26.2 IRDA Firmware driver API description ........... 329 26.2.1 How to use this driver ..............329 26.2.2 Initialization and Configuration functions ........330 26.2.3 IO operation functions ..............331 26.2.4 Peripheral State and Errors functions ..........332 26.2.5 Detailed description of functions ............
  • Page 11: Table Of Contents

    UM1940 Contents 29.1.4 NAND_HandleTypeDef ..............371 29.2 NAND Firmware driver API description ......... 371 29.2.1 How to use this driver ..............371 29.2.2 NAND Initialization and de-initialization functions ......372 29.2.3 NAND Input and Output functions ..........372 29.2.4 NAND Control functions ..............373 29.2.5 NAND State functions..............
  • Page 12: Table Of Contents

    Contents UM1940 32.1 PCD Firmware driver registers structures ........393 32.1.1 PCD_HandleTypeDef ..............393 32.2 PCD Firmware driver API description ..........393 32.2.1 How to use this driver ..............393 32.2.2 Initialization and de-initialization functions ........394 32.2.3 IO operation functions ..............394 32.2.4 Peripheral Control functions ............
  • Page 13: Table Of Contents

    UM1940 Contents 36.2.1 RCC specific features ..............418 36.2.2 RCC Limitations ................419 36.2.3 Initialization and de-initialization functions ........419 36.2.4 Peripheral Control functions ............420 36.2.5 Detailed description of functions ............ 420 36.3 RCC Firmware driver defines ............425 36.3.1 RCC ....................
  • Page 14: Table Of Contents

    Contents UM1940 39.2.2 Backup Domain Reset ..............468 39.2.3 Backup Domain Access..............468 39.2.4 How to use this driver ..............468 39.2.5 RTC and low power modes ............468 39.2.6 Initialization and de-initialization functions ........469 39.2.7 RTC Time and Date functions ............469 39.2.8 RTC Alarm functions ..............
  • Page 15: Table Of Contents

    UM1940 Contents 41.3 SD Firmware driver defines ............523 41.3.1 SD ....................523 HAL SMARTCARD Generic Driver ..........531 42.1 SMARTCARD Firmware driver registers structures ...... 531 42.1.1 SMARTCARD_InitTypeDef ............531 42.1.2 SMARTCARD_HandleTypeDef ............532 42.2 SMARTCARD Firmware driver API description ......532 42.2.1 How to use this driver ..............
  • Page 16: Table Of Contents

    Contents UM1940 44.3 SRAM Firmware driver defines ............. 572 44.3.1 SRAM ..................... 572 HAL TIM Generic Driver .............. 573 45.1 TIM Firmware driver registers structures ........573 45.1.1 TIM_Base_InitTypeDef ..............573 45.1.2 TIM_OC_InitTypeDef ..............573 45.1.3 TIM_OnePulse_InitTypeDef ............574 45.1.4 TIM_IC_InitTypeDef ...............
  • Page 17: Table Of Contents

    UM1940 Contents 46.2.3 Timer Hall Sensor functions ............631 46.2.4 Timer Complementary Output Compare functions ......631 46.2.5 Timer Complementary PWM functions ........... 632 46.2.6 Timer Complementary One Pulse functions........632 46.2.7 Peripheral Control functions ............632 46.2.8 Extension Callbacks functions ............633 46.2.9 Extension Peripheral State functions ..........
  • Page 18: Table Of Contents

    Contents UM1940 49.1 WWDG Firmware driver registers structures ......... 691 49.1.1 WWDG_InitTypeDef ............... 691 49.1.2 WWDG_HandleTypeDef ..............691 49.2 WWDG Firmware driver API description ........691 49.2.1 WWDG specific features ..............691 49.2.2 How to use this driver ..............692 49.2.3 Initialization and Configuration functions ........
  • Page 19: Table Of Contents

    UM1940 Contents LL DAC Generic Driver ..............832 54.1 DAC Firmware driver registers structures ........832 54.1.1 LL_DAC_InitTypeDef ..............832 54.2 DAC Firmware driver API description ..........832 54.2.1 Detailed description of functions ............ 832 54.3 DAC Firmware driver defines ............848 54.3.1 DAC ....................
  • Page 20: Table Of Contents

    Contents UM1940 LL I2S Generic Driver ..............981 59.1 I2S Firmware driver registers structures ........981 59.1.1 LL_I2S_InitTypeDef ................ 981 59.2 I2S Firmware driver API description ..........981 59.2.1 Detailed description of functions ............ 981 59.3 I2S Firmware driver defines ............995 59.3.1 I2S ....................
  • Page 21: Table Of Contents

    UM1940 Contents 64.2 RTC Firmware driver API description .......... 1063 64.2.1 Detailed description of functions ..........1063 64.3 RTC Firmware driver defines ............1117 64.3.1 RTC ....................1117 LL SPI Generic Driver ..............1125 65.1 SPI Firmware driver registers structures ........1125 65.1.1 LL_SPI_InitTypeDef ..............
  • Page 22: Table Of Contents

    Contents UM1940 LL UTILS Generic Driver ............1292 69.1 UTILS Firmware driver registers structures ......... 1292 69.1.1 LL_UTILS_PLLInitTypeDef ............1292 69.1.2 LL_UTILS_ClkInitTypeDef ............1292 69.2 UTILS Firmware driver API description ........1292 69.2.1 System Configuration functions ............ 1292 69.2.2 Detailed description of functions ..........1293 69.3 UTILS Firmware driver defines ............
  • Page 23 UM1940 Contents 71.20 WWDG ..................1365 FAQs ................... 1366 Revision history ................ 1370 DocID028236 Rev 2 23/1371...
  • Page 24: Table Of Contents

    List of tables UM1940 List of tables Table 1: Acronyms and definitions ......................26 Table 2: HAL driver files..........................28 Table 3: User-application files ........................30 Table 4: API classification ......................... 34 Table 5: List of devices supported by the HAL drivers ................34 Table 6: HAL API naming rules ........................
  • Page 25: Table Of Contents

    UM1940 List of figures List of figures Figure 1: Example of project template ...................... 31 Figure 2: Adding family-specific functions ....................41 Figure 3: Adding new peripherals ......................41 Figure 4: Updating existing APIs ......................42 Figure 5: File inclusion model ........................43 Figure 6: HAL driver model ........................
  • Page 26: Acronyms And Definitions

    Acronyms and definitions UM1940 Acronyms and definitions Table 1: Acronyms and definitions Acronym Definition Analog-to-digital converter ANSI American National Standards Institute Application Programming Interface Board Support Package Controller area network CMSIS Cortex Microcontroller Software Interface Standard Central Processing Unit CRC calculation unit Digital to analog converter DCMI Digital Camera Module Interface...
  • Page 27 UM1940 Acronyms and definitions Acronym Definition SRAM SRAM external memory SMARTCARD Smartcard IC Serial Peripheral interface SysTick System tick timer Advanced-control, general-purpose or basic timer UART Universal asynchronous receiver/transmitter USART Universal synchronous receiver/transmitter WWDG Window watchdog Universal Serial Bus STM32 peripheral or block DocID028236 Rev 2 27/1371...
  • Page 28: Overview Of Hal Drivers

    Overview of HAL drivers UM1940 Overview of HAL drivers The HAL drivers were designed to offer a rich set of APIs and to interact easily with the application upper layers. Each driver consists of a set of functions covering the most common peripheral features. The development of each driver is driven by a common API which standardizes the driver structure, the functions and the parameter names.
  • Page 29 UM1940 Overview of HAL drivers File Description Extension file of a peripheral/module driver. It includes the specific APIs for a given part number or family, as well as the newly defined APIs that overwrite the default generic APIs if the internal stm32f2xx_hal_ppp_ex.c process is implemented in different way.
  • Page 30: User-Application Files

    Overview of HAL drivers UM1940 2.1.2 User-application files The minimum files required to build an application using the HAL are listed in the table below: Table 3: User-application files File Description This file contains SystemInit() which is called at startup just after reset and before branching to the main program.
  • Page 31: Hal Data Structures

    UM1940 Overview of HAL drivers It provides ready-to-use user files preconfigured as defined below: HAL is initialized SysTick ISR implemented for HAL_Delay() System clock configured with the maximum frequency of the device If an existing project is copied to another location, then include paths must be updated.
  • Page 32 Overview of HAL drivers UM1940 The peripheral handle is used for the following purposes: Multi-instance support: each peripheral/module instance has its own handle. As a result instance resources are independent. Peripheral process intercommunication: the handle is used to manage shared data resources between the process routines.
  • Page 33: Initialization And Configuration Structure

    UM1940 Overview of HAL drivers 3) For the shared and system peripherals, no handle or instance object is used. The peripherals concerned by this exception are the following: GPIO SYSTICK NVIC FLASH. 2.2.2 Initialization and configuration structure These structures are defined in the generic driver header file when it is common to all part numbers.
  • Page 34: Devices Supported By Hal Drivers

    Overview of HAL drivers UM1940 HAL_StatusTypeDef HAL_ADC_Stop_IT(ADC_HandleTypeDef* hadc); void HAL_ADC_IRQHandler(ADC_HandleTypeDef* hadc); Extension APIs:This set of API is divided into two sub-categories : Family specific APIs: APIs applying to a given family. They are located in the extension HAL driver file (see example below related to the ADC). HAL_StatusTypeDef HAL_ADCEx_InjectedStop(ADC_HandleTypeDef* hadc);...
  • Page 35 UM1940 Overview of HAL drivers IP/Module STM32F205xx STM32F215xx STM32F207xx STM32F217xx stm32f2xx_hal_i2c.c stm32f2xx_hal_i2s.c stm32f2xx_hal_irda.c stm32f2xx_hal_iwdg.c stm32f2xx_hal_nand.c stm32f2xx_hal_nor.c stm32f2xx_hal_pccard.c stm32f2xx_hal_pcd.c stm32f2xx_hal_pcd_ex.c stm32f2xx_hal_pwr.c stm32f2xx_hal_pwr_ex.c stm32f2xx_hal_rcc.c stm32f2xx_hal_rcc_ex.c stm32f2xx_hal_rng.c stm32f2xx_hal_rtc.c stm32f2xx_hal_rtc_ex.c stm32f2xx_hal_sd.c stm32f2xx_hal_smartcard.c stm32f2xx_hal_spi.c stm32f2xx_hal_sram.c stm32f2xx_hal_tim.c stm32f2xx_hal_tim_ex.c stm32f2xx_hal_uart.c stm32f2xx_hal_usart.c stm32f2xx_hal_wwdg.c stm32f2xx_ll_fsmc.c stm32f2xx_ll_sdmmc.c stm32f2xx_ll_usb.c stm32f2xx_ll_adc.c stm32f2xx_ll_crc.c stm32f2xx_ll_dac.c stm32f2xx_ll_dma.c stm32f2xx_ll_exti.c...
  • Page 36: Hal Driver Rules

    Overview of HAL drivers UM1940 IP/Module STM32F205xx STM32F215xx STM32F207xx STM32F217xx stm32f2xx_ll_rng.c stm32f2xx_ll_rtc.c stm32f2xx_ll_spi.c stm32f2xx_ll_tim.c stm32f2xx_ll_usart.c stm32f2xx_ll_utils.c HAL driver rules 2.5.1 HAL API naming rules The following naming rules are used in HAL drivers: Table 6: HAL API naming rules Generic Family specific Device specific File...
  • Page 37: Hal General Naming Rules

    UM1940 Overview of HAL drivers The structure containing the PPP peripheral initialization parameters are named PPP_InitTypeDef (e.g. ADC_InitTypeDef). The structure containing the Specific configuration parameters for the PPP peripheral are named PPP_xxxxConfTypeDef (e.g. ADC_ChannelConfTypeDef). Peripheral handle structures are named PPP_HandleTypedef (e.g DMA_HandleTypeDef) The functions used to initialize the PPP peripheral according to parameters specified in PPP_InitTypeDef are named HAL_PPP_Init (e.g.
  • Page 38: Hal Interrupt Handler And Callback Functions

    Overview of HAL drivers UM1940 Macros Description __HAL_PPP_DISABLE(__HANDLE__) Disables a peripheral __HAL_PPP_XXXX (__HANDLE__, __PARAM__) Specific PPP HAL driver macro __HAL_PPP_GET_ IT_SOURCE (__HANDLE__, __ Checks the source of specified INTERRUPT __) interrupt NVIC and SYSTICK are two ARM Cortex core features. The APIs related to these features are located in the stm32f2xx_hal_cortex.c file.
  • Page 39: Hal Generic Apis

    UM1940 Overview of HAL drivers Callback functions Example Ex: HAL_USART_TxCpltCallback HAL_PPP_ProcessCpltCallback Called by peripheral or DMA interrupt handler when the process completes Ex: HAL_USART_ErrorCallback HAL_PPP_ErrorCallback Called by peripheral or DMA interrupt handler when an error occurs HAL generic APIs The generic APIs provide common generic functions applying to all STM32 devices. They are composed of four APIs groups: Initialization and de-initialization functions:HAL_PPP_Init(), HAL_PPP_DeInit() IO operation functions: HAL_PPP_Read(), HAL_PPP_Write(),HAL_PPP_Transmit(),...
  • Page 40: Hal Extension Apis

    Overview of HAL drivers UM1940 Function Common API name Description group This function allows waiting for the end of conversions when the polling method is used. In HAL_ADC_PollForConversion() this case, a timout value is specified by the user according to the application. This function starts ADC conversions when the HAL_ADC_Start_IT() interrupt method is used...
  • Page 41: Hal Extension Model Cases

    UM1940 Overview of HAL drivers Function Group Common API Name This function configures the selected ADC Injected channel HAL_ADCEx_InjectedConfigChannel() (corresponding rank in the sequencer and sample time) 2.7.2 HAL extension model cases The specific IP features can be handled by the HAL drivers in five different ways. They are described below.
  • Page 42: Figure 4: Updating Existing Apis

    Overview of HAL drivers UM1940 Case 3: Updating existing common APIs In this case, the routines are defined with the same names in the stm32f2xx_hal_ppp_ex.c extension file, while the generic API is defined as weak, so that the compiler will overwrite the original routine by the new defined function.
  • Page 43: File Inclusion Model

    UM1940 Overview of HAL drivers File inclusion model The header of the common HAL driver file (stm32f2xx_hal.h) includes the common configurations for the whole HAL library. It is the only header file that is included in the user sources and the HAL C sources files to be able to use the HAL resources. Figure 5: File inclusion model A PPP driver is a standalone module which is used in a project.
  • Page 44: Hal Configuration

    Overview of HAL drivers UM1940 Typedef enum HAL_OK = 0x00, HAL_ERROR = 0x01, HAL_BUSY = 0x02, HAL_TIMEOUT = 0x03 } HAL_StatusTypeDef; HAL Locked The HAL lock is used by all HAL APIs to prevent accessing by accident shared resources. typedef enum HAL_UNLOCKED = 0x00, /*!<Resources unlocked */ HAL_LOCKED = 0x01 /*!<...
  • Page 45 UM1940 Overview of HAL drivers Configuration item Description Default Value VDD_VALUE VDD value 3300 (mV) USE_RTOS Enables the use of RTOS FALSE (for future use) PREFETCH_ENABLE Enables prefetch feature TRUE Enables instruction cache TRUE INSTRUCTION_CACHE_ENABLE DATA_CACHE_ENABLE Enables data cache TRUE Enables module to be used in USE HAL_PPP_MODULE the HAL driver...
  • Page 46: Hal System Peripheral Handling

    Overview of HAL drivers UM1940 2.11 HAL system peripheral handling This chapter gives an overview of how the system peripherals are handled by the HAL drivers. The full API list is provided within each peripheral driver description section. 2.11.1 Clock Two main functions can be used to configure the system clock: HAL_RCC_OscConfig (RCC_OscInitTypeDef *RCC_OscInitStruct).
  • Page 47: Table 12: Description Of Gpio_Inittypedef Structure

    UM1940 Overview of HAL drivers Table 12: Description of GPIO_InitTypeDef structure Structure Description field Specifies the GPIO pins to be configured. Possible values: GPIO_PIN_x or GPIO_PIN_All, where x[0..15] Specifies the operating mode for the selected pins: GPIO mode or EXTI mode. Possible values are: GPIO mode GPIO_MODE_INPUT : Input floating...
  • Page 48: Cortex Nvic And Systick Timer

    Overview of HAL drivers UM1940 2.11.3 Cortex NVIC and SysTick timer The Cortex HAL driver, stm32f2xx_hal_cortex.c, provides APIs to handle NVIC and Systick. The supported APIs include: HAL_NVIC_SetPriority()/ HAL_NVIC_SetPriorityGrouping() HAL_NVIC_GetPriority() / HAL_NVIC_GetPriorityGrouping() HAL_NVIC_EnableIRQ()/HAL_NVIC_DisableIRQ() HAL_NVIC_SystemReset() HAL_SYSTICK_IRQHandler() HAL_NVIC_GetPendingIRQ() / HAL_NVIC_SetPendingIRQ () / HAL_NVIC_ClearPendingIRQ() HAL_NVIC_GetActive(IRQn) HAL_SYSTICK_Config()
  • Page 49: Table 13: Description Of Exti Configuration Macros

    UM1940 Overview of HAL drivers Table 13: Description of EXTI configuration macros Macros Description Defines the EXTI line connected to the internal peripheral. Example: PPP_EXTI_LINE_FUNCTION #define PWR_EXTI_LINE_PVD ((uint32_t)0x00010000) /*!<External interrupt line 16 Connected to the PVD EXTI Line */ Enables a given EXTI line __HAL_PPP_EXTI_ENABLE_IT(__EXTI_LINE__) Example: __HAL_PVD_EXTI_ENABLE_IT(PWR_EXTI_LINE_PVD)
  • Page 50 Overview of HAL drivers UM1940 Two operating modes are available: Polling mode I/O operation Use HAL_DMA_Start() to start DMA transfer when the source and destination addresses and the Length of data to be transferred have been configured. Use HAL_DMA_PollForTransfer() to poll for the end of current transfer. In this case a fixed timeout can be configured depending on the user application.
  • Page 51: How To Use Hal Drivers

    UM1940 Overview of HAL drivers 2.12 How to use HAL drivers 2.12.1 HAL usage models The following figure shows the typical use of the HAL driver and the interaction between the application user, the HAL driver and the interrupts. Figure 6: HAL driver model The functions implemented in the HAL driver are shown in green, the functions called from interrupt handlers in dotted lines, and the msp functions implemented in the user application in red.
  • Page 52: Hal Initialization

    Overview of HAL drivers UM1940 2.12.2 HAL initialization 2.12.2.1 HAL global initialization In addition to the peripheral initialization and de-initialization functions, a set of APIs are provided to initialize the HAL core implemented in file stm32f2xx_hal.c. HAL_Init(): this function must be called at application startup to initialize data/instruction cache and pre-fetch queue set SysTick timer to generate an interrupt each 1ms (based on HSI clock) with the lowest priority...
  • Page 53: Table 14: Msp Functions

    UM1940 Overview of HAL drivers 2.12.2.3 HAL MSP initialization process The peripheral initialization is done through HAL_PPP_Init() while the hardware resources initialization used by a peripheral (PPP) is performed during this initialization by calling MSP callback function HAL_PPP_MspInit(). The MspInit callback performs the low level initialization related to the different additional hardware resources: RCC, GPIO, NVIC and DMA.
  • Page 54: Hal Io Operation Process

    Overview of HAL drivers UM1940 2.12.3 HAL IO operation process The HAL functions with internal data processing like transmit, receive, write and read are generally provided with three data processing modes as follows: Polling mode Interrupt mode DMA mode 2.12.3.1 Polling mode In Polling mode, the HAL functions return the process status when the data processing in blocking mode is complete.
  • Page 55 UM1940 Overview of HAL drivers An example of use is illustrated below: main.c file: UART_HandleTypeDef UartHandle; int main(void) /* Set User Parameters */ UartHandle.Init.BaudRate = 9600; UartHandle.Init.WordLength = UART_DATABITS_8; UartHandle.Init.StopBits = UART_STOPBITS_1; UartHandle.Init.Parity = UART_PARITY_NONE; UartHandle.Init.HwFlowCtl = UART_HWCONTROL_NONE; UartHandle.Init.Mode = UART_MODE_TX_RX; UartHandle.Init.Instance = USART1;...
  • Page 56 Overview of HAL drivers UM1940 The initialization is done as follows (UART example): int main(void) /* Set User Parameters */ UartHandle.Init.BaudRate = 9600; UartHandle.Init.WordLength = UART_DATABITS_8; UartHandle.Init.StopBits = UART_STOPBITS_1; UartHandle.Init.Parity = UART_PARITY_NONE; UartHandle.Init.HwFlowCtl = UART_HWCONTROL_NONE; UartHandle.Init.Mode = UART_MODE_TX_RX; UartHandle.Init.Instance = UART1; HAL_UART_Init(&UartHandle);...
  • Page 57: Timeout And Error Management

    UM1940 Overview of HAL drivers HAL_USART_TxCpltCallback() and HAL_USART_ErrorCallback() should be linked in the HAL_PPP_Process_DMA() function to the DMA transfer complete callback and the DMA transfer Error callback by using the following statement: HAL_PPP_Process_DMA (PPP_HandleTypeDef *hppp, Params….) (…) hppp->DMA_Handle->XferCpltCallback = HAL_UART_TxCpltCallback ; hppp->DMA_Handle->XferErrorCallback = HAL_UART_ErrorCallback ;...
  • Page 58 Overview of HAL drivers UM1940 The following example shows how to use the timeout inside the polling functions: HAL_PPP_StateTypeDef HAL_PPP_Poll (PPP_HandleTypeDef *hppp, uint32_t Timeout) (…) timeout = HAL_GetTick() + Timeout; (…) while(ProcessOngoing) (…) if(Timeout != HAL_MAX_DELAY) if(HAL_GetTick() >= timeout) /* Process unlocked */ __HAL_UNLOCK(hppp);...
  • Page 59 UM1940 Overview of HAL drivers In all peripheral handles, a HAL_PPP_ErrorTypeDef is defined and used to store the last error code. typedef struct PPP_TypeDef * Instance; /* PPP registers base address */ PPP_InitTypeDef Init; /* PPP initialization parameters */ HAL_LockTypeDef Lock; /* PPP locking object */ __IO HAL_PPP_StateTypeDef State;...
  • Page 60 Overview of HAL drivers UM1940 * @param expr: If expr is false, it calls assert_failed function * which reports the name of the source file and the source * line number of the call that failed. * If expr is true, it returns no value. * @retval None */ #define assert_param(expr) ((expr)?(void)0:assert_failed((uint8_t *)__FILE__, __LINE__))
  • Page 61: Overview Of Low Layer Drivers

    UM1940 Overview of Low Layer drivers Overview of Low Layer drivers The Low Layer (LL) drivers are designed to offer a fast light-weight expert-oriented layer which is closer to the hardware than the HAL. Contrary to the HAL, LL APIs are not provided for peripherals where optimized access is not a key feature, or those requiring heavy software configuration and/or complex upper-level stack (such as FSMC, USB or SDMMC).
  • Page 62: Figure 7: Low Layer Driver Folders

    Overview of Low Layer drivers UM1940 File Description Template file allowing to define the assert_param macro, that is used when run-time checking is enabled. stm32_assert_template.h This file is required only when the LL drivers are used in standalone mode (without calling the HAL APIs). It should be copied to the application folder and renamed to stm32_assert.h.
  • Page 63: Overview Of Low Layer Apis And Naming Rules

    UM1940 Overview of Low Layer drivers Figure 8: Low Layer driver CMSIS files Application files have to include only the used Low Layer driver header files. Overview of Low Layer APIs and naming rules 3.2.1 Peripheral initialization functions The LL drivers offer three set of initialization functions. They are defined in stm32f2xx_ll_ppp.c file: Functions to initialize peripheral main features according to the parameters specified in data structures...
  • Page 64: Table 17: Common Peripheral Initialization Functions

    Overview of Low Layer drivers UM1940 Table 17: Common peripheral initialization functions Return Functions Parameters Description Type Initializes the peripheral main features according to the parameters specified in PPP_TypeDef* PPPx PPP_InitStruct. LL_PPP_InitTypeDef* LL_PPP_Init ErrorStatus Example: LL_USART_Init(USART_TypeDef PPP_InitStruct *USARTx, LL_USART_InitTypeDef *USART_InitStruct) Fills each PPP_InitStruct member with its default value.
  • Page 65: Table 18: Optional Peripheral Initialization Functions

    UM1940 Overview of Low Layer drivers Additional functions are available for some peripherals (refer to Table 18: "Optional peripheral initialization functions" Table 18: Optional peripheral initialization functions Return Functions Parameters Examples Type Initializes peripheral features according to the parameters specified in PPP_InitStruct. Example: LL_ADC_INJ_Init(ADC_TypeDef *ADCx, LL_ADC_INJ_InitTypeDef...
  • Page 66 Overview of Low Layer drivers UM1940 Return Functions Parameters Examples Type Fills each PPP_CommonInitStruct member with its default value LL_PPP_ LL_PPP_CommonInitType void Example: Def* PPP_CommonInitStruct CommonStructInit LL_ADC_CommonStructInit(LL_AD C_CommonInitTypeDef *ADC_CommonInitStruct) Initializes the peripheral clock configuration in synchronous mode. PPP_TypeDef* PPPx LL_PPP_ClockInit Error Example: LL_PPP_ClockInit...
  • Page 67: Peripheral Register-Level Configuration Functions

    UM1940 Overview of Low Layer drivers 3.2.2 Peripheral register-level configuration functions On top of the peripheral initialization functions, the LL drivers offer a set of inline functions for direct atomic register access. Their format is as follows: __STATIC_INLINE return_type LL_PPP_Function (PPPx_TypeDef *PPPx, args) The “Function”...
  • Page 68: Table 22: Peripheral Activation/Deactivation Management

    Overview of Low Layer drivers UM1940 'x' corresponds to the group index and refers to the index of the modified register on a given bus. Peripheral activation/deactivation management: Enable/disable a peripheral or activate/deactivate specific peripheral features Table 22: Peripheral activation/deactivation management Name Examples LL_ADC_Enable ()
  • Page 69: Cohabiting Of Hal And Ll

    (RCC, common HAL, flash and GPIO). Several examples showing how to use HAL and LL in the same application are provided within stm32f2 firmware package (refer to Examples_MIX projects). When the HAL Init/DeInit APIs are not used and are replaced by the Low Layer macros, the InitMsp() functions are not called and the MSP initialization should be done in the user application.
  • Page 70: Hal System Driver

    HAL System Driver UM1940 HAL System Driver HAL Firmware driver API description 5.1.1 How to use this driver The common HAL driver contains a set of generic and common APIs that can be used by the PPP peripheral drivers and the user to start using the HAL. The HAL contains two APIs' categories: Common HAL APIs Services HAL APIs...
  • Page 71: Detailed Description Of Functions

    UM1940 HAL System Driver Get the device revision identifier Enable/Disable Debug module during SLEEP mode Enable/Disable Debug module during STOP mode Enable/Disable Debug module during STANDBY mode This section contains the following APIs: HAL_IncTick() HAL_GetTick() HAL_Delay() HAL_SuspendTick() HAL_ResumeTick() HAL_GetHalVersion() HAL_GetREVID() HAL_GetDEVID() HAL_DBGMCU_EnableDBGSleepMode() HAL_DBGMCU_DisableDBGSleepMode()
  • Page 72 HAL System Driver UM1940 HAL_MspDeInit Function name void HAL_MspDeInit (void ) Function description DeInitializes the MSP. Return values None: HAL_InitTick Function name HAL_StatusTypeDef HAL_InitTick (uint32_t TickPriority) Function description This function configures the source of the time base. Parameters TickPriority: Tick interrupt priority. Return values HAL: status Notes...
  • Page 73 UM1940 HAL System Driver HAL_GetTick Function name uint32_t HAL_GetTick (void ) Function description Provides a tick value in millisecond. Return values tick: value Notes This function is declared as __weak to be overwritten in case of other implementations in user file. HAL_SuspendTick Function name void HAL_SuspendTick (void )
  • Page 74 HAL System Driver UM1940 Function description Returns the device identifier. Return values Device: identifier HAL_DBGMCU_EnableDBGSleepMode Function name void HAL_DBGMCU_EnableDBGSleepMode (void ) Function description Enable the Debug Module during SLEEP mode. Return values None: HAL_DBGMCU_DisableDBGSleepMode Function name void HAL_DBGMCU_DisableDBGSleepMode (void ) Function description Disable the Debug Module during SLEEP mode.
  • Page 75: Hal Firmware Driver Defines

    UM1940 HAL System Driver supply voltage ranges from 2.4 to 3.6 V. HAL_DisableCompensationCell Function name void HAL_DisableCompensationCell (void ) Function description Power-down the I/O Compensation Cell. Return values None: Notes The I/O compensation cell can be used only when the device supply voltage ranges from 2.4 to 3.6 V.
  • Page 76 HAL System Driver UM1940 __HAL_DBGMCU_FREEZE_TIM9 __HAL_DBGMCU_FREEZE_TIM10 __HAL_DBGMCU_FREEZE_TIM11 __HAL_DBGMCU_UNFREEZE_TIM2 __HAL_DBGMCU_UNFREEZE_TIM3 __HAL_DBGMCU_UNFREEZE_TIM4 __HAL_DBGMCU_UNFREEZE_TIM5 __HAL_DBGMCU_UNFREEZE_TIM6 __HAL_DBGMCU_UNFREEZE_TIM7 __HAL_DBGMCU_UNFREEZE_TIM12 __HAL_DBGMCU_UNFREEZE_TIM13 __HAL_DBGMCU_UNFREEZE_TIM14 __HAL_DBGMCU_UNFREEZE_RTC __HAL_DBGMCU_UNFREEZE_WWDG __HAL_DBGMCU_UNFREEZE_IWDG __HAL_DBGMCU_UNFREEZE_I2C1_TIMEOUT __HAL_DBGMCU_UNFREEZE_I2C2_TIMEOUT __HAL_DBGMCU_UNFREEZE_I2C3_TIMEOUT __HAL_DBGMCU_UNFREEZE_CAN1 __HAL_DBGMCU_UNFREEZE_CAN2 __HAL_DBGMCU_UNFREEZE_TIM1 __HAL_DBGMCU_UNFREEZE_TIM8 __HAL_DBGMCU_UNFREEZE_TIM9 __HAL_DBGMCU_UNFREEZE_TIM10 __HAL_DBGMCU_UNFREEZE_TIM11 __HAL_SYSCFG_REMAPMEMORY_FLASH __HAL_SYSCFG_REMAPMEMORY_SYSTEMFLASH __HAL_SYSCFG_REMAPMEMORY_SRAM __HAL_SYSCFG_REMAPMEMORY_FSMC 76/1371 DocID028236 Rev 2...
  • Page 77: Hal Adc Generic Driver

    UM1940 HAL ADC Generic Driver HAL ADC Generic Driver ADC Firmware driver registers structures 6.1.1 ADC_InitTypeDef Data Fields uint32_t ClockPrescaler uint32_t Resolution uint32_t DataAlign uint32_t ScanConvMode uint32_t EOCSelection uint32_t ContinuousConvMode uint32_t NbrOfConversion uint32_t DiscontinuousConvMode uint32_t NbrOfDiscConversion uint32_t ExternalTrigConv uint32_t ExternalTrigConvEdge uint32_t DMAContinuousRequests Field Documentation uint32_t ADC_InitTypeDef::ClockPrescaler...
  • Page 78: Adc_Channelconftypedef

    HAL ADC Generic Driver UM1940 HAL_ADC_Start_IT() ) with parameter EOCSelection set to end of each conversion or in mode 'transfer by DMA' (function HAL_ADC_Start_DMA()). If overrun feature is intended to be bypassed, use ADC in mode 'polling' or 'interruption' with parameter EOCSelection must be set to end of sequence uint32_t ADC_InitTypeDef::ContinuousConvMode Specifies whether the conversion is performed in single mode (one conversion) or...
  • Page 79: Adc_Analogwdgconftypedef

    UM1940 HAL ADC Generic Driver uint32_t ADC_ChannelConfTypeDef::Channel Specifies the channel to configure into ADC regular group. This parameter can be a value of ADC_channels uint32_t ADC_ChannelConfTypeDef::Rank Specifies the rank in the regular group sequencer. This parameter must be a number between Min_Data = 1 and Max_Data = 16 uint32_t ADC_ChannelConfTypeDef::SamplingTime Sampling time value to be set for the selected channel.
  • Page 80: Adc_Handletypedef

    HAL ADC Generic Driver UM1940 6.1.4 ADC_HandleTypeDef Data Fields ADC_TypeDef * Instance ADC_InitTypeDef Init __IO uint32_t NbrOfCurrentConversionRank DMA_HandleTypeDef * DMA_Handle HAL_LockTypeDef Lock __IO uint32_t State __IO uint32_t ErrorCode Field Documentation ADC_TypeDef* ADC_HandleTypeDef::Instance Register base address ADC_InitTypeDef ADC_HandleTypeDef::Init ADC required parameters __IO uint32_t ADC_HandleTypeDef::NbrOfCurrentConversionRank ADC number of current conversion rank DMA_HandleTypeDef* ADC_HandleTypeDef::DMA_Handle...
  • Page 81: How To Use This Driver

    UM1940 HAL ADC Generic Driver 6.2.2 How to use this driver Initialize the ADC low level resources by implementing the HAL_ADC_MspInit(): Enable the ADC interface clock using __HAL_RCC_ADC_CLK_ENABLE() ADC pins configuration Enable the clock for the ADC GPIOs using the following function: __HAL_RCC_GPIOx_CLK_ENABLE() Configure these ADC pins in analog mode using HAL_GPIO_Init() In case of using interrupts (e.g.
  • Page 82 HAL ADC Generic Driver UM1940 At ADC end of conversion HAL_ADC_ConvCpltCallback() function is executed and user can add his own code by customization of function pointer HAL_ADC_ConvCpltCallback In case of ADC Error, HAL_ADC_ErrorCallback() function is executed and user can add his own code by customization of function pointer HAL_ADC_ErrorCallback Stop the ADC peripheral using HAL_ADC_Stop_IT() DMA mode IO operation Start the ADC peripheral using HAL_ADC_Start_DMA(), at this stage the user specify...
  • Page 83: Initialization And De-Initialization Functions

    UM1940 HAL ADC Generic Driver Disable the NVIC for ADC using function HAL_NVIC_DisableIRQ(ADCx_IRQn) Optionally, in case of usage of DMA: Deinitialize the DMA using function HAL_DMA_DeInit(). Disable the NVIC for DMA using function HAL_NVIC_DisableIRQ(DMAx_Channelx_IRQn) 6.2.3 Initialization and de-initialization functions This section provides functions allowing to: Initialize and configure the ADC.
  • Page 84: Peripheral State And Errors Functions

    HAL ADC Generic Driver UM1940 This section contains the following APIs: HAL_ADC_ConfigChannel() HAL_ADC_AnalogWDGConfig() 6.2.6 Peripheral State and errors functions This subsection provides functions allowing to Check the ADC state Check the ADC Error This section contains the following APIs: HAL_ADC_GetState() HAL_ADC_GetError() 6.2.7 Detailed description of functions...
  • Page 85 UM1940 HAL ADC Generic Driver Return values None: HAL_ADC_MspDeInit void HAL_ADC_MspDeInit (ADC_HandleTypeDef * hadc) Function name Function description DeInitializes the ADC MSP. Parameters hadc: pointer to a ADC_HandleTypeDef structure that contains the configuration information for the specified ADC. Return values None: HAL_ADC_Start HAL_StatusTypeDef HAL_ADC_Start (ADC_HandleTypeDef *...
  • Page 86 HAL ADC Generic Driver UM1940 the complete sequence. HAL_ADC_PollForEvent Function name HAL_StatusTypeDef HAL_ADC_PollForEvent (ADC_HandleTypeDef * hadc, uint32_t EventType, uint32_t Timeout) Function description Poll for conversion event. Parameters hadc: pointer to a ADC_HandleTypeDef structure that contains the configuration information for the specified ADC. EventType: the ADC event type.
  • Page 87 UM1940 HAL ADC Generic Driver HAL_ADC_Start_DMA Function name HAL_StatusTypeDef HAL_ADC_Start_DMA (ADC_HandleTypeDef * hadc, uint32_t * pData, uint32_t Length) Function description Enables ADC DMA request after last transfer (Single-ADC mode) and enables ADC peripheral. Parameters hadc: pointer to a ADC_HandleTypeDef structure that contains the configuration information for the specified ADC.
  • Page 88 HAL ADC Generic Driver UM1940 Parameters hadc: pointer to a ADC_HandleTypeDef structure that contains the configuration information for the specified ADC. Return values None: HAL_ADC_LevelOutOfWindowCallback Function name void HAL_ADC_LevelOutOfWindowCallback (ADC_HandleTypeDef * hadc) Function description Analog watchdog callback in non blocking mode. Parameters hadc: pointer to a ADC_HandleTypeDef structure that contains the configuration information for the specified ADC.
  • Page 89: Adc Firmware Driver Defines

    UM1940 HAL ADC Generic Driver AnalogWDGConfig: : pointer to an ADC_AnalogWDGConfTypeDef structure that contains the configuration information of ADC analog watchdog. Return values HAL: status Notes Analog watchdog thresholds can be modified while ADC conversion is on going. In this case, some constraints must be taken into account: The programmed threshold values are effective from the next ADC EOC (end of unitary conversion).
  • Page 90 HAL ADC Generic Driver UM1940 ADC_CHANNEL_3 ADC_CHANNEL_4 ADC_CHANNEL_5 ADC_CHANNEL_6 ADC_CHANNEL_7 ADC_CHANNEL_8 ADC_CHANNEL_9 ADC_CHANNEL_10 ADC_CHANNEL_11 ADC_CHANNEL_12 ADC_CHANNEL_13 ADC_CHANNEL_14 ADC_CHANNEL_15 ADC_CHANNEL_16 ADC_CHANNEL_17 ADC_CHANNEL_18 ADC_CHANNEL_VREFINT ADC_CHANNEL_VBAT ADC Channels Type ADC_ALL_CHANNELS ADC_REGULAR_CHANNELS reserved for future use ADC_INJECTED_CHANNELS reserved for future use ADC Clock Prescaler ADC_CLOCK_SYNC_PCLK_DIV2 ADC_CLOCK_SYNC_PCLK_DIV4 ADC_CLOCK_SYNC_PCLK_DIV6...
  • Page 91 UM1940 HAL ADC Generic Driver ADC_TWOSAMPLINGDELAY_10CYCLES ADC_TWOSAMPLINGDELAY_11CYCLES ADC_TWOSAMPLINGDELAY_12CYCLES ADC_TWOSAMPLINGDELAY_13CYCLES ADC_TWOSAMPLINGDELAY_14CYCLES ADC_TWOSAMPLINGDELAY_15CYCLES ADC_TWOSAMPLINGDELAY_16CYCLES ADC_TWOSAMPLINGDELAY_17CYCLES ADC_TWOSAMPLINGDELAY_18CYCLES ADC_TWOSAMPLINGDELAY_19CYCLES ADC_TWOSAMPLINGDELAY_20CYCLES ADC EOC Selection ADC_EOC_SEQ_CONV ADC_EOC_SINGLE_CONV ADC_EOC_SINGLE_SEQ_CONV reserved for future use ADC Error Code HAL_ADC_ERROR_NONE No error HAL_ADC_ERROR_INTERNAL ADC IP internal error: if problem of clocking, enable/disable, erroneous state HAL_ADC_ERROR_OVR Overrun error...
  • Page 92 HAL ADC Generic Driver UM1940 None __HAL_ADC_DISABLE Description: Disable the ADC peripheral. Parameters: __HANDLE__: ADC handle Return value: None __HAL_ADC_ENABLE_IT Description: Enable the ADC end of conversion interrupt. Parameters: __HANDLE__: specifies the ADC Handle. __INTERRUPT__: ADC Interrupt. Return value: None Description: __HAL_ADC_DISABLE_IT Disable the ADC end of conversion...
  • Page 93 UM1940 HAL ADC Generic Driver None __HAL_ADC_GET_FLAG Description: Get the selected ADC's flag status. Parameters: __HANDLE__: specifies the ADC Handle. __FLAG__: ADC flag. Return value: None ADC Exported Types HAL_ADC_STATE_RESET ADC not yet initialized or disabled HAL_ADC_STATE_READY ADC peripheral ready for use HAL_ADC_STATE_BUSY_INTERNAL ADC is busy to internal process (initialization, calibration)
  • Page 94 HAL ADC Generic Driver UM1940 ADC_EXTERNALTRIGCONV_T1_CC3 ADC_EXTERNALTRIGCONV_T2_CC2 ADC_EXTERNALTRIGCONV_T2_CC3 ADC_EXTERNALTRIGCONV_T2_CC4 ADC_EXTERNALTRIGCONV_T2_TRGO ADC_EXTERNALTRIGCONV_T3_CC1 ADC_EXTERNALTRIGCONV_T3_TRGO ADC_EXTERNALTRIGCONV_T4_CC4 ADC_EXTERNALTRIGCONV_T5_CC1 ADC_EXTERNALTRIGCONV_T5_CC2 ADC_EXTERNALTRIGCONV_T5_CC3 ADC_EXTERNALTRIGCONV_T8_CC1 ADC_EXTERNALTRIGCONV_T8_TRGO ADC_EXTERNALTRIGCONV_Ext_IT11 ADC_SOFTWARE_START ADC Flags Definition ADC_FLAG_AWD ADC_FLAG_EOC ADC_FLAG_JEOC ADC_FLAG_JSTRT ADC_FLAG_STRT ADC_FLAG_OVR ADC Interrupts Definition ADC_IT_EOC ADC_IT_AWD ADC_IT_JEOC ADC_IT_OVR ADC Resolution ADC_RESOLUTION_12B ADC_RESOLUTION_10B ADC_RESOLUTION_8B ADC_RESOLUTION_6B ADC Sampling Times...
  • Page 95 UM1940 HAL ADC Generic Driver ADC_SAMPLETIME_56CYCLES ADC_SAMPLETIME_84CYCLES ADC_SAMPLETIME_112CYCLES ADC_SAMPLETIME_144CYCLES ADC_SAMPLETIME_480CYCLES DocID028236 Rev 2 95/1371...
  • Page 96: Hal Adc Extension Driver

    HAL ADC Extension Driver UM1940 HAL ADC Extension Driver ADCEx Firmware driver registers structures 7.1.1 ADC_InjectionConfTypeDef Data Fields uint32_t InjectedChannel uint32_t InjectedRank uint32_t InjectedSamplingTime uint32_t InjectedOffset uint32_t InjectedNbrOfConversion uint32_t InjectedDiscontinuousConvMode uint32_t AutoInjectedConv uint32_t ExternalTrigInjecConv uint32_t ExternalTrigInjecConvEdge Field Documentation uint32_t ADC_InjectionConfTypeDef::InjectedChannel Selection of ADC channel to configure This parameter can be a value of ADC_channels Note: Depending on devices, some channels may not be available on...
  • Page 97: Adc_Multimodetypedef

    UM1940 HAL ADC Extension Driver a channel on injected group can impact the configuration of other channels previously set. uint32_t ADC_InjectionConfTypeDef::InjectedDiscontinuousConvMode Specifies whether the conversions sequence of injected group is performed in Complete-sequence/Discontinuous-sequence (main sequence subdivided in successive parts). Discontinuous mode is used only if sequencer is enabled (parameter 'ScanConvMode').
  • Page 98: Adcex Firmware Driver Api Description

    HAL ADC Extension Driver UM1940 Field Documentation uint32_t ADC_MultiModeTypeDef::Mode Configures the ADC to operate in independent or multi mode. This parameter can be a value of ADCEx_Common_mode uint32_t ADC_MultiModeTypeDef::DMAAccessMode Configures the Direct memory access mode for multi ADC mode. This parameter can be a value of ADCEx_Direct_memory_access_mode_for_multi_mode uint32_t ADC_MultiModeTypeDef::TwoSamplingDelay...
  • Page 99: Extended Features Functions

    UM1940 HAL ADC Extension Driver At ADC end of conversion HAL_ADCEx_InjectedConvCpltCallback() function is executed and user can add his own code by customization of function pointer HAL_ADCEx_InjectedConvCpltCallback In case of ADC Error, HAL_ADCEx_InjectedErrorCallback() function is executed and user can add his own code by customization of function pointer HAL_ADCEx_InjectedErrorCallback Stop the ADC peripheral using HAL_ADCEx_InjectedStop_IT() DMA mode IO operation...
  • Page 100 HAL ADC Extension Driver UM1940 7.2.3 Detailed description of functions HAL_ADCEx_InjectedStart Function name HAL_StatusTypeDef HAL_ADCEx_InjectedStart (ADC_HandleTypeDef * hadc) Function description Enables the selected ADC software start conversion of the injected channels. Parameters hadc: pointer to a ADC_HandleTypeDef structure that contains the configuration information for the specified ADC. Return values HAL: status HAL_ADCEx_InjectedStop...
  • Page 101 UM1940 HAL ADC Extension Driver HAL_ADCEx_InjectedStop_IT Function name HAL_StatusTypeDef HAL_ADCEx_InjectedStop_IT (ADC_HandleTypeDef * hadc) Function description Stop conversion of injected channels, disable interruption of end- of-conversion. Parameters hadc: ADC handle Return values None: Notes If ADC must be disabled and if conversion is on going on regular group, function HAL_ADC_Stop must be used to stop both injected and regular groups, and disable the ADC.
  • Page 102 HAL ADC Extension Driver UM1940 HAL_ADCEx_MultiModeStop_DMA Function name HAL_StatusTypeDef HAL_ADCEx_MultiModeStop_DMA (ADC_HandleTypeDef * hadc) Function description Disables ADC DMA (multi-ADC mode) and disables ADC peripheral. Parameters hadc: pointer to a ADC_HandleTypeDef structure that contains the configuration information for the specified ADC. Return values HAL: status HAL_ADCEx_MultiModeGetValue...
  • Page 103: Adcex Firmware Driver Defines

    UM1940 HAL ADC Extension Driver Function description Configures the ADC multi-mode. Parameters hadc: : pointer to a ADC_HandleTypeDef structure that contains the configuration information for the specified ADC. multimode: : pointer to an ADC_MultiModeTypeDef structure that contains the configuration information for multimode.
  • Page 104 HAL ADC Extension Driver UM1940 ADC_EXTERNALTRIGINJECCONVEDGE_RISINGFALLING ADC External Trigger Source Injected ADC_EXTERNALTRIGINJECCONV_T1_CC4 ADC_EXTERNALTRIGINJECCONV_T1_TRGO ADC_EXTERNALTRIGINJECCONV_T2_CC1 ADC_EXTERNALTRIGINJECCONV_T2_TRGO ADC_EXTERNALTRIGINJECCONV_T3_CC2 ADC_EXTERNALTRIGINJECCONV_T3_CC4 ADC_EXTERNALTRIGINJECCONV_T4_CC1 ADC_EXTERNALTRIGINJECCONV_T4_CC2 ADC_EXTERNALTRIGINJECCONV_T4_CC3 ADC_EXTERNALTRIGINJECCONV_T4_TRGO ADC_EXTERNALTRIGINJECCONV_T5_CC4 ADC_EXTERNALTRIGINJECCONV_T5_TRGO ADC_EXTERNALTRIGINJECCONV_T8_CC2 ADC_EXTERNALTRIGINJECCONV_T8_CC3 ADC_EXTERNALTRIGINJECCONV_T8_CC4 ADC_EXTERNALTRIGINJECCONV_EXT_IT15 ADC_INJECTED_SOFTWARE_START ADC Injected Rank ADC_INJECTED_RANK_1 ADC_INJECTED_RANK_2 ADC_INJECTED_RANK_3 ADC_INJECTED_RANK_4 104/1371 DocID028236 Rev 2...
  • Page 105: Hal Can Generic Driver

    UM1940 HAL CAN Generic Driver HAL CAN Generic Driver CAN Firmware driver registers structures 8.1.1 CAN_InitTypeDef Data Fields uint32_t Prescaler uint32_t Mode uint32_t SJW uint32_t BS1 uint32_t BS2 uint32_t TTCM uint32_t ABOM uint32_t AWUM uint32_t NART uint32_t RFLM uint32_t TXFP Field Documentation uint32_t CAN_InitTypeDef::Prescaler Specifies the length of a time quantum.
  • Page 106: Can_Filterconftypedef

    HAL CAN Generic Driver UM1940 uint32_t CAN_InitTypeDef::TXFP Enable or disable the transmit FIFO priority. This parameter can be set to ENABLE or DISABLE 8.1.2 CAN_FilterConfTypeDef Data Fields uint32_t FilterIdHigh uint32_t FilterIdLow uint32_t FilterMaskIdHigh uint32_t FilterMaskIdLow uint32_t FilterFIFOAssignment uint32_t FilterNumber uint32_t FilterMode uint32_t FilterScale uint32_t FilterActivation uint32_t BankNumber...
  • Page 107: Cantxmsgtypedef

    UM1940 HAL CAN Generic Driver 8.1.3 CanTxMsgTypeDef Data Fields uint32_t StdId uint32_t ExtId uint32_t IDE uint32_t RTR uint32_t DLC uint8_t Data Field Documentation uint32_t CanTxMsgTypeDef::StdId Specifies the standard identifier. This parameter must be a number between Min_Data = 0 and Max_Data = 0x7FF uint32_t CanTxMsgTypeDef::ExtId Specifies the extended identifier.
  • Page 108: Can_Handletypedef

    HAL CAN Generic Driver UM1940 uint32_t CanRxMsgTypeDef::RTR Specifies the type of frame for the received message. This parameter can be a value CAN_remote_transmission_request uint32_t CanRxMsgTypeDef::DLC Specifies the length of the frame that will be received. This parameter must be a number between Min_Data = 0 and Max_Data = 8 uint8_t CanRxMsgTypeDef::Data[8] Contains the data to be received.
  • Page 109 UM1940 HAL CAN Generic Driver Connect and configure the involved CAN pins to AF9 using the following function HAL_GPIO_Init() Initialize and configure the CAN using CAN_Init() function. Transmit the desired CAN frame using HAL_CAN_Transmit() function. Receive a CAN frame using HAL_CAN_Receive() function. Polling mode IO operation Start the CAN peripheral transmission and wait the end of this operation using HAL_CAN_Transmit(), at this stage user can specify the value of timeout according to...
  • Page 110: Io Operation Functions

    HAL CAN Generic Driver UM1940 8.2.3 IO operation functions This section provides functions allowing to: Transmit a CAN frame message. Receive a CAN frame message. Enter CAN peripheral in sleep mode. Wake up the CAN peripheral from sleep mode. This section contains the following APIs: HAL_CAN_Transmit() HAL_CAN_Transmit_IT() HAL_CAN_Receive()
  • Page 111 UM1940 HAL CAN Generic Driver sFilterConfig: pointer to a CAN_FilterConfTypeDef structure that contains the filter configuration information. Return values None: HAL_CAN_DeInit Function name HAL_StatusTypeDef HAL_CAN_DeInit (CAN_HandleTypeDef * hcan) Function description Deinitializes the CANx peripheral registers to their default reset values. Parameters hcan: pointer to a CAN_HandleTypeDef structure that contains the configuration information for the specified CAN.
  • Page 112 HAL CAN Generic Driver UM1940 contains the configuration information for the specified CAN. Return values HAL: status HAL_CAN_Receive Function name HAL_StatusTypeDef HAL_CAN_Receive (CAN_HandleTypeDef * hcan, uint8_t FIFONumber, uint32_t Timeout) Function description Receives a correct CAN frame. Parameters hcan: pointer to a CAN_HandleTypeDef structure that contains the configuration information for the specified CAN.
  • Page 113 UM1940 HAL CAN Generic Driver Function description Handles CAN interrupt request. Parameters hcan: pointer to a CAN_HandleTypeDef structure that contains the configuration information for the specified CAN. Return values None: HAL_CAN_TxCpltCallback Function name void HAL_CAN_TxCpltCallback (CAN_HandleTypeDef * hcan) Function description Transmission complete callback in non blocking mode.
  • Page 114: Can Firmware Driver Defines

    HAL CAN Generic Driver UM1940 Return values HAL: state CAN Firmware driver defines 8.3.1 CAN Error Code HAL_CAN_ERROR_NONE No error HAL_CAN_ERROR_EWG EWG error HAL_CAN_ERROR_EPV EPV error HAL_CAN_ERROR_BOF BOF error HAL_CAN_ERROR_STF Stuff error HAL_CAN_ERROR_FOR Form error HAL_CAN_ERROR_ACK Acknowledgment error HAL_CAN_ERROR_BR Bit recessive HAL_CAN_ERROR_BD LEC dominant HAL_CAN_ERROR_CRC...
  • Page 115 UM1940 HAL CAN Generic Driver __HAL_CAN_MSG_PENDING Description: Return the number of pending received messages. Parameters: __HANDLE__: CAN handle __FIFONUMBER__: Receive FIFO number, CAN_FIFO0 or CAN_FIFO1. Return value: The: number of pending message. __HAL_CAN_GET_FLAG Description: Check whether the specified CAN flag is set or not.
  • Page 116 HAL CAN Generic Driver UM1940 acknowledge Flag CAN_FLAG_EWG: Error Warning Flag CAN_FLAG_EPV: Error Passive Flag CAN_FLAG_BOF: Bus-Off Flag Return value: The: new state of __FLAG__ (TRUE or FALSE). __HAL_CAN_CLEAR_FLAG Description: Clear the specified CAN pending flag. Parameters: __HANDLE__: CAN Handle. __FLAG__: specifies the flag to check.
  • Page 117 UM1940 HAL CAN Generic Driver FALSE). __HAL_CAN_GET_IT_SOURCE Description: Check if the specified CAN interrupt source is enabled or disabled. Parameters: __HANDLE__: CAN Handle __INTERRUPT__: specifies the CAN interrupt source to check. This parameter can be one of the following values: CAN_IT_TME: Transmit mailbox empty interrupt enable CAN_IT_FMP0: FIFO0 message...
  • Page 118 HAL CAN Generic Driver UM1940 Return value: None __HAL_CAN_DBG_FREEZE Description: Enable or disable the DBG Freeze for CAN. Parameters: __HANDLE__: CAN Handle __NEWSTATE__: new state of the CAN peripheral. This parameter can be: ENABLE (CAN reception/transmission is frozen during debug. Reception FIFOs can still be accessed/controlled normally) or DISABLE (CAN is working during debug).
  • Page 119 UM1940 HAL CAN Generic Driver CAN_FLAG_SLAK Sleep acknowledge flag CAN_FLAG_ERRI Error flag CAN_FLAG_WKU Wake up flag CAN_FLAG_SLAKI Sleep acknowledge flag CAN_FLAG_EWG Error warning flag CAN_FLAG_EPV Error passive flag CAN_FLAG_BOF Bus-Off flag CAN Identifier Type CAN_ID_STD Standard Id CAN_ID_EXT Extended Id CAN InitStatus CAN_INITSTATUS_FAILED CAN initialization failed...
  • Page 120 HAL CAN Generic Driver UM1940 CAN_MODE_SILENT_LOOPBACK Loopback combined with silent mode CAN Receive FIFO Number Constants CAN_FIFO0 CAN FIFO 0 used to receive CAN_FIFO1 CAN FIFO 1 used to receive CAN Remote Transmission Request CAN_RTR_DATA Data frame CAN_RTR_REMOTE Remote frame CAN Synchronisation Jump Width CAN_SJW_1TQ 1 time quantum...
  • Page 121 UM1940 HAL CAN Generic Driver CAN_BS2_7TQ 7 time quantum CAN_BS2_8TQ 8 time quantum DocID028236 Rev 2 121/1371...
  • Page 122: Hal Cortex Generic Driver

    HAL CORTEX Generic Driver UM1940 HAL CORTEX Generic Driver CORTEX Firmware driver registers structures 9.1.1 MPU_Region_InitTypeDef Data Fields uint8_t Enable uint8_t Number uint32_t BaseAddress uint8_t Size uint8_t SubRegionDisable uint8_t TypeExtField uint8_t AccessPermission uint8_t DisableExec uint8_t IsShareable uint8_t IsCacheable uint8_t IsBufferable Field Documentation uint8_t MPU_Region_InitTypeDef::Enable Specifies the status of the region.
  • Page 123: Cortex Firmware Driver Api Description

    UM1940 HAL CORTEX Generic Driver uint8_t MPU_Region_InitTypeDef::IsBufferable Specifies the bufferable status of the protected region. This parameter can be a value CORTEX_MPU_Access_Bufferable CORTEX Firmware driver API description 9.2.1 How to use this driver How to configure Interrupts using CORTEX HAL driver This section provides functions allowing to configure the NVIC interrupts (IRQ).
  • Page 124: Peripheral Control Functions

    HAL CORTEX Generic Driver UM1940 This section contains the following APIs: HAL_NVIC_SetPriorityGrouping() HAL_NVIC_SetPriority() HAL_NVIC_EnableIRQ() HAL_NVIC_DisableIRQ() HAL_NVIC_SystemReset() HAL_SYSTICK_Config() 9.2.3 Peripheral Control functions This subsection provides a set of functions allowing to control the CORTEX (NVIC, SYSTICK, MPU) functionalities. This section contains the following APIs: HAL_MPU_Disable() HAL_MPU_Enable() HAL_MPU_ConfigRegion()
  • Page 125 UM1940 HAL CORTEX Generic Driver HAL_NVIC_SetPriority Function name void HAL_NVIC_SetPriority (IRQn_Type IRQn, uint32_t PreemptPriority, uint32_t SubPriority) Function description Sets the priority of an interrupt. Parameters IRQn: External interrupt number. This parameter can be an enumerator of IRQn_Type enumeration (For the complete STM32 Devices IRQ Channels list, please refer to the appropriate CMSIS device file (stm32f2xxxx.h)) PreemptPriority: The preemption priority for the IRQn...
  • Page 126 HAL CORTEX Generic Driver UM1940 Function description Initializes the System Timer and its interrupt, and starts the System Tick Timer. Parameters TicksNumb: Specifies the ticks Number of ticks between two interrupts. Return values status: - 0 Function succeeded. 1 Function failed. HAL_NVIC_GetPriorityGrouping Function name uint32_t HAL_NVIC_GetPriorityGrouping (void )
  • Page 127 UM1940 HAL CORTEX Generic Driver STM32 Devices IRQ Channels list, please refer to the appropriate CMSIS device file (stm32f2xxxx.h)) Return values status: - 0 Interrupt status is not pending. 1 Interrupt status is pending. HAL_NVIC_SetPendingIRQ Function name void HAL_NVIC_SetPendingIRQ (IRQn_Type IRQn) Function description Sets Pending bit of an external interrupt.
  • Page 128 HAL CORTEX Generic Driver UM1940 Return values None: HAL_SYSTICK_IRQHandler void HAL_SYSTICK_IRQHandler (void ) Function name Function description This function handles SYSTICK interrupt request. Return values None: HAL_SYSTICK_Callback Function name void HAL_SYSTICK_Callback (void ) Function description SYSTICK callback. Return values None: HAL_MPU_Enable Function name void HAL_MPU_Enable (uint32_t MPU_Control)
  • Page 129: Cortex Firmware Driver Defines

    UM1940 HAL CORTEX Generic Driver CORTEX Firmware driver defines 9.3.1 CORTEX CORTEX MPU Instruction Access Bufferable MPU_ACCESS_BUFFERABLE MPU_ACCESS_NOT_BUFFERABLE CORTEX MPU Instruction Access Cacheable MPU_ACCESS_CACHEABLE MPU_ACCESS_NOT_CACHEABLE CORTEX MPU Instruction Access Shareable MPU_ACCESS_SHAREABLE MPU_ACCESS_NOT_SHAREABLE MPU HFNMI and PRIVILEGED Access control MPU_HFNMI_PRIVDEF_NONE MPU_HARDFAULT_NMI MPU_PRIVILEGED_DEFAULT MPU_HFNMI_PRIVDEF CORTEX MPU Instruction Access...
  • Page 130 HAL CORTEX Generic Driver UM1940 MPU_REGION_PRIV_RO MPU_REGION_PRIV_RO_URO CORTEX MPU Region Size MPU_REGION_SIZE_32B MPU_REGION_SIZE_64B MPU_REGION_SIZE_128B MPU_REGION_SIZE_256B MPU_REGION_SIZE_512B MPU_REGION_SIZE_1KB MPU_REGION_SIZE_2KB MPU_REGION_SIZE_4KB MPU_REGION_SIZE_8KB MPU_REGION_SIZE_16KB MPU_REGION_SIZE_32KB MPU_REGION_SIZE_64KB MPU_REGION_SIZE_128KB MPU_REGION_SIZE_256KB MPU_REGION_SIZE_512KB MPU_REGION_SIZE_1MB MPU_REGION_SIZE_2MB MPU_REGION_SIZE_4MB MPU_REGION_SIZE_8MB MPU_REGION_SIZE_16MB MPU_REGION_SIZE_32MB MPU_REGION_SIZE_64MB MPU_REGION_SIZE_128MB MPU_REGION_SIZE_256MB MPU_REGION_SIZE_512MB MPU_REGION_SIZE_1GB MPU_REGION_SIZE_2GB MPU_REGION_SIZE_4GB MPU TEX Levels MPU_TEX_LEVEL0 MPU_TEX_LEVEL1 MPU_TEX_LEVEL2...
  • Page 131 UM1940 HAL CORTEX Generic Driver CORTEX Preemption Priority Group NVIC_PRIORITYGROUP_0 0 bits for pre-emption priority 4 bits for subpriority NVIC_PRIORITYGROUP_1 1 bits for pre-emption priority 3 bits for subpriority NVIC_PRIORITYGROUP_2 2 bits for pre-emption priority 2 bits for subpriority NVIC_PRIORITYGROUP_3 3 bits for pre-emption priority 1 bits for subpriority NVIC_PRIORITYGROUP_4 4 bits for pre-emption priority 0 bits for subpriority...
  • Page 132: Hal Crc Generic Driver

    HAL CRC Generic Driver UM1940 HAL CRC Generic Driver 10.1 CRC Firmware driver registers structures 10.1.1 CRC_HandleTypeDef Data Fields CRC_TypeDef * Instance HAL_LockTypeDef Lock __IO HAL_CRC_StateTypeDef State Field Documentation CRC_TypeDef* CRC_HandleTypeDef::Instance Register base address HAL_LockTypeDef CRC_HandleTypeDef::Lock CRC locking object __IO HAL_CRC_StateTypeDef CRC_HandleTypeDef::State CRC communication state 10.2 CRC Firmware driver API description...
  • Page 133 UM1940 HAL CRC Generic Driver 10.2.3 Peripheral Control functions This section provides functions allowing to: Compute the 32-bit CRC value of 32-bit data buffer, using combination of the previous CRC value and the new one. Compute the 32-bit CRC value of 32-bit data buffer, independently of the previous CRC value.
  • Page 134 HAL CRC Generic Driver UM1940 HAL_CRC_MspDeInit Function name void HAL_CRC_MspDeInit (CRC_HandleTypeDef * hcrc) Function description DeInitializes the CRC MSP. Parameters hcrc: pointer to a CRC_HandleTypeDef structure that contains the configuration information for CRC Return values None: HAL_CRC_Accumulate Function name uint32_t HAL_CRC_Accumulate (CRC_HandleTypeDef * hcrc, uint32_t pBuffer, uint32_t BufferLength) Function description Computes the 32-bit CRC of 32-bit data buffer using combination...
  • Page 135: Crc Firmware Driver Defines

    UM1940 HAL CRC Generic Driver 10.3 CRC Firmware driver defines 10.3.1 CRC Exported Macros __HAL_CRC_RESET_HANDLE_STATE Description: Resets CRC handle state. Parameters: __HANDLE__: CRC handle Return value: None __HAL_CRC_DR_RESET Description: Resets CRC Data Register. Parameters: __HANDLE__: CRC handle Return value: None __HAL_CRC_SET_IDR Description: Stores a 8-bit data in the Independent...
  • Page 136: Hal Cryp Generic Driver

    HAL CRYP Generic Driver UM1940 HAL CRYP Generic Driver 11.1 CRYP Firmware driver registers structures 11.1.1 CRYP_InitTypeDef Data Fields uint32_t DataType uint32_t KeySize uint8_t * pKey uint8_t * pInitVect uint8_t IVSize uint8_t TagSize uint8_t * Header uint32_t HeaderSize uint8_t * pScratch Field Documentation uint32_t CRYP_InitTypeDef::DataType 32-bit data, 16-bit data, 8-bit data or 1-bit string.
  • Page 137: Cryp Firmware Driver Api Description

    UM1940 HAL CRYP Generic Driver __IO uint16_t CrypOutCount HAL_StatusTypeDef Status HAL_PhaseTypeDef Phase DMA_HandleTypeDef * hdmain DMA_HandleTypeDef * hdmaout HAL_LockTypeDef Lock __IO HAL_CRYP_STATETypeDef State Field Documentation CRYP_TypeDef* CRYP_HandleTypeDef::Instance CRYP registers base address CRYP_InitTypeDef CRYP_HandleTypeDef::Init CRYP required parameters uint8_t* CRYP_HandleTypeDef::pCrypInBuffPtr Pointer to CRYP processing (encryption, decryption,...) buffer uint8_t* CRYP_HandleTypeDef::pCrypOutBuffPtr Pointer to CRYP processing (encryption, decryption,...) buffer __IO uint16_t CRYP_HandleTypeDef::CrypInCount...
  • Page 138 HAL CRYP Generic Driver UM1940 Configure the priority and enable the NVIC for the transfer complete interrupt on the two DMA Streams. The output stream should have higher priority than the input stream HAL_NVIC_SetPriority() and HAL_NVIC_EnableIRQ() Initialize the CRYP HAL using HAL_CRYP_Init(). This function configures mainly: The data type: 1-bit, 8-bit, 16-bit and 32-bit The key size: 128, 192 and 256.
  • Page 139: Des Processing Functions

    UM1940 HAL CRYP Generic Driver HAL_CRYP_AESCBC_Decrypt() HAL_CRYP_AESCTR_Decrypt() HAL_CRYP_AESECB_Encrypt_IT() HAL_CRYP_AESCBC_Encrypt_IT() HAL_CRYP_AESCTR_Encrypt_IT() HAL_CRYP_AESECB_Decrypt_IT() HAL_CRYP_AESCBC_Decrypt_IT() HAL_CRYP_AESCTR_Decrypt_IT() HAL_CRYP_AESECB_Encrypt_DMA() HAL_CRYP_AESCBC_Encrypt_DMA() HAL_CRYP_AESCTR_Encrypt_DMA() HAL_CRYP_AESECB_Decrypt_DMA() HAL_CRYP_AESCBC_Decrypt_DMA() HAL_CRYP_AESCTR_Decrypt_DMA() 11.2.4 DES processing functions This section provides functions allowing to: Encrypt plaintext using DES using ECB or CBC chaining modes Decrypt cyphertext using ECB or CBC chaining modes Three processing functions are available: Polling mode Interrupt mode...
  • Page 140: Dma Callback Functions

    HAL CRYP Generic Driver UM1940 HAL_CRYP_TDESECB_Decrypt() HAL_CRYP_TDESCBC_Encrypt() HAL_CRYP_TDESCBC_Decrypt() HAL_CRYP_TDESECB_Encrypt_IT() HAL_CRYP_TDESCBC_Encrypt_IT() HAL_CRYP_TDESECB_Decrypt_IT() HAL_CRYP_TDESCBC_Decrypt_IT() HAL_CRYP_TDESECB_Encrypt_DMA() HAL_CRYP_TDESCBC_Encrypt_DMA() HAL_CRYP_TDESECB_Decrypt_DMA() HAL_CRYP_TDESCBC_Decrypt_DMA() 11.2.6 DMA callback functions This section provides DMA callback functions: DMA Input data transfer complete DMA Output data transfer complete DMA error This section contains the following APIs: HAL_CRYP_InCpltCallback() HAL_CRYP_OutCpltCallback() HAL_CRYP_ErrorCallback()
  • Page 141 UM1940 HAL CRYP Generic Driver (CRYP_HandleTypeDef * hcryp) Function description DeInitializes the CRYP peripheral. Parameters hcryp: pointer to a CRYP_HandleTypeDef structure that contains the configuration information for CRYP module Return values HAL: status HAL_CRYP_MspInit Function name void HAL_CRYP_MspInit (CRYP_HandleTypeDef * hcryp) Function description Initializes the CRYP MSP.
  • Page 142 HAL CRYP Generic Driver UM1940 Size: Length of the plaintext buffer, must be a multiple of 16. pPlainData: Pointer to the plaintext buffer Timeout: Specify Timeout value Return values HAL: status HAL_CRYP_AESCBC_Encrypt HAL_StatusTypeDef HAL_CRYP_AESCBC_Encrypt Function name (CRYP_HandleTypeDef * hcryp, uint8_t * pPlainData, uint16_t Size, uint8_t * pCypherData, uint32_t Timeout) Function description Initializes the CRYP peripheral in AES CBC encryption mode then...
  • Page 143 UM1940 HAL CRYP Generic Driver Return values HAL: status HAL_CRYP_AESCTR_Decrypt HAL_StatusTypeDef HAL_CRYP_AESCTR_Decrypt Function name (CRYP_HandleTypeDef * hcryp, uint8_t * pCypherData, uint16_t Size, uint8_t * pPlainData, uint32_t Timeout) Function description Initializes the CRYP peripheral in AES CTR decryption mode then decrypted pCypherData. Parameters hcryp: pointer to a CRYP_HandleTypeDef structure that contains the configuration information for CRYP module...
  • Page 144 HAL CRYP Generic Driver UM1940 HAL_CRYP_AESCTR_Encrypt_IT Function name HAL_StatusTypeDef HAL_CRYP_AESCTR_Encrypt_IT (CRYP_HandleTypeDef * hcryp, uint8_t * pPlainData, uint16_t Size, uint8_t * pCypherData) Function description Initializes the CRYP peripheral in AES CTR encryption mode using Interrupt. Parameters hcryp: pointer to a CRYP_HandleTypeDef structure that contains the configuration information for CRYP module pPlainData: Pointer to the plaintext buffer Size: Length of the plaintext buffer, must be a multiple of 16...
  • Page 145 UM1940 HAL CRYP Generic Driver using IT. Parameters hcryp: pointer to a CRYP_HandleTypeDef structure that contains the configuration information for CRYP module pCypherData: Pointer to the cyphertext buffer Size: Length of the plaintext buffer, must be a multiple of 16 pPlainData: Pointer to the plaintext buffer Return values HAL: status...
  • Page 146 HAL CRYP Generic Driver UM1940 pCypherData: Pointer to the cyphertext buffer Return values HAL: status HAL_CRYP_AESCBC_Decrypt_DMA Function name HAL_StatusTypeDef HAL_CRYP_AESCBC_Decrypt_DMA (CRYP_HandleTypeDef * hcryp, uint8_t * pCypherData, uint16_t Size, uint8_t * pPlainData) Function description Initializes the CRYP peripheral in AES CBC encryption mode using DMA.
  • Page 147 UM1940 HAL CRYP Generic Driver HAL_CRYP_DESECB_Encrypt Function name HAL_StatusTypeDef HAL_CRYP_DESECB_Encrypt (CRYP_HandleTypeDef * hcryp, uint8_t * pPlainData, uint16_t Size, uint8_t * pCypherData, uint32_t Timeout) Function description Initializes the CRYP peripheral in DES ECB encryption mode. Parameters hcryp: pointer to a CRYP_HandleTypeDef structure that contains the configuration information for CRYP module pPlainData: Pointer to the plaintext buffer Size: Length of the plaintext buffer, must be a multiple of 8...
  • Page 148 HAL CRYP Generic Driver UM1940 Parameters hcryp: pointer to a CRYP_HandleTypeDef structure that contains the configuration information for CRYP module pCypherData: Pointer to the cyphertext buffer Size: Length of the plaintext buffer, must be a multiple of 8 pPlainData: Pointer to the plaintext buffer Timeout: Specify Timeout value Return values HAL: status...
  • Page 149 UM1940 HAL CRYP Generic Driver Return values HAL: status HAL_CRYP_DESCBC_Decrypt_IT HAL_StatusTypeDef HAL_CRYP_DESCBC_Decrypt_IT Function name (CRYP_HandleTypeDef * hcryp, uint8_t * pCypherData, uint16_t Size, uint8_t * pPlainData) Function description Initializes the CRYP peripheral in DES ECB decryption mode using interrupt. Parameters hcryp: pointer to a CRYP_HandleTypeDef structure that contains the configuration information for CRYP module pPlainData: Pointer to the plaintext buffer Size: Length of the plaintext buffer, must be a multiple of 8...
  • Page 150 HAL CRYP Generic Driver UM1940 Function description Initializes the CRYP peripheral in DES CBC encryption mode using DMA. Parameters hcryp: pointer to a CRYP_HandleTypeDef structure that contains the configuration information for CRYP module pPlainData: Pointer to the plaintext buffer Size: Length of the plaintext buffer, must be a multiple of 8 pCypherData: Pointer to the cyphertext buffer Return values HAL: status...
  • Page 151 UM1940 HAL CRYP Generic Driver pCypherData: Pointer to the cyphertext buffer Timeout: Specify Timeout value Return values HAL: status HAL_CRYP_TDESECB_Decrypt Function name HAL_StatusTypeDef HAL_CRYP_TDESECB_Decrypt (CRYP_HandleTypeDef * hcryp, uint8_t * pCypherData, uint16_t Size, uint8_t * pPlainData, uint32_t Timeout) Function description Initializes the CRYP peripheral in TDES ECB decryption mode then decrypted pCypherData.
  • Page 152 HAL CRYP Generic Driver UM1940 HAL_CRYP_TDESECB_Decrypt_IT Function name HAL_StatusTypeDef HAL_CRYP_TDESECB_Decrypt_IT (CRYP_HandleTypeDef * hcryp, uint8_t * pCypherData, uint16_t Size, uint8_t * pPlainData) Function description Initializes the CRYP peripheral in TDES ECB decryption mode. Parameters hcryp: pointer to a CRYP_HandleTypeDef structure that contains the configuration information for CRYP module pPlainData: Pointer to the plaintext buffer Size: Length of the plaintext buffer, must be a multiple of 8...
  • Page 153 UM1940 HAL CRYP Generic Driver Size: Length of the plaintext buffer, must be a multiple of 8 pCypherData: Pointer to the cyphertext buffer Return values HAL: status HAL_CRYP_TDESECB_Decrypt_DMA Function name HAL_StatusTypeDef HAL_CRYP_TDESECB_Decrypt_DMA (CRYP_HandleTypeDef * hcryp, uint8_t * pCypherData, uint16_t Size, uint8_t * pPlainData) Function description Initializes the CRYP peripheral in TDES ECB decryption mode using DMA.
  • Page 154 HAL CRYP Generic Driver UM1940 HAL_CRYP_InCpltCallback Function name void HAL_CRYP_InCpltCallback (CRYP_HandleTypeDef * hcryp) Function description Input FIFO transfer completed callbacks. Parameters hcryp: pointer to a CRYP_HandleTypeDef structure that contains the configuration information for CRYP module Return values None: HAL_CRYP_OutCpltCallback Function name void HAL_CRYP_OutCpltCallback (CRYP_HandleTypeDef * hcryp) Function description...
  • Page 155: Cryp Firmware Driver Defines

    UM1940 HAL CRYP Generic Driver 11.3 CRYP Firmware driver defines 11.3.1 CRYP CRYP Data Type CRYP_DATATYPE_32B CRYP_DATATYPE_16B CRYP_DATATYPE_8B CRYP_DATATYPE_1B CRYP CRYP_AlgoModeDirection CRYP_CR_ALGOMODE_DIRECTION CRYP_CR_ALGOMODE_TDES_ECB_ENCRYPT CRYP_CR_ALGOMODE_TDES_ECB_DECRYPT CRYP_CR_ALGOMODE_TDES_CBC_ENCRYPT CRYP_CR_ALGOMODE_TDES_CBC_DECRYPT CRYP_CR_ALGOMODE_DES_ECB_ENCRYPT CRYP_CR_ALGOMODE_DES_ECB_DECRYPT CRYP_CR_ALGOMODE_DES_CBC_ENCRYPT CRYP_CR_ALGOMODE_DES_CBC_DECRYPT CRYP_CR_ALGOMODE_AES_ECB_ENCRYPT CRYP_CR_ALGOMODE_AES_ECB_DECRYPT CRYP_CR_ALGOMODE_AES_CBC_ENCRYPT CRYP_CR_ALGOMODE_AES_CBC_DECRYPT CRYP_CR_ALGOMODE_AES_CTR_ENCRYPT CRYP_CR_ALGOMODE_AES_CTR_DECRYPT CRYP CRYP_Interrupt CRYP_IT_INI Input FIFO Interrupt CRYP_IT_OUTI Output FIFO Interrupt CRYP CRYP_Flags...
  • Page 156 HAL CRYP Generic Driver UM1940 __HAL_CRYP_RESET_HANDLE_STATE Description: Reset CRYP handle state. Parameters: __HANDLE__: specifies the CRYP handle. Return value: None __HAL_CRYP_ENABLE Description: Enable/Disable the CRYP peripheral. Parameters: __HANDLE__: specifies the CRYP handle. Return value: None __HAL_CRYP_DISABLE __HAL_CRYP_FIFO_FLUSH Description: Flush the data FIFO. Parameters: __HANDLE__: specifies the CRYP handle.
  • Page 157 UM1940 HAL CRYP Generic Driver CRYP_FLAG_BUSY: The CRYP core is currently processing a block of data or a key preparation (for AES decryption). CRYP_FLAG_IFEM: Input FIFO is empty CRYP_FLAG_IFNF: Input FIFO is not full CRYP_FLAG_INRIS: Input FIFO service raw interrupt is pending CRYP_FLAG_OFNE: Output FIFO is not empty CRYP_FLAG_OFFU: Output FIFO is...
  • Page 158 HAL CRYP Generic Driver UM1940 Parameters: __HANDLE__: specifies the CRYP handle. __INTERRUPT__: CRYP interrupt. Return value: None CRYP Key Size CRYP_KEYSIZE_128B CRYP_KEYSIZE_192B CRYP_KEYSIZE_256B 158/1371 DocID028236 Rev 2...
  • Page 159: Hal Dac Generic Driver

    UM1940 HAL DAC Generic Driver HAL DAC Generic Driver 12.1 DAC Firmware driver registers structures 12.1.1 DAC_HandleTypeDef Data Fields DAC_TypeDef * Instance __IO HAL_DAC_StateTypeDef State HAL_LockTypeDef Lock DMA_HandleTypeDef * DMA_Handle1 DMA_HandleTypeDef * DMA_Handle2 __IO uint32_t ErrorCode Field Documentation DAC_TypeDef* DAC_HandleTypeDef::Instance Register base address __IO HAL_DAC_StateTypeDef DAC_HandleTypeDef::State DAC communication state...
  • Page 160: Dac Firmware Driver Api Description

    HAL DAC Generic Driver UM1940 12.2 DAC Firmware driver API description 12.2.1 DAC Peripheral features DAC Channels The device integrates two 12-bit Digital Analog Converters that can be used independently or simultaneously (dual mode): DAC channel1 with DAC_OUT1 (PA4) as output DAC channel2 with DAC_OUT2 (PA5) as output DAC Triggers Digital to Analog conversion can be non-triggered using DAC_TRIGGER_NONE and...
  • Page 161 UM1940 HAL DAC Generic Driver DAC data value to voltage correspondence The analog output voltage on each DAC channel pin is determined by the following equation: DAC_OUTx = VREF+ * DOR / 4095 with DOR is the Data Output Register VEF+ is the input voltage reference (refer to the device datasheet) e.g.
  • Page 162 HAL DAC Generic Driver UM1940 You can refer to the DAC HAL driver header file for more useful macros 12.2.3 Initialization and de-initialization functions This section provides functions allowing to: Initialize and configure the DAC. De-initialize the DAC. This section contains the following APIs: HAL_DAC_Init() HAL_DAC_DeInit() HAL_DAC_MspInit()
  • Page 163 UM1940 HAL DAC Generic Driver This section contains the following APIs: HAL_DAC_GetState() HAL_DAC_GetError() HAL_DAC_IRQHandler() HAL_DAC_ConvCpltCallbackCh1() HAL_DAC_ConvHalfCpltCallbackCh1() HAL_DAC_ErrorCallbackCh1() HAL_DAC_DMAUnderrunCallbackCh1() 12.2.7 Detailed description of functions HAL_DAC_Init Function name HAL_StatusTypeDef HAL_DAC_Init (DAC_HandleTypeDef * hdac) Function description Initializes the DAC peripheral according to the specified parameters in the DAC_InitStruct.
  • Page 164 HAL DAC Generic Driver UM1940 HAL_DAC_Start Function name HAL_StatusTypeDef HAL_DAC_Start (DAC_HandleTypeDef * hdac, uint32_t Channel) Function description Enables DAC and starts conversion of channel. Parameters hdac: pointer to a DAC_HandleTypeDef structure that contains the configuration information for the specified DAC. Channel: The selected DAC channel.
  • Page 165 UM1940 HAL DAC Generic Driver HAL_DAC_Stop_DMA Function name HAL_StatusTypeDef HAL_DAC_Stop_DMA (DAC_HandleTypeDef * hdac, uint32_t Channel) Function description Disables DAC and stop conversion of channel. Parameters hdac: pointer to a DAC_HandleTypeDef structure that contains the configuration information for the specified DAC. Channel: The selected DAC channel.
  • Page 166 HAL DAC Generic Driver UM1940 Channel: The selected DAC channel. This parameter can be one of the following values: DAC_CHANNEL_1: DAC Channel1 selected DAC_CHANNEL_2: DAC Channel2 selected Alignment: Specifies the data alignment. This parameter can be one of the following values: DAC_ALIGN_8B_R: 8bit right data alignment selected DAC_ALIGN_12B_L: 12bit left data alignment selected DAC_ALIGN_12B_R: 12bit right data alignment selected...
  • Page 167: Dac Firmware Driver Defines

    UM1940 HAL DAC Generic Driver HAL_DAC_ConvHalfCpltCallbackCh1 Function name void HAL_DAC_ConvHalfCpltCallbackCh1 (DAC_HandleTypeDef * hdac) Function description Conversion half DMA transfer callback in non blocking mode for Channel1. Parameters hdac: pointer to a DAC_HandleTypeDef structure that contains the configuration information for the specified DAC. Return values None: HAL_DAC_ErrorCallbackCh1...
  • Page 168 HAL DAC Generic Driver UM1940 DAC Exported Macros __HAL_DAC_RESET_HANDLE_STATE Description: Reset DAC handle state. Parameters: __HANDLE__: specifies the DAC handle. Return value: None Description: __HAL_DAC_ENABLE Enable the DAC channel. Parameters: __HANDLE__: specifies the DAC handle. __DAC_Channel__: specifies the DAC channel Return value: None __HAL_DAC_DISABLE...
  • Page 169 UM1940 HAL DAC Generic Driver None __HAL_DAC_GET_IT_SOURCE Description: Checks if the specified DAC interrupt source is enabled or disabled. Parameters: __HANDLE__: DAC handle __INTERRUPT__: DAC interrupt source to check This parameter can be any combination of the following values: DAC_IT_DMAUDR1: DAC channel 1 DMA underrun interrupt DAC_IT_DMAUDR2: DAC channel 2 DMA underrun interrupt...
  • Page 170 HAL DAC Generic Driver UM1940 DAC_FLAG_DMAUDR2 DAC IT Definition DAC_IT_DMAUDR1 DAC_IT_DMAUDR2 DAC Output Buffer DAC_OUTPUTBUFFER_ENABLE DAC_OUTPUTBUFFER_DISABLE DAC Trigger Selection DAC_TRIGGER_NONE Conversion is automatic once the DAC1_DHRxxxx register has been loaded, and not by external trigger DAC_TRIGGER_T2_TRGO TIM2 TRGO selected as external conversion trigger for DAC channel DAC_TRIGGER_T4_TRGO TIM4 TRGO selected as external conversion trigger for...
  • Page 171: Hal Dac Extension Driver

    UM1940 HAL DAC Extension Driver HAL DAC Extension Driver 13.1 DACEx Firmware driver API description 13.1.1 How to use this driver When Dual mode is enabled (i.e DAC Channel1 and Channel2 are used simultaneously) : Use HAL_DACEx_DualGetValue() to get digital data to be converted and use HAL_DACEx_DualSetValue() to set digital value to converted simultaneously in Channel 1 and Channel 2.
  • Page 172 HAL DAC Extension Driver UM1940 Function description Enables or disables the selected DAC channel wave generation. Parameters hdac: pointer to a DAC_HandleTypeDef structure that contains the configuration information for the specified DAC. Channel: The selected DAC channel. This parameter can be one of the following values: DAC_CHANNEL_1 / DAC_CHANNEL_2 Amplitude: Select max triangle amplitude.
  • Page 173 UM1940 HAL DAC Extension Driver DAC_LFSRUNMASK_BITS2_0: Unmask DAC channel LFSR bit[2:0] for noise wave generation DAC_LFSRUNMASK_BITS3_0: Unmask DAC channel LFSR bit[3:0] for noise wave generation DAC_LFSRUNMASK_BITS4_0: Unmask DAC channel LFSR bit[4:0] for noise wave generation DAC_LFSRUNMASK_BITS5_0: Unmask DAC channel LFSR bit[5:0] for noise wave generation DAC_LFSRUNMASK_BITS6_0: Unmask DAC channel LFSR bit[6:0] for noise wave generation DAC_LFSRUNMASK_BITS7_0: Unmask DAC channel...
  • Page 174 HAL DAC Extension Driver UM1940 Return values None: HAL_DACEx_ConvHalfCpltCallbackCh2 void HAL_DACEx_ConvHalfCpltCallbackCh2 Function name (DAC_HandleTypeDef * hdac) Function description Conversion half DMA transfer callback in non blocking mode for Channel2. Parameters hdac: pointer to a DAC_HandleTypeDef structure that contains the configuration information for the specified DAC. Return values None: HAL_DACEx_ErrorCallbackCh2...
  • Page 175: Dacex Firmware Driver Defines

    UM1940 HAL DAC Extension Driver Return values None: DAC_DMAHalfConvCpltCh2 void DAC_DMAHalfConvCpltCh2 (DMA_HandleTypeDef * Function name hdma) Function description DMA half transfer complete callback. Parameters hdma: pointer to a DMA_HandleTypeDef structure that contains the configuration information for the specified DMA module. Return values None: 13.2...
  • Page 176 HAL DAC Extension Driver UM1940 DAC_TRIANGLEAMPLITUDE_15 Select max triangle amplitude of 15 DAC_TRIANGLEAMPLITUDE_31 Select max triangle amplitude of 31 DAC_TRIANGLEAMPLITUDE_63 Select max triangle amplitude of 63 DAC_TRIANGLEAMPLITUDE_127 Select max triangle amplitude of 127 DAC_TRIANGLEAMPLITUDE_255 Select max triangle amplitude of 255 DAC_TRIANGLEAMPLITUDE_511 Select max triangle amplitude of 511 DAC_TRIANGLEAMPLITUDE_1023...
  • Page 177: Hal Dcmi Generic Driver

    UM1940 HAL DCMI Generic Driver HAL DCMI Generic Driver 14.1 DCMI Firmware driver registers structures 14.1.1 DCMI_CodesInitTypeDef Data Fields uint8_t FrameStartCode uint8_t LineStartCode uint8_t LineEndCode uint8_t FrameEndCode Field Documentation uint8_t DCMI_CodesInitTypeDef::FrameStartCode Specifies the code of the frame start delimiter. uint8_t DCMI_CodesInitTypeDef::LineStartCode Specifies the code of the line start delimiter.
  • Page 178: Dcmi_Handletypedef

    HAL DCMI Generic Driver UM1940 uint32_t DCMI_InitTypeDef::ExtendedDataMode Specifies the data width: 8-bit, 10-bit, 12-bit or 14-bit. This parameter can be a value DCMI_Extended_Data_Mode DCMI_CodesInitTypeDef DCMI_InitTypeDef::SyncroCode Specifies the code of the frame start delimiter. uint32_t DCMI_InitTypeDef::JPEGMode Enable or Disable the JPEG mode. This parameter can be a value of DCMI_MODE_JPEG 14.1.3 DCMI_HandleTypeDef...
  • Page 179: Initialization And Configuration Functions

    UM1940 HAL DCMI Generic Driver Program the required configuration through following parameters: horizontal and vertical polarity, pixel clock polarity, Capture Rate, Synchronization Mode, code of the frame delimiter and data width using HAL_DCMI_Init() function. Configure the DMA2_Stream1 channel1 to transfer Data from DCMI DR register to the destination memory buffer.
  • Page 180 HAL DCMI Generic Driver UM1940 HAL_DCMI_Stop() HAL_DCMI_Suspend() HAL_DCMI_Resume() HAL_DCMI_IRQHandler() HAL_DCMI_ErrorCallback() HAL_DCMI_LineEventCallback() HAL_DCMI_VsyncEventCallback() HAL_DCMI_FrameEventCallback() HAL_DCMI_VsyncCallback() HAL_DCMI_HsyncCallback() 14.2.4 Peripheral Control functions This section provides functions allowing to: Configure the CROP feature. Enable/Disable the CROP feature. This section contains the following APIs: HAL_DCMI_ConfigCrop() HAL_DCMI_DisableCrop() HAL_DCMI_EnableCrop() 14.2.5...
  • Page 181 UM1940 HAL DCMI Generic Driver contains the configuration information for DCMI. Return values HAL: status HAL_DCMI_MspInit Function name void HAL_DCMI_MspInit (DCMI_HandleTypeDef * hdcmi) Function description Initializes the DCMI MSP. Parameters hdcmi: pointer to a DCMI_HandleTypeDef structure that contains the configuration information for DCMI. Return values None: HAL_DCMI_MspDeInit...
  • Page 182 HAL DCMI Generic Driver UM1940 Function description Suspend DCMI capture. Parameters hdcmi: pointer to a DCMI_HandleTypeDef structure that contains the configuration information for DCMI. Return values HAL: status HAL_DCMI_Resume Function name HAL_StatusTypeDef HAL_DCMI_Resume (DCMI_HandleTypeDef * hdcmi) Function description Resume DCMI capture. Parameters hdcmi: pointer to a DCMI_HandleTypeDef structure that contains the configuration information for DCMI.
  • Page 183 UM1940 HAL DCMI Generic Driver Parameters hdcmi: pointer to a DCMI_HandleTypeDef structure that contains the configuration information for DCMI. Return values None: HAL_DCMI_VsyncCallback Function name void HAL_DCMI_VsyncCallback (DCMI_HandleTypeDef * hdcmi) Function description HAL_DCMI_HsyncCallback void HAL_DCMI_HsyncCallback (DCMI_HandleTypeDef * Function name hdcmi) Function description HAL_DCMI_IRQHandler Function name...
  • Page 184: Dcmi Firmware Driver Defines

    HAL DCMI Generic Driver UM1940 HAL_DCMI_DisableCrop Function name HAL_StatusTypeDef HAL_DCMI_DisableCrop (DCMI_HandleTypeDef * hdcmi) Function description Disable the Crop feature. Parameters hdcmi: pointer to a DCMI_HandleTypeDef structure that contains the configuration information for DCMI. Return values HAL: status HAL_DCMI_GetState Function name HAL_DCMI_StateTypeDef HAL_DCMI_GetState (DCMI_HandleTypeDef * hdcmi) Function description...
  • Page 185 UM1940 HAL DCMI Generic Driver HAL_DCMI_ERROR_DMA DMA error DCMI Exported Macros __HAL_DCMI_RESET_HANDLE_STATE Description: Reset DCMI handle state. Parameters: __HANDLE__: specifies the DCMI handle. Return value: None Description: __HAL_DCMI_ENABLE Enable the DCMI. Parameters: __HANDLE__: DCMI handle Return value: None __HAL_DCMI_DISABLE Description: Disable the DCMI.
  • Page 186 HAL DCMI Generic Driver UM1940 flag mask DCMI_FLAG_LINERI: Line flag mask DCMI_FLAG_FRAMEMI: DCMI Capture complete masked interrupt status DCMI_FLAG_OVRMI: DCMI Overrun masked interrupt status DCMI_FLAG_ERRMI: DCMI Synchronization error masked interrupt status DCMI_FLAG_VSYNCMI: DCMI VSYNC masked interrupt status DCMI_FLAG_LINEMI: DCMI Line masked interrupt status Return value: The: state of FLAG.
  • Page 187 UM1940 HAL DCMI Generic Driver DCMI_IT_VSYNC: VSYNC interrupt mask DCMI_IT_LINE: Line interrupt mask Return value: None __HAL_DCMI_DISABLE_IT Description: Disable the specified DCMI interrupts. Parameters: __HANDLE__: DCMI handle __INTERRUPT__: specifies the DCMI interrupt sources to be enabled. This parameter can be any combination of the following values: DCMI_IT_FRAME: Frame capture complete interrupt mask...
  • Page 188 HAL DCMI Generic Driver UM1940 DCMI_EXTEND_DATA_10B Interface captures 10-bit data on every pixel clock DCMI_EXTEND_DATA_12B Interface captures 12-bit data on every pixel clock DCMI_EXTEND_DATA_14B Interface captures 14-bit data on every pixel clock DCMI Flags DCMI_FLAG_HSYNC HSYNC pin state (active line / synchronization between lines) DCMI_FLAG_VSYNC VSYNC pin state (active frame / synchronization between frames)
  • Page 189 UM1940 HAL DCMI Generic Driver DCMI_SYNCHRO_EMBEDDED Embedded synchronization data capture is synchronized with synchronization codes embedded in the data flow DCMI VSYNC Polarity DCMI_VSPOLARITY_LOW Vertical synchronization active Low DCMI_VSPOLARITY_HIGH Vertical synchronization active High DCMI Window Coordinate DCMI_WINDOW_COORDINATE Window coordinate DCMI Window Height DCMI_WINDOW_HEIGHT Window Height DCMI Window Vertical Line...
  • Page 190: Hal Dma Generic Driver

    HAL DMA Generic Driver UM1940 HAL DMA Generic Driver 15.1 DMA Firmware driver registers structures 15.1.1 DMA_InitTypeDef Data Fields uint32_t Channel uint32_t Direction uint32_t PeriphInc uint32_t MemInc uint32_t PeriphDataAlignment uint32_t MemDataAlignment uint32_t Mode uint32_t Priority uint32_t FIFOMode uint32_t FIFOThreshold uint32_t MemBurst uint32_t PeriphBurst Field Documentation uint32_t DMA_InitTypeDef::Channel...
  • Page 191: Dma_Handletypedef

    UM1940 HAL DMA Generic Driver Note:The Direct mode (FIFO mode disabled) cannot be used if the memory-to- memory data transfer is configured on the selected stream uint32_t DMA_InitTypeDef::FIFOThreshold Specifies the FIFO threshold level. This parameter can be a value of DMA_FIFO_threshold_level uint32_t DMA_InitTypeDef::MemBurst Specifies the Burst transfer configuration for the memory transfers.
  • Page 192: Dma Firmware Driver Api Description

    HAL DMA Generic Driver UM1940 void(* __DMA_HandleTypeDef::XferM1HalfCpltCallback)(struct __DMA_HandleTypeDef *hdma) DMA transfer Half complete Memory1 callback void(* __DMA_HandleTypeDef::XferErrorCallback)(struct __DMA_HandleTypeDef *hdma) DMA transfer error callback void(* __DMA_HandleTypeDef::XferAbortCallback)(struct __DMA_HandleTypeDef *hdma) DMA transfer Abort callback __IO uint32_t __DMA_HandleTypeDef::ErrorCode DMA Error code uint32_t __DMA_HandleTypeDef::StreamBaseAddress DMA Stream Base Address uint32_t __DMA_HandleTypeDef::StreamIndex DMA Stream Index 15.2...
  • Page 193 UM1940 HAL DMA Generic Driver Data Sizes for the Peripheral and the Memory (ie. you can set Half-Word data size for the peripheral to access its data register and set Word data size for the Memory to gain in access time. Each two half words will be packed and written in a single access to a Word in the Memory).
  • Page 194: State And Errors Functions

    HAL DMA Generic Driver UM1940 15.2.4 State and Errors functions This subsection provides functions allowing to Check the DMA state Get error code This section contains the following APIs: HAL_DMA_GetState() HAL_DMA_GetError() 15.2.5 Detailed description of functions HAL_DMA_Init HAL_StatusTypeDef HAL_DMA_Init (DMA_HandleTypeDef * Function name hdma) Function description...
  • Page 195 UM1940 HAL DMA Generic Driver HAL_DMA_Start_IT Function name HAL_StatusTypeDef HAL_DMA_Start_IT (DMA_HandleTypeDef * hdma, uint32_t SrcAddress, uint32_t DstAddress, uint32_t DataLength) Function description Start the DMA Transfer with interrupt enabled. Parameters hdma: pointer to a DMA_HandleTypeDef structure that contains the configuration information for the specified DMA Stream.
  • Page 196 HAL DMA Generic Driver UM1940 contains the configuration information for the specified DMA Stream. CompleteLevel: Specifies the DMA level complete. Timeout: Timeout duration. Return values HAL: status Notes The polling mode is kept in this version for legacy. it is recommanded to use the IT model instead.
  • Page 197: Dma Firmware Driver Defines

    UM1940 HAL DMA Generic Driver contains the configuration information for the specified DMA Stream. CallbackID: User Callback identifer a HAL_DMA_CallbackIDTypeDef ENUM as parameter. Return values HAL: status HAL_DMA_GetState HAL_DMA_StateTypeDef HAL_DMA_GetState Function name (DMA_HandleTypeDef * hdma) Function description Returns the DMA state. Parameters hdma: pointer to a DMA_HandleTypeDef structure that contains the configuration information for the specified DMA...
  • Page 198 HAL DMA Generic Driver UM1940 HAL_DMA_ERROR_NONE No error HAL_DMA_ERROR_TE Transfer error HAL_DMA_ERROR_FE FIFO error HAL_DMA_ERROR_DME Direct Mode error HAL_DMA_ERROR_TIMEOUT Timeout error HAL_DMA_ERROR_PARAM Parameter error HAL_DMA_ERROR_NO_XFER Abort requested with no Xfer ongoing HAL_DMA_ERROR_NOT_SUPPORTED Not supported mode DMA FIFO direct mode DMA_FIFOMODE_DISABLE FIFO mode disable DMA_FIFOMODE_ENABLE FIFO mode enable...
  • Page 199 UM1940 HAL DMA Generic Driver DMA_FLAG_TCIF3_7 DMA Handle index TIM_DMA_ID_UPDATE Index of the DMA handle used for Update DMA requests TIM_DMA_ID_CC1 Index of the DMA handle used for Capture/Compare 1 DMA requests TIM_DMA_ID_CC2 Index of the DMA handle used for Capture/Compare 2 DMA requests TIM_DMA_ID_CC3 Index of the DMA handle used for Capture/Compare 3...
  • Page 200 HAL DMA Generic Driver UM1940 DMA_PBURST_INC4 DMA_PBURST_INC8 DMA_PBURST_INC16 DMA Peripheral data size DMA_PDATAALIGN_BYTE Peripheral data alignment: Byte DMA_PDATAALIGN_HALFWORD Peripheral data alignment: HalfWord DMA_PDATAALIGN_WORD Peripheral data alignment: Word DMA Peripheral incremented mode DMA_PINC_ENABLE Peripheral increment mode enable DMA_PINC_DISABLE Peripheral increment mode disable DMA Priority level DMA_PRIORITY_LOW Priority level: Low...
  • Page 201: Hal Dma Extension Driver

    UM1940 HAL DMA Extension Driver HAL DMA Extension Driver 16.1 DMAEx Firmware driver API description 16.1.1 How to use this driver The DMA Extension HAL driver can be used as follows: Start a multi buffer transfer using the HAL_DMA_MultiBufferStart() function for polling mode or HAL_DMA_MultiBufferStart_IT() for interrupt mode.
  • Page 202 HAL DMA Extension Driver UM1940 HAL_DMAEx_MultiBufferStart_IT Function name HAL_StatusTypeDef HAL_DMAEx_MultiBufferStart_IT (DMA_HandleTypeDef * hdma, uint32_t SrcAddress, uint32_t DstAddress, uint32_t SecondMemAddress, uint32_t DataLength) Function description Starts the multi_buffer DMA Transfer with interrupt enabled. Parameters hdma: pointer to a DMA_HandleTypeDef structure that contains the configuration information for the specified DMA Stream.
  • Page 203: Hal Eth Generic Driver

    UM1940 HAL ETH Generic Driver HAL ETH Generic Driver 17.1 ETH Firmware driver registers structures 17.1.1 ETH_InitTypeDef Data Fields uint32_t AutoNegotiation uint32_t Speed uint32_t DuplexMode uint16_t PhyAddress uint8_t * MACAddr uint32_t RxMode uint32_t ChecksumMode uint32_t MediaInterface Field Documentation uint32_t ETH_InitTypeDef::AutoNegotiation Selects or not the AutoNegotiation mode for the external PHY The AutoNegotiation allows an automatic setting of the Speed (10/100Mbps) and the mode (half/full- duplex).
  • Page 204 HAL ETH Generic Driver UM1940 uint32_t RetryTransmission uint32_t AutomaticPadCRCStrip uint32_t BackOffLimit uint32_t DeferralCheck uint32_t ReceiveAll uint32_t SourceAddrFilter uint32_t PassControlFrames uint32_t BroadcastFramesReception uint32_t DestinationAddrFilter uint32_t PromiscuousMode uint32_t MulticastFramesFilter uint32_t UnicastFramesFilter uint32_t HashTableHigh uint32_t HashTableLow uint32_t PauseTime uint32_t ZeroQuantaPause uint32_t PauseLowThreshold uint32_t UnicastPauseFrameDetect uint32_t ReceiveFlowControl uint32_t TransmitFlowControl uint32_t VLANTagComparison...
  • Page 205 UM1940 HAL ETH Generic Driver uint32_t ETH_MACInitTypeDef::AutomaticPadCRCStrip Selects or not the Automatic MAC Pad/CRC Stripping. This parameter can be a value ETH_Automatic_Pad_CRC_Strip uint32_t ETH_MACInitTypeDef::BackOffLimit Selects the BackOff limit value. This parameter can be a value of ETH_Back_Off_Limit uint32_t ETH_MACInitTypeDef::DeferralCheck Selects or not the deferral check function (Half-Duplex mode). This parameter can be a value of ETH_Deferral_Check uint32_t ETH_MACInitTypeDef::ReceiveAll...
  • Page 206: Eth_Dmainittypedef

    HAL ETH Generic Driver UM1940 address and unique multicast address). This parameter can be a value of ETH_Unicast_Pause_Frame_Detect uint32_t ETH_MACInitTypeDef::ReceiveFlowControl Enables or disables the MAC to decode the received Pause frame and disable its transmitter for a specified time (Pause Time) This parameter can be a value of ETH_Receive_Flow_Control uint32_t ETH_MACInitTypeDef::TransmitFlowControl Enables or disables the MAC to transmit Pause frames (Full-Duplex mode) or the...
  • Page 207: Eth_Dmadesctypedef

    UM1940 HAL ETH Generic Driver uint32_t ETH_DMAInitTypeDef::ForwardErrorFrames Selects or not the forward to the DMA of erroneous frames. This parameter can be a value of ETH_Forward_Error_Frames uint32_t ETH_DMAInitTypeDef::ForwardUndersizedGoodFrames Enables or disables the Rx FIFO to forward Undersized frames (frames with no Error and length less than 64 bytes) including pad-bytes and CRC) This parameter can be a value of ETH_Forward_Undersized_Good_Frames...
  • Page 208: Eth_Dmarxframeinfos

    HAL ETH Generic Driver UM1940 uint32_t ETH_DMADescTypeDef::Buffer1Addr Buffer1 address pointer uint32_t ETH_DMADescTypeDef::Buffer2NextDescAddr Buffer2 or next descriptor address pointer Enhanced ETHERNET DMA PTP Descriptors uint32_t ETH_DMADescTypeDef::ExtendedStatus Extended status for PTP receive descriptor uint32_t ETH_DMADescTypeDef::Reserved1 Reserved uint32_t ETH_DMADescTypeDef::TimeStampLow Time Stamp Low value for transmit and receive uint32_t ETH_DMADescTypeDef::TimeStampHigh Time Stamp High value for transmit and receive 17.1.5...
  • Page 209: Eth Firmware Driver Api Description

    UM1940 HAL ETH Generic Driver ETH_DMADescTypeDef* ETH_HandleTypeDef::RxDesc Rx descriptor to Get ETH_DMADescTypeDef* ETH_HandleTypeDef::TxDesc Tx descriptor to Set ETH_DMARxFrameInfos ETH_HandleTypeDef::RxFrameInfos last Rx frame infos __IO HAL_ETH_StateTypeDef ETH_HandleTypeDef::State ETH communication state HAL_LockTypeDef ETH_HandleTypeDef::Lock ETH Lock 17.2 ETH Firmware driver API description 17.2.1 How to use this driver Declare a ETH_HandleTypeDef handle structure, for example: ETH_HandleTypeDef heth;...
  • Page 210 HAL ETH Generic Driver UM1940 HAL_ETH_Init() HAL_ETH_DeInit() HAL_ETH_DMATxDescListInit() HAL_ETH_DMARxDescListInit() HAL_ETH_MspInit() HAL_ETH_MspDeInit() 17.2.3 IO operation functions This section provides functions allowing to: Transmit a frame HAL_ETH_TransmitFrame(); Receive a frame HAL_ETH_GetReceivedFrame(); HAL_ETH_GetReceivedFrame_IT(); Read from an External PHY register HAL_ETH_ReadPHYRegister(); Write to an External PHY register HAL_ETH_WritePHYRegister(); This section contains the following APIs: HAL_ETH_TransmitFrame() HAL_ETH_GetReceivedFrame()
  • Page 211 UM1940 HAL ETH Generic Driver 17.2.6 Detailed description of functions HAL_ETH_Init Function name HAL_StatusTypeDef HAL_ETH_Init (ETH_HandleTypeDef * heth) Function description Initializes the Ethernet MAC and DMA according to default parameters. Parameters heth: pointer to a ETH_HandleTypeDef structure that contains the configuration information for ETHERNET module Return values HAL: status HAL_ETH_DeInit...
  • Page 212 HAL ETH Generic Driver UM1940 TxBuffCount: Number of the used Tx desc in the list Return values HAL: status HAL_ETH_DMARxDescListInit Function name HAL_StatusTypeDef HAL_ETH_DMARxDescListInit (ETH_HandleTypeDef * heth, ETH_DMADescTypeDef * DMARxDescTab, uint8_t * RxBuff, uint32_t RxBuffCount) Function description Initializes the DMA Rx descriptors in chain mode. Parameters heth: pointer to a ETH_HandleTypeDef structure that contains the configuration information for ETHERNET module...
  • Page 213 UM1940 HAL ETH Generic Driver RegValue: PHY register value Return values HAL: status HAL_ETH_WritePHYRegister Function name HAL_StatusTypeDef HAL_ETH_WritePHYRegister (ETH_HandleTypeDef * heth, uint16_t PHYReg, uint32_t RegValue) Function description Writes to a PHY register. Parameters heth: pointer to a ETH_HandleTypeDef structure that contains the configuration information for ETHERNET module PHYReg: PHY register address, is the index of one of the 32 PHY register.
  • Page 214 HAL ETH Generic Driver UM1940 Function description Rx Transfer completed callbacks. Parameters heth: pointer to a ETH_HandleTypeDef structure that contains the configuration information for ETHERNET module Return values None: HAL_ETH_ErrorCallback Function name void HAL_ETH_ErrorCallback (ETH_HandleTypeDef * heth) Function description Ethernet transfer error callbacks. Parameters heth: pointer to a ETH_HandleTypeDef structure that contains the configuration information for ETHERNET module...
  • Page 215: Eth Firmware Driver Defines

    UM1940 HAL ETH Generic Driver Parameters heth: pointer to a ETH_HandleTypeDef structure that contains the configuration information for ETHERNET module dmaconf: DMA Configuration structure Return values HAL: status HAL_ETH_GetState Function name HAL_ETH_StateTypeDef HAL_ETH_GetState (ETH_HandleTypeDef * heth) Function description Return the ETH HAL state. Parameters heth: pointer to a ETH_HandleTypeDef structure that contains the configuration information for ETHERNET module...
  • Page 216 HAL ETH Generic Driver UM1940 ETH_VLAN_TAG optional 802.1q VLAN Tag ETH_MIN_ETH_PAYLOAD Minimum Ethernet payload size ETH_MAX_ETH_PAYLOAD Maximum Ethernet payload size ETH_JUMBO_FRAME_PAYLOAD Jumbo frame payload size ETH_RX_BUF_SIZE ETH_RXBUFNB ETH_TX_BUF_SIZE ETH_TXBUFNB ETH Carrier Sense ETH_CARRIERSENCE_ENABLE ETH_CARRIERSENCE_DISABLE ETH Checksum Mode ETH_CHECKSUM_BY_HARDWARE ETH_CHECKSUM_BY_SOFTWARE ETH Checksum Offload ETH_CHECKSUMOFFLAOD_ENABLE ETH_CHECKSUMOFFLAOD_DISABLE ETH Deferral Check...
  • Page 217 UM1940 HAL ETH Generic Driver ETH_DMA_FLAG_DATATRANSFERERROR Error bits 0-Rx DMA, 1-Tx DMA ETH_DMA_FLAG_READWRITEERROR Error bits 0-write transfer, 1-read transfer ETH_DMA_FLAG_ACCESSERROR Error bits 0-data buffer, 1-desc. access ETH_DMA_FLAG_NIS Normal interrupt summary flag ETH_DMA_FLAG_AIS Abnormal interrupt summary flag ETH_DMA_FLAG_ER Early receive flag ETH_DMA_FLAG_FBE Fatal bus error flag ETH_DMA_FLAG_ET...
  • Page 218 HAL ETH Generic Driver UM1940 ETH_DMA_IT_T Transmit interrupt ETH DMA overflow ETH_DMA_OVERFLOW_RXFIFOCOUNTER Overflow bit for FIFO overflow counter ETH_DMA_OVERFLOW_MISSEDFRAMECOUNTER Overflow bit for missed frame counter ETH DMA receive process state ETH_DMA_RECEIVEPROCESS_STOPPED Stopped - Reset or Stop Rx Command issued ETH_DMA_RECEIVEPROCESS_FETCHING Running - fetching the Rx descriptor ETH_DMA_RECEIVEPROCESS_WAITING Running - waiting for packet...
  • Page 219 UM1940 HAL ETH Generic Driver ETH_DMARXDESC_RE Receive error: error reported by MII interface ETH_DMARXDESC_DBE Dribble bit error: frame contains non int multiple of 8 bits ETH_DMARXDESC_CE CRC error ETH_DMARXDESC_MAMPCE Rx MAC Address/Payload Checksum Error: Rx MAC address matched/ Rx Payload Checksum Error ETH_DMARXDESC_DIC Disable Interrupt on Completion ETH_DMARXDESC_RBS2...
  • Page 220 HAL ETH Generic Driver UM1940 ETH DMA Rx descriptor buffers ETH_DMARXDESC_BUFFER1 DMA Rx Desc Buffer1 ETH_DMARXDESC_BUFFER2 DMA Rx Desc Buffer2 ETH DMA transmit process state ETH_DMA_TRANSMITPROCESS_STOPPED Stopped - Reset or Stop Tx Command issued ETH_DMA_TRANSMITPROCESS_FETCHING Running - fetching the Tx descriptor ETH_DMA_TRANSMITPROCESS_WAITING Running - waiting for status ETH_DMA_TRANSMITPROCESS_READING...
  • Page 221 UM1940 HAL ETH Generic Driver ETH_DMATXDESC_FF Frame Flushed: DMA/MTL flushed the frame due to SW flush ETH_DMATXDESC_PCE Payload Checksum Error ETH_DMATXDESC_LCA Loss of Carrier: carrier lost during transmission ETH_DMATXDESC_NC No Carrier: no carrier signal from the transceiver ETH_DMATXDESC_LCO Late Collision: transmission aborted due to collision ETH_DMATXDESC_EC Excessive Collision: transmission...
  • Page 222 HAL ETH Generic Driver UM1940 ETH Duplex Mode ETH_MODE_FULLDUPLEX ETH_MODE_HALFDUPLEX ETH Exported Macros Description: __HAL_ETH_RESET_HANDLE_STATE Reset ETH handle state. Parameters: __HANDLE__: specifies the ETH handle. Return value: None __HAL_ETH_DMATXDESC_GET_FLAG Description: Checks whether the specified ETHERNET DMA Tx Desc flag is set or not.
  • Page 223 UM1940 HAL ETH Generic Driver __HAL_ETH_DMARXDESC_DISABLE_IT Description: Disables the specified DMA Rx Desc receive interrupt. Parameters: __HANDLE__: ETH Handle Return value: None __HAL_ETH_DMARXDESC_SET_OWN_ Description: Set the specified DMA Rx Desc Own bit. Parameters: __HANDLE__: ETH Handle Return value: None __HAL_ETH_DMATXDESC_GET_COLLI Description: SION_COUNT Returns the specified ETHERNET DMA...
  • Page 224 HAL ETH Generic Driver UM1940 Parameters: __HANDLE__: ETH Handle Return value: None __HAL_ETH_DMATXDESC_CHECKSUM Description: _INSERTION Selects the specified ETHERNET DMA Tx Desc Checksum Insertion. Parameters: __HANDLE__: ETH Handle __CHECKSUM__: specifies is the DMA Tx desc checksum insertion. This parameter can be one of the following values: ETH_DMATXDESC_CHECKSUMB YPASS : Checksum bypass...
  • Page 225 UM1940 HAL ETH Generic Driver Enables the DMA Tx Desc padding for frame shorter than 64 bytes. Parameters: __HANDLE__: ETH Handle Return value: None __HAL_ETH_DMATXDESC_SHORT_FRA Description: ME_PADDING_DISABLE Disables the DMA Tx Desc padding for frame shorter than 64 bytes. Parameters: __HANDLE__: ETH Handle Return value: None...
  • Page 226 HAL ETH Generic Driver UM1940 None __HAL_ETH_INITIATE_PAUSE_CONTRO Description: L_FRAME Initiate a Pause Control Frame (Full- duplex only). Parameters: __HANDLE__: ETH Handle Return value: None Description: __HAL_ETH_GET_FLOW_CONTROL_BU SY_STATUS Checks whether the ETHERNET flow control busy bit is set or not. Parameters: __HANDLE__: ETH Handle Return value: The: new state of flow control busy...
  • Page 227 UM1940 HAL ETH Generic Driver ETH_MAC_FLAG_MMCT : MMC transmit flag ETH_MAC_FLAG_MMCR : MMC receive flag ETH_MAC_FLAG_MMC : MMC flag ETH_MAC_FLAG_PMT : PMT flag Return value: The: state of ETHERNET MAC flag. __HAL_ETH_DMA_ENABLE_IT Description: Enables the specified ETHERNET DMA interrupts. Parameters: __HANDLE__: : ETH Handle __INTERRUPT__: specifies the ETHERNET DMA interrupt sources to...
  • Page 228 HAL ETH Generic Driver UM1940 __HANDLE__: ETH Handle __FLAG__: specifies the flag to check. Return value: The: new state of ETH_DMA_FLAG (SET or RESET). __HAL_ETH_DMA_CLEAR_FLAG Description: Checks whether the specified ETHERNET DMA flag is set or not. Parameters: __HANDLE__: ETH Handle __FLAG__: specifies the flag to clear.
  • Page 229 UM1940 HAL ETH Generic Driver UP_ENABLE Enables any unicast packet filtered by the MAC address recognition to be a wake-up frame. Parameters: __HANDLE__: ETH Handle. Return value: None __HAL_ETH_GLOBAL_UNICAST_WAKE Description: UP_DISABLE Disables any unicast packet filtered by the MAC address recognition to be a wake-up frame.
  • Page 230 HAL ETH Generic Driver UM1940 Detection. Parameters: __HANDLE__: ETH Handle. Return value: None Description: __HAL_ETH_POWER_DOWN_ENABLE Enables the MAC Power Down. Parameters: __HANDLE__: ETH Handle Return value: None __HAL_ETH_POWER_DOWN_DISABLE Description: Disables the MAC Power Down. Parameters: __HANDLE__: ETH Handle Return value: None __HAL_ETH_GET_PMT_FLAG_STATUS Description:...
  • Page 231 UM1940 HAL ETH Generic Driver __HANDLE__: ETH Handle. Return value: None __HAL_ETH_MMC_COUNTER_HALF_PR Description: ESET Preset and Initialize the MMC counters to almost-half value: 0x7FFF_FFF0 (half - 16) Parameters: __HANDLE__: ETH Handle. Return value: None Description: __HAL_ETH_MMC_COUNTER_FREEZE_ ENABLE Enables the MMC Counter Freeze. Parameters: __HANDLE__: ETH Handle.
  • Page 232 HAL ETH Generic Driver UM1940 Rollover. Parameters: __HANDLE__: ETH Handle. Return value: None Description: __HAL_ETH_ETH_MMC_COUNTER_RO LLOVER_DISABLE Disables the MMC Counter Stop Rollover. Parameters: __HANDLE__: ETH Handle. Return value: None __HAL_ETH_MMC_COUNTERS_RESET Description: Resets the MMC Counters. Parameters: __HANDLE__: ETH Handle. Return value: None __HAL_ETH_MMC_RX_IT_ENABLE Description:...
  • Page 233 UM1940 HAL ETH Generic Driver Parameters: __HANDLE__: ETH Handle. __INTERRUPT__: specifies the ETHERNET MMC interrupt sources to be enabled or disabled. This parameter can be one of the following values: ETH_MMC_IT_RGUF : When Rx good unicast frames counter reaches half the maximum value ETH_MMC_IT_RFAE : When Rx alignment error counter reaches half the maximum value...
  • Page 234 HAL ETH Generic Driver UM1940 the maximum value ETH_MMC_IT_TGFMSC: When Tx good multi col counter reaches half the maximum value ETH_MMC_IT_TGFSC : When Tx good single col counter reaches half the maximum value Return value: None Description: __HAL_ETH_WAKEUP_EXTI_ENABLE_I Enables the ETH External interrupt line. Return value: None Description:...
  • Page 235 UM1940 HAL ETH Generic Driver External interrupt line. Return value: None __HAL_ETH_WAKEUP_EXTI_DISABLE_ Description: RISING_EDGE_TRIGGER Disables the rising edge trigger to the ETH External interrupt line. Return value: None __HAL_ETH_WAKEUP_EXTI_ENABLE_F Description: ALLING_EDGE_TRIGGER Enables falling edge trigger to the ETH External interrupt line. Return value: None __HAL_ETH_WAKEUP_EXTI_DISABLE_...
  • Page 236 HAL ETH Generic Driver UM1940 ETH Flush Received Frame ETH_FLUSHRECEIVEDFRAME_ENABLE ETH_FLUSHRECEIVEDFRAME_DISABLE ETH Forward Error Frames ETH_FORWARDERRORFRAMES_ENABLE ETH_FORWARDERRORFRAMES_DISABLE ETH Forward Undersized Good Frames ETH_FORWARDUNDERSIZEDGOODFRAMES_ENABLE ETH_FORWARDUNDERSIZEDGOODFRAMES_DISABLE ETH Inter Frame Gap ETH_INTERFRAMEGAP_96BIT minimum IFG between frames during transmission is 96Bit ETH_INTERFRAMEGAP_88BIT minimum IFG between frames during transmission is 88Bit ETH_INTERFRAMEGAP_80BIT minimum IFG between frames during transmission is...
  • Page 237 UM1940 HAL ETH Generic Driver ETH_MAC_ADDRESSMASK_BYTE5 Mask MAC Address high reg bits [7:0] ETH_MAC_ADDRESSMASK_BYTE4 Mask MAC Address low reg bits [31:24] ETH_MAC_ADDRESSMASK_BYTE3 Mask MAC Address low reg bits [23:16] ETH_MAC_ADDRESSMASK_BYTE2 Mask MAC Address low reg bits [15:8] ETH_MAC_ADDRESSMASK_BYTE1 Mask MAC Address low reg bits [70] ETH MAC addresses filter SA DA ETH_MAC_ADDRESSFILTER_SA ETH_MAC_ADDRESSFILTER_DA...
  • Page 238 HAL ETH Generic Driver UM1940 ETH_MULTICASTFRAMESFILTER_PERFECT ETH_MULTICASTFRAMESFILTER_NONE ETH Pass Control Frames ETH_PASSCONTROLFRAMES_BLOCKALL MAC filters all control frames from reaching the application ETH_PASSCONTROLFRAMES_FORWARDALL MAC forwards all control frames to application even if they fail the Address Filter ETH_PASSCONTROLFRAMES_FORWARDPASSEDADDRFILTER MAC forwards control frames that pass the Address Filter.
  • Page 239 UM1940 HAL ETH Generic Driver ETH Receive Threshold Control ETH_RECEIVEDTHRESHOLDCONTROL_64BYTES threshold level of the MTL Receive FIFO is 64 Bytes ETH_RECEIVEDTHRESHOLDCONTROL_32BYTES threshold level of the MTL Receive FIFO is 32 Bytes ETH_RECEIVEDTHRESHOLDCONTROL_96BYTES threshold level of the MTL Receive FIFO is 96 Bytes ETH_RECEIVEDTHRESHOLDCONTROL_128BYTES threshold level of the MTL Receive FIFO is 128 Bytes...
  • Page 240 HAL ETH Generic Driver UM1940 is 64 ETH_RXDMABURSTLENGTH_4XPBL_128BEAT maximum number of beats to be transferred in one RxDMA transaction is 128 ETH Rx Mode ETH_RXPOLLING_MODE ETH_RXINTERRUPT_MODE ETH Second Frame Operate ETH_SECONDFRAMEOPERARTE_ENABLE ETH_SECONDFRAMEOPERARTE_DISABLE ETH Source Addr Filter ETH_SOURCEADDRFILTER_NORMAL_ENABLE ETH_SOURCEADDRFILTER_INVERSE_ENABLE ETH_SOURCEADDRFILTER_DISABLE ETH Speed ETH_SPEED_10M ETH_SPEED_100M ETH Transmit Flow Control...
  • Page 241 UM1940 HAL ETH Generic Driver ETH Tx DMA Burst Length ETH_TXDMABURSTLENGTH_1BEAT maximum number of beats to be transferred in one TxDMA (or both) transaction is 1 ETH_TXDMABURSTLENGTH_2BEAT maximum number of beats to be transferred in one TxDMA (or both) transaction is 2 ETH_TXDMABURSTLENGTH_4BEAT maximum number of beats to be transferred in one TxDMA (or both)
  • Page 242 HAL ETH Generic Driver UM1940 ETH_VLANTAGCOMPARISON_12BIT ETH_VLANTAGCOMPARISON_16BIT ETH Watchdog ETH_WATCHDOG_ENABLE ETH_WATCHDOG_DISABLE ETH Zero Quanta Pause ETH_ZEROQUANTAPAUSE_ENABLE ETH_ZEROQUANTAPAUSE_DISABLE 242/1371 DocID028236 Rev 2...
  • Page 243: Flash Firmware Driver Registers Structures

    UM1940 HAL FLASH Generic Driver HAL FLASH Generic Driver 18.1 FLASH Firmware driver registers structures 18.1.1 FLASH_ProcessTypeDef Data Fields __IO FLASH_ProcedureTypeDef ProcedureOnGoing __IO uint32_t NbSectorsToErase __IO uint8_t VoltageForErase __IO uint32_t Sector __IO uint32_t Bank __IO uint32_t Address HAL_LockTypeDef Lock __IO uint32_t ErrorCode Field Documentation __IO FLASH_ProcedureTypeDef FLASH_ProcessTypeDef::ProcedureOnGoing __IO uint32_t FLASH_ProcessTypeDef::NbSectorsToErase...
  • Page 244: Programming Operation Functions

    HAL FLASH Generic Driver UM1940 Lock and Unlock the FLASH interface using HAL_FLASH_Unlock() and HAL_FLASH_Lock() functions Program functions: byte, half word, word and double word There Two modes of programming : Polling mode using HAL_FLASH_Program() function Interrupt mode using HAL_FLASH_Program_IT() function Interrupts and flags management functions : Handle FLASH interrupts by calling HAL_FLASH_IRQHandler() Wait for last FLASH operation according to its status...
  • Page 245 UM1940 HAL FLASH Generic Driver 18.2.6 Detailed description of functions HAL_FLASH_Program Function name HAL_StatusTypeDef HAL_FLASH_Program (uint32_t TypeProgram, uint32_t Address, uint64_t Data) Function description Program byte, halfword, word or double word at a specified address. Parameters TypeProgram: Indicate the way to program at a specified address.
  • Page 246 HAL FLASH Generic Driver UM1940 HAL_FLASH_OperationErrorCallback Function name void HAL_FLASH_OperationErrorCallback (uint32_t ReturnValue) Function description FLASH operation error interrupt callback. Parameters ReturnValue: The value saved in this parameter depends on the ongoing procedure Mass Erase: Bank number which has been requested to erase Sectors Erase: Sector number which returned an error Program: Address which was selected for data program Return values...
  • Page 247: Flash Firmware Driver Defines

    UM1940 HAL FLASH Generic Driver Return values FLASH_ErrorCode: The returned value can be a combination of: HAL_FLASH_ERROR_NONE: FLASH Programming Sequence error flag HAL_FLASH_ERROR_PGS: FLASH Programming Sequence error flag HAL_FLASH_ERROR_PGP: FLASH Programming Parallelism error flag HAL_FLASH_ERROR_PGA: FLASH Programming Alignment error flag HAL_FLASH_ERROR_WRP: FLASH Write protected error flag HAL_FLASH_ERROR_OPERATION: FLASH operation...
  • Page 248 HAL FLASH Generic Driver UM1940 Get the FLASH Latency. Return value: FLASH: Latency The value of this parameter depend on device used within the same series __HAL_FLASH_PREFETCH_BUFFER_ENABLE Description: Enable the FLASH prefetch buffer. Return value: none __HAL_FLASH_PREFETCH_BUFFER_DISABL Description: Disable the FLASH prefetch buffer.
  • Page 249 UM1940 HAL FLASH Generic Driver Notes: This function must be used only when the Instruction Cache is disabled. __HAL_FLASH_DATA_CACHE_RESET Description: Resets the FLASH data Cache. Return value: None Notes: This function must be used only when the data Cache is disabled. __HAL_FLASH_ENABLE_IT Description: Enable the specified FLASH...
  • Page 250 HAL FLASH Generic Driver UM1940 __FLAG__: specifies the FLASH flags to check. This parameter can be any combination of the following values: FLASH_FLAG_EOP : FLASH End of Operation flag FLASH_FLAG_OPERR : FLASH operation Error flag FLASH_FLAG_WRPERR: FLASH Write protected error flag FLASH_FLAG_PGAERR: FLASH Programming...
  • Page 251 UM1940 HAL FLASH Generic Driver FLASH Flag definition FLASH_FLAG_EOP FLASH End of Operation flag FLASH_FLAG_OPERR FLASH operation Error flag FLASH_FLAG_WRPERR FLASH Write protected error flag FLASH_FLAG_PGAERR FLASH Programming Alignment error flag FLASH_FLAG_PGPERR FLASH Programming Parallelism error flag FLASH_FLAG_PGSERR FLASH Programming Sequence error flag FLASH_FLAG_BSY FLASH Busy flag FLASH Interrupt definition...
  • Page 252 HAL FLASH Generic Driver UM1940 FLASH_TYPEPROGRAM_HALFWORD Program a half-word (16-bit) at a specified address FLASH_TYPEPROGRAM_WORD Program a word (32-bit) at a specified address FLASH_TYPEPROGRAM_DOUBLEWORD Program a double word (64-bit) at a specified address 252/1371 DocID028236 Rev 2...
  • Page 253: Flashex Firmware Driver Registers Structures

    UM1940 HAL FLASH Extension Driver HAL FLASH Extension Driver 19.1 FLASHEx Firmware driver registers structures 19.1.1 FLASH_EraseInitTypeDef Data Fields uint32_t TypeErase uint32_t Banks uint32_t Sector uint32_t NbSectors uint32_t VoltageRange Field Documentation uint32_t FLASH_EraseInitTypeDef::TypeErase Mass erase or sector Erase. This parameter can be a value of FLASHEx_Type_Erase uint32_t FLASH_EraseInitTypeDef::Banks Select banks to erase when Mass erase is enabled.
  • Page 254: Flashex Firmware Driver Api Description

    HAL FLASH Extension Driver UM1940 uint32_t FLASH_OBProgramInitTypeDef::Banks Select banks for WRP activation/deactivation of all sectors. This parameter must be a value of FLASHEx_Banks uint32_t FLASH_OBProgramInitTypeDef::RDPLevel Set the read protection level. This parameter can be a value of FLASHEx_Option_Bytes_Read_Protection uint32_t FLASH_OBProgramInitTypeDef::BORLevel Set the BOR Level.
  • Page 255 UM1940 HAL FLASH Extension Driver SectorError: pointer to variable that contains the configuration information on faulty sector in case of error (0xFFFFFFFF means that all the sectors have been correctly erased) Return values HAL: Status HAL_FLASHEx_Erase_IT HAL_StatusTypeDef HAL_FLASHEx_Erase_IT Function name (FLASH_EraseInitTypeDef * pEraseInit) Function description Perform a mass erase or erase the specified FLASH memory...
  • Page 256: Flashex Firmware Driver Defines

    HAL FLASH Extension Driver UM1940 range is 2.1V to 2.7V, the operation will be done by half word (16-bit) FLASH_VOLTAGE_RANGE_3: when the device voltage range is 2.7V to 3.6V, the operation will be done by word (32-bit) FLASH_VOLTAGE_RANGE_4: when the device voltage range is 2.7V to 3.6V + External Vpp, the operation will be done by double word (64-bit) Return values...
  • Page 257 UM1940 HAL FLASH Extension Driver IS_OB_WRP_SECTOR FLASH Mass Erase bit FLASH_MER_BIT only 1 MER Bit FLASH Option Bytes IWatchdog OB_IWDG_SW Software IWDG selected OB_IWDG_HW Hardware IWDG selected FLASH Option Bytes nRST_STDBY OB_STDBY_NO_RST No reset generated when entering in STANDBY OB_STDBY_RST Reset generated when entering in STANDBY FLASH Option Bytes nRST_STOP OB_STOP_NO_RST...
  • Page 258 HAL FLASH Extension Driver UM1940 FLASH_SECTOR_0 Sector Number 0 FLASH_SECTOR_1 Sector Number 1 FLASH_SECTOR_2 Sector Number 2 FLASH_SECTOR_3 Sector Number 3 FLASH_SECTOR_4 Sector Number 4 FLASH_SECTOR_5 Sector Number 5 FLASH_SECTOR_6 Sector Number 6 FLASH_SECTOR_7 Sector Number 7 FLASH_SECTOR_8 Sector Number 8 FLASH_SECTOR_9 Sector Number 9 FLASH_SECTOR_10...
  • Page 259: Hal Gpio Generic Driver

    UM1940 HAL GPIO Generic Driver HAL GPIO Generic Driver 20.1 GPIO Firmware driver registers structures 20.1.1 GPIO_InitTypeDef Data Fields uint32_t Pin uint32_t Mode uint32_t Pull uint32_t Speed uint32_t Alternate Field Documentation uint32_t GPIO_InitTypeDef::Pin Specifies the GPIO pins to be configured. This parameter can be any value of GPIO_pins_define uint32_t GPIO_InitTypeDef::Mode Specifies the operating mode for the selected pins.
  • Page 260 HAL GPIO Generic Driver UM1940 All ports have external interrupt/event capability. To use external interrupt lines, the port must be configured in input mode. All available GPIO pins are connected to the 16 external interrupt/event lines from EXTI0 to EXTI15. The external interrupt/event controller consists of up to 23 edge detectors (16 lines are connected to GPIO) for generating event/interrupt requests (each input line can be independently configured to select the type (interrupt or event) and the corresponding...
  • Page 261 UM1940 HAL GPIO Generic Driver HAL_GPIO_TogglePin() HAL_GPIO_LockPin() HAL_GPIO_EXTI_IRQHandler() HAL_GPIO_EXTI_Callback() 20.2.5 Detailed description of functions HAL_GPIO_Init Function name void HAL_GPIO_Init (GPIO_TypeDef * GPIOx, GPIO_InitTypeDef * GPIO_Init) Function description Initializes the GPIOx peripheral according to the specified parameters in the GPIO_Init. Parameters GPIOx: where x can be (A..I) to select the GPIO peripheral.
  • Page 262 HAL GPIO Generic Driver UM1940 PinState: specifies the value to be written to the selected bit. This parameter can be one of the GPIO_PinState enum values: GPIO_PIN_RESET: to clear the port pin GPIO_PIN_SET: to set the port pin Return values None: Notes This function uses GPIOx_BSRR register to allow atomic...
  • Page 263: Gpio Firmware Driver Defines

    UM1940 HAL GPIO Generic Driver Parameters GPIO_Pin: Specifies the pins connected EXTI line Return values None: 20.3 GPIO Firmware driver defines 20.3.1 GPIO GPIO Alternate function selection GPIO_AF0_RTC_50Hz GPIO_AF0_MCO GPIO_AF0_TAMPER GPIO_AF0_SWJ GPIO_AF0_TRACE GPIO_AF1_TIM1 GPIO_AF1_TIM2 GPIO_AF2_TIM3 GPIO_AF2_TIM4 GPIO_AF2_TIM5 GPIO_AF3_TIM8 GPIO_AF3_TIM9 GPIO_AF3_TIM10 GPIO_AF3_TIM11 GPIO_AF4_I2C1 GPIO_AF4_I2C2...
  • Page 264 HAL GPIO Generic Driver UM1940 GPIO_AF9_TIM14 GPIO_AF10_OTG_FS GPIO_AF10_OTG_HS GPIO_AF11_ETH GPIO_AF12_FSMC GPIO_AF12_OTG_HS_FS GPIO_AF12_SDIO GPIO_AF13_DCMI GPIO_AF15_EVENTOUT GPIO Exported Macros __HAL_GPIO_EXTI_GET_FLAG Description: Checks whether the specified EXTI line flag is set or not. Parameters: __EXTI_LINE__: specifies the EXTI line flag to check. This parameter can be GPIO_PIN_x where x can be(0..15) Return value: The: new state of __EXTI_LINE__ (SET or...
  • Page 265 UM1940 HAL GPIO Generic Driver Clears the EXTI's line pending bits. Parameters: __EXTI_LINE__: specifies the EXTI lines to clear. This parameter can be any combination of GPIO_PIN_x where x can be (0..15) Return value: None __HAL_GPIO_EXTI_GENERATE_SWIT Description: Generates a Software interrupt on selected EXTI line.
  • Page 266 HAL GPIO Generic Driver UM1940 GPIO_PIN_3 GPIO_PIN_4 GPIO_PIN_5 GPIO_PIN_6 GPIO_PIN_7 GPIO_PIN_8 GPIO_PIN_9 GPIO_PIN_10 GPIO_PIN_11 GPIO_PIN_12 GPIO_PIN_13 GPIO_PIN_14 GPIO_PIN_15 GPIO_PIN_All GPIO_PIN_MASK GPIO pull define GPIO_NOPULL No Pull-up or Pull-down activation GPIO_PULLUP Pull-up activation GPIO_PULLDOWN Pull-down activation GPIO speed define GPIO_SPEED_FREQ_LOW IO works at 2 MHz, please refer to the product datasheet GPIO_SPEED_FREQ_MEDIUM range 12,5 MHz to 50 MHz, please refer to the...
  • Page 267: Hal Gpio Extension Driver

    UM1940 HAL GPIO Extension Driver HAL GPIO Extension Driver 21.1 GPIOEx Firmware driver defines 21.1.1 GPIOEx GPIO Get Port Index GPIO_GET_INDEX GPIO Check Alternate Function IS_GPIO_AF DocID028236 Rev 2 267/1371...
  • Page 268: Hal Hash Generic Driver

    HAL HASH Generic Driver UM1940 HAL HASH Generic Driver 22.1 HASH Firmware driver registers structures 22.1.1 HASH_InitTypeDef Data Fields uint32_t DataType uint32_t KeySize uint8_t * pKey Field Documentation uint32_t HASH_InitTypeDef::DataType 32-bit data, 16-bit data, 8-bit data or 1-bit string. This parameter can be a value of HASH_Data_Type uint32_t HASH_InitTypeDef::KeySize The key size is used only in HMAC operation...
  • Page 269: Hash Firmware Driver Api Description

    UM1940 HAL HASH Generic Driver HAL_HASH_PhaseTypeDef HASH_HandleTypeDef::Phase HASH peripheral phase DMA_HandleTypeDef* HASH_HandleTypeDef::hdmain HASH In DMA handle parameters HAL_LockTypeDef HASH_HandleTypeDef::Lock HASH locking object __IO HAL_HASH_StateTypeDef HASH_HandleTypeDef::State HASH peripheral state 22.2 HASH Firmware driver API description 22.2.1 How to use this driver The HASH HAL driver can be used as follows: Initialize the HASH low level resources by implementing the HAL_HASH_MspInit(): Enable the HASH interface clock using __HAL_RCC_HASH_CLK_ENABLE()
  • Page 270: Hash Processing Using Polling Mode Functions

    HAL HASH Generic Driver UM1940 In HMAC mode, there is no Accumulate API. Only Start API is available. In case of using DMA, call the DMA start processing e.g. HAL_HASH_SHA1_Start_DMA(). After that, call the finish function in order to get the digest value e.g.
  • Page 271: Hmac Processing Using Dma Mode Functions

    UM1940 HAL HASH Generic Driver This section contains the following APIs: HAL_HMAC_MD5_Start() HAL_HMAC_SHA1_Start() HAL_HASH_SHA1_Start_DMA() HAL_HASH_SHA1_Finish() HAL_HASH_MD5_Start_DMA() HAL_HASH_MD5_Finish() 22.2.6 HMAC processing using DMA mode functions This section provides functions allowing to calculate in DMA mode the HMAC value using one of the following algorithms: SHA1 This section contains the following APIs: HAL_HMAC_MD5_Start_DMA()
  • Page 272 HAL HASH Generic Driver UM1940 Parameters hhash: pointer to a HASH_HandleTypeDef structure that contains the configuration information for HASH module Return values HAL: status HAL_HASH_DeInit Function name HAL_StatusTypeDef HAL_HASH_DeInit (HASH_HandleTypeDef * hhash) Function description DeInitializes the HASH peripheral. Parameters hhash: pointer to a HASH_HandleTypeDef structure that contains the configuration information for HASH module Return values HAL: status...
  • Page 273 UM1940 HAL HASH Generic Driver Return values HAL: status HAL_HASH_MD5_Accumulate HAL_StatusTypeDef HAL_HASH_MD5_Accumulate Function name (HASH_HandleTypeDef * hhash, uint8_t * pInBuffer, uint32_t Size) Function description Initializes the HASH peripheral in MD5 mode then writes the pInBuffer. Parameters hhash: pointer to a HASH_HandleTypeDef structure that contains the configuration information for HASH module pInBuffer: Pointer to the input buffer (buffer to be hashed).
  • Page 274 HAL HASH Generic Driver UM1940 Return values HAL: status HAL_HMAC_MD5_Start HAL_StatusTypeDef HAL_HMAC_MD5_Start Function name (HASH_HandleTypeDef * hhash, uint8_t * pInBuffer, uint32_t Size, uint8_t * pOutBuffer, uint32_t Timeout) Function description Initializes the HASH peripheral in HMAC MD5 mode then processes pInBuffer. Parameters hhash: pointer to a HASH_HandleTypeDef structure that contains the configuration information for HASH module...
  • Page 275 UM1940 HAL HASH Generic Driver Return values HAL: status HAL_HASH_SHA1_Start_DMA HAL_StatusTypeDef HAL_HASH_SHA1_Start_DMA Function name (HASH_HandleTypeDef * hhash, uint8_t * pInBuffer, uint32_t Size) Function description Initializes the HASH peripheral in SHA1 mode then enables DMA to control data transfer. Parameters hhash: pointer to a HASH_HandleTypeDef structure that contains the configuration information for HASH module pInBuffer: Pointer to the input buffer (buffer to be hashed).
  • Page 276 HAL HASH Generic Driver UM1940 Function description Returns the computed digest in MD5 mode. Parameters hhash: pointer to a HASH_HandleTypeDef structure that contains the configuration information for HASH module pOutBuffer: Pointer to the computed digest. Its size must be 16 bytes. Timeout: Timeout value Return values HAL: status...
  • Page 277 UM1940 HAL HASH Generic Driver Function description return the HASH state Parameters hhash: pointer to a HASH_HandleTypeDef structure that contains the configuration information for HASH module Return values HAL: state HAL_HASH_MspInit Function name void HAL_HASH_MspInit (HASH_HandleTypeDef * hhash) Function description Initializes the HASH MSP.
  • Page 278: Hash Firmware Driver Defines

    HAL HASH Generic Driver UM1940 Parameters hhash: pointer to a HASH_HandleTypeDef structure that contains the configuration information for HASH module Return values None: 22.3 HASH Firmware driver defines 22.3.1 HASH HASH Data Type HASH_DATATYPE_32B 32-bit data. No swapping HASH_DATATYPE_16B 16-bit data. Each half word is swapped HASH_DATATYPE_8B 8-bit data.
  • Page 279 UM1940 HAL HASH Generic Driver None __HAL_HASH_GET_FLAG Description: Check whether the specified HASH flag is set or not. Parameters: __FLAG__: specifies the flag to check. This parameter can be one of the following values: HASH_FLAG_DINIS: A new block can be entered into the input buffer. HASH_FLAG_DCIS: Digest calculation complete HASH_FLAG_DMAS: DMA interface...
  • Page 280: Hal Hcd Generic Driver

    HAL HCD Generic Driver UM1940 HAL HCD Generic Driver 23.1 HCD Firmware driver registers structures 23.1.1 HCD_HandleTypeDef Data Fields HCD_TypeDef * Instance HCD_InitTypeDef Init HCD_HCTypeDef hc HAL_LockTypeDef Lock __IO HCD_StateTypeDef State void * pData Field Documentation HCD_TypeDef* HCD_HandleTypeDef::Instance Register base address HCD_InitTypeDef HCD_HandleTypeDef::Init HCD required parameters HCD_HCTypeDef HCD_HandleTypeDef::hc[15U]...
  • Page 281 UM1940 HAL HCD Generic Driver 23.2.2 Initialization and de-initialization functions This section provides functions allowing to: This section contains the following APIs: HAL_HCD_Init() HAL_HCD_HC_Init() HAL_HCD_HC_Halt() HAL_HCD_DeInit() HAL_HCD_MspInit() HAL_HCD_MspDeInit() 23.2.3 IO operation functions This subsection provides a set of functions allowing to manage the USB Host Data Transfer This section contains the following APIs: HAL_HCD_HC_SubmitRequest()
  • Page 282 HAL HCD Generic Driver UM1940 Return values HAL: status HAL_HCD_DeInit HAL_StatusTypeDef HAL_HCD_DeInit (HCD_HandleTypeDef * Function name hhcd) Function description DeInitialize the host driver. Parameters hhcd: HCD handle Return values HAL: status HAL_HCD_HC_Init HAL_StatusTypeDef HAL_HCD_HC_Init (HCD_HandleTypeDef Function name * hhcd, uint8_t ch_num, uint8_t epnum, uint8_t dev_address, uint8_t speed, uint8_t ep_type, uint16_t mps) Function description Initialize a host channel.
  • Page 283 UM1940 HAL HCD Generic Driver Function description Initialize the HCD MSP. Parameters hhcd: HCD handle Return values None: HAL_HCD_MspDeInit Function name void HAL_HCD_MspDeInit (HCD_HandleTypeDef * hhcd) Function description DeInitialize the HCD MSP. Parameters hhcd: HCD handle Return values None: HAL_HCD_HC_SubmitRequest Function name HAL_StatusTypeDef HAL_HCD_HC_SubmitRequest (HCD_HandleTypeDef * hhcd, uint8_t ch_num, uint8_t...
  • Page 284 HAL HCD Generic Driver UM1940 Parameters hhcd: HCD handle Return values None: HAL_HCD_Connect_Callback Function name void HAL_HCD_Connect_Callback (HCD_HandleTypeDef * hhcd) Function description Connection Event callback. Parameters hhcd: HCD handle Return values None: HAL_HCD_Disconnect_Callback Function name void HAL_HCD_Disconnect_Callback (HCD_HandleTypeDef * hhcd) Function description Disconnection Event callback.
  • Page 285 UM1940 HAL HCD Generic Driver Parameters hhcd: HCD handle Return values HAL: status HAL_HCD_Stop Function name HAL_StatusTypeDef HAL_HCD_Stop (HCD_HandleTypeDef * hhcd) Function description Stop the host driver. Parameters hhcd: HCD handle Return values HAL: status HAL_HCD_GetState Function name HCD_StateTypeDef HAL_HCD_GetState (HCD_HandleTypeDef * hhcd) Function description Return the HCD handle state.
  • Page 286: Hcd Firmware Driver Defines

    HAL HCD Generic Driver UM1940 Parameters hhcd: HCD handle chnum: Channel number. This parameter can be a value from 1 to 15 Return values Host: channel state This parameter can be one of these values: HC_IDLE/ HC_XFRC/ HC_HALTED/ HC_NYET/ HC_NAK/ HC_STALL/ HC_XACTERR/ HC_BBLERR/ HC_DATATGLERR HAL_HCD_GetCurrentFrame Function name...
  • Page 287 UM1940 HAL HCD Generic Driver HCD_PHY_EMBEDDED HCD Speed HCD_SPEED_HIGH HCD_SPEED_LOW HCD_SPEED_FULL DocID028236 Rev 2 287/1371...
  • Page 288: Hal I2C Generic Driver

    HAL I2C Generic Driver UM1940 HAL I2C Generic Driver 24.1 I2C Firmware driver registers structures 24.1.1 I2C_InitTypeDef Data Fields uint32_t ClockSpeed uint32_t DutyCycle uint32_t OwnAddress1 uint32_t AddressingMode uint32_t DualAddressMode uint32_t OwnAddress2 uint32_t GeneralCallMode uint32_t NoStretchMode Field Documentation uint32_t I2C_InitTypeDef::ClockSpeed Specifies the clock frequency. This parameter must be set to a value lower than 400kHz uint32_t I2C_InitTypeDef::DutyCycle Specifies the I2C fast mode duty cycle.
  • Page 289: I2C Firmware Driver Api Description

    UM1940 HAL I2C Generic Driver __IO uint32_t PreviousState DMA_HandleTypeDef * hdmatx DMA_HandleTypeDef * hdmarx HAL_LockTypeDef Lock __IO HAL_I2C_StateTypeDef State __IO HAL_I2C_ModeTypeDef Mode __IO uint32_t ErrorCode __IO uint32_t Devaddress __IO uint32_t Memaddress __IO uint32_t MemaddSize __IO uint32_t EventCount Field Documentation I2C_TypeDef* I2C_HandleTypeDef::Instance I2C registers base address I2C_InitTypeDef I2C_HandleTypeDef::Init I2C communication parameters...
  • Page 290 HAL I2C Generic Driver UM1940 Declare a I2C_HandleTypeDef handle structure, for example: I2C_HandleTypeDef hi2c; Initialize the I2C low level resources by implement the HAL_I2C_MspInit() API: Enable the I2Cx interface clock I2C pins configuration Enable the clock for the I2C GPIOs Configure I2C pins as alternate function open-drain NVIC configuration if you need to use interrupt process Configure the I2Cx interrupt priority...
  • Page 291 UM1940 HAL I2C Generic Driver Receive in master mode an amount of data in non blocking mode using HAL_I2C_Master_Receive_IT() At reception end of transfer HAL_I2C_MasterRxCpltCallback is executed and user can add his own code by customization of function pointer HAL_I2C_MasterRxCpltCallback Transmit in slave mode an amount of data in non blocking mode using HAL_I2C_Slave_Transmit_IT() At transmission end of transfer HAL_I2C_SlaveTxCpltCallback is executed and user...
  • Page 292 HAL I2C Generic Driver UM1940 Abort a master I2C process communication with Interrupt using HAL_I2C_Master_Abort_IT() End of abort process, HAL_I2C_AbortCpltCallback() is executed and user can add his own code by customization of function pointer HAL_I2C_AbortCpltCallback() Enable/disable the Address listen mode in slave I2C mode using HAL_I2C_EnableListen_IT() HAL_I2C_DisableListen_IT() When address slave I2C match, HAL_I2C_AddrCallback() is executed and user can add his own code to check the Address Match Code and the...
  • Page 293 UM1940 HAL I2C Generic Driver At reception end of transfer HAL_I2C_MasterRxCpltCallback is executed and user can add his own code by customization of function pointer HAL_I2C_MasterRxCpltCallback Transmit in slave mode an amount of data in non blocking mode (DMA) using HAL_I2C_Slave_Transmit_DMA() At transmission end of transfer HAL_I2C_SlaveTxCpltCallback is executed and user can add his own code by customization of function pointer...
  • Page 294 HAL I2C Generic Driver UM1940 Call the function HAL_I2C_Init() to configure the selected device with the selected configuration: Communication Speed Duty cycle Addressing mode Own Address 1 Dual Addressing mode Own Address 2 General call mode Nostretch mode Call the function HAL_I2C_DeInit() to restore the default configuration of the selected I2Cx peripheral.
  • Page 295 UM1940 HAL I2C Generic Driver HAL_I2C_Mem_Write_DMA() HAL_I2C_Mem_Read_DMA() A set of Transfer Complete Callbacks are provided in non Blocking mode: HAL_I2C_MemTxCpltCallback() HAL_I2C_MemRxCpltCallback() HAL_I2C_MasterTxCpltCallback() HAL_I2C_MasterRxCpltCallback() HAL_I2C_SlaveTxCpltCallback() HAL_I2C_SlaveRxCpltCallback() HAL_I2C_ErrorCallback() HAL_I2C_AbortCpltCallback() This section contains the following APIs: HAL_I2C_Master_Transmit() HAL_I2C_Master_Receive() HAL_I2C_Slave_Transmit() HAL_I2C_Slave_Receive() HAL_I2C_Master_Transmit_IT() HAL_I2C_Master_Receive_IT() HAL_I2C_Master_Sequential_Transmit_IT() HAL_I2C_Master_Sequential_Receive_IT() HAL_I2C_Slave_Transmit_IT() HAL_I2C_Slave_Receive_IT()
  • Page 296: Peripheral State, Mode And Error Functions

    HAL I2C Generic Driver UM1940 24.2.4 Peripheral State, Mode and Error functions This subsection permits to get in run-time the status of the peripheral and the data flow. This section contains the following APIs: HAL_I2C_GetState() HAL_I2C_GetMode() HAL_I2C_GetError() 24.2.5 Detailed description of functions HAL_I2C_Init Function name HAL_StatusTypeDef HAL_I2C_Init (I2C_HandleTypeDef * hi2c)
  • Page 297 UM1940 HAL I2C Generic Driver (I2C_HandleTypeDef * hi2c, uint16_t DevAddress, uint8_t * pData, uint16_t Size, uint32_t Timeout) Function description Transmits in master mode an amount of data in blocking mode. Parameters hi2c: Pointer to a I2C_HandleTypeDef structure that contains the configuration information for the specified I2C. DevAddress: Target device address: The device 7 bits address value in datasheet must be shift at right before call interface...
  • Page 298 HAL I2C Generic Driver UM1940 Parameters hi2c: Pointer to a I2C_HandleTypeDef structure that contains the configuration information for the specified I2C. pData: Pointer to data buffer Size: Amount of data to be sent Timeout: Timeout duration Return values HAL: status HAL_I2C_Mem_Write HAL_StatusTypeDef HAL_I2C_Mem_Write Function name...
  • Page 299 UM1940 HAL I2C Generic Driver Parameters hi2c: Pointer to a I2C_HandleTypeDef structure that contains the configuration information for the specified I2C. DevAddress: Target device address Trials: Number of trials Timeout: Timeout duration Return values HAL: status Notes This function is used with Memory devices HAL_I2C_Master_Transmit_IT Function name HAL_StatusTypeDef HAL_I2C_Master_Transmit_IT...
  • Page 300 HAL I2C Generic Driver UM1940 Size: Amount of data to be sent Return values HAL: status HAL_I2C_Slave_Receive_IT Function name HAL_StatusTypeDef HAL_I2C_Slave_Receive_IT (I2C_HandleTypeDef * hi2c, uint8_t * pData, uint16_t Size) Function description Receive in slave mode an amount of data in non-blocking mode with Interrupt.
  • Page 301 UM1940 HAL I2C Generic Driver HAL_I2C_Master_Sequential_Transmit_IT Function name HAL_StatusTypeDef HAL_I2C_Master_Sequential_Transmit_IT (I2C_HandleTypeDef * hi2c, uint16_t DevAddress, uint8_t * pData, uint16_t Size, uint32_t XferOptions) Function description Sequential transmit in master mode an amount of data in non- blocking mode with Interrupt. Parameters hi2c: Pointer to a I2C_HandleTypeDef structure that contains the configuration information for the specified I2C.
  • Page 302 HAL I2C Generic Driver UM1940 the configuration information for I2C module pData: Pointer to data buffer Size: Amount of data to be sent XferOptions: Options of Transfer, value of I2C XferOptions definition Return values HAL: status Notes This interface allow to manage repeated start condition when a direction change during transfer HAL_I2C_Slave_Sequential_Receive_IT Function name...
  • Page 303 UM1940 HAL I2C Generic Driver HAL_I2C_DisableListen_IT Function name HAL_StatusTypeDef HAL_I2C_DisableListen_IT (I2C_HandleTypeDef * hi2c) Function description Disable the Address listen mode with Interrupt. Parameters hi2c: Pointer to a I2C_HandleTypeDef structure that contains the configuration information for the specified I2C. Return values HAL: status HAL_I2C_Master_Transmit_DMA Function name...
  • Page 304 HAL I2C Generic Driver UM1940 pData: Pointer to data buffer Size: Amount of data to be sent Return values HAL: status HAL_I2C_Slave_Receive_DMA Function name HAL_StatusTypeDef HAL_I2C_Slave_Receive_DMA (I2C_HandleTypeDef * hi2c, uint8_t * pData, uint16_t Size) Function description Receive in slave mode an amount of data in non-blocking mode with DMA.
  • Page 305 UM1940 HAL I2C Generic Driver Return values HAL: status HAL_I2C_EV_IRQHandler void HAL_I2C_EV_IRQHandler (I2C_HandleTypeDef * hi2c) Function name Function description This function handles I2C event interrupt request. Parameters hi2c: Pointer to a I2C_HandleTypeDef structure that contains the configuration information for the specified I2C. Return values None: HAL_I2C_ER_IRQHandler...
  • Page 306 HAL I2C Generic Driver UM1940 HAL_I2C_SlaveRxCpltCallback Function name void HAL_I2C_SlaveRxCpltCallback (I2C_HandleTypeDef * hi2c) Function description Slave Rx Transfer completed callback. Parameters hi2c: Pointer to a I2C_HandleTypeDef structure that contains the configuration information for the specified I2C. Return values None: HAL_I2C_AddrCallback Function name void HAL_I2C_AddrCallback (I2C_HandleTypeDef * hi2c, uint8_t TransferDirection, uint16_t AddrMatchCode)
  • Page 307 UM1940 HAL I2C Generic Driver HAL_I2C_ErrorCallback Function name void HAL_I2C_ErrorCallback (I2C_HandleTypeDef * hi2c) Function description I2C error callback. Parameters hi2c: Pointer to a I2C_HandleTypeDef structure that contains the configuration information for the specified I2C. Return values None: HAL_I2C_AbortCpltCallback Function name void HAL_I2C_AbortCpltCallback (I2C_HandleTypeDef * hi2c) Function description I2C abort callback.
  • Page 308: I2C Firmware Driver Defines

    HAL I2C Generic Driver UM1940 24.3 I2C Firmware driver defines 24.3.1 I2C addressing mode I2C_ADDRESSINGMODE_7BIT I2C_ADDRESSINGMODE_10BIT I2C dual addressing mode I2C_DUALADDRESS_DISABLE I2C_DUALADDRESS_ENABLE I2C duty cycle in fast mode I2C_DUTYCYCLE_2 I2C_DUTYCYCLE_16_9 I2C Error Code HAL_I2C_ERROR_NONE No error HAL_I2C_ERROR_BERR BERR error HAL_I2C_ERROR_ARLO ARLO error HAL_I2C_ERROR_AF AF error...
  • Page 309 UM1940 HAL I2C Generic Driver I2C_IT_EVT: Event interrupt enable I2C_IT_ERR: Error interrupt enable Return value: None __HAL_I2C_DISABLE_IT Description: __HAL_I2C_GET_IT_SOURCE Checks if the specified I2C interrupt source is enabled or disabled. Parameters: __HANDLE__: specifies the I2C Handle. This parameter can be I2C where x: 1, 2, or 3 to select the I2C peripheral.
  • Page 310 HAL I2C Generic Driver UM1940 I2C_FLAG_STOPF: Stop detection flag I2C_FLAG_ADD10: 10-bit header sent flag I2C_FLAG_BTF: Byte transfer finished flag I2C_FLAG_ADDR: Address sent flag Address matched flag I2C_FLAG_SB: Start bit flag I2C_FLAG_DUALF: Dual flag I2C_FLAG_SMBHOST: SMBus host header I2C_FLAG_SMBDEFAULT: SMBus default header I2C_FLAG_GENCALL: General call header flag I2C_FLAG_TRA: Transmitter/Receiver...
  • Page 311 UM1940 HAL I2C Generic Driver Clears the I2C ADDR pending flag. Parameters: __HANDLE__: specifies the I2C Handle. This parameter can be I2C where x: 1, 2, or 3 to select the I2C peripheral. Return value: None __HAL_I2C_CLEAR_STOPFLAG Description: Clears the I2C STOPF pending flag. Parameters: __HANDLE__: specifies the I2C Handle.
  • Page 312 HAL I2C Generic Driver UM1940 I2C_FLAG_TXE I2C_FLAG_RXNE I2C_FLAG_STOPF I2C_FLAG_ADD10 I2C_FLAG_BTF I2C_FLAG_ADDR I2C_FLAG_SB I2C_FLAG_DUALF I2C_FLAG_SMBHOST I2C_FLAG_SMBDEFAULT I2C_FLAG_GENCALL I2C_FLAG_TRA I2C_FLAG_BUSY I2C_FLAG_MSL I2C general call addressing mode I2C_GENERALCALL_DISABLE I2C_GENERALCALL_ENABLE I2C Interrupt configuration definition I2C_IT_BUF I2C_IT_EVT I2C_IT_ERR I2C Private macros to check input parameters IS_I2C_DUTY_CYCLE IS_I2C_ADDRESSING_MODE IS_I2C_DUAL_ADDRESS...
  • Page 313 UM1940 HAL I2C Generic Driver I2C nostretch mode I2C_NOSTRETCH_DISABLE I2C_NOSTRETCH_ENABLE I2C XferDirection definition I2C_DIRECTION_RECEIVE I2C_DIRECTION_TRANSMIT I2C XferOptions definition I2C_FIRST_FRAME I2C_NEXT_FRAME I2C_FIRST_AND_LAST_FRAME I2C_LAST_FRAME DocID028236 Rev 2 313/1371...
  • Page 314: Hal I2S Generic Driver

    HAL I2S Generic Driver UM1940 HAL I2S Generic Driver 25.1 I2S Firmware driver registers structures 25.1.1 I2S_InitTypeDef Data Fields uint32_t Mode uint32_t Standard uint32_t DataFormat uint32_t MCLKOutput uint32_t AudioFreq uint32_t CPOL uint32_t ClockSource Field Documentation uint32_t I2S_InitTypeDef::Mode Specifies the I2S operating mode. This parameter can be a value of I2S_Mode uint32_t I2S_InitTypeDef::Standard Specifies the standard used for the I2S communication.
  • Page 315: I2S Firmware Driver Api Description

    UM1940 HAL I2S Generic Driver __IO uint32_t ErrorCode Field Documentation SPI_TypeDef* I2S_HandleTypeDef::Instance I2S_InitTypeDef I2S_HandleTypeDef::Init uint16_t* I2S_HandleTypeDef::pTxBuffPtr __IO uint16_t I2S_HandleTypeDef::TxXferSize __IO uint16_t I2S_HandleTypeDef::TxXferCount uint16_t* I2S_HandleTypeDef::pRxBuffPtr __IO uint16_t I2S_HandleTypeDef::RxXferSize __IO uint16_t I2S_HandleTypeDef::RxXferCount DMA_HandleTypeDef* I2S_HandleTypeDef::hdmatx DMA_HandleTypeDef* I2S_HandleTypeDef::hdmarx __IO HAL_LockTypeDef I2S_HandleTypeDef::Lock __IO HAL_I2S_StateTypeDef I2S_HandleTypeDef::State __IO uint32_t I2S_HandleTypeDef::ErrorCode 25.2 I2S Firmware driver API description...
  • Page 316 HAL I2S Generic Driver UM1940 Receive an amount of data in blocking mode using HAL_I2S_Receive() Interrupt mode IO operation Send an amount of data in non blocking mode using HAL_I2S_Transmit_IT() At transmission end of half transfer HAL_I2S_TxHalfCpltCallback is executed and user can add his own code by customization of function pointer HAL_I2S_TxHalfCpltCallback At transmission end of transfer HAL_I2S_TxCpltCallback is executed and user can...
  • Page 317 UM1940 HAL I2S Generic Driver 25.2.2 Initialization and de-initialization functions This subsection provides a set of functions allowing to initialize and de-initialize the I2Sx peripheral in simplex mode: User must Implement HAL_I2S_MspInit() function in which he configures all related peripherals resources (CLOCK, GPIO, DMA, IT and NVIC ). Call the function HAL_I2S_Init() to configure the selected device with the selected configuration: Mode...
  • Page 318 HAL I2S Generic Driver UM1940 HAL_I2S_Receive_DMA() HAL_I2S_DMAPause() HAL_I2S_DMAResume() HAL_I2S_DMAStop() HAL_I2S_IRQHandler() HAL_I2S_TxHalfCpltCallback() HAL_I2S_TxCpltCallback() HAL_I2S_RxHalfCpltCallback() HAL_I2S_RxCpltCallback() HAL_I2S_ErrorCallback() HAL_I2S_GetState() HAL_I2S_GetError() 25.2.4 Peripheral State and Errors functions This subsection permits to get in run-time the status of the peripheral and the data flow. This section contains the following APIs: HAL_I2S_GetState() HAL_I2S_GetError() 25.2.5...
  • Page 319 UM1940 HAL I2S Generic Driver HAL_I2S_MspDeInit Function name void HAL_I2S_MspDeInit (I2S_HandleTypeDef * hi2s) Function description I2S MSP DeInit. Parameters hi2s: pointer to a I2S_HandleTypeDef structure that contains the configuration information for I2S module Return values None: HAL_I2S_Transmit Function name HAL_StatusTypeDef HAL_I2S_Transmit (I2S_HandleTypeDef * hi2s, uint16_t * pData, uint16_t Size, uint32_t Timeout) Function description Transmit an amount of data in blocking mode.
  • Page 320 HAL I2S Generic Driver UM1940 In I2S Master Receiver mode, just after enabling the peripheral the clock will be generate in continuous way and as the I2S is not disabled at the end of the I2S transaction. HAL_I2S_Transmit_IT Function name HAL_StatusTypeDef HAL_I2S_Transmit_IT (I2S_HandleTypeDef * hi2s, uint16_t * pData, uint16_t Size) Function description...
  • Page 321 UM1940 HAL I2S Generic Driver HAL_I2S_IRQHandler Function name void HAL_I2S_IRQHandler (I2S_HandleTypeDef * hi2s) Function description This function handles I2S interrupt request. Parameters hi2s: pointer to a I2S_HandleTypeDef structure that contains the configuration information for I2S module Return values None: HAL_I2S_Transmit_DMA Function name HAL_StatusTypeDef HAL_I2S_Transmit_DMA (I2S_HandleTypeDef * hi2s, uint16_t * pData, uint16_t Size)
  • Page 322 HAL I2S Generic Driver UM1940 HAL_I2S_DMAPause Function name HAL_StatusTypeDef HAL_I2S_DMAPause (I2S_HandleTypeDef * hi2s) Function description Pauses the audio stream playing from the Media. Parameters hi2s: pointer to a I2S_HandleTypeDef structure that contains the configuration information for I2S module Return values HAL: status HAL_I2S_DMAResume Function name...
  • Page 323: I2S Firmware Driver Defines

    UM1940 HAL I2S Generic Driver HAL_I2S_TxHalfCpltCallback Function name void HAL_I2S_TxHalfCpltCallback (I2S_HandleTypeDef * hi2s) Function description Tx Transfer Half completed callbacks. Parameters hi2s: pointer to a I2S_HandleTypeDef structure that contains the configuration information for I2S module Return values None: HAL_I2S_TxCpltCallback Function name void HAL_I2S_TxCpltCallback (I2S_HandleTypeDef * hi2s) Function description Tx Transfer completed callbacks.
  • Page 324 HAL I2S Generic Driver UM1940 I2S_AUDIOFREQ_192K I2S_AUDIOFREQ_96K I2S_AUDIOFREQ_48K I2S_AUDIOFREQ_44K I2S_AUDIOFREQ_32K I2S_AUDIOFREQ_22K I2S_AUDIOFREQ_16K I2S_AUDIOFREQ_11K I2S_AUDIOFREQ_8K I2S_AUDIOFREQ_DEFAULT I2S Clock Polarity I2S_CPOL_LOW I2S_CPOL_HIGH I2S Clock Source I2S_CLOCK_PLL I2S_CLOCK_EXTERNAL I2S Data Format I2S_DATAFORMAT_16B I2S_DATAFORMAT_16B_EXTENDED I2S_DATAFORMAT_24B I2S_DATAFORMAT_32B I2S Error Code HAL_I2S_ERROR_NONE No error HAL_I2S_ERROR_UDR I2S Underrun error HAL_I2S_ERROR_OVR I2S Overrun error HAL_I2SEX_ERROR_UDR...
  • Page 325 UM1940 HAL I2S Generic Driver __HAL_I2S_ENABLE Description: Enable or disable the specified SPI peripheral (in I2S mode). Parameters: __HANDLE__: specifies the I2S Handle. Return value: None __HAL_I2S_DISABLE __HAL_I2S_ENABLE_IT Description: Enable or disable the specified I2S interrupts. Parameters: __HANDLE__: specifies the I2S Handle. __INTERRUPT__: specifies the interrupt source to enable or disable.
  • Page 326 HAL I2S Generic Driver UM1940 or not. Parameters: __HANDLE__: specifies the I2S Handle. __FLAG__: specifies the flag to check. This parameter can be one of the following values: I2S_FLAG_RXNE: Receive buffer not empty flag I2S_FLAG_TXE: Transmit buffer empty flag I2S_FLAG_UDR: Underrun flag I2S_FLAG_OVR: Overrun flag I2S_FLAG_FRE: Frame error flag I2S_FLAG_CHSIDE: Channel Side flag...
  • Page 327 UM1940 HAL I2S Generic Driver I2S_IT_RXNE I2S_IT_ERR I2S Mclk Output I2S_MCLKOUTPUT_ENABLE I2S_MCLKOUTPUT_DISABLE I2S Mode I2S_MODE_SLAVE_TX I2S_MODE_SLAVE_RX I2S_MODE_MASTER_TX I2S_MODE_MASTER_RX I2S Standard I2S_STANDARD_PHILIPS I2S_STANDARD_MSB I2S_STANDARD_LSB I2S_STANDARD_PCM_SHORT I2S_STANDARD_PCM_LONG DocID028236 Rev 2 327/1371...
  • Page 328: Hal Irda Generic Driver

    HAL IRDA Generic Driver UM1940 HAL IRDA Generic Driver 26.1 IRDA Firmware driver registers structures 26.1.1 IRDA_InitTypeDef Data Fields uint32_t BaudRate uint32_t WordLength uint32_t Parity uint32_t Mode uint8_t Prescaler uint32_t IrDAMode Field Documentation uint32_t IRDA_InitTypeDef::BaudRate This member configures the IRDA communication baud rate. The baud rate is computed using the following formula:IntegerDivider = ((PCLKx) / (8 * (hirda- >Init.BaudRate)))FractionalDivider = ((IntegerDivider - ((uint32_t) IntegerDivider)) * 8) + 0.5...
  • Page 329: Irda Firmware Driver Api Description

    UM1940 HAL IRDA Generic Driver __IO HAL_IRDA_StateTypeDef RxState __IO uint32_t ErrorCode Field Documentation USART_TypeDef* IRDA_HandleTypeDef::Instance IRDA_InitTypeDef IRDA_HandleTypeDef::Init uint8_t* IRDA_HandleTypeDef::pTxBuffPtr uint16_t IRDA_HandleTypeDef::TxXferSize __IO uint16_t IRDA_HandleTypeDef::TxXferCount uint8_t* IRDA_HandleTypeDef::pRxBuffPtr uint16_t IRDA_HandleTypeDef::RxXferSize __IO uint16_t IRDA_HandleTypeDef::RxXferCount DMA_HandleTypeDef* IRDA_HandleTypeDef::hdmatx DMA_HandleTypeDef* IRDA_HandleTypeDef::hdmarx HAL_LockTypeDef IRDA_HandleTypeDef::Lock __IO HAL_IRDA_StateTypeDef IRDA_HandleTypeDef::gState __IO HAL_IRDA_StateTypeDef IRDA_HandleTypeDef::RxState __IO uint32_t IRDA_HandleTypeDef::ErrorCode 26.2...
  • Page 330 HAL IRDA Generic Driver UM1940 Polling mode IO operation Send an amount of data in blocking mode using HAL_IRDA_Transmit() Receive an amount of data in blocking mode using HAL_IRDA_Receive() Interrupt mode IO operation Send an amount of data in non blocking mode using HAL_IRDA_Transmit_IT() At transmission end of transfer HAL_IRDA_TxCpltCallback is executed and user can add his own code by customization of function pointer HAL_IRDA_TxCpltCallback Receive an amount of data in non blocking mode using HAL_IRDA_Receive_IT()
  • Page 331 UM1940 HAL IRDA Generic Driver length defined by the M bit (8-bits or 9-bits), please refer to Reference manual for possible IRDA frame formats. Prescaler: A pulse of width less than two and greater than one PSC period(s) may or may not be rejected. The receiver set up time should be managed by software.
  • Page 332 HAL IRDA Generic Driver UM1940 HAL_IRDA_Receive_IT() HAL_IRDA_Transmit_DMA() HAL_IRDA_Receive_DMA() HAL_IRDA_DMAPause() HAL_IRDA_DMAResume() HAL_IRDA_DMAStop() HAL_IRDA_Abort() HAL_IRDA_AbortTransmit() HAL_IRDA_AbortReceive() HAL_IRDA_Abort_IT() HAL_IRDA_AbortTransmit_IT() HAL_IRDA_AbortReceive_IT() HAL_IRDA_IRQHandler() HAL_IRDA_TxCpltCallback() HAL_IRDA_TxHalfCpltCallback() HAL_IRDA_RxCpltCallback() HAL_IRDA_RxHalfCpltCallback() HAL_IRDA_ErrorCallback() HAL_IRDA_AbortCpltCallback() HAL_IRDA_AbortTransmitCpltCallback() HAL_IRDA_AbortReceiveCpltCallback() 26.2.4 Peripheral State and Errors functions This subsection provides a set of functions allowing to return the State of IrDA communication process and also return Peripheral Errors occurred during communication process HAL_IRDA_GetState() API can be helpful to check in run-time the state of the IrDA...
  • Page 333 UM1940 HAL IRDA Generic Driver * hirda) Function description DeInitializes the IRDA peripheral. Parameters hirda: pointer to a IRDA_HandleTypeDef structure that contains the configuration information for the specified IRDA module. Return values HAL: status HAL_IRDA_MspInit Function name void HAL_IRDA_MspInit (IRDA_HandleTypeDef * hirda) Function description IRDA MSP Init.
  • Page 334 HAL IRDA Generic Driver UM1940 module. pData: Pointer to data buffer Size: Amount of data to be received Timeout: Specify timeout value Return values HAL: status HAL_IRDA_Transmit_IT Function name HAL_StatusTypeDef HAL_IRDA_Transmit_IT (IRDA_HandleTypeDef * hirda, uint8_t * pData, uint16_t Size) Function description Send an amount of data in non blocking mode.
  • Page 335 UM1940 HAL IRDA Generic Driver Parameters hirda: pointer to a IRDA_HandleTypeDef structure that contains the configuration information for the specified IRDA module. pData: Pointer to data buffer Size: Amount of data to be received Return values HAL: status Notes When the IRDA parity is enabled (PCE = 1) the data received contain the parity bit.
  • Page 336 HAL IRDA Generic Driver UM1940 Notes This procedure could be used for aborting any ongoing transfer started in Interrupt or DMA mode. This procedure performs following operations : Disable PPP InterruptsDisable the DMA transfer in the peripheral register (if enabled)Abort DMA transfer by calling HAL_DMA_Abort (in case of transfer in DMA mode)Set handle State to READY This procedure is executed in blocking mode : when exiting...
  • Page 337 UM1940 HAL IRDA Generic Driver Notes This procedure could be used for aborting any ongoing transfer started in Interrupt or DMA mode. This procedure performs following operations : Disable PPP InterruptsDisable the DMA transfer in the peripheral register (if enabled)Abort DMA transfer by calling HAL_DMA_Abort_IT (in case of transfer in DMA mode)Set handle State to READYAt abort completion, call user abort complete callback...
  • Page 338 HAL IRDA Generic Driver UM1940 HAL_IRDA_IRQHandler Function name void HAL_IRDA_IRQHandler (IRDA_HandleTypeDef * hirda) Function description This function handles IRDA interrupt request. Parameters hirda: pointer to a IRDA_HandleTypeDef structure that contains the configuration information for the specified IRDA module. Return values None: HAL_IRDA_TxCpltCallback Function name...
  • Page 339 UM1940 HAL IRDA Generic Driver Return values None: HAL_IRDA_ErrorCallback void HAL_IRDA_ErrorCallback (IRDA_HandleTypeDef * hirda) Function name Function description IRDA error callbacks. Parameters hirda: pointer to a IRDA_HandleTypeDef structure that contains the configuration information for the specified IRDA module. Return values None: HAL_IRDA_AbortCpltCallback Function name...
  • Page 340: Irda Firmware Driver Defines

    HAL IRDA Generic Driver UM1940 HAL_IRDA_GetError Function name uint32_t HAL_IRDA_GetError (IRDA_HandleTypeDef * hirda) Function description Return the IARDA error code. Parameters hirda: : pointer to a IRDA_HandleTypeDef structure that contains the configuration information for the specified IRDA. Return values IRDA: Error Code 26.3 IRDA Firmware driver defines 26.3.1...
  • Page 341 UM1940 HAL IRDA Generic Driver __HANDLE__: specifies the USART Handle. This parameter can be USARTx where x: 1, 2, 3, 4, 5, 6, 7 or 8 to select the USART or UART peripheral. __FLAG__: specifies the flag to check. This parameter can be one of the following values: IRDA_FLAG_TXE: Transmit data register empty flag...
  • Page 342 HAL IRDA Generic Driver UM1940 flags are cleared by software sequence: a read operation to USART_SR register followed by a read operation to USART_DR register. RXNE flag can be also cleared by a read to the USART_DR register. TC flag can be also cleared by software sequence: a read operation to USART_SR register followed by a write operation to...
  • Page 343 UM1940 HAL IRDA Generic Driver Clear the IRDA ORE pending flag. Parameters: __HANDLE__: specifies the USART Handle. This parameter can be USARTx where x: 1, 2, 3, 4, 5, 6, 7 or 8 to select the USART or UART peripheral. Return value: None __HAL_IRDA_CLEAR_IDLEFLAG...
  • Page 344 HAL IRDA Generic Driver UM1940 None __HAL_IRDA_DISABLE_IT __HAL_IRDA_GET_IT_SOURCE Description: Checks whether the specified IRDA interrupt has occurred or not. Parameters: __HANDLE__: specifies the USART Handle. This parameter can be USARTx where x: 1, 2, 3, 4, 5, 6, 7 or 8 to select the USART or UART peripheral.
  • Page 345 UM1940 HAL IRDA Generic Driver __HAL_IRDA_ENABLE Description: Enable UART/USART associated to IRDA Handle. Parameters: __HANDLE__: specifies the IRDA Handle. IRDA Handle selects the USARTx or UARTy peripheral (USART,UART availability and x,y values depending on device). Return value: None Description: __HAL_IRDA_DISABLE Disable UART/USART associated to IRDA Handle.
  • Page 346 HAL IRDA Generic Driver UM1940 IRDA Low Power IRDA_POWERMODE_LOWPOWER IRDA_POWERMODE_NORMAL IRDA Transfer Mode IRDA_MODE_RX IRDA_MODE_TX IRDA_MODE_TX_RX IRDA Parity IRDA_PARITY_NONE IRDA_PARITY_EVEN IRDA_PARITY_ODD IRDA Word Length IRDA_WORDLENGTH_8B IRDA_WORDLENGTH_9B 346/1371 DocID028236 Rev 2...
  • Page 347: Hal Iwdg Generic Driver

    UM1940 HAL IWDG Generic Driver HAL IWDG Generic Driver 27.1 IWDG Firmware driver registers structures 27.1.1 IWDG_InitTypeDef Data Fields uint32_t Prescaler uint32_t Reload Field Documentation uint32_t IWDG_InitTypeDef::Prescaler Select the prescaler of the IWDG. This parameter can be a value of IWDG_Prescaler uint32_t IWDG_InitTypeDef::Reload Specifies the IWDG down-counter reload value.
  • Page 348 HAL IWDG Generic Driver UM1940 Min-max timeout value @32KHz (LSI): ~125us / ~32.7s The IWDG timeout may vary due to LSI frequency dispersion. STM32F2xx devices provide the capability to measure the LSI frequency (LSI clock connected internally to TIM5 CH4 input capture). The measured value can be used to have an IWDG timeout with an acceptable accuracy.
  • Page 349 UM1940 HAL IWDG Generic Driver 27.2.5 Detailed description of functions HAL_IWDG_Init Function name HAL_StatusTypeDef HAL_IWDG_Init (IWDG_HandleTypeDef * hiwdg) Function description Initialize the IWDG according to the specified parameters in the IWDG_InitTypeDef and start watchdog. Parameters hiwdg: pointer to a IWDG_HandleTypeDef structure that contains the configuration information for the specified IWDG module.
  • Page 350 HAL IWDG Generic Driver UM1940 IWDG_PRESCALER_4 IWDG prescaler set to 4 IWDG_PRESCALER_8 IWDG prescaler set to 8 IWDG_PRESCALER_16 IWDG prescaler set to 16 IWDG_PRESCALER_32 IWDG prescaler set to 32 IWDG_PRESCALER_64 IWDG prescaler set to 64 IWDG_PRESCALER_128 IWDG prescaler set to 128 IWDG_PRESCALER_256 IWDG prescaler set to 256 350/1371...
  • Page 351: Hal Mmc Generic Driver

    UM1940 HAL MMC Generic Driver HAL MMC Generic Driver 28.1 MMC Firmware driver registers structures 28.1.1 HAL_MMC_CardInfoTypeDef Data Fields uint32_t CardType uint32_t Class uint32_t RelCardAdd uint32_t BlockNbr uint32_t BlockSize uint32_t LogBlockNbr uint32_t LogBlockSize Field Documentation uint32_t HAL_MMC_CardInfoTypeDef::CardType Specifies the card Type uint32_t HAL_MMC_CardInfoTypeDef::Class Specifies the class of the card class uint32_t HAL_MMC_CardInfoTypeDef::RelCardAdd...
  • Page 352: Hal_Mmc_Cardcsdtypedef

    HAL MMC Generic Driver UM1940 MMC_TypeDef* MMC_HandleTypeDef::Instance MMC registers base address MMC_InitTypeDef MMC_HandleTypeDef::Init MMC required parameters HAL_LockTypeDef MMC_HandleTypeDef::Lock MMC locking object uint32_t* MMC_HandleTypeDef::pTxBuffPtr Pointer to MMC Tx transfer Buffer uint32_t MMC_HandleTypeDef::TxXferSize MMC Tx Transfer size uint32_t* MMC_HandleTypeDef::pRxBuffPtr Pointer to MMC Rx transfer Buffer uint32_t MMC_HandleTypeDef::RxXferSize MMC Rx Transfer size __IO uint32_t MMC_HandleTypeDef::Context...
  • Page 353 UM1940 HAL MMC Generic Driver __IO uint8_t EraseGrSize __IO uint8_t EraseGrMul __IO uint8_t WrProtectGrSize __IO uint8_t WrProtectGrEnable __IO uint8_t ManDeflECC __IO uint8_t WrSpeedFact __IO uint8_t MaxWrBlockLen __IO uint8_t WriteBlockPaPartial __IO uint8_t Reserved3 __IO uint8_t ContentProtectAppli __IO uint8_t FileFormatGrouop __IO uint8_t CopyFlag __IO uint8_t PermWrProtect __IO uint8_t TempWrProtect __IO uint8_t FileFormat...
  • Page 354: Hal_Mmc_Cardcidtypedef

    HAL MMC Generic Driver UM1940 __IO uint8_t HAL_MMC_CardCSDTypeDef::MaxWrCurrentVDDMin Max. write current @ VDD min __IO uint8_t HAL_MMC_CardCSDTypeDef::MaxWrCurrentVDDMax Max. write current @ VDD max __IO uint8_t HAL_MMC_CardCSDTypeDef::DeviceSizeMul Device size multiplier __IO uint8_t HAL_MMC_CardCSDTypeDef::EraseGrSize Erase group size __IO uint8_t HAL_MMC_CardCSDTypeDef::EraseGrMul Erase group size multiplier __IO uint8_t HAL_MMC_CardCSDTypeDef::WrProtectGrSize Write protect group size __IO uint8_t HAL_MMC_CardCSDTypeDef::WrProtectGrEnable...
  • Page 355: Hal_Mmc_Cardstatustypedef

    UM1940 HAL MMC Generic Driver __IO uint8_t CID_CRC __IO uint8_t Reserved2 Field Documentation __IO uint8_t HAL_MMC_CardCIDTypeDef::ManufacturerID Manufacturer ID __IO uint16_t HAL_MMC_CardCIDTypeDef::OEM_AppliID OEM/Application ID __IO uint32_t HAL_MMC_CardCIDTypeDef::ProdName1 Product Name part1 __IO uint8_t HAL_MMC_CardCIDTypeDef::ProdName2 Product Name part2 __IO uint8_t HAL_MMC_CardCIDTypeDef::ProdRev Product Revision __IO uint32_t HAL_MMC_CardCIDTypeDef::ProdSN Product Serial Number __IO uint8_t HAL_MMC_CardCIDTypeDef::Reserved1...
  • Page 356: Mmc Firmware Driver Api Description

    HAL MMC Generic Driver UM1940 __IO uint16_t HAL_MMC_CardStatusTypeDef::EraseSize Determines the number of AUs to be erased in one operation __IO uint8_t HAL_MMC_CardStatusTypeDef::EraseTimeout Determines the timeout for any number of AU erase __IO uint8_t HAL_MMC_CardStatusTypeDef::EraseOffset Carries information about the erase offset 28.2 MMC Firmware driver API description 28.2.1...
  • Page 357 UM1940 HAL MMC Generic Driver MMC Card Initialization and configuration To initialize the MMC Card, use the HAL_MMC_Init() function. It Initializes SDMMC IP (STM32 side) and the MMC Card, and put it into StandBy State (Ready for data transfer). This function provide the following operations: Initialize the SDMMC peripheral interface with defaullt configuration.
  • Page 358 HAL MMC Generic Driver UM1940 done correctly. The check is done through HAL_MMC_GetCardState() function for MMC card state. You can write to MMC card in DMA mode by using function HAL_MMC_WriteBlocks_DMA(). This function allows the read of 512 bytes blocks. You can choose either one block read operation or multiple block read operation by adjusting the "NumberOfBlocks"...
  • Page 359 UM1940 HAL MMC Generic Driver 28.2.2 Detailed description of functions HAL_MMC_Init Function name HAL_StatusTypeDef HAL_MMC_Init (MMC_HandleTypeDef * hmmc) Function description HAL_MMC_InitCard HAL_StatusTypeDef HAL_MMC_InitCard Function name (MMC_HandleTypeDef * hmmc) Function description HAL_MMC_DeInit Function name HAL_StatusTypeDef HAL_MMC_DeInit (MMC_HandleTypeDef * hmmc) Function description HAL_MMC_MspInit Function name void HAL_MMC_MspInit (MMC_HandleTypeDef * hmmc)
  • Page 360 HAL MMC Generic Driver UM1940 HAL_MMC_ReadBlocks_IT Function name HAL_StatusTypeDef HAL_MMC_ReadBlocks_IT (MMC_HandleTypeDef * hmmc, uint8_t * pData, uint32_t BlockAdd, uint32_t NumberOfBlocks) Function description HAL_MMC_WriteBlocks_IT HAL_StatusTypeDef HAL_MMC_WriteBlocks_IT Function name (MMC_HandleTypeDef * hmmc, uint8_t * pData, uint32_t BlockAdd, uint32_t NumberOfBlocks) Function description HAL_MMC_ReadBlocks_DMA Function name HAL_StatusTypeDef HAL_MMC_ReadBlocks_DMA (MMC_HandleTypeDef * hmmc, uint8_t * pData, uint32_t...
  • Page 361 UM1940 HAL MMC Generic Driver HAL_MMC_AbortCallback Function name void HAL_MMC_AbortCallback (MMC_HandleTypeDef * hmmc) Function description HAL_MMC_ConfigWideBusOperation HAL_StatusTypeDef HAL_MMC_ConfigWideBusOperation Function name (MMC_HandleTypeDef * hmmc, uint32_t WideMode) Function description HAL_MMC_GetCardState Function name HAL_MMC_CardStateTypeDef HAL_MMC_GetCardState (MMC_HandleTypeDef * hmmc) Function description HAL_MMC_GetCardCID Function name HAL_StatusTypeDef HAL_MMC_GetCardCID (MMC_HandleTypeDef * hmmc, HAL_MMC_CardCIDTypeDef * pCID)
  • Page 362: Mmc Firmware Driver Defines

    HAL MMC Generic Driver UM1940 HAL_MMC_Abort Function name HAL_StatusTypeDef HAL_MMC_Abort (MMC_HandleTypeDef * hmmc) Function description HAL_MMC_Abort_IT HAL_StatusTypeDef HAL_MMC_Abort_IT Function name (MMC_HandleTypeDef * hmmc) Function description 28.3 MMC Firmware driver defines 28.3.1 MMC Error status enumeration Structure definition HAL_MMC_ERROR_NONE No error HAL_MMC_ERROR_CMD_CRC_FAIL Command response received (but CRC check failed)
  • Page 363 UM1940 HAL MMC Generic Driver HAL_MMC_ERROR_CARD_ECC_FAILED Card internal ECC was applied but failed to correct the data HAL_MMC_ERROR_CC_ERR Internal card controller error HAL_MMC_ERROR_GENERAL_UNKNOWN_ERR General or unknown error HAL_MMC_ERROR_STREAM_READ_UNDERRUN The card could not sustain data reading in stream rmode HAL_MMC_ERROR_STREAM_WRITE_OVERRUN The card could not sustain data programming in stream mode HAL_MMC_ERROR_CID_CSD_OVERWRITE CID/CSD overwrite error...
  • Page 364 HAL MMC Generic Driver UM1940 MMC_DUAL_VOLTAGE_RANGE VALUE OF ARGUMENT eMMC_HIGH_VOLTAGE_RANGE for eMMC> 2Gb sector mode eMMC_DUAL_VOLTAGE_RANGE for eMMC> 2Gb sector mode MMC_INVALID_VOLTAGE_RANGE MMC Memory Cards MMC_HIGH_VOLTAGE_CARD MMC_DUAL_VOLTAGE_CARD Exported Constants BLOCKSIZE Block size is 512 bytes CAPACITY Log Block Nuumber for 2 G bytes Cards MMC Exported Macros __HAL_MMC_ENABLE Description:...
  • Page 365 UM1940 HAL MMC Generic Driver timeout interrupt SDIO_IT_DTIMEOUT: Data timeout interrupt SDIO_IT_TXUNDERR: Transmit FIFO underrun error interrupt SDIO_IT_RXOVERR: Received FIFO overrun error interrupt SDIO_IT_CMDREND: Command response received (CRC check passed) interrupt SDIO_IT_CMDSENT: Command sent (no response required) interrupt SDIO_IT_DATAEND: Data end (data counter, SDIDCOUNT, is zero) interrupt SDIO_IT_DBCKEND: Data block sent/received (CRC check passed) interrupt...
  • Page 366 HAL MMC Generic Driver UM1940 SDIO_IT_DTIMEOUT: Data timeout interrupt SDIO_IT_TXUNDERR: Transmit FIFO underrun error interrupt SDIO_IT_RXOVERR: Received FIFO overrun error interrupt SDIO_IT_CMDREND: Command response received (CRC check passed) interrupt SDIO_IT_CMDSENT: Command sent (no response required) interrupt SDIO_IT_DATAEND: Data end (data counter, SDIDCOUNT, is zero) interrupt SDIO_IT_DBCKEND: Data block sent/received (CRC check passed) interrupt...
  • Page 367 UM1940 HAL MMC Generic Driver underrun error SDIO_FLAG_RXOVERR: Received FIFO overrun error SDIO_FLAG_CMDREND: Command response received (CRC check passed) SDIO_FLAG_CMDSENT: Command sent (no response required) SDIO_FLAG_DATAEND: Data end (data counter, SDIDCOUNT, is zero) SDIO_FLAG_DBCKEND: Data block sent/received (CRC check passed) SDIO_FLAG_CMDACT: Command transfer in progress SDIO_FLAG_TXACT: Data transmit in progress...
  • Page 368 HAL MMC Generic Driver UM1940 response required) SDIO_FLAG_DATAEND: Data end (data counter, SDIDCOUNT, is zero) SDIO_FLAG_DBCKEND: Data block sent/received (CRC check passed) SDIO_FLAG_SDIOIT: SD I/O interrupt received Return value: None __HAL_MMC_GET_IT Description: Check whether the specified MMC interrupt has occurred or not. Parameters: __HANDLE__: MMC Handle __INTERRUPT__: specifies the SDMMC interrupt...
  • Page 369 UM1940 HAL MMC Generic Driver SDIO_IT_TXDAVL: Data available in transmit FIFO interrupt SDIO_IT_RXDAVL: Data available in receive FIFO interrupt SDIO_IT_SDIOIT: SD I/O interrupt received interrupt Return value: The: new state of MMC IT (SET or RESET). __HAL_MMC_CLEAR_IT Description: Clear the MMC's interrupt pending bits. Parameters: __HANDLE__: MMC Handle __INTERRUPT__: specifies the interrupt pending bit...
  • Page 370: Hal Nand Generic Driver

    HAL NAND Generic Driver UM1940 HAL NAND Generic Driver 29.1 NAND Firmware driver registers structures 29.1.1 NAND_IDTypeDef Data Fields uint8_t Maker_Id uint8_t Device_Id uint8_t Third_Id uint8_t Fourth_Id Field Documentation uint8_t NAND_IDTypeDef::Maker_Id uint8_t NAND_IDTypeDef::Device_Id uint8_t NAND_IDTypeDef::Third_Id uint8_t NAND_IDTypeDef::Fourth_Id 29.1.2 NAND_AddressTypeDef Data Fields uint16_t Page uint16_t Plane uint16_t Block...
  • Page 371: Nand_Handletypedef

    UM1940 HAL NAND Generic Driver uint32_t NAND_DeviceConfigTypeDef::BlockSize NAND memory block size measured in number of pages uint32_t NAND_DeviceConfigTypeDef::BlockNbr NAND memory number of total blocks uint32_t NAND_DeviceConfigTypeDef::PlaneNbr NAND memory number of planes uint32_t NAND_DeviceConfigTypeDef::PlaneSize NAND memory zone size measured in number of blocks FunctionalState NAND_DeviceConfigTypeDef::ExtraCommandEnable NAND extra command needed for Page reading mode.
  • Page 372: Nand Initialization And De-Initialization Functions

    HAL NAND Generic Driver UM1940 size..) predefined by the user in the HAL_NAND_Info_TypeDef structure. The read/write address information is contained by the Nand_Address_Typedef structure passed as parameter. Perform NAND flash Reset chip operation using the function HAL_NAND_Reset(). Perform NAND flash erase block operation using the function HAL_NAND_Erase_Block().
  • Page 373: Nand Control Functions

    UM1940 HAL NAND Generic Driver 29.2.4 NAND Control functions This subsection provides a set of functions allowing to control dynamically the NAND interface. This section contains the following APIs: HAL_NAND_ECC_Enable() HAL_NAND_ECC_Disable() HAL_NAND_GetECC() 29.2.5 NAND State functions This subsection permits to get in run-time the status of the NAND controller and the data flow.
  • Page 374 HAL NAND Generic Driver UM1940 contains the configuration information for NAND module. pDeviceConfig: : pointer to NAND_DeviceConfigTypeDef structure Return values HAL: status HAL_NAND_Read_ID Function name HAL_StatusTypeDef HAL_NAND_Read_ID (NAND_HandleTypeDef * hnand, NAND_IDTypeDef * pNAND_ID) Function description Read the NAND memory electronic signature. Parameters hnand: pointer to a NAND_HandleTypeDef structure that contains the configuration information for NAND module.
  • Page 375 UM1940 HAL NAND Generic Driver Return values None: HAL_NAND_Reset HAL_StatusTypeDef HAL_NAND_Reset Function name (NAND_HandleTypeDef * hnand) Function description NAND memory reset. Parameters hnand: pointer to a NAND_HandleTypeDef structure that contains the configuration information for NAND module. Return values HAL: status HAL_NAND_Read_Page_8b Function name HAL_StatusTypeDef HAL_NAND_Read_Page_8b...
  • Page 376 HAL NAND Generic Driver UM1940 NumSpareAreaToRead: Number of spare area to read Return values HAL: status HAL_NAND_Write_SpareArea_8b Function name HAL_StatusTypeDef HAL_NAND_Write_SpareArea_8b (NAND_HandleTypeDef * hnand, NAND_AddressTypeDef * pAddress, uint8_t * pBuffer, uint32_t NumSpareAreaTowrite) Function description Write Spare area(s) to NAND memory. Parameters hnand: pointer to a NAND_HandleTypeDef structure that contains the configuration information for NAND module.
  • Page 377 UM1940 HAL NAND Generic Driver pAddress, uint16_t * pBuffer, uint32_t NumSpareAreaToRead) Function description Read Spare area(s) from NAND memory (16-bits addressing) Parameters hnand: pointer to a NAND_HandleTypeDef structure that contains the configuration information for NAND module. pAddress: : pointer to NAND address structure pBuffer: pointer to source buffer to write.
  • Page 378 HAL NAND Generic Driver UM1940 HAL_NAND_Address_Inc Function name uint32_t HAL_NAND_Address_Inc (NAND_HandleTypeDef * hnand, NAND_AddressTypeDef * pAddress) Function description Increment the NAND memory address. Parameters hnand: pointer to a NAND_HandleTypeDef structure that contains the configuration information for NAND module. pAddress: pointer to NAND address structure Return values The: new status of the increment address operation.
  • Page 379: Nand Firmware Driver Defines

    UM1940 HAL NAND Generic Driver (NAND_HandleTypeDef * hnand) Function description return the NAND state Parameters hnand: pointer to a NAND_HandleTypeDef structure that contains the configuration information for NAND module. Return values HAL: state HAL_NAND_Read_Status Function name uint32_t HAL_NAND_Read_Status (NAND_HandleTypeDef * hnand) Function description NAND memory read status.
  • Page 380: Hal Nor Generic Driver

    HAL NOR Generic Driver UM1940 HAL NOR Generic Driver 30.1 NOR Firmware driver registers structures 30.1.1 NOR_IDTypeDef Data Fields uint16_t Manufacturer_Code uint16_t Device_Code1 uint16_t Device_Code2 uint16_t Device_Code3 Field Documentation uint16_t NOR_IDTypeDef::Manufacturer_Code Defines the device's manufacturer code used to identify the memory uint16_t NOR_IDTypeDef::Device_Code1 uint16_t NOR_IDTypeDef::Device_Code2 uint16_t NOR_IDTypeDef::Device_Code3...
  • Page 381: Nor Firmware Driver Api Description

    UM1940 HAL NOR Generic Driver FSMC_NORSRAM_EXTENDED_TypeDef* NOR_HandleTypeDef::Extended Extended mode register base address FSMC_NORSRAM_InitTypeDef NOR_HandleTypeDef::Init NOR device control configuration parameters HAL_LockTypeDef NOR_HandleTypeDef::Lock NOR locking object __IO HAL_NOR_StateTypeDef NOR_HandleTypeDef::State NOR device access state 30.2 NOR Firmware driver API description 30.2.1 How to use this driver This driver is a generic layered driver which contains a set of APIs used to control NOR flash memories.
  • Page 382: Nor Input And Output Functions

    HAL NOR Generic Driver UM1940 30.2.3 NOR Input and Output functions This section provides functions allowing to use and control the NOR memory This section contains the following APIs: HAL_NOR_Read_ID() HAL_NOR_ReturnToReadMode() HAL_NOR_Read() HAL_NOR_Program() HAL_NOR_ReadBuffer() HAL_NOR_ProgramBuffer() HAL_NOR_Erase_Block() HAL_NOR_Erase_Chip() HAL_NOR_Read_CFI() 30.2.4 NOR Control functions This subsection provides a set of functions allowing to control dynamically the NOR interface.
  • Page 383 UM1940 HAL NOR Generic Driver Parameters hnor: pointer to a NOR_HandleTypeDef structure that contains the configuration information for NOR module. Return values HAL: status HAL_NOR_MspInit Function name void HAL_NOR_MspInit (NOR_HandleTypeDef * hnor) Function description NOR MSP Init. Parameters hnor: pointer to a NOR_HandleTypeDef structure that contains the configuration information for NOR module.
  • Page 384 HAL NOR Generic Driver UM1940 contains the configuration information for NOR module. Return values HAL: status HAL_NOR_Read Function name HAL_StatusTypeDef HAL_NOR_Read (NOR_HandleTypeDef * hnor, uint32_t * pAddress, uint16_t * pData) Function description Read data from NOR memory. Parameters hnor: pointer to a NOR_HandleTypeDef structure that contains the configuration information for NOR module.
  • Page 385 UM1940 HAL NOR Generic Driver pData: pointer to source data buffer. uwBufferSize: Size of the buffer to write Return values HAL: status HAL_NOR_Erase_Block Function name HAL_StatusTypeDef HAL_NOR_Erase_Block (NOR_HandleTypeDef * hnor, uint32_t BlockAddress, uint32_t Address) Function description Erase the specified block of the NOR memory. Parameters hnor: pointer to a NOR_HandleTypeDef structure that contains the configuration information for NOR module.
  • Page 386: Nor Firmware Driver Defines

    HAL NOR Generic Driver UM1940 HAL_NOR_WriteOperation_Disable Function name HAL_StatusTypeDef HAL_NOR_WriteOperation_Disable (NOR_HandleTypeDef * hnor) Function description Disables dynamically NOR write operation. Parameters hnor: pointer to a NOR_HandleTypeDef structure that contains the configuration information for NOR module. Return values HAL: status HAL_NOR_GetState Function name HAL_NOR_StateTypeDef HAL_NOR_GetState (NOR_HandleTypeDef * hnor)
  • Page 387: Hal Pccard Generic Driver

    UM1940 HAL PCCARD Generic Driver HAL PCCARD Generic Driver 31.1 PCCARD Firmware driver registers structures 31.1.1 PCCARD_HandleTypeDef Data Fields FSMC_PCCARD_TypeDef * Instance FSMC_PCCARD_InitTypeDef Init __IO HAL_PCCARD_StateTypeDef State HAL_LockTypeDef Lock Field Documentation FSMC_PCCARD_TypeDef* PCCARD_HandleTypeDef::Instance Register base address for PCCARD device FSMC_PCCARD_InitTypeDef PCCARD_HandleTypeDef::Init PCCARD device control configuration parameters __IO HAL_PCCARD_StateTypeDef PCCARD_HandleTypeDef::State PCCARD device access state...
  • Page 388: Pccard Initialization And De-Initialization Functions

    HAL PCCARD Generic Driver UM1940 This driver is a set of generic APIs which handle standard PCCARD/compact flash operations. If a PCCARD/Compact Flash device contains different operations and/or implementations, it should be implemented separately. 31.2.2 PCCARD Initialization and de-initialization functions This section provides functions allowing to initialize/de-initialize the PCCARD memory This section contains the following APIs: HAL_PCCARD_Init()
  • Page 389 UM1940 HAL PCCARD Generic Driver Return values HAL: status HAL_PCCARD_DeInit HAL_StatusTypeDef HAL_PCCARD_DeInit Function name (PCCARD_HandleTypeDef * hpccard) Function description Perform the PCCARD memory De-initialization sequence. Parameters hpccard: pointer to a PCCARD_HandleTypeDef structure that contains the configuration information for PCCARD module. Return values HAL: status HAL_PCCARD_MspInit...
  • Page 390 HAL PCCARD Generic Driver UM1940 HAL_PCCARD_Write_Sector Function name HAL_StatusTypeDef HAL_PCCARD_Write_Sector (PCCARD_HandleTypeDef * hpccard, uint16_t * pBuffer, uint16_t SectorAddress, uint8_t * pStatus) Function description Write sector to PCCARD memory. Parameters hpccard: pointer to a PCCARD_HandleTypeDef structure that contains the configuration information for PCCARD module.
  • Page 391 UM1940 HAL PCCARD Generic Driver module. Return values HAL: status HAL_PCCARD_IRQHandler Function name void HAL_PCCARD_IRQHandler (PCCARD_HandleTypeDef * hpccard) Function description This function handles PCCARD device interrupt request. Parameters hpccard: pointer to a PCCARD_HandleTypeDef structure that contains the configuration information for PCCARD module.
  • Page 392: Pccard Firmware Driver Defines

    HAL PCCARD Generic Driver UM1940 HAL_PCCARD_ReadStatus Function name HAL_PCCARD_StatusTypeDef HAL_PCCARD_ReadStatus (PCCARD_HandleTypeDef * hpccard) Function description Reads the Compact Flash memory status using the Read status command. Parameters hpccard: pointer to a PCCARD_HandleTypeDef structure that contains the configuration information for PCCARD module.
  • Page 393: Hal Pcd Generic Driver

    UM1940 HAL PCD Generic Driver HAL PCD Generic Driver 32.1 PCD Firmware driver registers structures 32.1.1 PCD_HandleTypeDef Data Fields PCD_TypeDef * Instance PCD_InitTypeDef Init PCD_EPTypeDef IN_ep PCD_EPTypeDef OUT_ep HAL_LockTypeDef Lock __IO PCD_StateTypeDef State uint32_t Setup void * pData Field Documentation PCD_TypeDef* PCD_HandleTypeDef::Instance Register base address PCD_InitTypeDef PCD_HandleTypeDef::Init...
  • Page 394 HAL PCD Generic Driver UM1940 hpcd.pData = pdev; Enable PCD transmission and reception: HAL_PCD_Start(); 32.2.2 Initialization and de-initialization functions This section provides functions allowing to: This section contains the following APIs: HAL_PCD_Init() HAL_PCD_DeInit() HAL_PCD_MspInit() HAL_PCD_MspDeInit() 32.2.3 IO operation functions This subsection provides a set of functions allowing to manage the PCD data transfers. This section contains the following APIs: HAL_PCD_Start() HAL_PCD_Stop()
  • Page 395: Peripheral State Functions

    UM1940 HAL PCD Generic Driver 32.2.5 Peripheral State functions This subsection permits to get in run-time the status of the peripheral and the data flow. This section contains the following APIs: HAL_PCD_GetState() 32.2.6 Detailed description of functions HAL_PCD_Init Function name HAL_StatusTypeDef HAL_PCD_Init (PCD_HandleTypeDef * hpcd) Function description...
  • Page 396 HAL PCD Generic Driver UM1940 Return values HAL: status HAL_PCD_Stop HAL_StatusTypeDef HAL_PCD_Stop (PCD_HandleTypeDef * Function name hpcd) Function description Stop The USB OTG Device. Parameters hpcd: PCD handle Return values HAL: status HAL_PCD_IRQHandler void HAL_PCD_IRQHandler (PCD_HandleTypeDef * hpcd) Function name Function description Handles PCD interrupt request.
  • Page 397 UM1940 HAL PCD Generic Driver HAL_PCD_SOFCallback Function name void HAL_PCD_SOFCallback (PCD_HandleTypeDef * hpcd) Function description USB Start Of Frame callback. Parameters hpcd: PCD handle Return values None: HAL_PCD_ResetCallback Function name void HAL_PCD_ResetCallback (PCD_HandleTypeDef * hpcd) Function description USB Reset callback. Parameters hpcd: PCD handle Return values...
  • Page 398 HAL PCD Generic Driver UM1940 epnum: endpoint number Return values None: HAL_PCD_ConnectCallback Function name void HAL_PCD_ConnectCallback (PCD_HandleTypeDef * hpcd) Function description Connection event callback. Parameters hpcd: PCD handle Return values None: HAL_PCD_DisconnectCallback Function name void HAL_PCD_DisconnectCallback (PCD_HandleTypeDef * hpcd) Function description Disconnection event callback.
  • Page 399 UM1940 HAL PCD Generic Driver HAL_PCD_EP_Open Function name HAL_StatusTypeDef HAL_PCD_EP_Open (PCD_HandleTypeDef * hpcd, uint8_t ep_addr, uint16_t ep_mps, uint8_t ep_type) Function description Open and configure an endpoint. Parameters hpcd: PCD handle ep_addr: endpoint address ep_mps: endpoint max packet size ep_type: endpoint type Return values HAL: status HAL_PCD_EP_Close...
  • Page 400 HAL PCD Generic Driver UM1940 HAL_PCD_EP_GetRxCount Function name uint16_t HAL_PCD_EP_GetRxCount (PCD_HandleTypeDef * hpcd, uint8_t ep_addr) Function description Get Received Data Size. Parameters hpcd: PCD handle ep_addr: endpoint address Return values Data: Size HAL_PCD_EP_SetStall Function name HAL_StatusTypeDef HAL_PCD_EP_SetStall (PCD_HandleTypeDef * hpcd, uint8_t ep_addr) Function description Set a STALL condition over an endpoint.
  • Page 401: Pcd Firmware Driver Defines

    UM1940 HAL PCD Generic Driver HAL_PCD_DeActivateRemoteWakeup Function name HAL_StatusTypeDef HAL_PCD_DeActivateRemoteWakeup (PCD_HandleTypeDef * hpcd) Function description De-activate remote wakeup signalling. Parameters hpcd: PCD handle Return values HAL: status HAL_PCD_GetState Function name PCD_StateTypeDef HAL_PCD_GetState (PCD_HandleTypeDef * hpcd) Function description Return the PCD handle state. Parameters hpcd: PCD handle Return values...
  • Page 402 HAL PCD Generic Driver UM1940 __HAL_USB_OTG_HS_WAKEUP_EXTI_DISABLE_IT __HAL_USB_OTG_HS_WAKEUP_EXTI_GET_FLAG __HAL_USB_OTG_HS_WAKEUP_EXTI_CLEAR_FLAG __HAL_USB_OTG_HS_WAKEUP_EXTI_ENABLE_RISING_ EDGE __HAL_USB_OTG_HS_WAKEUP_EXTI_ENABLE_FALLIN G_EDGE __HAL_USB_OTG_HS_WAKEUP_EXTI_ENABLE_RISING_ FALLING_EDGE __HAL_USB_OTG_HS_WAKEUP_EXTI_GENERATE_SWIT __HAL_USB_OTG_FS_WAKEUP_EXTI_ENABLE_IT __HAL_USB_OTG_FS_WAKEUP_EXTI_DISABLE_IT __HAL_USB_OTG_FS_WAKEUP_EXTI_GET_FLAG __HAL_USB_OTG_FS_WAKEUP_EXTI_CLEAR_FLAG __HAL_USB_OTG_FS_WAKEUP_EXTI_ENABLE_RISING_ EDGE __HAL_USB_OTG_FS_WAKEUP_EXTI_ENABLE_FALLING _EDGE __HAL_USB_OTG_FS_WAKEUP_EXTI_ENABLE_RISING_ FALLING_EDGE __HAL_USB_OTG_FS_WAKEUP_EXTI_GENERATE_SWIT PCD Instance definition IS_PCD_ALL_INSTANCE PCD PHY Module PCD_PHY_ULPI PCD_PHY_EMBEDDED PCD Speed PCD_SPEED_HIGH PCD_SPEED_HIGH_IN_FULL PCD_SPEED_FULL Turnaround Timeout Value USBD_HS_TRDT_VALUE USBD_FS_TRDT_VALUE...
  • Page 403: Hal Pcd Extension Driver

    UM1940 HAL PCD Extension Driver HAL PCD Extension Driver 33.1 PCDEx Firmware driver API description 33.1.1 Extended features functions This section provides functions allowing to: Update FIFO configuration This section contains the following APIs: HAL_PCDEx_SetTxFiFo() HAL_PCDEx_SetRxFiFo() 33.1.2 Detailed description of functions HAL_PCDEx_SetTxFiFo Function name HAL_StatusTypeDef HAL_PCDEx_SetTxFiFo...
  • Page 404: Hal Pwr Generic Driver

    HAL PWR Generic Driver UM1940 HAL PWR Generic Driver 34.1 PWR Firmware driver registers structures 34.1.1 PWR_PVDTypeDef Data Fields uint32_t PVDLevel uint32_t Mode Field Documentation uint32_t PWR_PVDTypeDef::PVDLevel PVDLevel: Specifies the PVD detection level. This parameter can be a value of PWR_PVD_detection_level uint32_t PWR_PVDTypeDef::Mode Mode: Specifies the operating mode for the selected pins.
  • Page 405 PWR_SLEEPENTRY_WFI: enter SLEEP mode with WFI instruction PWR_SLEEPENTRY_WFE: enter SLEEP mode with WFE instruction The Regulator parameter is not used for the STM32F2 family and is kept as parameter just to maintain compatibility with the lower power families (STM32L). Exit: Any peripheral interrupt acknowledged by the nested vectored interrupt controller (NVIC) can wake up the device from Sleep mode.
  • Page 406 HAL PWR Generic Driver UM1940 To wake up from the Stop mode with an RTC alarm event, it is necessary to configure the RTC to generate the RTC alarm using the HAL_RTC_SetAlarm_IT() function. To wake up from the Stop mode with an RTC Tamper or time stamp event, it is necessary to configure the RTC to detect the tamper or time stamp event using the HAL_RTCEx_SetTimeStamp_IT() or HAL_RTCEx_SetTamper_IT() functions.
  • Page 407 UM1940 HAL PWR Generic Driver Notes If the HSE divided by 2, 3, ..31 is used as the RTC clock, the Backup Domain Access should be kept enabled. HAL_PWR_ConfigPVD Function name void HAL_PWR_ConfigPVD (PWR_PVDTypeDef * sConfigPVD) Function description Configures the voltage threshold detected by the Power Voltage Detector(PVD).
  • Page 408 HAL PWR Generic Driver UM1940 HAL_PWR_EnterSTOPMode Function name void HAL_PWR_EnterSTOPMode (uint32_t Regulator, uint8_t STOPEntry) Function description Enters Stop mode. Parameters Regulator: Specifies the regulator state in Stop mode. This parameter can be one of the following values: PWR_MAINREGULATOR_ON: Stop mode with regulator ON PWR_LOWPOWERREGULATOR_ON: Stop mode with low power regulator ON...
  • Page 409 In Sleep mode, the systick is stopped to avoid exit from this mode with systick interrupt when used as time base for Timeout This parameter is not used for the STM32F2 family and is kept as parameter just to maintain compatibility with the lower power families.
  • Page 410: Pwr Firmware Driver Defines

    HAL PWR Generic Driver UM1940 Return values None: Notes Clears SLEEPONEXIT bit of SCR register. When this bit is set, the processor re-enters SLEEP mode when an interruption handling is over. HAL_PWR_EnableSEVOnPend Function name void HAL_PWR_EnableSEVOnPend (void ) Function description Enables CORTEX M3 SEVONPEND bit.
  • Page 411 UM1940 HAL PWR Generic Driver wakeup event was received from the WKUP pin or from the RTC alarm (Alarm A or Alarm B), RTC Tamper event, RTC TimeStamp event or RTC Wakeup. An additional wakeup event is detected if the WKUP pin is enabled (by setting the EWUP bit) when the WKUP pin level is already high.
  • Page 412 HAL PWR Generic Driver UM1940 None. __HAL_PWR_PVD_EXTI_ENABLE_EVENT Description: Enable event on PVD Exti Line 16. Return value: None. __HAL_PWR_PVD_EXTI_DISABLE_EVENT Description: Disable event on PVD Exti Line 16. Return value: None. __HAL_PWR_PVD_EXTI_ENABLE_RISING_ Description: EDGE Enable the PVD Extended Interrupt Rising Trigger. Return value: None.
  • Page 413 UM1940 HAL PWR Generic Driver None. __HAL_PWR_PVD_EXTI_GET_FLAG Description: checks whether the specified PVD Exti interrupt flag is set or not. Return value: EXTI: PVD Line Status. __HAL_PWR_PVD_EXTI_CLEAR_FLAG Description: Clear the PVD Exti flag. Return value: None. Description: __HAL_PWR_PVD_EXTI_GENERATE_SWIT Generates a Software interrupt on PVD EXTI line.
  • Page 414 HAL PWR Generic Driver UM1940 PWR_EXTI_LINE_PVD External interrupt line 16 Connected to the PVD EXTI Line PWR PVD Mode PWR_PVD_MODE_NORMAL basic mode is used PWR_PVD_MODE_IT_RISING External Interrupt Mode with Rising edge trigger detection PWR_PVD_MODE_IT_FALLING External Interrupt Mode with Falling edge trigger detection PWR_PVD_MODE_IT_RISING_FALLING External Interrupt Mode with Rising/Falling edge trigger detection...
  • Page 415: Hal Pwr Extension Driver

    UM1940 HAL PWR Extension Driver HAL PWR Extension Driver 35.1 PWREx Firmware driver API description 35.1.1 Peripheral extended features functions Main and Backup Regulators configuration The backup domain includes 4 Kbytes of backup SRAM accessible only from the CPU, and address in 32-bit, 16-bit or 8-bit mode. Its content is retained even in Standby or VBAT mode when the low power backup regulator is enabled.
  • Page 416: Pwrex Firmware Driver Defines

    HAL PWR Extension Driver UM1940 HAL_PWREx_EnableBkUpReg Function name HAL_StatusTypeDef HAL_PWREx_EnableBkUpReg (void ) Function description Enables the Backup Regulator. Return values HAL: status HAL_PWREx_DisableBkUpReg Function name HAL_StatusTypeDef HAL_PWREx_DisableBkUpReg (void ) Function description Disables the Backup Regulator. Return values HAL: status 35.2 PWREx Firmware driver defines 35.2.1 PWREx...
  • Page 417: Hal Rcc Generic Driver

    UM1940 HAL RCC Generic Driver HAL RCC Generic Driver 36.1 RCC Firmware driver registers structures 36.1.1 RCC_PLLInitTypeDef Data Fields uint32_t PLLState uint32_t PLLSource uint32_t PLLM uint32_t PLLN uint32_t PLLP uint32_t PLLQ Field Documentation uint32_t RCC_PLLInitTypeDef::PLLState The new state of the PLL. This parameter can be a value of RCC_PLL_Config uint32_t RCC_PLLInitTypeDef::PLLSource RCC_PLLSource: PLL entry clock source.
  • Page 418: Rcc_Clkinittypedef

    HAL RCC Generic Driver UM1940 uint32_t RCC_OscInitTypeDef::LSEState The new state of the LSE. This parameter can be a value of RCC_LSE_Config uint32_t RCC_OscInitTypeDef::HSIState The new state of the HSI. This parameter can be a value of RCC_HSI_Config uint32_t RCC_OscInitTypeDef::HSICalibrationValue The HSI calibration trimming value (default is RCC_HSICALIBRATION_DEFAULT). This parameter must be a number between Min_Data = 0x00 and Max_Data = 0x1F uint32_t RCC_OscInitTypeDef::LSIState The new state of the LSI.
  • Page 419: Rcc Limitations

    UM1940 HAL RCC Generic Driver Configure the System clock frequency and Flash settings Configure the AHB and APB busses prescalers Enable the clock for the peripheral(s) to be used Configure the clock source(s) for peripherals which clocks are not derived from the System clock (I2S, RTC, ADC, USB OTG FS/SDIO/RNG) 36.2.2 RCC Limitations...
  • Page 420 HAL RCC Generic Driver UM1940 frequencies of these clocks. All the peripheral clocks are derived from the System clock (SYSCLK) except: I2S: the I2S clock can be derived either from a specific PLL (PLLI2S) or from an external clock mapped on the I2S_CKIN pin. You have to use __HAL_RCC_PLLI2S_CONFIG() macro to configure this clock.RTC: the RTC clock can be derived either from the LSI, LSE or HSE clock divided by 2 to 31.
  • Page 421 UM1940 HAL RCC Generic Driver HAL_RCC_OscConfig Function name HAL_StatusTypeDef HAL_RCC_OscConfig (RCC_OscInitTypeDef * RCC_OscInitStruct) Function description Initializes the RCC Oscillators according to the specified parameters in the RCC_OscInitTypeDef. Parameters RCC_OscInitStruct: pointer to an RCC_OscInitTypeDef structure that contains the configuration information for the RCC Oscillators.
  • Page 422 HAL RCC Generic Driver UM1940 HAL_RCC_MCOConfig Function name void HAL_RCC_MCOConfig (uint32_t RCC_MCOx, uint32_t RCC_MCOSource, uint32_t RCC_MCODiv) Function description Selects the clock source to output on MCO1 pin(PA8) or on MCO2 pin(PC9). Parameters RCC_MCOx: specifies the output direction for the clock source.
  • Page 423 UM1940 HAL RCC Generic Driver HAL_RCC_DisableCSS Function name void HAL_RCC_DisableCSS (void ) Function description Disables the Clock Security System. Return values None: HAL_RCC_GetSysClockFreq Function name uint32_t HAL_RCC_GetSysClockFreq (void ) Function description Returns the SYSCLK frequency. Return values SYSCLK: frequency Notes The system frequency computed by this function is not the real frequency in the chip.
  • Page 424 HAL RCC Generic Driver UM1940 HAL_RCC_GetPCLK1Freq Function name uint32_t HAL_RCC_GetPCLK1Freq (void ) Function description Returns the PCLK1 frequency. Return values PCLK1: frequency Notes Each time PCLK1 changes, this function must be called to update the right PCLK1 value. Otherwise, any configuration based on this function will be incorrect.
  • Page 425: Rcc Firmware Driver Defines

    UM1940 HAL RCC Generic Driver HAL_RCC_CSSCallback Function name void HAL_RCC_CSSCallback (void ) Function description RCC Clock Security System interrupt callback. Return values None: 36.3 RCC Firmware driver defines 36.3.1 AHB1 Peripheral Clock Enable Disable __HAL_RCC_GPIOA_CLK_ENABLE __HAL_RCC_GPIOB_CLK_ENABLE __HAL_RCC_GPIOC_CLK_ENABLE __HAL_RCC_GPIOD_CLK_ENABLE __HAL_RCC_GPIOE_CLK_ENABLE __HAL_RCC_GPIOF_CLK_ENABLE __HAL_RCC_GPIOG_CLK_ENABLE __HAL_RCC_GPIOH_CLK_ENABLE __HAL_RCC_GPIOI_CLK_ENABLE...
  • Page 426 HAL RCC Generic Driver UM1940 __HAL_RCC_USB_OTG_HS_CLK_DISABLE __HAL_RCC_USB_OTG_HS_ULPI_CLK_DISABLE AHB1 Force Release Reset __HAL_RCC_AHB1_FORCE_RESET __HAL_RCC_GPIOA_FORCE_RESET __HAL_RCC_GPIOB_FORCE_RESET __HAL_RCC_GPIOC_FORCE_RESET __HAL_RCC_GPIOD_FORCE_RESET __HAL_RCC_GPIOE_FORCE_RESET __HAL_RCC_GPIOF_FORCE_RESET __HAL_RCC_GPIOG_FORCE_RESET __HAL_RCC_GPIOH_FORCE_RESET __HAL_RCC_GPIOI_FORCE_RESET __HAL_RCC_CRC_FORCE_RESET __HAL_RCC_DMA1_FORCE_RESET __HAL_RCC_DMA2_FORCE_RESET __HAL_RCC_USB_OTG_HS_FORCE_RESET __HAL_RCC_OTGHSULPI_FORCE_RESET __HAL_RCC_AHB1_RELEASE_RESET __HAL_RCC_GPIOA_RELEASE_RESET __HAL_RCC_GPIOB_RELEASE_RESET __HAL_RCC_GPIOC_RELEASE_RESET __HAL_RCC_GPIOD_RELEASE_RESET __HAL_RCC_GPIOE_RELEASE_RESET __HAL_RCC_GPIOF_RELEASE_RESET __HAL_RCC_GPIOG_RELEASE_RESET __HAL_RCC_GPIOH_RELEASE_RESET __HAL_RCC_GPIOI_RELEASE_RESET __HAL_RCC_CRC_RELEASE_RESET __HAL_RCC_DMA1_RELEASE_RESET __HAL_RCC_DMA2_RELEASE_RESET __HAL_RCC_USB_OTG_HS_RELEASE_RESET __HAL_RCC_OTGHSULPI_RELEASE_RESET AHB1 Peripheral Low Power Enable Disable __HAL_RCC_GPIOA_CLK_SLEEP_ENABLE...
  • Page 427 UM1940 HAL RCC Generic Driver __HAL_RCC_GPIOC_CLK_SLEEP_ENABLE __HAL_RCC_GPIOD_CLK_SLEEP_ENABLE __HAL_RCC_GPIOE_CLK_SLEEP_ENABLE __HAL_RCC_GPIOF_CLK_SLEEP_ENABLE __HAL_RCC_GPIOG_CLK_SLEEP_ENABLE __HAL_RCC_GPIOH_CLK_SLEEP_ENABLE __HAL_RCC_GPIOI_CLK_SLEEP_ENABLE __HAL_RCC_CRC_CLK_SLEEP_ENABLE __HAL_RCC_FLITF_CLK_SLEEP_ENABLE __HAL_RCC_SRAM1_CLK_SLEEP_ENABLE __HAL_RCC_SRAM2_CLK_SLEEP_ENABLE __HAL_RCC_BKPSRAM_CLK_SLEEP_ENABLE __HAL_RCC_DMA1_CLK_SLEEP_ENABLE __HAL_RCC_DMA2_CLK_SLEEP_ENABLE __HAL_RCC_USB_OTG_HS_CLK_SLEEP_ENABLE __HAL_RCC_USB_OTG_HS_ULPI_CLK_SLEEP_ENABLE __HAL_RCC_GPIOA_CLK_SLEEP_DISABLE __HAL_RCC_GPIOB_CLK_SLEEP_DISABLE __HAL_RCC_GPIOC_CLK_SLEEP_DISABLE __HAL_RCC_GPIOD_CLK_SLEEP_DISABLE __HAL_RCC_GPIOE_CLK_SLEEP_DISABLE __HAL_RCC_GPIOF_CLK_SLEEP_DISABLE __HAL_RCC_GPIOG_CLK_SLEEP_DISABLE __HAL_RCC_GPIOH_CLK_SLEEP_DISABLE __HAL_RCC_GPIOI_CLK_SLEEP_DISABLE __HAL_RCC_CRC_CLK_SLEEP_DISABLE __HAL_RCC_FLITF_CLK_SLEEP_DISABLE __HAL_RCC_SRAM1_CLK_SLEEP_DISABLE __HAL_RCC_SRAM2_CLK_SLEEP_DISABLE __HAL_RCC_BKPSRAM_CLK_SLEEP_DISABLE __HAL_RCC_DMA1_CLK_SLEEP_DISABLE __HAL_RCC_DMA2_CLK_SLEEP_DISABLE __HAL_RCC_USB_OTG_HS_CLK_SLEEP_DISABLE __HAL_RCC_USB_OTG_HS_ULPI_CLK_SLEEP_DISABLE AHB1 Peripheral Clock Enable Disable Status __HAL_RCC_GPIOA_IS_CLK_ENABLED DocID028236 Rev 2 427/1371...
  • Page 428 HAL RCC Generic Driver UM1940 __HAL_RCC_GPIOB_IS_CLK_ENABLED __HAL_RCC_GPIOC_IS_CLK_ENABLED __HAL_RCC_GPIOD_IS_CLK_ENABLED __HAL_RCC_GPIOE_IS_CLK_ENABLED __HAL_RCC_GPIOF_IS_CLK_ENABLED __HAL_RCC_GPIOG_IS_CLK_ENABLED __HAL_RCC_GPIOH_IS_CLK_ENABLED __HAL_RCC_GPIOI_IS_CLK_ENABLED __HAL_RCC_CRC_IS_CLK_ENABLED __HAL_RCC_BKPSRAM_IS_CLK_ENABLED __HAL_RCC_DMA1_IS_CLK_ENABLED __HAL_RCC_DMA2_IS_CLK_ENABLED __HAL_RCC_USB_OTG_HS_IS_CLK_ENABLED __HAL_RCC_USB_OTG_HS_ULPI_IS_CLK_ENABLED __HAL_RCC_GPIOA_IS_CLK_DISABLED __HAL_RCC_GPIOB_IS_CLK_DISABLED __HAL_RCC_GPIOC_IS_CLK_DISABLED __HAL_RCC_GPIOD_IS_CLK_DISABLED __HAL_RCC_GPIOE_IS_CLK_DISABLED __HAL_RCC_GPIOF_IS_CLK_DISABLED __HAL_RCC_GPIOG_IS_CLK_DISABLED __HAL_RCC_GPIOH_IS_CLK_DISABLED __HAL_RCC_GPIOI_IS_CLK_DISABLED __HAL_RCC_CRC_IS_CLK_DISABLED __HAL_RCC_BKPSRAM_IS_CLK_DISABLED __HAL_RCC_DMA1_IS_CLK_DISABLED __HAL_RCC_DMA2_IS_CLK_DISABLED __HAL_RCC_USB_OTG_HS_IS_CLK_DISABLED __HAL_RCC_USB_OTG_HS_ULPI_IS_CLK_DISABLED __HAL_RCC_ETHMAC_IS_CLK_ENABLED __HAL_RCC_ETHMACTX_IS_CLK_ENABLED __HAL_RCC_ETHMACRX_IS_CLK_ENABLED __HAL_RCC_ETHMACPTP_IS_CLK_ENABLED __HAL_RCC_ETH_IS_CLK_ENABLED __HAL_RCC_ETHMAC_IS_CLK_DISABLED __HAL_RCC_ETHMACTX_IS_CLK_DISABLED 428/1371 DocID028236 Rev 2...
  • Page 429 UM1940 HAL RCC Generic Driver __HAL_RCC_ETHMACRX_IS_CLK_DISABLED __HAL_RCC_ETHMACPTP_IS_CLK_DISABLED __HAL_RCC_ETH_IS_CLK_DISABLED AHB2 Peripheral Clock Enable Disable __HAL_RCC_USB_OTG_FS_CLK_ENABLE __HAL_RCC_RNG_CLK_ENABLE __HAL_RCC_USB_OTG_FS_CLK_DISABLE __HAL_RCC_RNG_CLK_DISABLE AHB2 Force Release Reset __HAL_RCC_AHB2_FORCE_RESET __HAL_RCC_RNG_FORCE_RESET __HAL_RCC_USB_OTG_FS_FORCE_RESET __HAL_RCC_AHB2_RELEASE_RESET __HAL_RCC_RNG_RELEASE_RESET __HAL_RCC_USB_OTG_FS_RELEASE_RESET AHB2 Peripheral Low Power Enable Disable __HAL_RCC_USB_OTG_FS_CLK_SLEEP_ENABLE __HAL_RCC_RNG_CLK_SLEEP_ENABLE __HAL_RCC_USB_OTG_FS_CLK_SLEEP_DISABLE __HAL_RCC_RNG_CLK_SLEEP_DISABLE AHB2 Peripheral Clock Enable Disable Status __HAL_RCC_USB_OTG_FS_IS_CLK_ENABLED __HAL_RCC_RNG_IS_CLK_ENABLED __HAL_RCC_USB_OTG_FS_IS_CLK_DISABLED...
  • Page 430 HAL RCC Generic Driver UM1940 __HAL_RCC_FSMC_FORCE_RESET __HAL_RCC_AHB3_RELEASE_RESET __HAL_RCC_FSMC_RELEASE_RESET AHB3 Peripheral Low Power Enable Disable __HAL_RCC_FSMC_CLK_SLEEP_ENABLE __HAL_RCC_FSMC_CLK_SLEEP_DISABLE AHB3 Peripheral Clock Enable Disable Status __HAL_RCC_FSMC_IS_CLK_ENABLED __HAL_RCC_FSMC_IS_CLK_DISABLED AHB Clock Source RCC_SYSCLK_DIV1 RCC_SYSCLK_DIV2 RCC_SYSCLK_DIV4 RCC_SYSCLK_DIV8 RCC_SYSCLK_DIV16 RCC_SYSCLK_DIV64 RCC_SYSCLK_DIV128 RCC_SYSCLK_DIV256 RCC_SYSCLK_DIV512 APB1/APB2 Clock Source RCC_HCLK_DIV1 RCC_HCLK_DIV2 RCC_HCLK_DIV4 RCC_HCLK_DIV8...
  • Page 431 UM1940 HAL RCC Generic Driver __HAL_RCC_SPI2_CLK_ENABLE __HAL_RCC_SPI3_CLK_ENABLE __HAL_RCC_USART2_CLK_ENABLE __HAL_RCC_USART3_CLK_ENABLE __HAL_RCC_UART4_CLK_ENABLE __HAL_RCC_UART5_CLK_ENABLE __HAL_RCC_I2C1_CLK_ENABLE __HAL_RCC_I2C2_CLK_ENABLE __HAL_RCC_I2C3_CLK_ENABLE __HAL_RCC_CAN1_CLK_ENABLE __HAL_RCC_CAN2_CLK_ENABLE __HAL_RCC_PWR_CLK_ENABLE __HAL_RCC_DAC_CLK_ENABLE __HAL_RCC_TIM2_CLK_DISABLE __HAL_RCC_TIM3_CLK_DISABLE __HAL_RCC_TIM4_CLK_DISABLE __HAL_RCC_TIM5_CLK_DISABLE __HAL_RCC_TIM6_CLK_DISABLE __HAL_RCC_TIM7_CLK_DISABLE __HAL_RCC_TIM12_CLK_DISABLE __HAL_RCC_TIM13_CLK_DISABLE __HAL_RCC_TIM14_CLK_DISABLE __HAL_RCC_WWDG_CLK_DISABLE __HAL_RCC_SPI2_CLK_DISABLE __HAL_RCC_SPI3_CLK_DISABLE __HAL_RCC_USART2_CLK_DISABLE __HAL_RCC_USART3_CLK_DISABLE __HAL_RCC_UART4_CLK_DISABLE __HAL_RCC_UART5_CLK_DISABLE __HAL_RCC_I2C1_CLK_DISABLE __HAL_RCC_I2C2_CLK_DISABLE __HAL_RCC_I2C3_CLK_DISABLE __HAL_RCC_PWR_CLK_DISABLE __HAL_RCC_CAN1_CLK_DISABLE __HAL_RCC_CAN2_CLK_DISABLE __HAL_RCC_DAC_CLK_DISABLE APB1 Force Release Reset DocID028236 Rev 2...
  • Page 432 HAL RCC Generic Driver UM1940 __HAL_RCC_APB1_FORCE_RESET __HAL_RCC_TIM2_FORCE_RESET __HAL_RCC_TIM3_FORCE_RESET __HAL_RCC_TIM4_FORCE_RESET __HAL_RCC_TIM5_FORCE_RESET __HAL_RCC_TIM6_FORCE_RESET __HAL_RCC_TIM7_FORCE_RESET __HAL_RCC_TIM12_FORCE_RESET __HAL_RCC_TIM13_FORCE_RESET __HAL_RCC_TIM14_FORCE_RESET __HAL_RCC_WWDG_FORCE_RESET __HAL_RCC_SPI2_FORCE_RESET __HAL_RCC_SPI3_FORCE_RESET __HAL_RCC_USART2_FORCE_RESET __HAL_RCC_USART3_FORCE_RESET __HAL_RCC_UART4_FORCE_RESET __HAL_RCC_UART5_FORCE_RESET __HAL_RCC_I2C1_FORCE_RESET __HAL_RCC_I2C2_FORCE_RESET __HAL_RCC_I2C3_FORCE_RESET __HAL_RCC_CAN1_FORCE_RESET __HAL_RCC_CAN2_FORCE_RESET __HAL_RCC_PWR_FORCE_RESET __HAL_RCC_DAC_FORCE_RESET __HAL_RCC_APB1_RELEASE_RESET __HAL_RCC_TIM2_RELEASE_RESET __HAL_RCC_TIM3_RELEASE_RESET __HAL_RCC_TIM4_RELEASE_RESET __HAL_RCC_TIM5_RELEASE_RESET __HAL_RCC_TIM6_RELEASE_RESET __HAL_RCC_TIM7_RELEASE_RESET __HAL_RCC_TIM12_RELEASE_RESET __HAL_RCC_TIM13_RELEASE_RESET __HAL_RCC_TIM14_RELEASE_RESET __HAL_RCC_WWDG_RELEASE_RESET __HAL_RCC_SPI2_RELEASE_RESET 432/1371 DocID028236 Rev 2...
  • Page 433 UM1940 HAL RCC Generic Driver __HAL_RCC_SPI3_RELEASE_RESET __HAL_RCC_USART2_RELEASE_RESET __HAL_RCC_USART3_RELEASE_RESET __HAL_RCC_UART4_RELEASE_RESET __HAL_RCC_UART5_RELEASE_RESET __HAL_RCC_I2C1_RELEASE_RESET __HAL_RCC_I2C2_RELEASE_RESET __HAL_RCC_I2C3_RELEASE_RESET __HAL_RCC_CAN1_RELEASE_RESET __HAL_RCC_CAN2_RELEASE_RESET __HAL_RCC_PWR_RELEASE_RESET __HAL_RCC_DAC_RELEASE_RESET APB1 Peripheral Low Power Enable Disable __HAL_RCC_TIM2_CLK_SLEEP_ENABLE __HAL_RCC_TIM3_CLK_SLEEP_ENABLE __HAL_RCC_TIM4_CLK_SLEEP_ENABLE __HAL_RCC_TIM5_CLK_SLEEP_ENABLE __HAL_RCC_TIM6_CLK_SLEEP_ENABLE __HAL_RCC_TIM7_CLK_SLEEP_ENABLE __HAL_RCC_TIM12_CLK_SLEEP_ENABLE __HAL_RCC_TIM13_CLK_SLEEP_ENABLE __HAL_RCC_TIM14_CLK_SLEEP_ENABLE __HAL_RCC_WWDG_CLK_SLEEP_ENABLE __HAL_RCC_SPI2_CLK_SLEEP_ENABLE __HAL_RCC_SPI3_CLK_SLEEP_ENABLE __HAL_RCC_USART2_CLK_SLEEP_ENABLE __HAL_RCC_USART3_CLK_SLEEP_ENABLE __HAL_RCC_UART4_CLK_SLEEP_ENABLE __HAL_RCC_UART5_CLK_SLEEP_ENABLE __HAL_RCC_I2C1_CLK_SLEEP_ENABLE __HAL_RCC_I2C2_CLK_SLEEP_ENABLE __HAL_RCC_I2C3_CLK_SLEEP_ENABLE __HAL_RCC_PWR_CLK_SLEEP_ENABLE...
  • Page 434 HAL RCC Generic Driver UM1940 __HAL_RCC_TIM2_CLK_SLEEP_DISABLE __HAL_RCC_TIM3_CLK_SLEEP_DISABLE __HAL_RCC_TIM4_CLK_SLEEP_DISABLE __HAL_RCC_TIM5_CLK_SLEEP_DISABLE __HAL_RCC_TIM6_CLK_SLEEP_DISABLE __HAL_RCC_TIM7_CLK_SLEEP_DISABLE __HAL_RCC_TIM12_CLK_SLEEP_DISABLE __HAL_RCC_TIM13_CLK_SLEEP_DISABLE __HAL_RCC_TIM14_CLK_SLEEP_DISABLE __HAL_RCC_WWDG_CLK_SLEEP_DISABLE __HAL_RCC_SPI2_CLK_SLEEP_DISABLE __HAL_RCC_SPI3_CLK_SLEEP_DISABLE __HAL_RCC_USART2_CLK_SLEEP_DISABLE __HAL_RCC_USART3_CLK_SLEEP_DISABLE __HAL_RCC_UART4_CLK_SLEEP_DISABLE __HAL_RCC_UART5_CLK_SLEEP_DISABLE __HAL_RCC_I2C1_CLK_SLEEP_DISABLE __HAL_RCC_I2C2_CLK_SLEEP_DISABLE __HAL_RCC_I2C3_CLK_SLEEP_DISABLE __HAL_RCC_PWR_CLK_SLEEP_DISABLE __HAL_RCC_CAN1_CLK_SLEEP_DISABLE __HAL_RCC_CAN2_CLK_SLEEP_DISABLE __HAL_RCC_DAC_CLK_SLEEP_DISABLE APB1 Peripheral Clock Enable Disable Status __HAL_RCC_TIM2_IS_CLK_ENABLED __HAL_RCC_TIM3_IS_CLK_ENABLED __HAL_RCC_TIM4_IS_CLK_ENABLED __HAL_RCC_TIM5_IS_CLK_ENABLED __HAL_RCC_TIM6_IS_CLK_ENABLED __HAL_RCC_TIM7_IS_CLK_ENABLED __HAL_RCC_TIM12_IS_CLK_ENABLED __HAL_RCC_TIM13_IS_CLK_ENABLED __HAL_RCC_TIM14_IS_CLK_ENABLED...
  • Page 435 UM1940 HAL RCC Generic Driver __HAL_RCC_USART2_IS_CLK_ENABLED __HAL_RCC_USART3_IS_CLK_ENABLED __HAL_RCC_UART4_IS_CLK_ENABLED __HAL_RCC_UART5_IS_CLK_ENABLED __HAL_RCC_I2C1_IS_CLK_ENABLED __HAL_RCC_I2C2_IS_CLK_ENABLED __HAL_RCC_I2C3_IS_CLK_ENABLED __HAL_RCC_PWR_IS_CLK_ENABLED __HAL_RCC_CAN1_IS_CLK_ENABLED __HAL_RCC_CAN2_IS_CLK_ENABLED __HAL_RCC_DAC_IS_CLK_ENABLED __HAL_RCC_TIM2_IS_CLK_DISABLED __HAL_RCC_TIM3_IS_CLK_DISABLED __HAL_RCC_TIM4_IS_CLK_DISABLED __HAL_RCC_TIM5_IS_CLK_DISABLED __HAL_RCC_TIM6_IS_CLK_DISABLED __HAL_RCC_TIM7_IS_CLK_DISABLED __HAL_RCC_TIM12_IS_CLK_DISABLED __HAL_RCC_TIM13_IS_CLK_DISABLED __HAL_RCC_TIM14_IS_CLK_DISABLED __HAL_RCC_WWDG_IS_CLK_DISABLED __HAL_RCC_SPI2_IS_CLK_DISABLED __HAL_RCC_SPI3_IS_CLK_DISABLED __HAL_RCC_USART2_IS_CLK_DISABLED __HAL_RCC_USART3_IS_CLK_DISABLED __HAL_RCC_UART4_IS_CLK_DISABLED __HAL_RCC_UART5_IS_CLK_DISABLED __HAL_RCC_I2C1_IS_CLK_DISABLED __HAL_RCC_I2C2_IS_CLK_DISABLED __HAL_RCC_I2C3_IS_CLK_DISABLED __HAL_RCC_PWR_IS_CLK_DISABLED __HAL_RCC_CAN1_IS_CLK_DISABLED __HAL_RCC_CAN2_IS_CLK_DISABLED __HAL_RCC_DAC_IS_CLK_DISABLED APB2 Peripheral Clock Enable Disable __HAL_RCC_TIM1_CLK_ENABLE DocID028236 Rev 2 435/1371...
  • Page 436 HAL RCC Generic Driver UM1940 __HAL_RCC_TIM8_CLK_ENABLE __HAL_RCC_USART1_CLK_ENABLE __HAL_RCC_USART6_CLK_ENABLE __HAL_RCC_ADC1_CLK_ENABLE __HAL_RCC_ADC2_CLK_ENABLE __HAL_RCC_ADC3_CLK_ENABLE __HAL_RCC_SDIO_CLK_ENABLE __HAL_RCC_SPI1_CLK_ENABLE __HAL_RCC_SYSCFG_CLK_ENABLE __HAL_RCC_TIM9_CLK_ENABLE __HAL_RCC_TIM10_CLK_ENABLE __HAL_RCC_TIM11_CLK_ENABLE __HAL_RCC_TIM1_CLK_DISABLE __HAL_RCC_TIM8_CLK_DISABLE __HAL_RCC_USART1_CLK_DISABLE __HAL_RCC_USART6_CLK_DISABLE __HAL_RCC_ADC1_CLK_DISABLE __HAL_RCC_ADC2_CLK_DISABLE __HAL_RCC_ADC3_CLK_DISABLE __HAL_RCC_SDIO_CLK_DISABLE __HAL_RCC_SPI1_CLK_DISABLE __HAL_RCC_SYSCFG_CLK_DISABLE __HAL_RCC_TIM9_CLK_DISABLE __HAL_RCC_TIM10_CLK_DISABLE __HAL_RCC_TIM11_CLK_DISABLE APB2 Force Release Reset __HAL_RCC_APB2_FORCE_RESET __HAL_RCC_TIM1_FORCE_RESET __HAL_RCC_TIM8_FORCE_RESET __HAL_RCC_USART1_FORCE_RESET __HAL_RCC_USART6_FORCE_RESET __HAL_RCC_ADC_FORCE_RESET __HAL_RCC_SDIO_FORCE_RESET __HAL_RCC_SPI1_FORCE_RESET __HAL_RCC_SYSCFG_FORCE_RESET...
  • Page 437 UM1940 HAL RCC Generic Driver __HAL_RCC_TIM10_FORCE_RESET __HAL_RCC_TIM11_FORCE_RESET __HAL_RCC_APB2_RELEASE_RESET __HAL_RCC_TIM1_RELEASE_RESET __HAL_RCC_TIM8_RELEASE_RESET __HAL_RCC_USART1_RELEASE_RESET __HAL_RCC_USART6_RELEASE_RESET __HAL_RCC_ADC_RELEASE_RESET __HAL_RCC_SDIO_RELEASE_RESET __HAL_RCC_SPI1_RELEASE_RESET __HAL_RCC_SYSCFG_RELEASE_RESET __HAL_RCC_TIM9_RELEASE_RESET __HAL_RCC_TIM10_RELEASE_RESET __HAL_RCC_TIM11_RELEASE_RESET APB2 Peripheral Low Power Enable Disable __HAL_RCC_TIM1_CLK_SLEEP_ENABLE __HAL_RCC_USART1_CLK_SLEEP_ENABLE __HAL_RCC_USART6_CLK_SLEEP_ENABLE __HAL_RCC_ADC1_CLK_SLEEP_ENABLE __HAL_RCC_SDIO_CLK_SLEEP_ENABLE __HAL_RCC_SPI1_CLK_SLEEP_ENABLE __HAL_RCC_SYSCFG_CLK_SLEEP_ENABLE __HAL_RCC_TIM8_CLK_SLEEP_ENABLE __HAL_RCC_TIM9_CLK_SLEEP_ENABLE __HAL_RCC_TIM10_CLK_SLEEP_ENABLE __HAL_RCC_TIM11_CLK_SLEEP_ENABLE __HAL_RCC_ADC2_CLK_SLEEP_ENABLE __HAL_RCC_ADC3_CLK_SLEEP_ENABLE __HAL_RCC_TIM1_CLK_SLEEP_DISABLE __HAL_RCC_USART1_CLK_SLEEP_DISABLE __HAL_RCC_USART6_CLK_SLEEP_DISABLE __HAL_RCC_ADC1_CLK_SLEEP_DISABLE __HAL_RCC_SDIO_CLK_SLEEP_DISABLE...
  • Page 438 HAL RCC Generic Driver UM1940 __HAL_RCC_TIM9_CLK_SLEEP_DISABLE __HAL_RCC_TIM10_CLK_SLEEP_DISABLE __HAL_RCC_TIM11_CLK_SLEEP_DISABLE __HAL_RCC_ADC2_CLK_SLEEP_DISABLE __HAL_RCC_ADC3_CLK_SLEEP_DISABLE APB2 Peripheral Clock Enable Disable Status __HAL_RCC_TIM1_IS_CLK_ENABLED __HAL_RCC_TIM8_IS_CLK_ENABLED __HAL_RCC_USART1_IS_CLK_ENABLED __HAL_RCC_USART6_IS_CLK_ENABLED __HAL_RCC_ADC1_IS_CLK_ENABLED __HAL_RCC_ADC2_IS_CLK_ENABLED __HAL_RCC_ADC3_IS_CLK_ENABLED __HAL_RCC_SDIO_IS_CLK_ENABLED __HAL_RCC_SPI1_IS_CLK_ENABLED __HAL_RCC_SYSCFG_IS_CLK_ENABLED __HAL_RCC_TIM9_IS_CLK_ENABLED __HAL_RCC_TIM10_IS_CLK_ENABLED __HAL_RCC_TIM11_IS_CLK_ENABLED __HAL_RCC_TIM1_IS_CLK_DISABLED __HAL_RCC_TIM8_IS_CLK_DISABLED __HAL_RCC_USART1_IS_CLK_DISABLED __HAL_RCC_USART6_IS_CLK_DISABLED __HAL_RCC_ADC1_IS_CLK_DISABLED __HAL_RCC_ADC2_IS_CLK_DISABLED __HAL_RCC_ADC3_IS_CLK_DISABLED __HAL_RCC_SDIO_IS_CLK_DISABLED __HAL_RCC_SPI1_IS_CLK_DISABLED __HAL_RCC_SYSCFG_IS_CLK_DISABLED __HAL_RCC_TIM9_IS_CLK_DISABLED __HAL_RCC_TIM10_IS_CLK_DISABLED __HAL_RCC_TIM11_IS_CLK_DISABLED RCC BitAddress AliasRegion...
  • Page 439 UM1940 HAL RCC Generic Driver RCC_CR_HSION_BB RCC_CSSON_BIT_NUMBER RCC_CR_CSSON_BB RCC_PLLON_BIT_NUMBER RCC_CR_PLLON_BB RCC_PLLI2SON_BIT_NUMBER RCC_CR_PLLI2SON_BB RCC_CFGR_OFFSET RCC_I2SSRC_BIT_NUMBER RCC_CFGR_I2SSRC_BB RCC_BDCR_OFFSET RCC_RTCEN_BIT_NUMBER RCC_BDCR_RTCEN_BB RCC_BDRST_BIT_NUMBER RCC_BDCR_BDRST_BB RCC_CSR_OFFSET RCC_LSION_BIT_NUMBER RCC_CSR_LSION_BB RCC_CR_BYTE2_ADDRESS RCC_CIR_BYTE1_ADDRESS RCC_CIR_BYTE2_ADDRESS RCC_BDCR_BYTE0_ADDRESS RCC_DBP_TIMEOUT_VALUE RCC_LSE_TIMEOUT_VALUE HSE_TIMEOUT_VALUE HSI_TIMEOUT_VALUE LSI_TIMEOUT_VALUE PLLI2S_TIMEOUT_VALUE RCC Exported Macros __HAL_RCC_PLL_PLLSOURCE_CONFIG Description: Macro to configure the PLL clock source.
  • Page 440 HAL RCC Generic Driver UM1940 RCC_PLLSOURCE_HSE: HSE oscillator clock selected as PLL clock entry Notes: This function must be used only when the main PLL is disabled. __HAL_RCC_PLL_PLLM_CONFIG Description: Macro to configure the PLL multiplication factor. Parameters: __PLLM__: specifies the division factor for PLL VCO input clock This parameter must be a number between Min_Data = 2 and Max_Data = 63.
  • Page 441 UM1940 HAL RCC Generic Driver Parameters: __INTERRUPT__: specifies the RCC interrupt sources to be enabled. This parameter can be any combination of the following values: RCC_IT_LSIRDY: LSI ready interrupt. RCC_IT_LSERDY: LSE ready interrupt. RCC_IT_HSIRDY: HSI ready interrupt. RCC_IT_HSERDY: HSE ready interrupt.
  • Page 442 HAL RCC Generic Driver UM1940 interrupt. RCC_IT_CSS: Clock Security System interrupt __HAL_RCC_GET_IT Description: Check the RCC's interrupt has occurred or not. Parameters: __INTERRUPT__: specifies the RCC interrupt source to check. This parameter can be one of the following values: RCC_IT_LSIRDY: LSI ready interrupt. RCC_IT_LSERDY: LSE ready interrupt.
  • Page 443 UM1940 HAL RCC Generic Driver RCC_FLAG_SFTRST: Software reset. RCC_FLAG_IWDGRST: Independent Watchdog reset. RCC_FLAG_WWDGRST: Window Watchdog reset. RCC_FLAG_LPWRRST: Low Power reset. Return value: The: new state of __FLAG__ (TRUE or FALSE). __HAL_RCC_GET_FLAG RCC_GET_PLL_OSCSOURCE Get Clock source __HAL_RCC_SYSCLK_CONFIG Description: Macro to configure the system clock source. Parameters: __RCC_SYSCLKSOURCE__: specifies the system clock source.
  • Page 444 HAL RCC Generic Driver UM1940 RCC_PLLSOURCE_HSE: HSE oscillator is used as PLL clock source. HSE Config RCC_HSE_OFF RCC_HSE_ON RCC_HSE_BYPASS HSE Configuration __HAL_RCC_HSE_CONFIG Description: Macro to configure the External High Speed oscillator (HSE). Parameters: __STATE__: specifies the new state of the HSE. This parameter can be one of the following values: RCC_HSE_OFF: turn OFF the HSE oscillator, HSERDY flag goes low after 6 HSE oscillator...
  • Page 445 UM1940 HAL RCC Generic Driver system clock source after startup from Reset, wake-up from STOP and STANDBY mode, or in case of failure of the HSE used directly or indirectly as system clock (if the Clock Security System CSS is enabled).
  • Page 446 HAL RCC Generic Driver UM1940 __HAL_RCC_RTC_CLKPRESCALER Description: Macros to configure the RTC clock (RTCCLK). Parameters: __RTCCLKSource__: specifies the RTC clock source. This parameter can be one of the following values: RCC_RTCCLKSOURCE_LSE: LSE selected as RTC clock. RCC_RTCCLKSOURCE_LSI: LSI selected as RTC clock. RCC_RTCCLKSOURCE_HSE_DIVx: HSE clock divided by x selected as RTC clock, where x:[2,31]...
  • Page 447 UM1940 HAL RCC Generic Driver RCC_IT_HSIRDY RCC_IT_HSERDY RCC_IT_PLLRDY RCC_IT_PLLI2SRDY RCC_IT_CSS RCC Private macros to check input parameters IS_RCC_OSCILLATORTYPE IS_RCC_HSE IS_RCC_LSE IS_RCC_HSI IS_RCC_LSI IS_RCC_PLL IS_RCC_PLLSOURCE IS_RCC_SYSCLKSOURCE IS_RCC_RTCCLKSOURCE IS_RCC_PLLM_VALUE IS_RCC_PLLN_VALUE IS_RCC_PLLP_VALUE IS_RCC_PLLQ_VALUE IS_RCC_HCLK IS_RCC_CLOCKTYPE IS_RCC_PCLK IS_RCC_MCO IS_RCC_MCO1SOURCE IS_RCC_MCO2SOURCE IS_RCC_MCODIV IS_RCC_CALIBRATION_VALUE LSE Config RCC_LSE_OFF RCC_LSE_ON RCC_LSE_BYPASS...
  • Page 448 HAL RCC Generic Driver UM1940 parameter can be one of the following values: RCC_LSE_OFF: turn OFF the LSE oscillator, LSERDY flag goes low after 6 LSE oscillator clock cycles. RCC_LSE_ON: turn ON the LSE oscillator. RCC_LSE_BYPASS: LSE oscillator bypassed with external clock. Notes: Transition LSE Bypass to LSE On and LSE On to LSE Bypass are not supported by this macro.
  • Page 449 UM1940 HAL RCC Generic Driver RCC_MCODIV_1 RCC_MCODIV_2 RCC_MCODIV_3 RCC_MCODIV_4 RCC_MCODIV_5 MCO Index RCC_MCO1 RCC_MCO2 Oscillator Type RCC_OSCILLATORTYPE_NONE RCC_OSCILLATORTYPE_HSE RCC_OSCILLATORTYPE_HSI RCC_OSCILLATORTYPE_LSE RCC_OSCILLATORTYPE_LSI PLLP Clock Divider RCC_PLLP_DIV2 RCC_PLLP_DIV4 RCC_PLLP_DIV6 RCC_PLLP_DIV8 PLL Clock Source RCC_PLLSOURCE_HSI RCC_PLLSOURCE_HSE PLL Config RCC_PLL_NONE RCC_PLL_OFF RCC_PLL_ON PLL Configuration Notes: __HAL_RCC_PLL_ENABLE After enabling the main PLL, the application software...
  • Page 450 HAL RCC Generic Driver UM1940 Macro to configure the main PLL clock source, multiplication and division factors. Parameters: __RCC_PLLSource__: specifies the PLL entry clock source. This parameter can be one of the following values: RCC_PLLSOURCE_HSI: HSI oscillator clock selected as PLL clock entry RCC_PLLSOURCE_HSE: HSE oscillator clock selected as PLL clock entry __PLLM__: specifies the division factor for PLL VCO...
  • Page 451 UM1940 HAL RCC Generic Driver Parameters: __PLLI2SN__: specifies the multiplication factor for PLLI2S VCO output clock This parameter must be a number between Min_Data = 192 and Max_Data = 432. __PLLI2SR__: specifies the division factor for I2S clock This parameter must be a number between Min_Data = 2 and Max_Data = 7.
  • Page 452 HAL RCC Generic Driver UM1940 RCC_RTCCLKSOURCE_HSE_DIV10 RCC_RTCCLKSOURCE_HSE_DIV11 RCC_RTCCLKSOURCE_HSE_DIV12 RCC_RTCCLKSOURCE_HSE_DIV13 RCC_RTCCLKSOURCE_HSE_DIV14 RCC_RTCCLKSOURCE_HSE_DIV15 RCC_RTCCLKSOURCE_HSE_DIV16 RCC_RTCCLKSOURCE_HSE_DIV17 RCC_RTCCLKSOURCE_HSE_DIV18 RCC_RTCCLKSOURCE_HSE_DIV19 RCC_RTCCLKSOURCE_HSE_DIV20 RCC_RTCCLKSOURCE_HSE_DIV21 RCC_RTCCLKSOURCE_HSE_DIV22 RCC_RTCCLKSOURCE_HSE_DIV23 RCC_RTCCLKSOURCE_HSE_DIV24 RCC_RTCCLKSOURCE_HSE_DIV25 RCC_RTCCLKSOURCE_HSE_DIV26 RCC_RTCCLKSOURCE_HSE_DIV27 RCC_RTCCLKSOURCE_HSE_DIV28 RCC_RTCCLKSOURCE_HSE_DIV29 RCC_RTCCLKSOURCE_HSE_DIV30 RCC_RTCCLKSOURCE_HSE_DIV31 System Clock Source RCC_SYSCLKSOURCE_HSI RCC_SYSCLKSOURCE_HSE RCC_SYSCLKSOURCE_PLLCLK System Clock Source Status RCC_SYSCLKSOURCE_STATUS_HSI HSI used as system clock RCC_SYSCLKSOURCE_STATUS_HSE HSE used as system clock RCC_SYSCLKSOURCE_STATUS_PLLCLK...
  • Page 453: Hal Rcc Extension Driver

    UM1940 HAL RCC Extension Driver HAL RCC Extension Driver 37.1 RCCEx Firmware driver registers structures 37.1.1 RCC_PLLI2SInitTypeDef Data Fields uint32_t PLLI2SN uint32_t PLLI2SR Field Documentation uint32_t RCC_PLLI2SInitTypeDef::PLLI2SN Specifies the multiplication factor for PLLI2S VCO output clock. This parameter must be a number between Min_Data = 192 and Max_Data = 432. This parameter will be used only when PLLI2S is selected as Clock Source I2S uint32_t RCC_PLLI2SInitTypeDef::PLLI2SR Specifies the division factor for I2S clock.
  • Page 454 HAL RCC Extension Driver UM1940 Important note: Care must be taken when HAL_RCCEx_PeriphCLKConfig() is used to select the RTC clock source; in this case the Backup domain will be reset in order to modify the RTC Clock source, as consequence RTC registers (including the backup registers) and RCC_BDCR register are set to their reset values.
  • Page 455 UM1940 HAL RCC Extension Driver __HAL_RCC_ETHMAC_CLK_DISABLE __HAL_RCC_ETHMACTX_CLK_DISABLE __HAL_RCC_ETHMACRX_CLK_DISABLE __HAL_RCC_ETHMACPTP_CLK_DISABLE __HAL_RCC_ETH_CLK_ENABLE __HAL_RCC_ETH_CLK_DISABLE AHB1 Force Release Reset __HAL_RCC_ETHMAC_FORCE_RESET __HAL_RCC_ETHMAC_RELEASE_RESET AHB1 Peripheral Low Power Enable Disable __HAL_RCC_ETHMAC_CLK_SLEEP_ENABLE __HAL_RCC_ETHMACTX_CLK_SLEEP_ENABLE __HAL_RCC_ETHMACRX_CLK_SLEEP_ENABLE __HAL_RCC_ETHMACPTP_CLK_SLEEP_ENABLE __HAL_RCC_ETHMAC_CLK_SLEEP_DISABLE __HAL_RCC_ETHMACTX_CLK_SLEEP_DISABLE __HAL_RCC_ETHMACRX_CLK_SLEEP_DISABLE __HAL_RCC_ETHMACPTP_CLK_SLEEP_DISABLE AHB2 Peripheral Clock Enable Disable __HAL_RCC_DCMI_CLK_ENABLE __HAL_RCC_DCMI_CLK_DISABLE __HAL_RCC_CRYP_CLK_ENABLE __HAL_RCC_HASH_CLK_ENABLE __HAL_RCC_CRYP_CLK_DISABLE __HAL_RCC_HASH_CLK_DISABLE AHB2 Force Release Reset...
  • Page 456 HAL RCC Extension Driver UM1940 __HAL_RCC_HASH_CLK_SLEEP_ENABLE __HAL_RCC_CRYP_CLK_SLEEP_DISABLE __HAL_RCC_HASH_CLK_SLEEP_DISABLE RCC BitAddress AliasRegion PLL_TIMEOUT_VALUE RCC Private macros to check input parameters IS_RCC_PERIPHCLOCK IS_RCC_PLLI2SN_VALUE IS_RCC_PLLI2SR_VALUE RCC Extended MCOx Clock Config __HAL_RCC_MCO1_CONFIG Description: Macro to configure the MCO1 clock. Parameters: __MCOCLKSOURCE__: specifies the MCO clock source.
  • Page 457 UM1940 HAL RCC Extension Driver RCC_MCO2SOURCE_HSE: HSE clock selected as MCO2 source RCC_MCO2SOURCE_PLLCLK: main PLL clock selected as MCO2 source __MCODIV__: specifies the MCO clock prescaler. This parameter can be one of the following values: RCC_MCODIV_1: no division applied to MCOx clock RCC_MCODIV_2: division by 2 applied to MCOx clock...
  • Page 458: Hal Rng Generic Driver

    HAL RNG Generic Driver UM1940 HAL RNG Generic Driver 38.1 RNG Firmware driver registers structures 38.1.1 RNG_HandleTypeDef Data Fields RNG_TypeDef * Instance HAL_LockTypeDef Lock __IO HAL_RNG_StateTypeDef State uint32_t RandomNumber Field Documentation RNG_TypeDef* RNG_HandleTypeDef::Instance Register base address HAL_LockTypeDef RNG_HandleTypeDef::Lock RNG locking object __IO HAL_RNG_StateTypeDef RNG_HandleTypeDef::State RNG communication state uint32_t RNG_HandleTypeDef::RandomNumber...
  • Page 459 UM1940 HAL RNG Generic Driver 38.2.3 Peripheral Control functions This section provides functions allowing to: Get the 32 bit Random number Get the 32 bit Random number with interrupt enabled Handle RNG interrupt request This section contains the following APIs: HAL_RNG_GenerateRandomNumber() HAL_RNG_GenerateRandomNumber_IT() HAL_RNG_IRQHandler()
  • Page 460 HAL RNG Generic Driver UM1940 Return values None: HAL_RNG_MspDeInit void HAL_RNG_MspDeInit (RNG_HandleTypeDef * hrng) Function name Function description DeInitializes the RNG MSP. Parameters hrng: pointer to a RNG_HandleTypeDef structure that contains the configuration information for RNG. Return values None: HAL_RNG_GetRandomNumber uint32_t HAL_RNG_GetRandomNumber (RNG_HandleTypeDef Function name * hrng)
  • Page 461 UM1940 HAL RNG Generic Driver Function description Generates a 32-bit random number in interrupt mode. Parameters hrng: pointer to a RNG_HandleTypeDef structure that contains the configuration information for RNG. Return values HAL: status HAL_RNG_ReadLastRandomNumber Function name uint32_t HAL_RNG_ReadLastRandomNumber (RNG_HandleTypeDef * hrng) Function description Read latest generated random number.
  • Page 462: Rng Firmware Driver Defines

    HAL RNG Generic Driver UM1940 HAL_RNG_ReadyDataCallback Function name void HAL_RNG_ReadyDataCallback (RNG_HandleTypeDef * hrng, uint32_t random32bit) Function description Data Ready callback in non-blocking mode. Parameters hrng: pointer to a RNG_HandleTypeDef structure that contains the configuration information for RNG. random32bit: generated random number. Return values None: HAL_RNG_GetState...
  • Page 463 UM1940 HAL RNG Generic Driver Return value: None __HAL_RNG_DISABLE Description: Disables the RNG peripheral. Parameters: __HANDLE__: RNG Handle Return value: None __HAL_RNG_GET_FLAG Description: Check the selected RNG flag status. Parameters: __HANDLE__: RNG Handle __FLAG__: RNG flag This parameter can be one of the following values: RNG_FLAG_DRDY: Data ready RNG_FLAG_CECS: Clock error current status...
  • Page 464 HAL RNG Generic Driver UM1940 __HAL_RNG_DISABLE_IT Description: Disables the RNG interrupts. Parameters: __HANDLE__: RNG Handle Return value: None __HAL_RNG_GET_IT Description: Checks whether the specified RNG interrupt has occurred or not. Parameters: __HANDLE__: RNG Handle __INTERRUPT__: specifies the RNG interrupt status flag to check. This parameter can be one of the following values: RNG_IT_DRDY: Data ready interrupt...
  • Page 465: Hal Rtc Generic Driver

    UM1940 HAL RTC Generic Driver HAL RTC Generic Driver 39.1 RTC Firmware driver registers structures 39.1.1 RTC_InitTypeDef Data Fields uint32_t HourFormat uint32_t AsynchPrediv uint32_t SynchPrediv uint32_t OutPut uint32_t OutPutPolarity uint32_t OutPutType Field Documentation uint32_t RTC_InitTypeDef::HourFormat Specifies the RTC Hour Format. This parameter can be a value of RTC_Hour_Formats uint32_t RTC_InitTypeDef::AsynchPrediv Specifies the RTC Asynchronous Predivider value.
  • Page 466: Rtc_Datetypedef

    HAL RTC Generic Driver UM1940 uint8_t RTC_TimeTypeDef::Minutes Specifies the RTC Time Minutes. This parameter must be a number between Min_Data = 0 and Max_Data = 59 uint8_t RTC_TimeTypeDef::Seconds Specifies the RTC Time Seconds. This parameter must be a number between Min_Data = 0 and Max_Data = 59 uint8_t RTC_TimeTypeDef::TimeFormat Specifies the RTC AM/PM Time.
  • Page 467: Rtc_Handletypedef

    UM1940 HAL RTC Generic Driver uint32_t RTC_AlarmTypeDef::AlarmDateWeekDaySel Specifies the RTC Alarm is on Date or WeekDay. This parameter can be a value of RTC_AlarmDateWeekDay_Definitions uint8_t RTC_AlarmTypeDef::AlarmDateWeekDay Specifies the RTC Alarm Date/WeekDay. If the Alarm Date is selected, this parameter must be set to a value in the 1-31 range. If the Alarm WeekDay is selected, this parameter can be a value of RTC_WeekDay_Definitions uint32_t RTC_AlarmTypeDef::Alarm...
  • Page 468: Backup Domain Reset

    HAL RTC Generic Driver UM1940 PI8 can be used as the RTC_AF2 pin 39.2.2 Backup Domain Reset The backup domain reset sets all RTC registers and the RCC_BDCR register to their reset values. The BKPSRAM is not affected by this reset. The only way to reset the BKPSRAM is through the Flash interface by requesting a protection level change from 1 to 0.
  • Page 469 UM1940 HAL RTC Generic Driver 39.2.6 Initialization and de-initialization functions This section provides functions allowing to initialize and configure the RTC Prescaler (Synchronous and Asynchronous), RTC Hour format, disable RTC registers Write protection, enter and exit the RTC initialization mode, RTC registers synchronization check and reference clock detection enable.
  • Page 470 HAL RTC Generic Driver UM1940 39.2.9 Peripheral Control functions This subsection provides functions allowing to Wait for RTC Time and Date Synchronization This section contains the following APIs: HAL_RTC_WaitForSynchro() 39.2.10 Peripheral State functions This subsection provides functions allowing to Get RTC state This section contains the following APIs: HAL_RTC_GetState() 39.2.11...
  • Page 471 UM1940 HAL RTC Generic Driver Function description DeInitializes the RTC MSP. Parameters hrtc: pointer to a RTC_HandleTypeDef structure that contains the configuration information for RTC. Return values None: HAL_RTC_SetTime Function name HAL_StatusTypeDef HAL_RTC_SetTime (RTC_HandleTypeDef * hrtc, RTC_TimeTypeDef * sTime, uint32_t Format) Function description Sets RTC current time.
  • Page 472 HAL RTC Generic Driver UM1940 RTC_FORMAT_BIN: Binary data format RTC_FORMAT_BCD: BCD data format Return values HAL: status HAL_RTC_GetDate Function name HAL_StatusTypeDef HAL_RTC_GetDate (RTC_HandleTypeDef * hrtc, RTC_DateTypeDef * sDate, uint32_t Format) Function description Gets RTC current date. Parameters hrtc: pointer to a RTC_HandleTypeDef structure that contains the configuration information for RTC.
  • Page 473 UM1940 HAL RTC Generic Driver RTC_FORMAT_BIN: Binary data format RTC_FORMAT_BCD: BCD data format Return values HAL: status HAL_RTC_DeactivateAlarm Function name HAL_StatusTypeDef HAL_RTC_DeactivateAlarm (RTC_HandleTypeDef * hrtc, uint32_t Alarm) Function description Deactivate the specified RTC Alarm. Parameters hrtc: pointer to a RTC_HandleTypeDef structure that contains the configuration information for RTC.
  • Page 474 HAL RTC Generic Driver UM1940 Function description This function handles AlarmA Polling request. Parameters hrtc: pointer to a RTC_HandleTypeDef structure that contains the configuration information for RTC. Timeout: Timeout duration Return values HAL: status HAL_RTC_AlarmAEventCallback Function name void HAL_RTC_AlarmAEventCallback (RTC_HandleTypeDef * hrtc) Function description Alarm A callback.
  • Page 475: Rtc Firmware Driver Defines

    UM1940 HAL RTC Generic Driver (RTC_HandleTypeDef * hrtc) Function description Enters the RTC Initialization mode. Parameters hrtc: pointer to a RTC_HandleTypeDef structure that contains the configuration information for RTC. Return values HAL: status Notes The RTC Initialization mode is write protected, use the __HAL_RTC_WRITEPROTECTION_DISABLE() before calling this function.
  • Page 476 HAL RTC Generic Driver UM1940 RTC_HOURFORMAT12_AM RTC_HOURFORMAT12_PM RTC DayLight Saving Definitions RTC_DAYLIGHTSAVING_SUB1H RTC_DAYLIGHTSAVING_ADD1H RTC_DAYLIGHTSAVING_NONE RTC Exported Macros Description: __HAL_RTC_RESET_HANDLE_STATE Reset RTC handle state. Parameters: __HANDLE__: specifies the RTC handle. Return value: None __HAL_RTC_WRITEPROTECTION_DISABLE Description: Disable the write protection for RTC registers.
  • Page 477 UM1940 HAL RTC Generic Driver __HAL_RTC_ALARMA_DISABLE Description: Disable the RTC ALARMA peripheral. Parameters: __HANDLE__: specifies the RTC handle. Return value: None __HAL_RTC_ALARMB_ENABLE Description: Enable the RTC ALARMB peripheral. Parameters: __HANDLE__: specifies the RTC handle. Return value: None __HAL_RTC_ALARMB_DISABLE Description: Disable the RTC ALARMB peripheral.
  • Page 478 HAL RTC Generic Driver UM1940 None __HAL_RTC_ALARM_DISABLE_IT Description: Disable the RTC Alarm interrupt. Parameters: __HANDLE__: specifies the RTC handle. __INTERRUPT__: specifies the RTC Alarm interrupt sources to be enabled or disabled. This parameter can be any combination of the following values: RTC_IT_ALRA: Alarm A interrupt RTC_IT_ALRB:...
  • Page 479 UM1940 HAL RTC Generic Driver This parameter can be: RTC_FLAG_ALRAF RTC_FLAG_ALRBF RTC_FLAG_ALRAW RTC_FLAG_ALRBW Return value: None __HAL_RTC_ALARM_CLEAR_FLAG Description: Clear the RTC Alarm's pending flags. Parameters: __HANDLE__: specifies the RTC handle. __FLAG__: specifies the RTC Alarm Flag sources to be enabled or disabled. This parameter can be: RTC_FLAG_ALRAF RTC_FLAG_ALRBF...
  • Page 480 HAL RTC Generic Driver UM1940 Return value: None __HAL_RTC_ALARM_EXTI_DISABLE_IT Description: Disable interrupt on the RTC Alarm associated Exti line. Return value: None __HAL_RTC_ALARM_EXTI_ENABLE_EVENT Description: Enable event on the RTC Alarm associated Exti line. Return value: None. Description: __HAL_RTC_ALARM_EXTI_DISABLE_EVENT Disable event on the RTC Alarm associated Exti line.
  • Page 481 UM1940 HAL RTC Generic Driver Return value: None. __HAL_RTC_ALARM_EXTI_ENABLE_RISING_FALLIN Description: G_EDGE Enable rising & falling edge trigger on the RTC Alarm associated Exti line. Return value: None. __HAL_RTC_ALARM_EXTI_DISABLE_RISING_FALLIN Description: G_EDGE Disable rising & falling edge trigger on the RTC Alarm associated Exti line. Return value: None.
  • Page 482 HAL RTC Generic Driver UM1940 RTC_FLAG_RSF RTC_FLAG_INITS RTC_FLAG_WUTWF RTC_FLAG_ALRBWF RTC_FLAG_ALRAWF RTC Hour Formats RTC_HOURFORMAT_24 RTC_HOURFORMAT_12 RTC Input Parameter Format Definitions RTC_FORMAT_BIN RTC_FORMAT_BCD RTC Interrupts Definitions RTC_IT_TS RTC_IT_WUT RTC_IT_ALRB RTC_IT_ALRA RTC_IT_TAMP RTC_IT_TAMP1 RTC Private macros to check input parameters IS_RTC_HOUR_FORMAT IS_RTC_OUTPUT IS_RTC_OUTPUT_POL IS_RTC_OUTPUT_TYPE IS_RTC_HOUR12...
  • Page 483 UM1940 HAL RTC Generic Driver IS_RTC_WEEKDAY IS_RTC_ALARM_DATE_WEEKDAY_DATE IS_RTC_ALARM_DATE_WEEKDAY_WEEKDAY IS_RTC_ALARM_DATE_WEEKDAY_SEL IS_RTC_ALARM_MASK IS_RTC_ALARM RTC Month Date Definitions RTC_MONTH_JANUARY RTC_MONTH_FEBRUARY RTC_MONTH_MARCH RTC_MONTH_APRIL RTC_MONTH_MAY RTC_MONTH_JUNE RTC_MONTH_JULY RTC_MONTH_AUGUST RTC_MONTH_SEPTEMBER RTC_MONTH_OCTOBER RTC_MONTH_NOVEMBER RTC_MONTH_DECEMBER RTC Output Polarity Definitions RTC_OUTPUT_POLARITY_HIGH RTC_OUTPUT_POLARITY_LOW RTC Output Selection Definitions RTC_OUTPUT_DISABLE RTC_OUTPUT_ALARMA RTC_OUTPUT_ALARMB RTC_OUTPUT_WAKEUP RTC Output Type ALARM OUT RTC_OUTPUT_TYPE_OPENDRAIN...
  • Page 484 HAL RTC Generic Driver UM1940 RTC_WEEKDAY_WEDNESDAY RTC_WEEKDAY_THURSDAY RTC_WEEKDAY_FRIDAY RTC_WEEKDAY_SATURDAY RTC_WEEKDAY_SUNDAY 484/1371 DocID028236 Rev 2...
  • Page 485: Rtcex Firmware Driver Registers Structures

    UM1940 HAL RTC Extension Driver HAL RTC Extension Driver 40.1 RTCEx Firmware driver registers structures 40.1.1 RTC_TamperTypeDef Data Fields uint32_t Tamper uint32_t PinSelection uint32_t Trigger Field Documentation uint32_t RTC_TamperTypeDef::Tamper Specifies the Tamper Pin. This parameter can be a value of RTCEx_Tamper_Pins_Definitions uint32_t RTC_TamperTypeDef::PinSelection Specifies the Tamper Pin.
  • Page 486: Rtc Timestamp And Tamper Functions

    HAL RTC Extension Driver UM1940 Tamper configuration Enable the RTC Tamper and configure the trigger using the HAL_RTCEx_SetTamper() function. You can configure RTC Tamper in interrupt mode using HAL_RTCEx_SetTamper_IT() function. The TAMPER1 alternate function can be mapped either to RTC_AF1 (PC13) or RTC_AF2 (PI8) depending on the value of TAMP1INSEL bit in RTC_TAFCR register.
  • Page 487 UM1940 HAL RTC Extension Driver Configure the Calibration Pinout (RTC_CALIB). Deactivate the Calibration Pinout (RTC_CALIB). Enable the RTC reference clock detection. Disable the RTC reference clock detection. This section contains the following APIs: HAL_RTCEx_BKUPWrite() HAL_RTCEx_BKUPRead() HAL_RTCEx_SetCoarseCalib() HAL_RTCEx_DeactivateCoarseCalib() HAL_RTCEx_SetCalibrationOutPut() HAL_RTCEx_DeactivateCalibrationOutPut() HAL_RTCEx_SetRefClock() HAL_RTCEx_DeactivateRefClock() 40.2.5 Extended features functions...
  • Page 488 HAL RTC Extension Driver UM1940 HAL_RTCEx_SetTimeStamp_IT Function name HAL_StatusTypeDef HAL_RTCEx_SetTimeStamp_IT (RTC_HandleTypeDef * hrtc, uint32_t TimeStampEdge, uint32_t RTC_TimeStampPin) Function description Sets TimeStamp with Interrupt. Parameters hrtc: pointer to a RTC_HandleTypeDef structure that contains the configuration information for RTC. TimeStampEdge: Specifies the pin edge on which the TimeStamp is activated.
  • Page 489 UM1940 HAL RTC Extension Driver Return values HAL: status HAL_RTCEx_SetTamper HAL_StatusTypeDef HAL_RTCEx_SetTamper Function name (RTC_HandleTypeDef * hrtc, RTC_TamperTypeDef * sTamper) Function description Sets Tamper. Parameters hrtc: pointer to a RTC_HandleTypeDef structure that contains the configuration information for RTC. sTamper: Pointer to Tamper Structure. Return values HAL: status Notes...
  • Page 490 HAL RTC Extension Driver UM1940 HAL_RTCEx_Tamper1EventCallback Function name void HAL_RTCEx_Tamper1EventCallback (RTC_HandleTypeDef * hrtc) Function description Tamper 1 callback. Parameters hrtc: pointer to a RTC_HandleTypeDef structure that contains the configuration information for RTC. Return values None: HAL_RTCEx_TimeStampEventCallback Function name void HAL_RTCEx_TimeStampEventCallback (RTC_HandleTypeDef * hrtc) Function description TimeStamp callback.
  • Page 491 UM1940 HAL RTC Extension Driver WakeUpClock: Wake up clock Return values HAL: status HAL_RTCEx_SetWakeUpTimer_IT Function name HAL_StatusTypeDef HAL_RTCEx_SetWakeUpTimer_IT (RTC_HandleTypeDef * hrtc, uint32_t WakeUpCounter, uint32_t WakeUpClock) Function description Sets wake up timer with interrupt. Parameters hrtc: pointer to a RTC_HandleTypeDef structure that contains the configuration information for RTC.
  • Page 492 HAL RTC Extension Driver UM1940 Function description Wake Up Timer callback. Parameters hrtc: pointer to a RTC_HandleTypeDef structure that contains the configuration information for RTC. Return values None: HAL_RTCEx_PollForWakeUpTimerEvent Function name HAL_StatusTypeDef HAL_RTCEx_PollForWakeUpTimerEvent (RTC_HandleTypeDef * hrtc, uint32_t Timeout) Function description This function handles Wake Up Timer Polling.
  • Page 493 UM1940 HAL RTC Extension Driver Parameters hrtc: pointer to a RTC_HandleTypeDef structure that contains the configuration information for RTC. CalibSign: Specifies the sign of the coarse calibration value. This parameter can be one of the following values : RTC_CALIBSIGN_POSITIVE: The value sign is positive RTC_CALIBSIGN_NEGATIVE: The value sign is negative Value: value of coarse calibration expressed in ppm (coded...
  • Page 494: Rtcex Firmware Driver Defines

    HAL RTC Extension Driver UM1940 Parameters hrtc: pointer to a RTC_HandleTypeDef structure that contains the configuration information for RTC. Return values HAL: status HAL_RTCEx_DeactivateRefClock Function name HAL_StatusTypeDef HAL_RTCEx_DeactivateRefClock (RTC_HandleTypeDef * hrtc) Function description Disable the RTC reference clock detection. Parameters hrtc: pointer to a RTC_HandleTypeDef structure that contains the configuration information for RTC.
  • Page 495 UM1940 HAL RTC Extension Driver RTC_BKP_DR7 RTC_BKP_DR8 RTC_BKP_DR9 RTC_BKP_DR10 RTC_BKP_DR11 RTC_BKP_DR12 RTC_BKP_DR13 RTC_BKP_DR14 RTC_BKP_DR15 RTC_BKP_DR16 RTC_BKP_DR17 RTC_BKP_DR18 RTC_BKP_DR19 RTC Calibration __HAL_RTC_COARSE_CALIB_ENABLE Description: Enable the Coarse calibration process. Parameters: __HANDLE__: specifies the RTC handle. Return value: None __HAL_RTC_COARSE_CALIB_DISABLE Description: Disable the Coarse calibration process.
  • Page 496 HAL RTC Extension Driver UM1940 __HAL_RTC_CALIBRATION_OUTPUT_DISABLE Description: Disable the calibration output. Parameters: __HANDLE__: specifies the RTC handle. Return value: None __HAL_RTC_CLOCKREF_DETECTION_ENABLE Description: Enable the clock reference detection. Parameters: __HANDLE__: specifies the RTC handle. Return value: None __HAL_RTC_CLOCKREF_DETECTION_DISABLE Description: Disable the clock reference detection.
  • Page 497 UM1940 HAL RTC Extension Driver RTC Tamper __HAL_RTC_TAMPER1_ENABLE Description: Enable the RTC Tamper1 input detection. Parameters: __HANDLE__: specifies the RTC handle. Return value: None __HAL_RTC_TAMPER1_DISABLE Description: Disable the RTC Tamper1 input detection. Parameters: __HANDLE__: specifies the RTC handle. Return value: None Description: __HAL_RTC_TAMPER_GET_IT...
  • Page 498 HAL RTC Extension Driver UM1940 __HAL_RTC_TAMPER_GET_FLAG Description: Get the selected RTC Tamper's flag status. Parameters: __HANDLE__: specifies the RTC handle. __FLAG__: specifies the RTC Tamper Flag sources to be enabled or disabled. This parameter can be: RTC_FLAG_TAMP1F Return value: None __HAL_RTC_TAMPER_CLEAR_FLAG Description: Clear the RTC Tamper's pending flags.
  • Page 499 UM1940 HAL RTC Extension Driver and Timestamp associated Exti line. Return value: None. __HAL_RTC_TAMPER_TIMESTAMP_EXTI_ Description: DISABLE_EVENT Disable event on the RTC Tamper and Timestamp associated Exti line. Return value: None. __HAL_RTC_TAMPER_TIMESTAMP_EXTI_ Description: ENABLE_FALLING_EDGE Enable falling edge trigger on the RTC Tamper and Timestamp associated Exti line.
  • Page 500 HAL RTC Extension Driver UM1940 on the RTC Tamper and Timestamp associated Exti line. Return value: None. Description: __HAL_RTC_TAMPER_TIMESTAMP_EXTI_ GET_FLAG Check whether the RTC Tamper and Timestamp associated Exti line interrupt flag is set or not. Return value: Line: Status. __HAL_RTC_TAMPER_TIMESTAMP_EXTI_ Description: CLEAR_FLAG...
  • Page 501 UM1940 HAL RTC Extension Driver Return value: None __HAL_RTC_TIMESTAMP_ENABLE_IT Description: Enable the RTC TimeStamp interrupt. Parameters: __HANDLE__: specifies the RTC handle. __INTERRUPT__: specifies the RTC TimeStamp interrupt sources to be enabled or disabled. This parameter can be: RTC_IT_TS: TimeStamp interrupt Return value: None Description:...
  • Page 502 HAL RTC Extension Driver UM1940 __HAL_RTC_TIMESTAMP_GET_IT_SOURCE Description: Check whether the specified RTC Time Stamp interrupt has been enabled or not. Parameters: __HANDLE__: specifies the RTC handle. __INTERRUPT__: specifies the RTC Time Stamp interrupt source to check. This parameter can be: RTC_IT_TS: TimeStamp interrupt Return value:...
  • Page 503 UM1940 HAL RTC Extension Driver RTC TimeStamp Edges Definitions RTC_TIMESTAMPEDGE_RISING RTC_TIMESTAMPEDGE_FALLING RTC WakeUp Timer Description: __HAL_RTC_WAKEUPTIMER_ENABLE Enable the RTC WakeUp Timer peripheral. Parameters: __HANDLE__: specifies the RTC handle. Return value: None __HAL_RTC_WAKEUPTIMER_DISABLE Description: Disable the RTC Wake-up Timer peripheral. Parameters: __HANDLE__: specifies the RTC handle.
  • Page 504 HAL RTC Extension Driver UM1940 the RTC WakeUpTimer interrupt sources to be enabled or disabled. This parameter can be: RTC_IT_WUT: WakeUpTimer A interrupt Return value: None __HAL_RTC_WAKEUPTIMER_GET_IT Description: Check whether the specified RTC WakeUpTimer interrupt has occurred or not. Parameters: __HANDLE__: specifies the RTC handle.
  • Page 505 UM1940 HAL RTC Extension Driver WakeUpTimer Flag to check. This parameter can be: RTC_FLAG_WUTF RTC_FLAG_WUTWF Return value: None __HAL_RTC_WAKEUPTIMER_CLEAR_FLAG Description: Clear the RTC Wake Up timer's pending flags. Parameters: __HANDLE__: specifies the RTC handle. __FLAG__: specifies the RTC Tamper Flag sources to be enabled or disabled.
  • Page 506 HAL RTC Extension Driver UM1940 None. __HAL_RTC_WAKEUPTIMER_EXTI_ENABLE_ Description: FALLING_EDGE Enable falling edge trigger on the RTC Wake-up Timer associated Exti line. Return value: None. __HAL_RTC_WAKEUPTIMER_EXTI_DISABLE_ Description: FALLING_EDGE Disable falling edge trigger on the RTC Wake-up Timer associated Exti line. Return value: None.
  • Page 507 UM1940 HAL RTC Extension Driver Return value: Line: Status. __HAL_RTC_WAKEUPTIMER_EXTI_CLEAR_ Description: FLAG Clear the RTC Wake-up Timer associated Exti line flag. Return value: None. __HAL_RTC_WAKEUPTIMER_EXTI_GENERATE_ Description: SWIT Generate a Software interrupt on the RTC Wake-up Timer associated Exti line. Return value: None.
  • Page 508: Sd Firmware Driver Registers Structures

    HAL SD Generic Driver UM1940 HAL SD Generic Driver 41.1 SD Firmware driver registers structures 41.1.1 HAL_SD_CardInfoTypeDef Data Fields uint32_t CardType uint32_t CardVersion uint32_t Class uint32_t RelCardAdd uint32_t BlockNbr uint32_t BlockSize uint32_t LogBlockNbr uint32_t LogBlockSize Field Documentation uint32_t HAL_SD_CardInfoTypeDef::CardType Specifies the card Type uint32_t HAL_SD_CardInfoTypeDef::CardVersion Specifies the card version uint32_t HAL_SD_CardInfoTypeDef::Class...
  • Page 509: Hal_Sd_Cardcsdtypedef

    UM1940 HAL SD Generic Driver uint32_t CSD uint32_t CID Field Documentation SD_TypeDef* SD_HandleTypeDef::Instance SD registers base address SD_InitTypeDef SD_HandleTypeDef::Init SD required parameters HAL_LockTypeDef SD_HandleTypeDef::Lock SD locking object uint32_t* SD_HandleTypeDef::pTxBuffPtr Pointer to SD Tx transfer Buffer uint32_t SD_HandleTypeDef::TxXferSize SD Tx Transfer size uint32_t* SD_HandleTypeDef::pRxBuffPtr Pointer to SD Rx transfer Buffer uint32_t SD_HandleTypeDef::RxXferSize...
  • Page 510 HAL SD Generic Driver UM1940 __IO uint8_t MaxRdCurrentVDDMax __IO uint8_t MaxWrCurrentVDDMin __IO uint8_t MaxWrCurrentVDDMax __IO uint8_t DeviceSizeMul __IO uint8_t EraseGrSize __IO uint8_t EraseGrMul __IO uint8_t WrProtectGrSize __IO uint8_t WrProtectGrEnable __IO uint8_t ManDeflECC __IO uint8_t WrSpeedFact __IO uint8_t MaxWrBlockLen __IO uint8_t WriteBlockPaPartial __IO uint8_t Reserved3 __IO uint8_t ContentProtectAppli __IO uint8_t FileFormatGrouop...
  • Page 511: Hal_Sd_Cardcidtypedef

    UM1940 HAL SD Generic Driver __IO uint8_t HAL_SD_CardCSDTypeDef::MaxRdCurrentVDDMin Max. read current @ VDD min __IO uint8_t HAL_SD_CardCSDTypeDef::MaxRdCurrentVDDMax Max. read current @ VDD max __IO uint8_t HAL_SD_CardCSDTypeDef::MaxWrCurrentVDDMin Max. write current @ VDD min __IO uint8_t HAL_SD_CardCSDTypeDef::MaxWrCurrentVDDMax Max. write current @ VDD max __IO uint8_t HAL_SD_CardCSDTypeDef::DeviceSizeMul Device size multiplier __IO uint8_t HAL_SD_CardCSDTypeDef::EraseGrSize...
  • Page 512: Hal_Sd_Cardstatustypedef

    HAL SD Generic Driver UM1940 __IO uint8_t ProdRev __IO uint32_t ProdSN __IO uint8_t Reserved1 __IO uint16_t ManufactDate __IO uint8_t CID_CRC __IO uint8_t Reserved2 Field Documentation __IO uint8_t HAL_SD_CardCIDTypeDef::ManufacturerID Manufacturer ID __IO uint16_t HAL_SD_CardCIDTypeDef::OEM_AppliID OEM/Application ID __IO uint32_t HAL_SD_CardCIDTypeDef::ProdName1 Product Name part1 __IO uint8_t HAL_SD_CardCIDTypeDef::ProdName2 Product Name part2 __IO uint8_t HAL_SD_CardCIDTypeDef::ProdRev...
  • Page 513: Sd Firmware Driver Api Description

    UM1940 HAL SD Generic Driver __IO uint8_t HAL_SD_CardStatusTypeDef::SpeedClass Carries information about the speed class of the card __IO uint8_t HAL_SD_CardStatusTypeDef::PerformanceMove Carries information about the card's performance move __IO uint8_t HAL_SD_CardStatusTypeDef::AllocationUnitSize Carries information about the card's allocation unit size __IO uint16_t HAL_SD_CardStatusTypeDef::EraseSize Determines the number of AUs to be erased in one operation __IO uint8_t HAL_SD_CardStatusTypeDef::EraseTimeout Determines the timeout for any number of AU erase...
  • Page 514 HAL SD Generic Driver UM1940 SDIO interrupts pending bits are managed using the macros __HAL_SD_GET_IT() and __HAL_SD_CLEAR_IT() At this stage, you can perform SD read/write/erase operations after SD card initialization SD Card Initialization and configuration To initialize the SD Card, use the HAL_SD_Init() function. It Initializes SDIO IP(STM32 side) and the SD Card, and put it into StandBy State (Ready for data transfer).
  • Page 515 UM1940 HAL SD Generic Driver SD Card Write operation You can write to SD card in polling mode by using function HAL_SD_WriteBlocks(). This function allows the read of 512 bytes blocks. You can choose either one block read operation or multiple block read operation by adjusting the "NumberOfBlocks" parameter.
  • Page 516 HAL SD Generic Driver UM1940 You can refer to the SD HAL driver header file for more useful macros 41.2.2 Initialization and de-initialization functions This section provides functions allowing to initialize/de-initialize the SD card device to be ready for use. This section contains the following APIs: HAL_SD_Init() HAL_SD_InitCard()
  • Page 517 UM1940 HAL SD Generic Driver 41.2.5 Detailed description of functions HAL_SD_Init Function name HAL_StatusTypeDef HAL_SD_Init (SD_HandleTypeDef * hsd) Function description Initializes the SD according to the specified parameters in the SD_HandleTypeDef and create the associated handle. Parameters hsd: Pointer to the SD handle Return values HAL: status HAL_SD_InitCard...
  • Page 518 HAL SD Generic Driver UM1940 uint32_t NumberOfBlocks, uint32_t Timeout) Function description Reads block(s) from a specified address in a card. Parameters hsd: Pointer to SD handle pData: pointer to the buffer that will contain the received data BlockAdd: Block Address from where data is to be read NumberOfBlocks: Number of SD blocks to read Timeout: Specify timeout value Return values...
  • Page 519 UM1940 HAL SD Generic Driver pData: Pointer to the buffer that will contain the received data BlockAdd: Block Address from where data is to be read NumberOfBlocks: Number of blocks to read. Return values HAL: status Notes This API should be followed by a check on the card state through HAL_SD_GetCardState().
  • Page 520 HAL SD Generic Driver UM1940 uint32_t NumberOfBlocks) Function description Writes block(s) to a specified address in a card. Parameters hsd: Pointer to SD handle pData: Pointer to the buffer that will contain the data to transmit BlockAdd: Block Address where data will be written NumberOfBlocks: Number of blocks to write Return values HAL: status...
  • Page 521 UM1940 HAL SD Generic Driver Function description SD Abort callbacks. Parameters hsd: Pointer SD handle Return values None: HAL_SD_ConfigWideBusOperation Function name HAL_StatusTypeDef HAL_SD_ConfigWideBusOperation (SD_HandleTypeDef * hsd, uint32_t WideMode) Function description Enables wide bus operation for the requested card if supported by card.
  • Page 522 HAL SD Generic Driver UM1940 pCSD) Function description Returns information the information of the card which are stored on the CSD register. Parameters hsd: Pointer to SD handle pCSD: Pointer to a HAL_SD_CardCSDTypeDef structure that contains all CSD register parameters Return values HAL: status HAL_SD_GetCardStatus...
  • Page 523: Sd Firmware Driver Defines

    UM1940 HAL SD Generic Driver HAL_SD_Abort Function name HAL_StatusTypeDef HAL_SD_Abort (SD_HandleTypeDef * hsd) Function description Abort the current transfer and disable the SD. Parameters hsd: pointer to a SD_HandleTypeDef structure that contains the configuration information for SD module. Return values HAL: status HAL_SD_Abort_IT Function name...
  • Page 524 HAL SD Generic Driver UM1940 locked card HAL_SD_ERROR_COM_CRC_FAILED CRC check of the previous command failed HAL_SD_ERROR_ILLEGAL_CMD Command is not legal for the card state HAL_SD_ERROR_CARD_ECC_FAILED Card internal ECC was applied but failed to correct the data HAL_SD_ERROR_CC_ERR Internal card controller error HAL_SD_ERROR_GENERAL_UNKNOWN_ERR General or unknown error HAL_SD_ERROR_STREAM_READ_UNDERRUN...
  • Page 525 UM1940 HAL SD Generic Driver SD Supported Memory Cards CARD_SDSC CARD_SDHC_SDXC CARD_SECURED SD Supported Version CARD_V1_X CARD_V2_X Exported Constants BLOCKSIZE Block size is 512 bytes SD Exported Macros __HAL_SD_ENABLE Description: Enable the SD device. Return value: None __HAL_SD_DISABLE Description: Disable the SD device. Return value: None Description:...
  • Page 526 HAL SD Generic Driver UM1940 SDIO_IT_DTIMEOUT: Data timeout interrupt SDIO_IT_TXUNDERR: Transmit FIFO underrun error interrupt SDIO_IT_RXOVERR: Received FIFO overrun error interrupt SDIO_IT_CMDREND: Command response received (CRC check passed) interrupt SDIO_IT_CMDSENT: Command sent (no response required) interrupt SDIO_IT_DATAEND: Data end (data counter, SDIDCOUNT, is zero) interrupt SDIO_IT_DBCKEND: Data block sent/received (CRC check passed) interrupt...
  • Page 527 UM1940 HAL SD Generic Driver error interrupt SDIO_IT_RXOVERR: Received FIFO overrun error interrupt SDIO_IT_CMDREND: Command response received (CRC check passed) interrupt SDIO_IT_CMDSENT: Command sent (no response required) interrupt SDIO_IT_DATAEND: Data end (data counter, SDIDCOUNT, is zero) interrupt SDIO_IT_DBCKEND: Data block sent/received (CRC check passed) interrupt SDIO_IT_CMDACT: Command transfer in progress interrupt...
  • Page 528 HAL SD Generic Driver UM1940 SDIO_FLAG_CMDREND: Command response received (CRC check passed) SDIO_FLAG_CMDSENT: Command sent (no response required) SDIO_FLAG_DATAEND: Data end (data counter, SDIDCOUNT, is zero) SDIO_FLAG_DBCKEND: Data block sent/received (CRC check passed) SDIO_FLAG_CMDACT: Command transfer in progress SDIO_FLAG_TXACT: Data transmit in progress SDIO_FLAG_RXACT: Data receive in progress SDIO_FLAG_TXFIFOHE: Transmit FIFO Half Empty...
  • Page 529 UM1940 HAL SD Generic Driver SDIO_FLAG_SDIOIT: SD I/O interrupt received Return value: None __HAL_SD_GET_IT Description: Check whether the specified SD interrupt has occurred or not. Parameters: __HANDLE__: SD Handle __INTERRUPT__: specifies the SDMMC interrupt source to check. This parameter can be one of the following values: SDIO_IT_CCRCFAIL: Command response received (CRC check failed) interrupt...
  • Page 530 HAL SD Generic Driver UM1940 interrupt Return value: The: new state of SD IT (SET or RESET). __HAL_SD_CLEAR_IT Description: Clear the SD's interrupt pending bits. Parameters: __HANDLE__: SD Handle __INTERRUPT__: specifies the interrupt pending bit to clear. This parameter can be one or a combination of the following values: SDIO_IT_CCRCFAIL: Command response received (CRC check failed) interrupt...
  • Page 531: Hal Smartcard Generic Driver

    UM1940 HAL SMARTCARD Generic Driver HAL SMARTCARD Generic Driver 42.1 SMARTCARD Firmware driver registers structures 42.1.1 SMARTCARD_InitTypeDef Data Fields uint32_t BaudRate uint32_t WordLength uint32_t StopBits uint32_t Parity uint32_t Mode uint32_t CLKPolarity uint32_t CLKPhase uint32_t CLKLastBit uint32_t Prescaler uint32_t GuardTime uint32_t NACKState Field Documentation uint32_t SMARTCARD_InitTypeDef::BaudRate This member configures the SmartCard communication baud rate.
  • Page 532: Smartcard_Handletypedef

    HAL SMARTCARD Generic Driver UM1940 the smartcard clock. The value given in the register (5 significant bits) is multiplied by 2 to give the division factor of the source clock frequency. This parameter can be a value of SMARTCARD_Prescaler uint32_t SMARTCARD_InitTypeDef::GuardTime Specifies the SmartCard Guard Time value in terms of number of baud clocks uint32_t SMARTCARD_InitTypeDef::NACKState Specifies the SmartCard NACK Transmission state.
  • Page 533 UM1940 HAL SMARTCARD Generic Driver Enable the clock for the SMARTCARD GPIOs. Configure these SMARTCARD pins as alternate function pull-up. NVIC configuration if you need to use interrupt process (HAL_SMARTCARD_Transmit_IT() and HAL_SMARTCARD_Receive_IT() APIs): Configure the USARTx interrupt priority. Enable the NVIC USART IRQ handle. DMA Configuration if you need to use DMA process (HAL_SMARTCARD_Transmit_DMA() and HAL_SMARTCARD_Receive_DMA() APIs):...
  • Page 534 HAL SMARTCARD Generic Driver UM1940 DMA mode IO operation Send an amount of data in non blocking mode (DMA) using HAL_SMARTCARD_Transmit_DMA() At transmission end of transfer HAL_SMARTCARD_TxCpltCallback is executed and user can add his own code by customization of function pointer HAL_SMARTCARD_TxCpltCallback Receive an amount of data in non blocking mode (DMA) using HAL_SMARTCARD_Receive_DMA()
  • Page 535 UM1940 HAL SMARTCARD Generic Driver NACKState: The Smartcard NACK state Recommended SmartCard interface configuration to get the Answer to Reset from the Card: Word Length = 9 Bits 1.5 Stop Bit Even parity BaudRate = 12096 baud Tx and Rx enabled Please refer to the ISO 7816-3 specification for more details.
  • Page 536 HAL SMARTCARD Generic Driver UM1940 HAL_SMARTCARD_Receive_DMA() A set of Transfer Complete Callbacks are provided in non Blocking mode: HAL_SMARTCARD_TxCpltCallback() HAL_SMARTCARD_RxCpltCallback() HAL_SMARTCARD_ErrorCallback() This section contains the following APIs: HAL_SMARTCARD_Transmit() HAL_SMARTCARD_Receive() HAL_SMARTCARD_Transmit_IT() HAL_SMARTCARD_Receive_IT() HAL_SMARTCARD_Transmit_DMA() HAL_SMARTCARD_Receive_DMA() HAL_SMARTCARD_Abort() HAL_SMARTCARD_AbortTransmit() HAL_SMARTCARD_AbortReceive() HAL_SMARTCARD_Abort_IT() HAL_SMARTCARD_AbortTransmit_IT() HAL_SMARTCARD_AbortReceive_IT() HAL_SMARTCARD_IRQHandler() HAL_SMARTCARD_TxCpltCallback() HAL_SMARTCARD_RxCpltCallback() HAL_SMARTCARD_ErrorCallback()
  • Page 537 UM1940 HAL SMARTCARD Generic Driver HAL_SMARTCARD_ReInit Function name HAL_StatusTypeDef HAL_SMARTCARD_ReInit (SMARTCARD_HandleTypeDef * hsc) Function description HAL_SMARTCARD_DeInit HAL_StatusTypeDef HAL_SMARTCARD_DeInit Function name (SMARTCARD_HandleTypeDef * hsc) Function description DeInitializes the USART SmartCard peripheral. Parameters hsc: pointer to a SMARTCARD_HandleTypeDef structure that contains the configuration information for SMARTCARD module.
  • Page 538 HAL SMARTCARD Generic Driver UM1940 Return values HAL: status HAL_SMARTCARD_Receive HAL_StatusTypeDef HAL_SMARTCARD_Receive Function name (SMARTCARD_HandleTypeDef * hsc, uint8_t * pData, uint16_t Size, uint32_t Timeout) Function description Receive an amount of data in blocking mode. Parameters hsc: pointer to a SMARTCARD_HandleTypeDef structure that contains the configuration information for SMARTCARD module.
  • Page 539 UM1940 HAL SMARTCARD Generic Driver Parameters hsc: pointer to a SMARTCARD_HandleTypeDef structure that contains the configuration information for SMARTCARD module. pData: pointer to data buffer Size: amount of data to be sent Return values HAL: status HAL_SMARTCARD_Receive_DMA Function name HAL_StatusTypeDef HAL_SMARTCARD_Receive_DMA (SMARTCARD_HandleTypeDef * hsc, uint8_t * pData, uint16_t Size) Function description...
  • Page 540 HAL SMARTCARD Generic Driver UM1940 performs following operations : Disable PPP InterruptsDisable the DMA transfer in the peripheral register (if enabled)Abort DMA transfer by calling HAL_DMA_Abort (in case of transfer in DMA mode)Set handle State to READY This procedure is executed in blocking mode : when exiting function, Abort is considered as completed.
  • Page 541 UM1940 HAL SMARTCARD Generic Driver Return values HAL: status Notes This procedure could be used for aborting any ongoing transfer started in Interrupt or DMA mode. This procedure performs following operations : Disable PPP InterruptsDisable the DMA transfer in the peripheral register (if enabled)Abort DMA transfer by calling HAL_DMA_Abort_IT (in case of transfer in DMA mode)Set handle State to READYAt abort completion, call user abort complete callback...
  • Page 542 HAL SMARTCARD Generic Driver UM1940 module. Return values None: HAL_SMARTCARD_RxCpltCallback Function name void HAL_SMARTCARD_RxCpltCallback (SMARTCARD_HandleTypeDef * hsc) Function description Rx Transfer completed callbacks. Parameters hsc: pointer to a SMARTCARD_HandleTypeDef structure that contains the configuration information for SMARTCARD module. Return values None: HAL_SMARTCARD_ErrorCallback Function name...
  • Page 543: Smartcard Firmware Driver Defines

    UM1940 HAL SMARTCARD Generic Driver Return values None: HAL_SMARTCARD_GetState HAL_SMARTCARD_StateTypeDef Function name HAL_SMARTCARD_GetState (SMARTCARD_HandleTypeDef * hsc) Function description return the SMARTCARD state Parameters hsc: pointer to a SMARTCARD_HandleTypeDef structure that contains the configuration information for SMARTCARD module. Return values HAL: state HAL_SMARTCARD_GetError Function name uint32_t HAL_SMARTCARD_GetError...
  • Page 544 HAL SMARTCARD Generic Driver UM1940 SMARTCARD Exported Macros __HAL_SMARTCARD_RESET_HANDLE_STA Description: Reset SMARTCARD handle gstate & RxState. Parameters: __HANDLE__: specifies the SMARTCARD Handle. Return value: None __HAL_SMARTCARD_FLUSH_DRREGISTER Description: Flushs the Smartcard DR register. Parameters: __HANDLE__: specifies the SMARTCARD Handle. __HAL_SMARTCARD_GET_FLAG Description: Checks whether the specified Smartcard flag is set or not.
  • Page 545 UM1940 HAL SMARTCARD Generic Driver Clears the specified Smartcard pending flags. Parameters: __HANDLE__: specifies the SMARTCARD Handle. __FLAG__: specifies the flag to check. This parameter can be any combination of the following values: SMARTCARD_FLAG_TC: Transmission Complete flag. SMARTCARD_FLAG_RXNE: Receive data register not empty flag.
  • Page 546 HAL SMARTCARD Generic Driver UM1940 can be USARTx where x: 1, 2, 3, 4, 5, 6, 7 or 8 to select the USART or SMARTCARD peripheral. Return value: None Description: __HAL_SMARTCARD_CLEAR_NEFLAG Clear the SMARTCARD NE pending flag. Parameters: __HANDLE__: specifies the USART Handle.
  • Page 547 UM1940 HAL SMARTCARD Generic Driver __HANDLE__: specifies the SMARTCARD Handle. __INTERRUPT__: specifies the SMARTCARD interrupt source to check. This parameter can be one of the following values: SMARTCARD_IT_TXE: Transmit Data Register empty interrupt SMARTCARD_IT_TC: Transmission complete interrupt SMARTCARD_IT_RXNE: Receive Data register not empty interrupt SMARTCARD_IT_IDLE: Idle line detection interrupt...
  • Page 548 HAL SMARTCARD Generic Driver UM1940 FALSE). __HAL_SMARTCARD_ONE_BIT_SAMPLE_EN Description: ABLE Macro to enable the SMARTCARD's one bit sample method. Parameters: __HANDLE__: specifies the SMARTCARD Handle. Return value: None __HAL_SMARTCARD_ONE_BIT_SAMPLE_DI Description: SABLE Macro to disable the SMARTCARD's one bit sample method. Parameters: __HANDLE__: specifies the SMARTCARD Handle.
  • Page 549 UM1940 HAL SMARTCARD Generic Driver None __HAL_SMARTCARD_DMA_REQUEST_ENAB Description: Macros to enable or disable the SmartCard DMA request. Parameters: __HANDLE__: specifies the SmartCard Handle. __REQUEST__: specifies the SmartCard DMA request. This parameter can be one of the following values: SMARTCARD_DMAREQ_TX: SmartCard DMA transmit request SMARTCARD_DMAREQ_RX : SmartCard DMA receive...
  • Page 550 HAL SMARTCARD Generic Driver UM1940 SMARTCARD_PRESCALER_SYSCLK_DIV18 SYSCLK divided by 18 SMARTCARD_PRESCALER_SYSCLK_DIV20 SYSCLK divided by 20 SMARTCARD_PRESCALER_SYSCLK_DIV22 SYSCLK divided by 22 SMARTCARD_PRESCALER_SYSCLK_DIV24 SYSCLK divided by 24 SMARTCARD_PRESCALER_SYSCLK_DIV26 SYSCLK divided by 26 SMARTCARD_PRESCALER_SYSCLK_DIV28 SYSCLK divided by 28 SMARTCARD_PRESCALER_SYSCLK_DIV30 SYSCLK divided by 30 SMARTCARD_PRESCALER_SYSCLK_DIV32 SYSCLK divided by 32 SMARTCARD_PRESCALER_SYSCLK_DIV34...
  • Page 551: Hal Spi Generic Driver

    UM1940 HAL SPI Generic Driver HAL SPI Generic Driver 43.1 SPI Firmware driver registers structures 43.1.1 SPI_InitTypeDef Data Fields uint32_t Mode uint32_t Direction uint32_t DataSize uint32_t CLKPolarity uint32_t CLKPhase uint32_t NSS uint32_t BaudRatePrescaler uint32_t FirstBit uint32_t TIMode uint32_t CRCCalculation uint32_t CRCPolynomial Field Documentation uint32_t SPI_InitTypeDef::Mode Specifies the SPI operating mode.
  • Page 552: Spi_Handletypedef

    HAL SPI Generic Driver UM1940 uint32_t SPI_InitTypeDef::CRCPolynomial Specifies the polynomial used for the CRC calculation. This parameter must be a number between Min_Data = 0 and Max_Data = 65535 43.1.2 __SPI_HandleTypeDef Data Fields SPI_TypeDef * Instance SPI_InitTypeDef Init uint8_t * pTxBuffPtr uint16_t TxXferSize __IO uint16_t TxXferCount uint8_t * pRxBuffPtr...
  • Page 553 UM1940 HAL SPI Generic Driver Configure the SPIx interrupt priority Enable the NVIC SPI IRQ handle DMA Configuration if you need to use DMA process Declare a DMA_HandleTypeDef handle structure for the transmit or receive stream Enable the DMAx clock Configure the DMA handle parameters Configure the DMA Tx or Rx stream Associate the initialized hdma_tx handle to the hspi DMA Tx or Rx handle...
  • Page 554 HAL SPI Generic Driver UM1940 CRC Polynomial if CRC enabled Call the function HAL_SPI_DeInit() to restore the default configuration of the selected SPIx peripheral. This section contains the following APIs: HAL_SPI_Init() HAL_SPI_DeInit() HAL_SPI_MspInit() HAL_SPI_MspDeInit() 43.2.3 IO operation functions This subsection provides a set of functions allowing to manage the SPI data transfers. The SPI supports master and slave mode : There are two modes of transfer: Blocking mode: The communication is performed in polling mode.
  • Page 555 UM1940 HAL SPI Generic Driver 43.2.4 Peripheral State and Errors functions This subsection provides a set of functions allowing to control the SPI. HAL_SPI_GetState() API can be helpful to check in run-time the state of the SPI peripheral HAL_SPI_GetError() check in run-time Errors occurring during communication This section contains the following APIs: HAL_SPI_GetState() HAL_SPI_GetError()
  • Page 556 HAL SPI Generic Driver UM1940 HAL_SPI_Transmit Function name HAL_StatusTypeDef HAL_SPI_Transmit (SPI_HandleTypeDef * hspi, uint8_t * pData, uint16_t Size, uint32_t Timeout) Function description Transmit an amount of data in blocking mode. Parameters hspi: pointer to a SPI_HandleTypeDef structure that contains the configuration information for SPI module. pData: pointer to data buffer Size: amount of data to be sent Timeout: Timeout duration...
  • Page 557 UM1940 HAL SPI Generic Driver Return values HAL: status HAL_SPI_Receive_IT HAL_StatusTypeDef HAL_SPI_Receive_IT Function name (SPI_HandleTypeDef * hspi, uint8_t * pData, uint16_t Size) Function description Receive an amount of data in non-blocking mode with Interrupt. Parameters hspi: pointer to a SPI_HandleTypeDef structure that contains the configuration information for SPI module.
  • Page 558 HAL SPI Generic Driver UM1940 Return values HAL: status Notes When the CRC feature is enabled the pData Length must be Size + 1. HAL_SPI_TransmitReceive_DMA Function name HAL_StatusTypeDef HAL_SPI_TransmitReceive_DMA (SPI_HandleTypeDef * hspi, uint8_t * pTxData, uint8_t * pRxData, uint16_t Size) Function description Transmit and Receive an amount of data in non-blocking mode with DMA.
  • Page 559 UM1940 HAL SPI Generic Driver Return values None: HAL_SPI_TxCpltCallback void HAL_SPI_TxCpltCallback (SPI_HandleTypeDef * hspi) Function name Function description Tx Transfer completed callback. Parameters hspi: pointer to a SPI_HandleTypeDef structure that contains the configuration information for SPI module. Return values None: HAL_SPI_RxCpltCallback void HAL_SPI_RxCpltCallback (SPI_HandleTypeDef * hspi) Function name...
  • Page 560: Spi Firmware Driver Defines

    HAL SPI Generic Driver UM1940 HAL_SPI_TxRxHalfCpltCallback Function name void HAL_SPI_TxRxHalfCpltCallback (SPI_HandleTypeDef * hspi) Function description Tx and Rx Half Transfer callback. Parameters hspi: pointer to a SPI_HandleTypeDef structure that contains the configuration information for SPI module. Return values None: HAL_SPI_ErrorCallback Function name void HAL_SPI_ErrorCallback (SPI_HandleTypeDef * hspi) Function description...
  • Page 561 UM1940 HAL SPI Generic Driver SPI_BAUDRATEPRESCALER_64 SPI_BAUDRATEPRESCALER_128 SPI_BAUDRATEPRESCALER_256 SPI Clock Phase SPI_PHASE_1EDGE SPI_PHASE_2EDGE SPI Clock Polarity SPI_POLARITY_LOW SPI_POLARITY_HIGH SPI CRC Calculation SPI_CRCCALCULATION_DISABLE SPI_CRCCALCULATION_ENABLE SPI Data Size SPI_DATASIZE_8BIT SPI_DATASIZE_16BIT SPI Direction Mode SPI_DIRECTION_2LINES SPI_DIRECTION_2LINES_RXONLY SPI_DIRECTION_1LINE SPI Error Code HAL_SPI_ERROR_NONE No error HAL_SPI_ERROR_MODF MODF error HAL_SPI_ERROR_CRC...
  • Page 562 HAL SPI Generic Driver UM1940 Enable or disable the specified SPI interrupts. Parameters: __HANDLE__: specifies the SPI Handle. This parameter can be SPI where x: 1, 2, or 3 to select the SPI peripheral. __INTERRUPT__: specifies the interrupt source to enable or disable. This parameter can be one of the following values: SPI_IT_TXE: Tx buffer empty interrupt enable...
  • Page 563 UM1940 HAL SPI Generic Driver empty flag SPI_FLAG_CRCERR: CRC error flag SPI_FLAG_MODF: Mode fault flag SPI_FLAG_OVR: Overrun flag SPI_FLAG_BSY: Busy flag SPI_FLAG_FRE: Frame format error flag Return value: The: new state of __FLAG__ (TRUE or FALSE). Description: __HAL_SPI_CLEAR_CRCERRFLAG Clear the SPI CRCERR pending flag. Parameters: __HANDLE__: specifies the SPI Handle.
  • Page 564 HAL SPI Generic Driver UM1940 None __HAL_SPI_ENABLE Description: Enable the SPI peripheral. Parameters: __HANDLE__: specifies the SPI Handle. This parameter can be SPI where x: 1, 2, or 3 to select the SPI peripheral. Return value: None Description: __HAL_SPI_DISABLE Disable the SPI peripheral. Parameters: __HANDLE__: specifies the SPI Handle.
  • Page 565 UM1940 HAL SPI Generic Driver SPI_NSS_HARD_INPUT SPI_NSS_HARD_OUTPUT SPI TI Mode SPI_TIMODE_DISABLE SPI_TIMODE_ENABLE DocID028236 Rev 2 565/1371...
  • Page 566: Hal Sram Generic Driver

    HAL SRAM Generic Driver UM1940 HAL SRAM Generic Driver 44.1 SRAM Firmware driver registers structures 44.1.1 SRAM_HandleTypeDef Data Fields FSMC_NORSRAM_TypeDef * Instance FSMC_NORSRAM_EXTENDED_TypeDef * Extended FSMC_NORSRAM_InitTypeDef Init HAL_LockTypeDef Lock __IO HAL_SRAM_StateTypeDef State DMA_HandleTypeDef * hdma Field Documentation FSMC_NORSRAM_TypeDef* SRAM_HandleTypeDef::Instance Register base address FSMC_NORSRAM_EXTENDED_TypeDef* SRAM_HandleTypeDef::Extended Extended mode register base address FSMC_NORSRAM_InitTypeDef SRAM_HandleTypeDef::Init...
  • Page 567: Sram Initialization And De_Initialization Functions

    UM1940 HAL SRAM Generic Driver Control register configuration using the FSMC NORSRAM interface function FSMC_NORSRAM_Init() Timing register configuration using the FSMC NORSRAM interface function FSMC_NORSRAM_Timing_Init() Extended mode Timing register configuration using the FSMC NORSRAM interface function FSMC_NORSRAM_Extended_Timing_Init() Enable the SRAM device using the macro __FSMC_NORSRAM_ENABLE() At this stage you can perform read/write accesses from/to the memory connected to the NOR/SRAM Bank.
  • Page 568: Sram State Functions

    HAL SRAM Generic Driver UM1940 44.2.5 SRAM State functions This subsection permits to get in run-time the status of the SRAM controller and the data flow. This section contains the following APIs: HAL_SRAM_GetState() 44.2.6 Detailed description of functions HAL_SRAM_Init Function name HAL_StatusTypeDef HAL_SRAM_Init (SRAM_HandleTypeDef * hsram, FSMC_NORSRAM_TimingTypeDef * Timing, FSMC_NORSRAM_TimingTypeDef * ExtTiming)
  • Page 569 UM1940 HAL SRAM Generic Driver HAL_SRAM_DMA_XferCpltCallback Function name void HAL_SRAM_DMA_XferCpltCallback (DMA_HandleTypeDef * hdma) Function description DMA transfer complete callback. Parameters hdma: pointer to a SRAM_HandleTypeDef structure that contains the configuration information for SRAM module. Return values None: HAL_SRAM_DMA_XferErrorCallback Function name void HAL_SRAM_DMA_XferErrorCallback (DMA_HandleTypeDef * hdma) Function description...
  • Page 570 HAL SRAM Generic Driver UM1940 * pDstBuffer, uint32_t BufferSize) Function description Reads 16-bit buffer from SRAM memory. Parameters hsram: pointer to a SRAM_HandleTypeDef structure that contains the configuration information for SRAM module. pAddress: Pointer to read start address pDstBuffer: Pointer to destination buffer BufferSize: Size of the buffer to read from memory Return values HAL: status...
  • Page 571 UM1940 HAL SRAM Generic Driver HAL_SRAM_Read_DMA Function name HAL_StatusTypeDef HAL_SRAM_Read_DMA (SRAM_HandleTypeDef * hsram, uint32_t * pAddress, uint32_t * pDstBuffer, uint32_t BufferSize) Function description Reads a Words data from the SRAM memory using DMA transfer. Parameters hsram: pointer to a SRAM_HandleTypeDef structure that contains the configuration information for SRAM module.
  • Page 572: Sram Firmware Driver Defines

    HAL SRAM Generic Driver UM1940 Function description Returns the SRAM controller state. Parameters hsram: pointer to a SRAM_HandleTypeDef structure that contains the configuration information for SRAM module. Return values HAL: state 44.3 SRAM Firmware driver defines 44.3.1 SRAM SRAM Exported Macros __HAL_SRAM_RESET_HANDLE_STATE Description: Reset SRAM handle state.
  • Page 573: Tim Firmware Driver Registers Structures

    UM1940 HAL TIM Generic Driver HAL TIM Generic Driver 45.1 TIM Firmware driver registers structures 45.1.1 TIM_Base_InitTypeDef Data Fields uint32_t Prescaler uint32_t CounterMode uint32_t Period uint32_t ClockDivision uint32_t RepetitionCounter uint32_t AutoReloadPreload Field Documentation uint32_t TIM_Base_InitTypeDef::Prescaler Specifies the prescaler value used to divide the TIM clock. This parameter can be a number between Min_Data = 0x0000 and Max_Data = 0xFFFF uint32_t TIM_Base_InitTypeDef::CounterMode Specifies the counter mode.
  • Page 574: Tim_Onepulse_Inittypedef

    HAL TIM Generic Driver UM1940 uint32_t TIM_OC_InitTypeDef::OCMode Specifies the TIM mode. This parameter can be a value of TIM_Output_Compare_and_PWM_modes uint32_t TIM_OC_InitTypeDef::Pulse Specifies the pulse value to be loaded into the Capture Compare Register. This parameter can be a number between Min_Data = 0x0000 and Max_Data = 0xFFFF uint32_t TIM_OC_InitTypeDef::OCPolarity Specifies the output polarity.
  • Page 575: Tim_Ic_Inittypedef

    UM1940 HAL TIM Generic Driver uint32_t TIM_OnePulse_InitTypeDef::OCIdleState Specifies the TIM Output Compare pin state during Idle state. This parameter can be a value of TIM_Output_Compare_Idle_State Note:This parameter is valid only for TIM1 and TIM8. uint32_t TIM_OnePulse_InitTypeDef::OCNIdleState Specifies the TIM Output Compare pin state during Idle state. This parameter can be a value of TIM_Output_Compare_N_Idle_State Note:This parameter is valid only for TIM1 and TIM8.
  • Page 576: Tim_Clockconfigtypedef

    HAL TIM Generic Driver UM1940 uint32_t TIM_Encoder_InitTypeDef::EncoderMode Specifies the active edge of the input signal. This parameter can be a value of TIM_Encoder_Mode uint32_t TIM_Encoder_InitTypeDef::IC1Polarity Specifies the active edge of the input signal. This parameter can be a value of TIM_Input_Capture_Polarity uint32_t TIM_Encoder_InitTypeDef::IC1Selection Specifies the input.
  • Page 577: Tim_Slaveconfigtypedef

    UM1940 HAL TIM Generic Driver Field Documentation uint32_t TIM_ClearInputConfigTypeDef::ClearInputState TIM clear Input state. This parameter can be ENABLE or DISABLE uint32_t TIM_ClearInputConfigTypeDef::ClearInputSource TIM clear Input sources. This parameter can be a value of TIM_ClearInput_Source uint32_t TIM_ClearInputConfigTypeDef::ClearInputPolarity TIM Clear Input polarity. This parameter can be a value of TIM_ClearInput_Polarity uint32_t TIM_ClearInputConfigTypeDef::ClearInputPrescaler TIM Clear Input prescaler.
  • Page 578: Tim Firmware Driver Api Description

    HAL TIM Generic Driver UM1940 DMA_HandleTypeDef* TIM_HandleTypeDef::hdma[7] DMA Handlers array This array is accessed by a DMA_Handle_index HAL_LockTypeDef TIM_HandleTypeDef::Lock Locking object __IO HAL_TIM_StateTypeDef TIM_HandleTypeDef::State TIM operation state 45.2 TIM Firmware driver API description 45.2.1 TIMER Generic features The Timer features include: 16-bit up, down, up/down auto-reload counter.
  • Page 579: Time Base Functions

    UM1940 HAL TIM Generic Driver Time Base : HAL_TIM_Base_Start(), HAL_TIM_Base_Start_DMA(), HAL_TIM_Base_Start_IT() Input Capture : HAL_TIM_IC_Start(), HAL_TIM_IC_Start_DMA(), HAL_TIM_IC_Start_IT() Output Compare : HAL_TIM_OC_Start(), HAL_TIM_OC_Start_DMA(), HAL_TIM_OC_Start_IT() PWM generation : HAL_TIM_PWM_Start(), HAL_TIM_PWM_Start_DMA(), HAL_TIM_PWM_Start_IT() One-pulse mode output : HAL_TIM_OnePulse_Start(), HAL_TIM_OnePulse_Start_IT() Encoder mode output : HAL_TIM_Encoder_Start(), HAL_TIM_Encoder_Start_DMA(), HAL_TIM_Encoder_Start_IT().
  • Page 580: Time Pwm Functions

    HAL TIM Generic Driver UM1940 HAL_TIM_OC_DeInit() HAL_TIM_OC_MspInit() HAL_TIM_OC_MspDeInit() HAL_TIM_OC_Start() HAL_TIM_OC_Stop() HAL_TIM_OC_Start_IT() HAL_TIM_OC_Stop_IT() HAL_TIM_OC_Start_DMA() HAL_TIM_OC_Stop_DMA() 45.2.5 Time PWM functions This section provides functions allowing to: Initialize and configure the TIM OPWM. De-initialize the TIM PWM. Start the Time PWM. Stop the Time PWM. Start the Time PWM and enable interrupt.
  • Page 581: Time One Pulse Functions

    UM1940 HAL TIM Generic Driver HAL_TIM_IC_Start_IT() HAL_TIM_IC_Stop_IT() HAL_TIM_IC_Start_DMA() HAL_TIM_IC_Stop_DMA() 45.2.7 Time One Pulse functions This section provides functions allowing to: Initialize and configure the TIM One Pulse. De-initialize the TIM One Pulse. Start the Time One Pulse. Stop the Time One Pulse. Start the Time One Pulse and enable interrupt.
  • Page 582: Irq Handler Management

    HAL TIM Generic Driver UM1940 45.2.9 IRQ handler management This section provides Timer IRQ handler function. This section contains the following APIs: HAL_TIM_IRQHandler() 45.2.10 Peripheral Control functions This section provides functions allowing to: Configure The Input Output channels for OC, PWM, IC or One Pulse mode. Configure External Clock source.
  • Page 583 UM1940 HAL TIM Generic Driver This section contains the following APIs: HAL_TIM_Base_GetState() HAL_TIM_OC_GetState() HAL_TIM_PWM_GetState() HAL_TIM_IC_GetState() HAL_TIM_OnePulse_GetState() HAL_TIM_Encoder_GetState() 45.2.13 Detailed description of functions HAL_TIM_Base_Init HAL_StatusTypeDef HAL_TIM_Base_Init (TIM_HandleTypeDef Function name * htim) Function description Initializes the TIM Time base Unit according to the specified parameters in the TIM_HandleTypeDef and create the associated handle.
  • Page 584 HAL TIM Generic Driver UM1940 HAL_TIM_Base_Start Function name HAL_StatusTypeDef HAL_TIM_Base_Start (TIM_HandleTypeDef * htim) Function description Starts the TIM Base generation. Parameters htim: pointer to a TIM_HandleTypeDef structure that contains the configuration information for TIM module. Return values HAL: status HAL_TIM_Base_Stop Function name HAL_StatusTypeDef HAL_TIM_Base_Stop (TIM_HandleTypeDef * htim)
  • Page 585 UM1940 HAL TIM Generic Driver Return values HAL: status HAL_TIM_Base_Stop_DMA HAL_StatusTypeDef HAL_TIM_Base_Stop_DMA Function name (TIM_HandleTypeDef * htim) Function description Stops the TIM Base generation in DMA mode. Parameters htim: pointer to a TIM_HandleTypeDef structure that contains the configuration information for TIM module. Return values HAL: status HAL_TIM_OC_Init...
  • Page 586 HAL TIM Generic Driver UM1940 HAL_TIM_OC_Start Function name HAL_StatusTypeDef HAL_TIM_OC_Start (TIM_HandleTypeDef * htim, uint32_t Channel) Function description Starts the TIM Output Compare signal generation. Parameters htim: pointer to a TIM_HandleTypeDef structure that contains the configuration information for TIM module. Channel: TIM Channel to be enabled. This parameter can be one of the following values: TIM_CHANNEL_1: TIM Channel 1 selected TIM_CHANNEL_2: TIM Channel 2 selected...
  • Page 587 UM1940 HAL TIM Generic Driver (TIM_HandleTypeDef * htim, uint32_t Channel) Function description Stops the TIM Output Compare signal generation in interrupt mode. Parameters htim: pointer to a TIM_HandleTypeDef structure that contains the configuration information for TIM module. Channel: TIM Channel to be disabled. This parameter can be one of the following values: TIM_CHANNEL_1: TIM Channel 1 selected TIM_CHANNEL_2: TIM Channel 2 selected...
  • Page 588 HAL TIM Generic Driver UM1940 HAL_TIM_PWM_Init Function name HAL_StatusTypeDef HAL_TIM_PWM_Init (TIM_HandleTypeDef * htim) Function description Initializes the TIM PWM Time Base according to the specified parameters in the TIM_HandleTypeDef and create the associated handle. Parameters htim: pointer to a TIM_HandleTypeDef structure that contains the configuration information for TIM module.
  • Page 589 UM1940 HAL TIM Generic Driver TIM_CHANNEL_3: TIM Channel 3 selected TIM_CHANNEL_4: TIM Channel 4 selected Return values HAL: status HAL_TIM_PWM_Stop Function name HAL_StatusTypeDef HAL_TIM_PWM_Stop (TIM_HandleTypeDef * htim, uint32_t Channel) Function description Stops the PWM signal generation. Parameters htim: pointer to a TIM_HandleTypeDef structure that contains the configuration information for TIM module.
  • Page 590 HAL TIM Generic Driver UM1940 HAL_TIM_PWM_Start_DMA Function name HAL_StatusTypeDef HAL_TIM_PWM_Start_DMA (TIM_HandleTypeDef * htim, uint32_t Channel, uint32_t * pData, uint16_t Length) Function description Starts the TIM PWM signal generation in DMA mode. Parameters htim: pointer to a TIM_HandleTypeDef structure that contains the configuration information for TIM module. Channel: TIM Channels to be enabled.
  • Page 591 UM1940 HAL TIM Generic Driver Function description DeInitializes the TIM peripheral. Parameters htim: pointer to a TIM_HandleTypeDef structure that contains the configuration information for TIM module. Return values HAL: status HAL_TIM_IC_MspInit Function name void HAL_TIM_IC_MspInit (TIM_HandleTypeDef * htim) Function description Initializes the TIM INput Capture MSP.
  • Page 592 HAL TIM Generic Driver UM1940 TIM_CHANNEL_3: TIM Channel 3 selected TIM_CHANNEL_4: TIM Channel 4 selected Return values HAL: status HAL_TIM_IC_Start_IT Function name HAL_StatusTypeDef HAL_TIM_IC_Start_IT (TIM_HandleTypeDef * htim, uint32_t Channel) Function description Starts the TIM Input Capture measurement in interrupt mode. Parameters htim: pointer to a TIM_HandleTypeDef structure that contains the configuration information for TIM module.
  • Page 593 UM1940 HAL TIM Generic Driver Length: The length of data to be transferred from TIM peripheral to memory. Return values HAL: status HAL_TIM_IC_Stop_DMA Function name HAL_StatusTypeDef HAL_TIM_IC_Stop_DMA (TIM_HandleTypeDef * htim, uint32_t Channel) Function description Stops the TIM Input Capture measurement on in DMA mode. Parameters htim: pointer to a TIM_HandleTypeDef structure that contains the configuration information for TIM module.
  • Page 594 HAL TIM Generic Driver UM1940 Function description Initializes the TIM One Pulse MSP. Parameters htim: pointer to a TIM_HandleTypeDef structure that contains the configuration information for TIM module. Return values None: HAL_TIM_OnePulse_MspDeInit Function name void HAL_TIM_OnePulse_MspDeInit (TIM_HandleTypeDef * htim) Function description DeInitializes TIM One Pulse MSP.
  • Page 595 UM1940 HAL TIM Generic Driver OutputChannel: : TIM Channels to be enabled. This parameter can be one of the following values: TIM_CHANNEL_1: TIM Channel 1 selected TIM_CHANNEL_2: TIM Channel 2 selected Return values HAL: status HAL_TIM_OnePulse_Stop_IT Function name HAL_StatusTypeDef HAL_TIM_OnePulse_Stop_IT (TIM_HandleTypeDef * htim, uint32_t OutputChannel) Function description Stops the TIM One Pulse signal generation in interrupt mode.
  • Page 596 HAL TIM Generic Driver UM1940 Return values None: HAL_TIM_Encoder_MspDeInit void HAL_TIM_Encoder_MspDeInit (TIM_HandleTypeDef * Function name htim) Function description DeInitializes TIM Encoder Interface MSP. Parameters htim: pointer to a TIM_HandleTypeDef structure that contains the configuration information for TIM module. Return values None: HAL_TIM_Encoder_Start Function name...
  • Page 597 UM1940 HAL TIM Generic Driver Channel: TIM Channels to be enabled. This parameter can be one of the following values: TIM_CHANNEL_1: TIM Channel 1 selected TIM_CHANNEL_2: TIM Channel 2 selected TIM_CHANNEL_ALL: TIM Channel 1 and TIM Channel 2 are selected Return values HAL: status HAL_TIM_Encoder_Stop_IT...
  • Page 598 HAL TIM Generic Driver UM1940 contains the configuration information for TIM module. Channel: TIM Channels to be enabled. This parameter can be one of the following values: TIM_CHANNEL_1: TIM Channel 1 selected TIM_CHANNEL_2: TIM Channel 2 selected TIM_CHANNEL_ALL: TIM Channel 1 and TIM Channel 2 are selected Return values HAL: status...
  • Page 599 UM1940 HAL TIM Generic Driver TIM_CHANNEL_3: TIM Channel 3 selected TIM_CHANNEL_4: TIM Channel 4 selected Return values HAL: status HAL_TIM_IC_ConfigChannel Function name HAL_StatusTypeDef HAL_TIM_IC_ConfigChannel (TIM_HandleTypeDef * htim, TIM_IC_InitTypeDef * sConfig, uint32_t Channel) Function description Initializes the TIM Input Capture Channels according to the specified parameters in the TIM_IC_InitTypeDef.
  • Page 600 HAL TIM Generic Driver UM1940 contains the configuration information for TIM module. sClearInputConfig: pointer to a TIM_ClearInputConfigTypeDef structure that contains the OCREF clear feature and parameters for the TIM peripheral. Channel: specifies the TIM Channel. This parameter can be one of the following values: TIM_CHANNEL_1: TIM Channel 1 selected TIM_CHANNEL_2: TIM Channel 2 selected TIM_CHANNEL_3: TIM Channel 3 selected...
  • Page 601 UM1940 HAL TIM Generic Driver Function description Configures the TIM in Slave mode. Parameters htim: pointer to a TIM_HandleTypeDef structure that contains the configuration information for TIM module. sSlaveConfig: pointer to a TIM_SlaveConfigTypeDef structure that contains the selected trigger (internal trigger input, filtered timer input or external trigger input) and the ) and the Slave mode (Disable, Reset, Gated, Trigger, External clock mode 1).
  • Page 602 HAL TIM Generic Driver UM1940 TIM_DMABASE_RCR TIM_DMABASE_CCR1 TIM_DMABASE_CCR2 TIM_DMABASE_CCR3 TIM_DMABASE_CCR4 TIM_DMABASE_BDTR TIM_DMABASE_DCR BurstRequestSrc: TIM DMA Request sources. This parameters can be on of the following values: TIM_DMA_UPDATE: TIM update Interrupt source TIM_DMA_CC1: TIM Capture Compare 1 DMA source TIM_DMA_CC2: TIM Capture Compare 2 DMA source TIM_DMA_CC3: TIM Capture Compare 3 DMA source TIM_DMA_CC4: TIM Capture Compare 4 DMA source TIM_DMA_COM: TIM Commutation DMA source...
  • Page 603 UM1940 HAL TIM Generic Driver TIM_DMABASE_EGR TIM_DMABASE_CCMR1 TIM_DMABASE_CCMR2 TIM_DMABASE_CCER TIM_DMABASE_CNT TIM_DMABASE_PSC TIM_DMABASE_ARR TIM_DMABASE_RCR TIM_DMABASE_CCR1 TIM_DMABASE_CCR2 TIM_DMABASE_CCR3 TIM_DMABASE_CCR4 TIM_DMABASE_BDTR TIM_DMABASE_DCR BurstRequestSrc: TIM DMA Request sources. This parameters can be on of the following values: TIM_DMA_UPDATE: TIM update Interrupt source TIM_DMA_CC1: TIM Capture Compare 1 DMA source TIM_DMA_CC2: TIM Capture Compare 2 DMA source TIM_DMA_CC3: TIM Capture Compare 3 DMA source TIM_DMA_CC4: TIM Capture Compare 4 DMA source...
  • Page 604 HAL TIM Generic Driver UM1940 TIM_EVENTSOURCE_CC1: Timer Capture Compare 1 Event source TIM_EVENTSOURCE_CC2: Timer Capture Compare 2 Event source TIM_EVENTSOURCE_CC3: Timer Capture Compare 3 Event source TIM_EVENTSOURCE_CC4: Timer Capture Compare 4 Event source TIM_EVENTSOURCE_COM: Timer COM event source TIM_EVENTSOURCE_TRIGGER: Timer Trigger Event source TIM_EVENTSOURCE_BREAK: Timer Break event source...
  • Page 605 UM1940 HAL TIM Generic Driver Parameters htim: pointer to a TIM_HandleTypeDef structure that contains the configuration information for TIM module. Return values None: HAL_TIM_IC_CaptureCallback Function name void HAL_TIM_IC_CaptureCallback (TIM_HandleTypeDef * htim) Function description Input Capture callback in non blocking mode. Parameters htim: pointer to a TIM_HandleTypeDef structure that contains the configuration information for TIM module.
  • Page 606 HAL TIM Generic Driver UM1940 Return values HAL: state HAL_TIM_OC_GetState HAL_TIM_StateTypeDef HAL_TIM_OC_GetState Function name (TIM_HandleTypeDef * htim) Function description Return the TIM OC state. Parameters htim: pointer to a TIM_HandleTypeDef structure that contains the configuration information for TIM module. Return values HAL: state HAL_TIM_PWM_GetState Function name...
  • Page 607 UM1940 HAL TIM Generic Driver TIM_Base_SetConfig Function name void TIM_Base_SetConfig (TIM_TypeDef * TIMx, TIM_Base_InitTypeDef * Structure) Function description Time Base configuration. Parameters TIMx: TIM peripheral Structure: pointer on TIM Time Base required parameters Return values None: TIM_TI1_SetConfig Function name void TIM_TI1_SetConfig (TIM_TypeDef * TIMx, uint32_t TIM_ICPolarity, uint32_t TIM_ICSelection, uint32_t TIM_ICFilter) Function description...
  • Page 608: Tim Firmware Driver Defines

    HAL TIM Generic Driver UM1940 Function description TIM DMA Delay Pulse complete callback. Parameters hdma: pointer to a DMA_HandleTypeDef structure that contains the configuration information for the specified DMA module. Return values None: TIM_DMAError Function name void TIM_DMAError (DMA_HandleTypeDef * hdma) Function description TIM DMA error callback.
  • Page 609 UM1940 HAL TIM Generic Driver TIM_AUTOMATICOUTPUT_DISABLE TIM Auto-Reload Preload TIM_AUTORELOAD_PRELOAD_DISABLE TIMx_ARR register is not buffered TIM_AUTORELOAD_PRELOAD_ENABLE TIMx_ARR register is buffered TIM Break Input State TIM_BREAK_ENABLE TIM_BREAK_DISABLE TIM Break Polarity TIM_BREAKPOLARITY_LOW TIM_BREAKPOLARITY_HIGH TIM Channel TIM_CHANNEL_1 TIM_CHANNEL_2 TIM_CHANNEL_3 TIM_CHANNEL_4 TIM_CHANNEL_ALL TIM Clear Input Polarity TIM_CLEARINPUTPOLARITY_INVERTED Polarity for ETRx pin TIM_CLEARINPUTPOLARITY_NONINVERTED...
  • Page 610 HAL TIM Generic Driver UM1940 TIM_CLOCKPOLARITY_RISING Polarity for TIx clock sources TIM_CLOCKPOLARITY_FALLING Polarity for TIx clock sources TIM_CLOCKPOLARITY_BOTHEDGE Polarity for TIx clock sources TIM Clock Prescaler TIM_CLOCKPRESCALER_DIV1 No prescaler is used TIM_CLOCKPRESCALER_DIV2 Prescaler for External ETR Clock: Capture performed once every 2 events. TIM_CLOCKPRESCALER_DIV4 Prescaler for External ETR Clock: Capture performed once every 4 events.
  • Page 611 UM1940 HAL TIM Generic Driver TIM_DMABASE_EGR TIM_DMABASE_CCMR1 TIM_DMABASE_CCMR2 TIM_DMABASE_CCER TIM_DMABASE_CNT TIM_DMABASE_PSC TIM_DMABASE_ARR TIM_DMABASE_RCR TIM_DMABASE_CCR1 TIM_DMABASE_CCR2 TIM_DMABASE_CCR3 TIM_DMABASE_CCR4 TIM_DMABASE_BDTR TIM_DMABASE_DCR TIM_DMABASE_OR TIM DMA Burst Length TIM_DMABURSTLENGTH_1TRANSFER TIM_DMABURSTLENGTH_2TRANSFERS TIM_DMABURSTLENGTH_3TRANSFERS TIM_DMABURSTLENGTH_4TRANSFERS TIM_DMABURSTLENGTH_5TRANSFERS TIM_DMABURSTLENGTH_6TRANSFERS TIM_DMABURSTLENGTH_7TRANSFERS TIM_DMABURSTLENGTH_8TRANSFERS TIM_DMABURSTLENGTH_9TRANSFERS TIM_DMABURSTLENGTH_10TRANSFERS TIM_DMABURSTLENGTH_11TRANSFERS TIM_DMABURSTLENGTH_12TRANSFERS TIM_DMABURSTLENGTH_13TRANSFERS TIM_DMABURSTLENGTH_14TRANSFERS TIM_DMABURSTLENGTH_15TRANSFERS TIM_DMABURSTLENGTH_16TRANSFERS TIM_DMABURSTLENGTH_17TRANSFERS TIM_DMABURSTLENGTH_18TRANSFERS TIM DMA sources...
  • Page 612 HAL TIM Generic Driver UM1940 TIM_DMA_CC1 TIM_DMA_CC2 TIM_DMA_CC3 TIM_DMA_CC4 TIM_DMA_COM TIM_DMA_TRIGGER TIM Encoder Mode TIM_ENCODERMODE_TI1 TIM_ENCODERMODE_TI2 TIM_ENCODERMODE_TI12 TIM ETR Polarity TIM_ETRPOLARITY_INVERTED Polarity for ETR source TIM_ETRPOLARITY_NONINVERTED Polarity for ETR source TIM ETR Prescaler TIM_ETRPRESCALER_DIV1 No prescaler is used TIM_ETRPRESCALER_DIV2 ETR input source is divided by 2 TIM_ETRPRESCALER_DIV4 ETR input source is divided by 4 TIM_ETRPRESCALER_DIV8...
  • Page 613 UM1940 HAL TIM Generic Driver Parameters: __HANDLE__: TIM handle Return value: None __HAL_TIM_MOE_ENABLE Description: Enable the TIM main Output. Parameters: __HANDLE__: TIM handle Return value: None __HAL_TIM_DISABLE Description: Disable the TIM peripheral. Parameters: __HANDLE__: TIM handle Return value: None Description: __HAL_TIM_MOE_DISABLE Disable the TIM main Output.
  • Page 614 HAL TIM Generic Driver UM1940 can be one of the following values: TIM_IT_UPDATE: Update interrupt TIM_IT_CC1: Capture/Compare 1 interrupt TIM_IT_CC2: Capture/Compare 2 interrupt TIM_IT_CC3: Capture/Compare 3 interrupt TIM_IT_CC4: Capture/Compare 4 interrupt TIM_IT_COM: Commutation interrupt TIM_IT_TRIGGER: Trigger interrupt TIM_IT_BREAK: Break interrupt Return value: None __HAL_TIM_DISABLE_IT...
  • Page 615 UM1940 HAL TIM Generic Driver DMA request TIM_DMA_CC3: Capture/Compare 3 DMA request TIM_DMA_CC4: Capture/Compare 4 DMA request TIM_DMA_COM: Commutation DMA request TIM_DMA_TRIGGER: Trigger DMA request Return value: None __HAL_TIM_DISABLE_DMA Description: Disable the specified DMA request. Parameters: __HANDLE__: specifies the TIM Handle. __DMA__: specifies the TIM DMA request to disable.
  • Page 616 HAL TIM Generic Driver UM1940 TIM_FLAG_CC3: Capture/Compare 3 interrupt flag TIM_FLAG_CC4: Capture/Compare 4 interrupt flag TIM_FLAG_CC5: Compare 5 interrupt flag TIM_FLAG_CC6: Compare 6 interrupt flag TIM_FLAG_COM: Commutation interrupt flag TIM_FLAG_TRIGGER: Trigger interrupt flag TIM_FLAG_BREAK: Break interrupt flag TIM_FLAG_BREAK2: Break 2 interrupt flag TIM_FLAG_SYSTEM_BREAK: System Break interrupt flag...
  • Page 617 UM1940 HAL TIM Generic Driver interrupt flag TIM_FLAG_TRIGGER: Trigger interrupt flag TIM_FLAG_BREAK: Break interrupt flag TIM_FLAG_BREAK2: Break 2 interrupt flag TIM_FLAG_SYSTEM_BREAK: System Break interrupt flag TIM_FLAG_CC1OF: Capture/Compare 1 overcapture flag TIM_FLAG_CC2OF: Capture/Compare 2 overcapture flag TIM_FLAG_CC3OF: Capture/Compare 3 overcapture flag TIM_FLAG_CC4OF: Capture/Compare 4 overcapture flag Return value:...
  • Page 618 HAL TIM Generic Driver UM1940 one of the following values: TIM_IT_UPDATE: Update interrupt TIM_IT_CC1: Capture/Compare 1 interrupt TIM_IT_CC2: Capture/Compare 2 interrupt TIM_IT_CC3: Capture/Compare 3 interrupt TIM_IT_CC4: Capture/Compare 4 interrupt TIM_IT_COM: Commutation interrupt TIM_IT_TRIGGER: Trigger interrupt TIM_IT_BREAK: Break interrupt Return value: None __HAL_TIM_IS_TIM_COUNTING_DO Description:...
  • Page 619 UM1940 HAL TIM Generic Driver time ConfigChannel function. Parameters: __HANDLE__: TIM handle. __CHANNEL__: : TIM Channels to be configured. This parameter can be one of the following values: TIM_CHANNEL_1: TIM Channel 1 selected TIM_CHANNEL_2: TIM Channel 2 selected TIM_CHANNEL_3: TIM Channel 3 selected TIM_CHANNEL_4: TIM Channel 4 selected...
  • Page 620 HAL TIM Generic Driver UM1940 None __HAL_TIM_GET_COUNTER Description: Gets the TIM Counter Register value on runtime. Parameters: __HANDLE__: TIM handle. Return value: 16-bit: or 32-bit value of the timer counter register (TIMx_CNT) Description: __HAL_TIM_SET_AUTORELOAD Sets the TIM Autoreload Register value on runtime without calling another time any Init function.
  • Page 621 UM1940 HAL TIM Generic Driver Return value: None __HAL_TIM_GET_CLOCKDIVISION Description: Gets the TIM Clock Division value on runtime. Parameters: __HANDLE__: TIM handle. Return value: The: clock division can be one of the following values: TIM_CLOCKDIVISION_DIV1: tDTS=tCK_INT TIM_CLOCKDIVISION_DIV2: tDTS=2*tCK_INT TIM_CLOCKDIVISION_DIV4: tDTS=4*tCK_INT __HAL_TIM_SET_ICPRESCALER Description: Sets the TIM Input Capture prescaler on...
  • Page 622 HAL TIM Generic Driver UM1940 runtime. Parameters: __HANDLE__: TIM handle. __CHANNEL__: : TIM Channels to be configured. This parameter can be one of the following values: TIM_CHANNEL_1: get input capture 1 prescaler value TIM_CHANNEL_2: get input capture 2 prescaler value TIM_CHANNEL_3: get input capture 3 prescaler value TIM_CHANNEL_4: get input capture 4...
  • Page 623 UM1940 HAL TIM Generic Driver When the USR bit of the TIMx_CR1 register is reset, any of the following events generate an update interrupt or DMA request (if enabled): _ Counter overflow/underflow _ Setting the UG bit _ Update generation through the slave mode controller Description: __HAL_TIM_SET_CAPTUREPOLARIT...
  • Page 624 HAL TIM Generic Driver UM1940 TIM_FLAG_CC1OF TIM_FLAG_CC2OF TIM_FLAG_CC3OF TIM_FLAG_CC4OF TIM Input Capture Polarity TIM_ICPOLARITY_RISING TIM_ICPOLARITY_FALLING TIM_ICPOLARITY_BOTHEDGE TIM Input Capture Prescaler TIM_ICPSC_DIV1 Capture performed each time an edge is detected on the capture input TIM_ICPSC_DIV2 Capture performed once every 2 events TIM_ICPSC_DIV4 Capture performed once every 4 events TIM_ICPSC_DIV8...
  • Page 625 UM1940 HAL TIM Generic Driver IS_TIM_PWM_MODE IS_TIM_OC_MODE IS_TIM_FAST_STATE IS_TIM_OC_POLARITY IS_TIM_OCN_POLARITY IS_TIM_OCIDLE_STATE IS_TIM_OCNIDLE_STATE IS_TIM_CHANNELS IS_TIM_OPM_CHANNELS IS_TIM_COMPLEMENTARY_CHANNELS IS_TIM_IC_POLARITY IS_TIM_IC_SELECTION IS_TIM_IC_PRESCALER IS_TIM_OPM_MODE IS_TIM_DMA_SOURCE IS_TIM_ENCODER_MODE IS_TIM_EVENT_SOURCE IS_TIM_CLOCKSOURCE IS_TIM_CLOCKPOLARITY IS_TIM_CLOCKPRESCALER IS_TIM_CLOCKFILTER IS_TIM_CLEARINPUT_SOURCE IS_TIM_CLEARINPUT_POLARITY IS_TIM_CLEARINPUT_PRESCALER IS_TIM_CLEARINPUT_FILTER IS_TIM_OSSR_STATE IS_TIM_OSSI_STATE IS_TIM_LOCK_LEVEL IS_TIM_BREAK_STATE IS_TIM_BREAK_POLARITY IS_TIM_AUTOMATIC_OUTPUT_STATE IS_TIM_TRGO_SOURCE IS_TIM_SLAVE_MODE IS_TIM_MSM_STATE IS_TIM_TRIGGER_SELECTION IS_TIM_INTERNAL_TRIGGEREVENT_SELECTION DocID028236 Rev 2 625/1371...
  • Page 626 HAL TIM Generic Driver UM1940 IS_TIM_TRIGGERPOLARITY IS_TIM_TRIGGERPRESCALER IS_TIM_TRIGGERFILTER IS_TIM_TI1SELECTION IS_TIM_DMA_BASE IS_TIM_DMA_LENGTH IS_TIM_IC_FILTER TIM Lock level TIM_LOCKLEVEL_OFF TIM_LOCKLEVEL_1 TIM_LOCKLEVEL_2 TIM_LOCKLEVEL_3 TIM Mask Definition TIM_CCER_CCxE_MASK TIM_CCER_CCxNE_MASK TIM Master Mode Selection TIM_TRGO_RESET TIM_TRGO_ENABLE TIM_TRGO_UPDATE TIM_TRGO_OC1 TIM_TRGO_OC1REF TIM_TRGO_OC2REF TIM_TRGO_OC3REF TIM_TRGO_OC4REF TIM Master Slave Mode TIM_MASTERSLAVEMODE_ENABLE TIM_MASTERSLAVEMODE_DISABLE TIM One Pulse Mode...
  • Page 627 UM1940 HAL TIM Generic Driver TIM_OCMODE_TIMING TIM_OCMODE_ACTIVE TIM_OCMODE_INACTIVE TIM_OCMODE_TOGGLE TIM_OCMODE_PWM1 TIM_OCMODE_PWM2 TIM_OCMODE_FORCED_ACTIVE TIM_OCMODE_FORCED_INACTIVE TIM Output Compare Idle State TIM_OCIDLESTATE_SET TIM_OCIDLESTATE_RESET TIM Output Compare N Idle State TIM_OCNIDLESTATE_SET TIM_OCNIDLESTATE_RESET TIM Output CompareN Polarity TIM_OCNPOLARITY_HIGH TIM_OCNPOLARITY_LOW TIM Output Compare Polarity TIM_OCPOLARITY_HIGH TIM_OCPOLARITY_LOW TIM Output Fast State TIM_OCFAST_DISABLE TIM_OCFAST_ENABLE...
  • Page 628 HAL TIM Generic Driver UM1940 TIM_TRIGGERPOLARITY_FALLING Polarity for TIxFPx or TI1_ED trigger sources TIM_TRIGGERPOLARITY_BOTHEDGE Polarity for TIxFPx or TI1_ED trigger sources TIM Trigger Prescaler TIM_TRIGGERPRESCALER_DIV1 No prescaler is used TIM_TRIGGERPRESCALER_DIV2 Prescaler for External ETR Trigger: Capture performed once every 2 events. TIM_TRIGGERPRESCALER_DIV4 Prescaler for External ETR Trigger: Capture performed once every 4 events.
  • Page 629: Timex Firmware Driver Registers Structures

    UM1940 HAL TIM Extension Driver HAL TIM Extension Driver 46.1 TIMEx Firmware driver registers structures 46.1.1 TIM_HallSensor_InitTypeDef Data Fields uint32_t IC1Polarity uint32_t IC1Prescaler uint32_t IC1Filter uint32_t Commutation_Delay Field Documentation uint32_t TIM_HallSensor_InitTypeDef::IC1Polarity Specifies the active edge of the input signal. This parameter can be a value of TIM_Input_Capture_Polarity uint32_t TIM_HallSensor_InitTypeDef::IC1Prescaler Specifies the Input Capture Prescaler.
  • Page 630: Timex Firmware Driver Api Description

    HAL TIM Extension Driver UM1940 Field Documentation uint32_t TIM_BreakDeadTimeConfigTypeDef::OffStateRunMode TIM off state in run mode. This parameter can be a value of TIM_OSSR_Off_State_Selection_for_Run_mode_state uint32_t TIM_BreakDeadTimeConfigTypeDef::OffStateIDLEMode TIM off state in IDLE mode. This parameter can be a value of TIM_OSSI_Off_State_Selection_for_Idle_mode_state uint32_t TIM_BreakDeadTimeConfigTypeDef::LockLevel TIM Lock level.
  • Page 631: Timer Hall Sensor Functions

    UM1940 HAL TIM Extension Driver Configure the TIM in the desired functioning mode using one of the initialization function of this driver: HAL_TIMEx_HallSensor_Init and HAL_TIMEx_ConfigCommutationEvent: to use the Timer Hall Sensor Interface and the commutation event with the corresponding Interrupt and DMA request if needed (Note that One Timer is used to interface with the Hall sensor Interface and another Timer should be used to use the commutation event).
  • Page 632: Timer Complementary Pwm Functions

    HAL TIM Extension Driver UM1940 HAL_TIMEx_OCN_Stop() HAL_TIMEx_OCN_Start_IT() HAL_TIMEx_OCN_Stop_IT() HAL_TIMEx_OCN_Start_DMA() HAL_TIMEx_OCN_Stop_DMA() 46.2.5 Timer Complementary PWM functions This section provides functions allowing to: Start the Complementary PWM. Stop the Complementary PWM. Start the Complementary PWM and enable interrupts. Stop the Complementary PWM and disable interrupts. Start the Complementary PWM and enable DMA transfers.
  • Page 633: Extension Callbacks Functions

    UM1940 HAL TIM Extension Driver Configure Complementary channels, break features and dead time. Configure Master and the Slave synchronization. Configure the commutation event in case of use of the Hall sensor interface. Configure the DMA Burst Mode. This section contains the following APIs: HAL_TIMEx_ConfigCommutationEvent() HAL_TIMEx_ConfigCommutationEvent_IT() HAL_TIMEx_ConfigCommutationEvent_DMA()
  • Page 634 HAL TIM Extension Driver UM1940 contains the configuration information for TIM module. Return values HAL: status HAL_TIMEx_HallSensor_MspInit Function name void HAL_TIMEx_HallSensor_MspInit (TIM_HandleTypeDef * htim) Function description Initializes the TIM Hall Sensor MSP. Parameters htim: pointer to a TIM_HandleTypeDef structure that contains the configuration information for TIM module.
  • Page 635 UM1940 HAL TIM Extension Driver Return values HAL: status HAL_TIMEx_HallSensor_Stop_IT HAL_StatusTypeDef HAL_TIMEx_HallSensor_Stop_IT Function name (TIM_HandleTypeDef * htim) Function description Stops the TIM Hall Sensor Interface in interrupt mode. Parameters htim: pointer to a TIM_HandleTypeDef structure that contains the configuration information for TIM module. Return values HAL: status HAL_TIMEx_HallSensor_Start_DMA...
  • Page 636 HAL TIM Extension Driver UM1940 HAL_TIMEx_OCN_Stop Function name HAL_StatusTypeDef HAL_TIMEx_OCN_Stop (TIM_HandleTypeDef * htim, uint32_t Channel) Function description Stops the TIM Output Compare signal generation on the complementary output. Parameters htim: pointer to a TIM_HandleTypeDef structure that contains the configuration information for TIM module. Channel: TIM Channel to be disabled.
  • Page 637 UM1940 HAL TIM Extension Driver HAL_TIMEx_OCN_Start_DMA Function name HAL_StatusTypeDef HAL_TIMEx_OCN_Start_DMA (TIM_HandleTypeDef * htim, uint32_t Channel, uint32_t * pData, uint16_t Length) Function description Starts the TIM Output Compare signal generation in DMA mode on the complementary output. Parameters htim: pointer to a TIM_HandleTypeDef structure that contains the configuration information for TIM module.
  • Page 638 HAL TIM Extension Driver UM1940 Return values HAL: status HAL_TIMEx_PWMN_Stop HAL_StatusTypeDef HAL_TIMEx_PWMN_Stop Function name (TIM_HandleTypeDef * htim, uint32_t Channel) Function description Stops the PWM signal generation on the complementary output. Parameters htim: pointer to a TIM_HandleTypeDef structure that contains the configuration information for TIM module. Channel: TIM Channel to be disabled.
  • Page 639 UM1940 HAL TIM Extension Driver HAL_TIMEx_PWMN_Start_DMA Function name HAL_StatusTypeDef HAL_TIMEx_PWMN_Start_DMA (TIM_HandleTypeDef * htim, uint32_t Channel, uint32_t * pData, uint16_t Length) Function description Starts the TIM PWM signal generation in DMA mode on the complementary output. Parameters htim: pointer to a TIM_HandleTypeDef structure that contains the configuration information for TIM module.
  • Page 640 HAL TIM Extension Driver UM1940 HAL_TIMEx_OnePulseN_Stop Function name HAL_StatusTypeDef HAL_TIMEx_OnePulseN_Stop (TIM_HandleTypeDef * htim, uint32_t OutputChannel) Function description Stops the TIM One Pulse signal generation on the complementary output. Parameters htim: pointer to a TIM_HandleTypeDef structure that contains the configuration information for TIM module. OutputChannel: TIM Channel to be disabled.
  • Page 641 UM1940 HAL TIM Extension Driver Parameters htim: pointer to a TIM_HandleTypeDef structure that contains the configuration information for TIM module. InputTrigger: the Internal trigger corresponding to the Timer Interfacing with the Hall sensor. This parameter can be one of the following values: TIM_TS_ITR0: Internal trigger 0 selected TIM_TS_ITR1: Internal trigger 1 selected TIM_TS_ITR2: Internal trigger 2 selected...
  • Page 642 HAL TIM Extension Driver UM1940 Notes This function is mandatory to use the commutation event in order to update the configuration at each commutation detection on the TRGI input of the Timer, the typical use of this feature is with the use of another Timer(interface Timer) configured in Hall sensor interface, this interface Timer will generate the commutation at its TRGO output (connected to Timer used in this function) each time the TI1 of the Interface...
  • Page 643 UM1940 HAL TIM Extension Driver Parameters htim: pointer to a TIM_HandleTypeDef structure that contains the configuration information for TIM module. sMasterConfig: pointer to a TIM_MasterConfigTypeDef structure that contains the selected trigger output (TRGO) and the Master/Slave mode. Return values HAL: status HAL_TIMEx_ConfigBreakDeadTime Function name HAL_StatusTypeDef HAL_TIMEx_ConfigBreakDeadTime...
  • Page 644: Timex Firmware Driver Defines

    HAL TIM Extension Driver UM1940 HSE_RTC clock (HSE divided by a programmable prescaler) Return values HAL: status HAL_TIMEx_CommutationCallback void HAL_TIMEx_CommutationCallback (TIM_HandleTypeDef Function name * htim) Function description Hall commutation changed callback in non blocking mode. Parameters htim: pointer to a TIM_HandleTypeDef structure that contains the configuration information for TIM module.
  • Page 645 UM1940 HAL TIM Extension Driver TIM_TIM2_ETH_PTP TIM_TIM2_USBFS_SOF TIM_TIM2_USBHS_SOF TIM_TIM5_GPIO TIM_TIM5_LSI TIM_TIM5_LSE TIM_TIM5_RTC TIM_TIM11_GPIO TIM_TIM11_HSE DocID028236 Rev 2 645/1371...
  • Page 646: Hal Uart Generic Driver

    HAL UART Generic Driver UM1940 HAL UART Generic Driver 47.1 UART Firmware driver registers structures 47.1.1 UART_InitTypeDef Data Fields uint32_t BaudRate uint32_t WordLength uint32_t StopBits uint32_t Parity uint32_t Mode uint32_t HwFlowCtl uint32_t OverSampling Field Documentation uint32_t UART_InitTypeDef::BaudRate This member configures the UART communication baud rate. The baud rate is computed using the following formula:IntegerDivider = ((PCLKx) / (8 * (OVR8+1) * (huart->Init.BaudRate)))FractionalDivider = ((IntegerDivider - ((uint32_t) IntegerDivider)) * 8 * (OVR8+1)) + 0.5 Where OVR8 is the "oversampling by 8 mode"...
  • Page 647: Uart Firmware Driver Api Description

    UM1940 HAL UART Generic Driver uint8_t * pRxBuffPtr uint16_t RxXferSize __IO uint16_t RxXferCount DMA_HandleTypeDef * hdmatx DMA_HandleTypeDef * hdmarx HAL_LockTypeDef Lock __IO HAL_UART_StateTypeDef gState __IO HAL_UART_StateTypeDef RxState __IO uint32_t ErrorCode Field Documentation USART_TypeDef* UART_HandleTypeDef::Instance UART registers base address UART_InitTypeDef UART_HandleTypeDef::Init UART communication parameters uint8_t* UART_HandleTypeDef::pTxBuffPtr Pointer to UART Tx transfer Buffer...
  • Page 648 HAL UART Generic Driver UM1940 Configure these UART pins as alternate function pull-up. NVIC configuration if you need to use interrupt process (HAL_UART_Transmit_IT() and HAL_UART_Receive_IT() APIs): Configure the USARTx interrupt priority. Enable the NVIC USART IRQ handle. DMA Configuration if you need to use DMA process (HAL_UART_Transmit_DMA() and HAL_UART_Receive_DMA() APIs): Declare a DMA handle structure for the Tx/Rx stream.
  • Page 649 UM1940 HAL UART Generic Driver DMA mode IO operation Send an amount of data in non blocking mode (DMA) using HAL_UART_Transmit_DMA() At transmission end of half transfer HAL_UART_TxHalfCpltCallback is executed and user can add his own code by customization of function pointer HAL_UART_TxHalfCpltCallback At transmission end of transfer HAL_UART_TxCpltCallback is executed and user can add his own code by customization of function pointer HAL_UART_TxCpltCallback...
  • Page 650 HAL UART Generic Driver UM1940 The HAL_UART_Init(), HAL_HalfDuplex_Init(), HAL_LIN_Init() and HAL_MultiProcessor_Init() APIs follow respectively the UART asynchronous, UART Half duplex, LIN and Multi-Processor configuration procedures (details for the procedures are available in reference manual (RM0329)). This section contains the following APIs: HAL_UART_Init() HAL_HalfDuplex_Init() HAL_LIN_Init()
  • Page 651 UM1940 HAL UART Generic Driver HAL_UART_Receive_IT() HAL_UART_Transmit_DMA() HAL_UART_Receive_DMA() HAL_UART_DMAPause() HAL_UART_DMAResume() HAL_UART_DMAStop() HAL_UART_Abort() HAL_UART_AbortTransmit() HAL_UART_AbortReceive() HAL_UART_Abort_IT() HAL_UART_AbortTransmit_IT() HAL_UART_AbortReceive_IT() HAL_UART_IRQHandler() HAL_UART_TxCpltCallback() HAL_UART_TxHalfCpltCallback() HAL_UART_RxCpltCallback() HAL_UART_RxHalfCpltCallback() HAL_UART_ErrorCallback() HAL_UART_AbortCpltCallback() HAL_UART_AbortTransmitCpltCallback() HAL_UART_AbortReceiveCpltCallback() 47.2.4 Peripheral Control functions This subsection provides a set of functions allowing to control the UART: HAL_LIN_SendBreak() API can be helpful to transmit the break character.
  • Page 652 HAL UART Generic Driver UM1940 47.2.6 Detailed description of functions HAL_UART_Init Function name HAL_StatusTypeDef HAL_UART_Init (UART_HandleTypeDef * huart) Function description Initializes the UART mode according to the specified parameters in the UART_InitTypeDef and create the associated handle. Parameters huart: pointer to a UART_HandleTypeDef structure that contains the configuration information for the specified UART module.
  • Page 653 UM1940 HAL UART Generic Driver handle. Parameters huart: pointer to a UART_HandleTypeDef structure that contains the configuration information for the specified UART module. Address: USART address WakeUpMethod: specifies the USART wake-up method. This parameter can be one of the following values: UART_WAKEUPMETHOD_IDLELINE: Wake-up by an idle line detection UART_WAKEUPMETHOD_ADDRESSMARK: Wake-up...
  • Page 654 HAL UART Generic Driver UM1940 Parameters huart: pointer to a UART_HandleTypeDef structure that contains the configuration information for the specified UART module. pData: Pointer to data buffer Size: Amount of data to be sent Timeout: Timeout duration Return values HAL: status HAL_UART_Receive HAL_StatusTypeDef HAL_UART_Receive Function name...
  • Page 655 UM1940 HAL UART Generic Driver HAL_UART_Transmit_DMA Function name HAL_StatusTypeDef HAL_UART_Transmit_DMA (UART_HandleTypeDef * huart, uint8_t * pData, uint16_t Size) Function description Sends an amount of data in non blocking mode. Parameters huart: pointer to a UART_HandleTypeDef structure that contains the configuration information for the specified UART module.
  • Page 656 HAL UART Generic Driver UM1940 HAL_UART_DMAStop Function name HAL_StatusTypeDef HAL_UART_DMAStop (UART_HandleTypeDef * huart) Function description Stops the DMA Transfer. Parameters huart: pointer to a UART_HandleTypeDef structure that contains the configuration information for the specified UART module. Return values HAL: status HAL_UART_Abort HAL_StatusTypeDef HAL_UART_Abort Function name...
  • Page 657 UM1940 HAL UART Generic Driver Parameters huart: UART handle. Return values HAL: status Notes This procedure could be used for aborting any ongoing transfer started in Interrupt or DMA mode. This procedure performs following operations : Disable PPP InterruptsDisable the DMA transfer in the peripheral register (if enabled)Abort DMA transfer by calling HAL_DMA_Abort (in case of transfer in DMA mode)Set handle State to READY This procedure is executed in blocking mode : when exiting...
  • Page 658 HAL UART Generic Driver UM1940 HAL_UART_AbortReceive_IT Function name HAL_StatusTypeDef HAL_UART_AbortReceive_IT (UART_HandleTypeDef * huart) Function description Abort ongoing Receive transfer (Interrupt mode). Parameters huart: UART handle. Return values HAL: status Notes This procedure could be used for aborting any ongoing transfer started in Interrupt or DMA mode. This procedure performs following operations : Disable PPP InterruptsDisable the DMA transfer in the peripheral register (if enabled)Abort DMA transfer by calling HAL_DMA_Abort_IT (in case of...
  • Page 659 UM1940 HAL UART Generic Driver HAL_UART_RxCpltCallback Function name void HAL_UART_RxCpltCallback (UART_HandleTypeDef * huart) Function description Rx Transfer completed callbacks. Parameters huart: pointer to a UART_HandleTypeDef structure that contains the configuration information for the specified UART module. Return values None: HAL_UART_RxHalfCpltCallback void HAL_UART_RxHalfCpltCallback (UART_HandleTypeDef * Function name huart)
  • Page 660 HAL UART Generic Driver UM1940 HAL_UART_AbortReceiveCpltCallback Function name void HAL_UART_AbortReceiveCpltCallback (UART_HandleTypeDef * huart) Function description UART Abort Receive Complete callback. Parameters huart: UART handle. Return values None: HAL_LIN_SendBreak Function name HAL_StatusTypeDef HAL_LIN_SendBreak (UART_HandleTypeDef * huart) Function description Transmits break characters. Parameters huart: pointer to a UART_HandleTypeDef structure that contains the configuration information for the specified UART...
  • Page 661: Uart Firmware Driver Defines

    UM1940 HAL UART Generic Driver Return values HAL: status HAL_HalfDuplex_EnableReceiver HAL_StatusTypeDef HAL_HalfDuplex_EnableReceiver Function name (UART_HandleTypeDef * huart) Function description Enables the UART receiver and disables the UART transmitter. Parameters huart: pointer to a UART_HandleTypeDef structure that contains the configuration information for the specified UART module.
  • Page 662 HAL UART Generic Driver UM1940 RxState. Parameters: __HANDLE__: specifies the UART Handle. This parameter can be UARTx where x: 1, 2, 3, 4, 5, 6, 7 or 8 to select the USART or UART peripheral. Return value: None __HAL_UART_FLUSH_DRREGISTER Description: Flushes the UART DR register.
  • Page 663 UM1940 HAL UART Generic Driver Return value: The: new state of __FLAG__ (TRUE or FALSE). __HAL_UART_CLEAR_FLAG Description: Clears the specified UART pending flag. Parameters: __HANDLE__: specifies the UART Handle. This parameter can be UARTx where x: 1, 2, 3, 4, 5, 6, 7 or 8 to select the USART or UART peripheral.
  • Page 664 HAL UART Generic Driver UM1940 UARTx where x: 1, 2, 3, 4, 5, 6, 7 or 8 to select the USART or UART peripheral. Return value: None Description: __HAL_UART_CLEAR_FEFLAG Clear the UART FE pending flag. Parameters: __HANDLE__: specifies the UART Handle.
  • Page 665 UM1940 HAL UART Generic Driver peripheral. Return value: None UART_IT_MASK Description: Enable the specified UART interrupt. Parameters: __HANDLE__: specifies the UART Handle. This parameter can be UARTx where x: 1, 2, 3, 4, 5, 6, 7 or 8 to select the USART or UART peripheral.
  • Page 666 HAL UART Generic Driver UM1940 UART_IT_CTS: CTS change interrupt UART_IT_LBD: LIN Break detection interrupt UART_IT_TXE: Transmit Data Register empty interrupt UART_IT_TC: Transmission complete interrupt UART_IT_RXNE: Receive Data register not empty interrupt UART_IT_IDLE: Idle line detection interrupt UART_IT_PE: Parity Error interrupt UART_IT_ERR: Error interrupt(Frame error, noise error, overrun error)
  • Page 667 UM1940 HAL UART Generic Driver Enable CTS flow control This macro allows to enable CTS hardware flow control for a given UART instance, without need to call Parameters: __HANDLE__: specifies the UART Handle. The Handle Instance can be USART1, USART2 or LPUART. Return value: None Notes:...
  • Page 668 HAL UART Generic Driver UM1940 __HAL_UART_DISABLE(__HANDL E__)) and should be followed by an Enable macro (i.e __HAL_UART_ENABLE(__HANDLE __)). __HAL_UART_HWCONTROL_RTS_ENABLE Description: Enable RTS flow control This macro allows to enable RTS hardware flow control for a given UART instance, without need to call Parameters: __HANDLE__: specifies the UART Handle.
  • Page 669 UM1940 HAL UART Generic Driver USART instance Deinit/Init, following conditions for macro call should be fulfilled : UART instance should have already been initialised (through call of HAL_UART_Init() )macro could only be called when corresponding UART instance is disabled (i.e __HAL_UART_DISABLE(__HANDL E__)) and should be followed by an Enable macro (i.e...
  • Page 670 HAL UART Generic Driver UM1940 UART FLags UART_FLAG_CTS UART_FLAG_LBD UART_FLAG_TXE UART_FLAG_TC UART_FLAG_RXNE UART_FLAG_IDLE UART_FLAG_ORE UART_FLAG_NE UART_FLAG_FE UART_FLAG_PE UART Hardware Flow Control UART_HWCONTROL_NONE UART_HWCONTROL_RTS UART_HWCONTROL_CTS UART_HWCONTROL_RTS_CTS UART Interrupt Definitions UART_IT_PE UART_IT_TXE UART_IT_TC UART_IT_RXNE UART_IT_IDLE UART_IT_LBD UART_IT_CTS UART_IT_ERR UART LIN Break Detection Length UART_LINBREAKDETECTLENGTH_10B UART_LINBREAKDETECTLENGTH_11B UART Transfer Mode...
  • Page 671 UM1940 HAL UART Generic Driver UART_PARITY_NONE UART_PARITY_EVEN UART_PARITY_ODD UART State UART_STATE_DISABLE UART_STATE_ENABLE UART Number of Stop Bits UART_STOPBITS_1 UART_STOPBITS_2 UART Wakeup Functions UART_WAKEUPMETHOD_IDLELINE UART_WAKEUPMETHOD_ADDRESSMARK UART Word Length UART_WORDLENGTH_8B UART_WORDLENGTH_9B DocID028236 Rev 2 671/1371...
  • Page 672: Hal Usart Generic Driver

    HAL USART Generic Driver UM1940 HAL USART Generic Driver 48.1 USART Firmware driver registers structures 48.1.1 USART_InitTypeDef Data Fields uint32_t BaudRate uint32_t WordLength uint32_t StopBits uint32_t Parity uint32_t Mode uint32_t CLKPolarity uint32_t CLKPhase uint32_t CLKLastBit Field Documentation uint32_t USART_InitTypeDef::BaudRate This member configures the Usart communication baud rate. The baud rate is computed using the following formula:IntegerDivider = ((PCLKx) / (8 * (husart- >Init.BaudRate)))FractionalDivider = ((IntegerDivider - ((uint32_t) IntegerDivider)) * 8) + 0.5...
  • Page 673: Usart Firmware Driver Api Description

    UM1940 HAL USART Generic Driver USART_InitTypeDef Init uint8_t * pTxBuffPtr uint16_t TxXferSize __IO uint16_t TxXferCount uint8_t * pRxBuffPtr uint16_t RxXferSize __IO uint16_t RxXferCount DMA_HandleTypeDef * hdmatx DMA_HandleTypeDef * hdmarx HAL_LockTypeDef Lock __IO HAL_USART_StateTypeDef State __IO uint32_t ErrorCode Field Documentation USART_TypeDef* USART_HandleTypeDef::Instance USART_InitTypeDef USART_HandleTypeDef::Init uint8_t* USART_HandleTypeDef::pTxBuffPtr uint16_t USART_HandleTypeDef::TxXferSize...
  • Page 674 HAL USART Generic Driver UM1940 Associate the initialized DMA handle to the USART DMA Tx/Rx handle. Configure the priority and enable the NVIC for the transfer complete interrupt on the DMA Tx/Rx Stream. Program the Baud Rate, Word Length, Stop Bit, Parity, Hardware flow control and Mode(Receiver/Transmitter) in the husart Init structure.
  • Page 675 UM1940 HAL USART Generic Driver USART HAL driver macros list Below the list of most used macros in USART HAL driver. __HAL_USART_ENABLE: Enable the USART peripheral __HAL_USART_DISABLE: Disable the USART peripheral __HAL_USART_GET_FLAG : Check whether the specified USART flag is set or not __HAL_USART_CLEAR_FLAG : Clear the specified USART pending flag __HAL_USART_ENABLE_IT: Enable the specified USART interrupt __HAL_USART_DISABLE_IT: Disable the specified USART interrupt...
  • Page 676 HAL USART Generic Driver UM1940 indicated through the dedicated USART IRQ when using Interrupt mode or the DMA IRQ when using DMA mode. The HAL_USART_TxCpltCallback(), HAL_USART_RxCpltCallback() and HAL_USART_TxRxCpltCallback() user callbacks will be executed respectively at the end of the transmit or Receive process The HAL_USART_ErrorCallback() user callback will be executed when a communication error is detected Blocking mode APIs are :...
  • Page 677 UM1940 HAL USART Generic Driver 48.2.4 Peripheral State and Errors functions This subsection provides a set of functions allowing to return the State of USART communication process, return Peripheral Errors occurred during communication process HAL_USART_GetState() API can be helpful to check in run-time the state of the USART peripheral.
  • Page 678 HAL USART Generic Driver UM1940 Function description USART MSP DeInit. Parameters husart: pointer to a USART_HandleTypeDef structure that contains the configuration information for the specified USART module. Return values None: HAL_USART_Transmit Function name HAL_StatusTypeDef HAL_USART_Transmit (USART_HandleTypeDef * husart, uint8_t * pTxData, uint16_t Size, uint32_t Timeout) Function description Simplex Send an amount of data in blocking mode.
  • Page 679 UM1940 HAL USART Generic Driver Return values HAL: status HAL_USART_Transmit_IT HAL_StatusTypeDef HAL_USART_Transmit_IT Function name (USART_HandleTypeDef * husart, uint8_t * pTxData, uint16_t Size) Function description Simplex Send an amount of data in non-blocking mode. Parameters husart: pointer to a USART_HandleTypeDef structure that contains the configuration information for the specified USART module.
  • Page 680 HAL USART Generic Driver UM1940 Size) Function description Simplex Send an amount of data in non-blocking mode. Parameters husart: pointer to a USART_HandleTypeDef structure that contains the configuration information for the specified USART module. pTxData: Pointer to data buffer Size: Amount of data to be sent Return values HAL: status HAL_USART_Receive_DMA...
  • Page 681 UM1940 HAL USART Generic Driver Function description Pauses the DMA Transfer. Parameters husart: pointer to a USART_HandleTypeDef structure that contains the configuration information for the specified USART module. Return values HAL: status HAL_USART_DMAResume Function name HAL_StatusTypeDef HAL_USART_DMAResume (USART_HandleTypeDef * husart) Function description Resumes the DMA Transfer.
  • Page 682 HAL USART Generic Driver UM1940 (USART_HandleTypeDef * husart) Function description Abort ongoing transfer (Interrupt mode). Parameters husart: USART handle. Return values HAL: status Notes This procedure could be used for aborting any ongoing transfer (either Tx or Rx, as described by TransferType parameter) started in Interrupt or DMA mode.
  • Page 683 UM1940 HAL USART Generic Driver HAL_USART_RxCpltCallback Function name void HAL_USART_RxCpltCallback (USART_HandleTypeDef * husart) Function description Rx Transfer completed callbacks. Parameters husart: pointer to a USART_HandleTypeDef structure that contains the configuration information for the specified USART module. Return values None: HAL_USART_RxHalfCpltCallback void HAL_USART_RxHalfCpltCallback Function name (USART_HandleTypeDef * husart)
  • Page 684: Usart Firmware Driver Defines

    HAL USART Generic Driver UM1940 Return values None: HAL_USART_GetState HAL_USART_StateTypeDef HAL_USART_GetState Function name (USART_HandleTypeDef * husart) Function description Returns the USART state. Parameters husart: pointer to a USART_HandleTypeDef structure that contains the configuration information for the specified USART module. Return values HAL: state HAL_USART_GetError Function name...
  • Page 685 UM1940 HAL USART Generic Driver __HAL_USART_RESET_HANDLE_STATE Description: Reset USART handle state. Parameters: __HANDLE__: specifies the USART Handle. This parameter can be USARTx where x: 1, 2, 3 or 6 to select the USART peripheral. Return value: None __HAL_USART_GET_FLAG Description: Checks whether the specified Smartcard flag is set or not.
  • Page 686 HAL USART Generic Driver UM1940 6 to select the USART peripheral. __FLAG__: specifies the flag to check. This parameter can be any combination of the following values: USART_FLAG_TC: Transmission Complete flag. USART_FLAG_RXNE: Receive data register not empty flag. Return value: None Notes: PE (Parity error), FE (Framing...
  • Page 687 UM1940 HAL USART Generic Driver __HAL_USART_CLEAR_NEFLAG Description: Clear the USART NE pending flag. Parameters: __HANDLE__: specifies the USART Handle. This parameter can be USARTx where x: 1, 2, 3 or 6 to select the USART peripheral. Return value: None __HAL_USART_CLEAR_OREFLAG Description: Clear the UART ORE pending flag.
  • Page 688 HAL USART Generic Driver UM1940 USART_IT_RXNE: Receive Data register not empty interrupt USART_IT_IDLE: Idle line detection interrupt USART_IT_PE: Parity Error interrupt USART_IT_ERR: Error interrupt(Frame error, noise error, overrun error) This parameter can be: ENABLE or DISABLE. Return value: None __HAL_USART_DISABLE_IT __HAL_USART_GET_IT_SOURCE Description: Checks whether the specified...
  • Page 689 UM1940 HAL USART Generic Driver __HANDLE__: specifies the USART Handle. Return value: None __HAL_USART_ONE_BIT_SAMPLE_DISABLE Description: Macro to disable the USART's one bit sample method. Parameters: __HANDLE__: specifies the USART Handle. Return value: None __HAL_USART_ENABLE Description: Enable USART. Parameters: __HANDLE__: specifies the USART Handle.
  • Page 690 HAL USART Generic Driver UM1940 USART_FLAG_PE USART Interrupts Definition USART_IT_PE USART_IT_TXE USART_IT_TC USART_IT_RXNE USART_IT_IDLE USART_IT_LBD USART_IT_CTS USART_IT_ERR USART Last Bit USART_LASTBIT_DISABLE USART_LASTBIT_ENABLE USART Mode USART_MODE_RX USART_MODE_TX USART_MODE_TX_RX USART NACK State USART_NACK_DISABLE USART_NACK_ENABLE USART Parity USART_PARITY_NONE USART_PARITY_EVEN USART_PARITY_ODD USART Number of Stop Bits USART_STOPBITS_1 USART_STOPBITS_0_5 USART_STOPBITS_2...
  • Page 691: Hal Wwdg Generic Driver

    UM1940 HAL WWDG Generic Driver HAL WWDG Generic Driver 49.1 WWDG Firmware driver registers structures 49.1.1 WWDG_InitTypeDef Data Fields uint32_t Prescaler uint32_t Window uint32_t Counter uint32_t EWIMode Field Documentation uint32_t WWDG_InitTypeDef::Prescaler Specifies the prescaler value of the WWDG. This parameter can be a value of WWDG_Prescaler uint32_t WWDG_InitTypeDef::Window Specifies the WWDG window value to be compared to the downcounter.
  • Page 692 HAL WWDG Generic Driver UM1940 The WWDG counter input clock is derived from the APB clock divided by a programmable prescaler. WWDG clock (Hz) = PCLK1 / (4096 * Prescaler) WWDG timeout (mS) = 1000 * Counter / WWDG clock WWDG Counter refresh is allowed between the following limits : min time (mS) = 1000 * (Counter _ Window) / WWDG clock max time (mS) = 1000 * (Counter _ 0x40) / WWDG clock...
  • Page 693 UM1940 HAL WWDG Generic Driver This section contains the following APIs: HAL_WWDG_Init() HAL_WWDG_MspInit() 49.2.4 IO operation functions This section provides functions allowing to: Refresh the WWDG. Handle WWDG interrupt request and associated function callback. This section contains the following APIs: HAL_WWDG_Refresh() HAL_WWDG_IRQHandler() HAL_WWDG_EarlyWakeupCallback()
  • Page 694: Wwdg Firmware Driver Defines

    HAL WWDG Generic Driver UM1940 HAL_WWDG_IRQHandler Function name void HAL_WWDG_IRQHandler (WWDG_HandleTypeDef * hwwdg) Function description Handle WWDG interrupt request. Parameters hwwdg: pointer to a WWDG_HandleTypeDef structure that contains the configuration information for the specified WWDG module. Return values None: Notes The Early Wakeup Interrupt (EWI) can be used if specific safety operations or data logging must be performed before the actual reset is generated.
  • Page 695 UM1940 HAL WWDG Generic Driver Parameters: __HANDLE__: WWDG handle __INTERRUPT__: specifies the interrupt to enable. This parameter can be one of the following values: WWDG_IT_EWI: Early wakeup interrupt Return value: None Notes: Once enabled this interrupt cannot be disabled except by a system reset. __HAL_WWDG_GET_IT Description: Checks whether the selected WWDG interrupt...
  • Page 696 HAL WWDG Generic Driver UM1940 The: new state of WWDG_FLAG (SET or RESET). __HAL_WWDG_CLEAR_FLAG Description: Clears the WWDG's pending flags. Parameters: __HANDLE__: WWDG handle __FLAG__: specifies the flag to clear. This parameter can be one of the following values: WWDG_FLAG_EWIF: Early wakeup interrupt flag Return value: None...
  • Page 697: Ll Adc Generic Driver

    UM1940 LL ADC Generic Driver LL ADC Generic Driver 50.1 ADC Firmware driver registers structures 50.1.1 LL_ADC_CommonInitTypeDef Data Fields uint32_t CommonClock uint32_t Multimode uint32_t MultiDMATransfer uint32_t MultiTwoSamplingDelay Field Documentation uint32_t LL_ADC_CommonInitTypeDef::CommonClock Set parameter common to several ADC: Clock source and prescaler. This parameter can be a value of ADC_LL_EC_COMMON_CLOCK_SOURCEThis feature can be modified afterwards using unitary function LL_ADC_SetCommonClock().
  • Page 698: Ll_Adc_Reg_Inittypedef

    LL ADC Generic Driver UM1940 50.1.3 LL_ADC_REG_InitTypeDef Data Fields uint32_t TriggerSource uint32_t SequencerLength uint32_t SequencerDiscont uint32_t ContinuousMode uint32_t DMATransfer Field Documentation uint32_t LL_ADC_REG_InitTypeDef::TriggerSource Set ADC group regular conversion trigger source: internal (SW start) or from external IP (timer event, external interrupt line). This parameter can be a value of ADC_LL_EC_REG_TRIGGER_SOURCE Note:On this STM32 serie, setting of external trigger edge is performed using function LL_ADC_REG_StartConversionExtTrig().
  • Page 699: Adc Firmware Driver Api Description

    UM1940 LL ADC Generic Driver uint32_t LL_ADC_INJ_InitTypeDef::TriggerSource Set ADC group injected conversion trigger source: internal (SW start) or from external IP (timer event, external interrupt line). This parameter can be a value of ADC_LL_EC_INJ_TRIGGER_SOURCE Note:On this STM32 serie, setting of external trigger edge is performed using function LL_ADC_INJ_StartConversionExtTrig().
  • Page 700 LL ADC Generic Driver UM1940 LL_DMA_DIRECTION_PERIPH_TO_MEMORY); For devices with several ADC: in multimode, some devices use a different data register outside of ADC instance scope (common data register). This macro manages this register difference, only ADC instance has to be set as parameter. Reference Manual to DR RDATA LL_ADC_DMA_GetRegAddr LL API cross...
  • Page 701 UM1940 LL ADC Generic Driver LL_ADC_SetCommonPathInternalCh Function name __STATIC_INLINE void LL_ADC_SetCommonPathInternalCh (ADC_Common_TypeDef * ADCxy_COMMON, uint32_t PathInternal) Function description Set parameter common to several ADC: measurement path to internal channels (VrefInt, temperature sensor, ...). Parameters ADCxy_COMMON: ADC common instance (can be set directly from CMSIS definition or by using helper macro __LL_ADC_COMMON_INSTANCE() ) PathInternal: This parameter can be a combination of the...
  • Page 702 LL ADC Generic Driver UM1940 Notes One or several values can be selected. Example: (LL_ADC_PATH_INTERNAL_VREFINT | LL_ADC_PATH_INTERNAL_TEMPSENSOR) Reference Manual to CCR TSVREFE LL_ADC_GetCommonPathInternalCh LL API cross CCR VBATE LL_ADC_GetCommonPathInternalCh reference: LL_ADC_SetResolution Function name __STATIC_INLINE void LL_ADC_SetResolution (ADC_TypeDef * ADCx, uint32_t Resolution) Function description Set ADC resolution.
  • Page 703 UM1940 LL ADC Generic Driver LL_ADC_DATA_ALIGN_LEFT Return values None: Notes Refer to reference manual for alignments formats dependencies to ADC resolutions. Reference Manual to CR2 ALIGN LL_ADC_SetDataAlignment LL API cross reference: LL_ADC_GetDataAlignment __STATIC_INLINE uint32_t LL_ADC_GetDataAlignment Function name (ADC_TypeDef * ADCx) Function description Get ADC conversion data alignment.
  • Page 704 LL ADC Generic Driver UM1940 reference: LL_ADC_GetSequencersScanMode Function name __STATIC_INLINE uint32_t LL_ADC_GetSequencersScanMode (ADC_TypeDef * ADCx) Function description Get ADC sequencers scan mode, for all ADC groups (group regular, group injected). Parameters ADCx: ADC instance Return values Returned: value can be one of the following values: LL_ADC_SEQ_SCAN_DISABLE LL_ADC_SEQ_SCAN_ENABLE Notes...
  • Page 705 UM1940 LL ADC Generic Driver LL_ADC_REG_TRIG_EXT_TIM8_TRGO LL_ADC_REG_TRIG_EXT_EXTI_LINE11 Return values None: Notes On this STM32 serie, setting of external trigger edge is performed using function LL_ADC_REG_StartConversionExtTrig(). Availability of parameters of trigger sources from timer depends on timers availability on the selected device. Reference Manual to CR2 EXTSEL LL_ADC_REG_SetTriggerSource LL API cross...
  • Page 706 LL ADC Generic Driver UM1940 LL_ADC_REG_IsTriggerSourceSWStart Function name __STATIC_INLINE uint32_t LL_ADC_REG_IsTriggerSourceSWStart (ADC_TypeDef * ADCx) Function description Get ADC group regular conversion trigger source internal (SW start) or external. Parameters ADCx: ADC instance Return values Value: "0" if trigger source external trigger Value "1" if trigger source SW start.
  • Page 707 UM1940 LL ADC Generic Driver LL_ADC_REG_SEQ_SCAN_ENABLE_6RANKS LL_ADC_REG_SEQ_SCAN_ENABLE_7RANKS LL_ADC_REG_SEQ_SCAN_ENABLE_8RANKS LL_ADC_REG_SEQ_SCAN_ENABLE_9RANKS LL_ADC_REG_SEQ_SCAN_ENABLE_10RANKS LL_ADC_REG_SEQ_SCAN_ENABLE_11RANKS LL_ADC_REG_SEQ_SCAN_ENABLE_12RANKS LL_ADC_REG_SEQ_SCAN_ENABLE_13RANKS LL_ADC_REG_SEQ_SCAN_ENABLE_14RANKS LL_ADC_REG_SEQ_SCAN_ENABLE_15RANKS LL_ADC_REG_SEQ_SCAN_ENABLE_16RANKS Return values None: Notes Description of ADC group regular sequencer features: For devices with sequencer fully configurable (function "LL_ADC_REG_SetSequencerRanks()" available): sequencer length and each rank affectation to a channel are configurable.
  • Page 708 LL ADC Generic Driver UM1940 Parameters ADCx: ADC instance Return values Returned: value can be one of the following values: LL_ADC_REG_SEQ_SCAN_DISABLE LL_ADC_REG_SEQ_SCAN_ENABLE_2RANKS LL_ADC_REG_SEQ_SCAN_ENABLE_3RANKS LL_ADC_REG_SEQ_SCAN_ENABLE_4RANKS LL_ADC_REG_SEQ_SCAN_ENABLE_5RANKS LL_ADC_REG_SEQ_SCAN_ENABLE_6RANKS LL_ADC_REG_SEQ_SCAN_ENABLE_7RANKS LL_ADC_REG_SEQ_SCAN_ENABLE_8RANKS LL_ADC_REG_SEQ_SCAN_ENABLE_9RANKS LL_ADC_REG_SEQ_SCAN_ENABLE_10RANKS LL_ADC_REG_SEQ_SCAN_ENABLE_11RANKS LL_ADC_REG_SEQ_SCAN_ENABLE_12RANKS LL_ADC_REG_SEQ_SCAN_ENABLE_13RANKS LL_ADC_REG_SEQ_SCAN_ENABLE_14RANKS LL_ADC_REG_SEQ_SCAN_ENABLE_15RANKS LL_ADC_REG_SEQ_SCAN_ENABLE_16RANKS Notes Description of ADC group regular sequencer features: For devices with sequencer fully configurable (function "LL_ADC_REG_SetSequencerRanks()"...
  • Page 709 UM1940 LL ADC Generic Driver LL_ADC_REG_SetSequencerDiscont Function name __STATIC_INLINE void LL_ADC_REG_SetSequencerDiscont (ADC_TypeDef * ADCx, uint32_t SeqDiscont) Function description Set ADC group regular sequencer discontinuous mode: sequence subdivided and scan conversions interrupted every selected number of ranks. Parameters ADCx: ADC instance SeqDiscont: This parameter can be one of the following values: LL_ADC_REG_SEQ_DISCONT_DISABLE...
  • Page 710 LL ADC Generic Driver UM1940 LL_ADC_REG_SetSequencerRanks Function name __STATIC_INLINE void LL_ADC_REG_SetSequencerRanks (ADC_TypeDef * ADCx, uint32_t Rank, uint32_t Channel) Function description Set ADC group regular sequence: channel on the selected scan sequence rank. Parameters ADCx: ADC instance Rank: This parameter can be one of the following values: LL_ADC_REG_RANK_1 LL_ADC_REG_RANK_2 LL_ADC_REG_RANK_3...
  • Page 711 UM1940 LL ADC Generic Driver Return values None: Notes This function performs configuration of: Channels ordering into each rank of scan sequence: whatever channel can be placed into whatever rank. On this STM32 serie, ADC group regular sequencer is fully configurable: sequencer length and each rank affectation to a channel are configurable.
  • Page 712 LL ADC Generic Driver UM1940 LL_ADC_REG_RANK_11 LL_ADC_REG_RANK_12 LL_ADC_REG_RANK_13 LL_ADC_REG_RANK_14 LL_ADC_REG_RANK_15 LL_ADC_REG_RANK_16 Return values Returned: value can be one of the following values: (1) On STM32F4, parameter available only on ADC instance: ADC1. LL_ADC_CHANNEL_0 LL_ADC_CHANNEL_1 LL_ADC_CHANNEL_2 LL_ADC_CHANNEL_3 LL_ADC_CHANNEL_4 LL_ADC_CHANNEL_5 LL_ADC_CHANNEL_6 LL_ADC_CHANNEL_7 LL_ADC_CHANNEL_8 LL_ADC_CHANNEL_9 LL_ADC_CHANNEL_10...
  • Page 713 UM1940 LL ADC Generic Driver decimal format: process the returned value with the helper macro __LL_ADC_CHANNEL_TO_DECIMAL_NB(). Reference Manual to SQR3 SQ1 LL_ADC_REG_GetSequencerRanks LL API cross SQR3 SQ2 LL_ADC_REG_GetSequencerRanks reference: SQR3 SQ3 LL_ADC_REG_GetSequencerRanks SQR3 SQ4 LL_ADC_REG_GetSequencerRanks SQR3 SQ5 LL_ADC_REG_GetSequencerRanks SQR3 SQ6 LL_ADC_REG_GetSequencerRanks SQR2 SQ7 LL_ADC_REG_GetSequencerRanks SQR2 SQ8 LL_ADC_REG_GetSequencerRanks SQR2 SQ9 LL_ADC_REG_GetSequencerRanks...
  • Page 714 LL ADC Generic Driver UM1940 LL_ADC_REG_CONV_CONTINUOUS Notes Description of ADC continuous conversion mode: single mode: one conversion per triggercontinuous mode: after the first trigger, following conversions launched successively automatically. Reference Manual to CR2 CONT LL_ADC_REG_GetContinuousMode LL API cross reference: LL_ADC_REG_SetDMATransfer __STATIC_INLINE void LL_ADC_REG_SetDMATransfer Function name (ADC_TypeDef * ADCx, uint32_t DMATransfer)
  • Page 715 UM1940 LL ADC Generic Driver Parameters ADCx: ADC instance Return values Returned: value can be one of the following values: LL_ADC_REG_DMA_TRANSFER_NONE LL_ADC_REG_DMA_TRANSFER_LIMITED LL_ADC_REG_DMA_TRANSFER_UNLIMITED Notes If transfer by DMA selected, specifies the DMA requests mode: Limited mode (One shot mode): DMA transfer requests are stopped when number of DMA data transfers (number of ADC conversions) is reached.
  • Page 716 LL ADC Generic Driver UM1940 LL_ADC_REG_GetFlagEndOfConversion Function name __STATIC_INLINE uint32_t LL_ADC_REG_GetFlagEndOfConversion (ADC_TypeDef * ADCx) Function description Get which ADC flag between EOC (end of unitary conversion) or EOS (end of sequence conversions) is used to indicate the end of conversion. Parameters ADCx: ADC instance Return values...
  • Page 717 UM1940 LL ADC Generic Driver LL API cross CR2 JEXTEN LL_ADC_INJ_SetTriggerSource reference: LL_ADC_INJ_GetTriggerSource Function name __STATIC_INLINE uint32_t LL_ADC_INJ_GetTriggerSource (ADC_TypeDef * ADCx) Function description Get ADC group injected conversion trigger source: internal (SW start) or from external IP (timer event, external interrupt line). Parameters ADCx: ADC instance Return values...
  • Page 718 LL ADC Generic Driver UM1940 Notes In case of group injected trigger source set to external trigger, to determine which peripheral is selected as external trigger, use function LL_ADC_INJ_GetTriggerSource. Reference Manual to CR2 JEXTEN LL_ADC_INJ_IsTriggerSourceSWStart LL API cross reference: LL_ADC_INJ_GetTriggerEdge Function name __STATIC_INLINE uint32_t LL_ADC_INJ_GetTriggerEdge (ADC_TypeDef * ADCx)
  • Page 719 UM1940 LL ADC Generic Driver reference: LL_ADC_INJ_GetSequencerLength Function name __STATIC_INLINE uint32_t LL_ADC_INJ_GetSequencerLength (ADC_TypeDef * ADCx) Function description Get ADC group injected sequencer length and scan direction. Parameters ADCx: ADC instance Return values Returned: value can be one of the following values: LL_ADC_INJ_SEQ_SCAN_DISABLE LL_ADC_INJ_SEQ_SCAN_ENABLE_2RANKS LL_ADC_INJ_SEQ_SCAN_ENABLE_3RANKS...
  • Page 720 LL ADC Generic Driver UM1940 LL_ADC_INJ_GetSequencerDiscont Function name __STATIC_INLINE uint32_t LL_ADC_INJ_GetSequencerDiscont (ADC_TypeDef * ADCx) Function description Get ADC group injected sequencer discontinuous mode: sequence subdivided and scan conversions interrupted every selected number of ranks. Parameters ADCx: ADC instance Return values Returned: value can be one of the following values: LL_ADC_INJ_SEQ_DISCONT_DISABLE LL_ADC_INJ_SEQ_DISCONT_1RANK...
  • Page 721 UM1940 LL ADC Generic Driver LL_ADC_CHANNEL_VBAT (1) (2) On devices STM32F42x and STM32F43x, limitation: this internal channel is shared between temperature sensor and Vbat, only 1 measurement path must be enabled. Return values None: Notes Depending on devices and packages, some channels may not be available.
  • Page 722 LL ADC Generic Driver UM1940 LL_ADC_CHANNEL_VREFINT (1) LL_ADC_CHANNEL_TEMPSENSOR (1)(2) LL_ADC_CHANNEL_VBAT (1) (2) On devices STM32F42x and STM32F43x, limitation: this internal channel is shared between temperature sensor and Vbat, only 1 measurement path must be enabled. (1) For ADC channel read back from ADC register, comparison with internal channel parameter to be done using helper macro __LL_ADC_CHANNEL_INTERNAL_TO_EXTERNAL().
  • Page 723 UM1940 LL ADC Generic Driver controlled only from ADC group regular. It is not possible to enable both ADC group injected auto- injected mode and sequencer discontinuous mode. Reference Manual to CR1 JAUTO LL_ADC_INJ_SetTrigAuto LL API cross reference: LL_ADC_INJ_GetTrigAuto Function name __STATIC_INLINE uint32_t LL_ADC_INJ_GetTrigAuto (ADC_TypeDef * ADCx) Function description...
  • Page 724 LL ADC Generic Driver UM1940 LL_ADC_INJ_GetOffset Function name __STATIC_INLINE uint32_t LL_ADC_INJ_GetOffset (ADC_TypeDef * ADCx, uint32_t Rank) Function description Get ADC group injected offset. Parameters ADCx: ADC instance Rank: This parameter can be one of the following values: LL_ADC_INJ_RANK_1 LL_ADC_INJ_RANK_2 LL_ADC_INJ_RANK_3 LL_ADC_INJ_RANK_4 Return values Value: between Min_Data=0x000 and Max_Data=0xFFF...
  • Page 725 UM1940 LL ADC Generic Driver LL_ADC_CHANNEL_18 LL_ADC_CHANNEL_VREFINT (1) LL_ADC_CHANNEL_TEMPSENSOR (1)(2) LL_ADC_CHANNEL_VBAT (1) (2) On devices STM32F42x and STM32F43x, limitation: this internal channel is shared between temperature sensor and Vbat, only 1 measurement path must be enabled. SamplingTime: This parameter can be one of the following values: LL_ADC_SAMPLINGTIME_3CYCLES LL_ADC_SAMPLINGTIME_15CYCLES...
  • Page 726 LL ADC Generic Driver UM1940 SMPR2 SMP0 LL_ADC_SetChannelSamplingTime LL_ADC_GetChannelSamplingTime __STATIC_INLINE uint32_t Function name LL_ADC_GetChannelSamplingTime (ADC_TypeDef * ADCx, uint32_t Channel) Function description Get sampling time of the selected ADC channel Unit: ADC clock cycles. Parameters ADCx: ADC instance Channel: This parameter can be one of the following values: (1) On STM32F4, parameter available only on ADC instance: ADC1.
  • Page 727 UM1940 LL ADC Generic Driver processing time. Refer to reference manual for ADC processing time of this STM32 serie. Reference Manual to SMPR1 SMP18 LL_ADC_GetChannelSamplingTime LL API cross SMPR1 SMP17 LL_ADC_GetChannelSamplingTime reference: SMPR1 SMP16 LL_ADC_GetChannelSamplingTime SMPR1 SMP15 LL_ADC_GetChannelSamplingTime SMPR1 SMP14 LL_ADC_GetChannelSamplingTime SMPR1 SMP13 LL_ADC_GetChannelSamplingTime SMPR1 SMP12 LL_ADC_GetChannelSamplingTime SMPR1 SMP11 LL_ADC_GetChannelSamplingTime...
  • Page 728 LL ADC Generic Driver UM1940 LL_ADC_AWD_CHANNEL_5_REG LL_ADC_AWD_CHANNEL_5_INJ LL_ADC_AWD_CHANNEL_5_REG_INJ LL_ADC_AWD_CHANNEL_6_REG LL_ADC_AWD_CHANNEL_6_INJ LL_ADC_AWD_CHANNEL_6_REG_INJ LL_ADC_AWD_CHANNEL_7_REG LL_ADC_AWD_CHANNEL_7_INJ LL_ADC_AWD_CHANNEL_7_REG_INJ LL_ADC_AWD_CHANNEL_8_REG LL_ADC_AWD_CHANNEL_8_INJ LL_ADC_AWD_CHANNEL_8_REG_INJ LL_ADC_AWD_CHANNEL_9_REG LL_ADC_AWD_CHANNEL_9_INJ LL_ADC_AWD_CHANNEL_9_REG_INJ LL_ADC_AWD_CHANNEL_10_REG LL_ADC_AWD_CHANNEL_10_INJ LL_ADC_AWD_CHANNEL_10_REG_INJ LL_ADC_AWD_CHANNEL_11_REG LL_ADC_AWD_CHANNEL_11_INJ LL_ADC_AWD_CHANNEL_11_REG_INJ LL_ADC_AWD_CHANNEL_12_REG LL_ADC_AWD_CHANNEL_12_INJ LL_ADC_AWD_CHANNEL_12_REG_INJ LL_ADC_AWD_CHANNEL_13_REG LL_ADC_AWD_CHANNEL_13_INJ LL_ADC_AWD_CHANNEL_13_REG_INJ LL_ADC_AWD_CHANNEL_14_REG LL_ADC_AWD_CHANNEL_14_INJ LL_ADC_AWD_CHANNEL_14_REG_INJ LL_ADC_AWD_CHANNEL_15_REG LL_ADC_AWD_CHANNEL_15_INJ LL_ADC_AWD_CHANNEL_15_REG_INJ LL_ADC_AWD_CHANNEL_16_REG LL_ADC_AWD_CHANNEL_16_INJ LL_ADC_AWD_CHANNEL_16_REG_INJ LL_ADC_AWD_CHANNEL_17_REG LL_ADC_AWD_CHANNEL_17_INJ...
  • Page 729 UM1940 LL ADC Generic Driver internal channel is shared between temperature sensor and Vbat, only 1 measurement path must be enabled. Return values None: Notes Once monitored channels are selected, analog watchdog is enabled. In case of need to define a single channel to monitor with analog watchdog from sequencer channel definition, use helper macro __LL_ADC_ANALOGWD_CHANNEL_GROUP().
  • Page 730 LL ADC Generic Driver UM1940 LL_ADC_AWD_CHANNEL_6_INJ LL_ADC_AWD_CHANNEL_6_REG_INJ LL_ADC_AWD_CHANNEL_7_REG LL_ADC_AWD_CHANNEL_7_INJ LL_ADC_AWD_CHANNEL_7_REG_INJ LL_ADC_AWD_CHANNEL_8_REG LL_ADC_AWD_CHANNEL_8_INJ LL_ADC_AWD_CHANNEL_8_REG_INJ LL_ADC_AWD_CHANNEL_9_REG LL_ADC_AWD_CHANNEL_9_INJ LL_ADC_AWD_CHANNEL_9_REG_INJ LL_ADC_AWD_CHANNEL_10_REG LL_ADC_AWD_CHANNEL_10_INJ LL_ADC_AWD_CHANNEL_10_REG_INJ LL_ADC_AWD_CHANNEL_11_REG LL_ADC_AWD_CHANNEL_11_INJ LL_ADC_AWD_CHANNEL_11_REG_INJ LL_ADC_AWD_CHANNEL_12_REG LL_ADC_AWD_CHANNEL_12_INJ LL_ADC_AWD_CHANNEL_12_REG_INJ LL_ADC_AWD_CHANNEL_13_REG LL_ADC_AWD_CHANNEL_13_INJ LL_ADC_AWD_CHANNEL_13_REG_INJ LL_ADC_AWD_CHANNEL_14_REG LL_ADC_AWD_CHANNEL_14_INJ LL_ADC_AWD_CHANNEL_14_REG_INJ LL_ADC_AWD_CHANNEL_15_REG LL_ADC_AWD_CHANNEL_15_INJ LL_ADC_AWD_CHANNEL_15_REG_INJ LL_ADC_AWD_CHANNEL_16_REG LL_ADC_AWD_CHANNEL_16_INJ LL_ADC_AWD_CHANNEL_16_REG_INJ LL_ADC_AWD_CHANNEL_17_REG LL_ADC_AWD_CHANNEL_17_INJ LL_ADC_AWD_CHANNEL_17_REG_INJ LL_ADC_AWD_CHANNEL_18_REG LL_ADC_AWD_CHANNEL_18_INJ LL_ADC_AWD_CHANNEL_18_REG_INJ...
  • Page 731 UM1940 LL ADC Generic Driver monitored: ADC groups regular and-or injected.resolution: resolution is not limited (corresponds to ADC resolution configured). Reference Manual to CR1 AWD1CH LL_ADC_GetAnalogWDMonitChannels LL API cross CR1 AWD1SGL LL_ADC_GetAnalogWDMonitChannels reference: CR1 AWD1EN LL_ADC_GetAnalogWDMonitChannels LL_ADC_SetAnalogWDThresholds Function name __STATIC_INLINE void LL_ADC_SetAnalogWDThresholds (ADC_TypeDef * ADCx, uint32_t AWDThresholdsHighLow, uint32_t AWDThresholdValue) Function description...
  • Page 732 LL ADC Generic Driver UM1940 Notes In case of ADC resolution different of 12 bits, analog watchdog thresholds data require a specific shift. Use helper macro __LL_ADC_ANALOGWD_GET_THRESHOLD_RESOLUTIO N(). Reference Manual to HTR HT LL_ADC_GetAnalogWDThresholds LL API cross LTR LT LL_ADC_GetAnalogWDThresholds reference: LL_ADC_SetMultimode Function name...
  • Page 733 UM1940 LL ADC Generic Driver Parameters ADCxy_COMMON: ADC common instance (can be set directly from CMSIS definition or by using helper macro __LL_ADC_COMMON_INSTANCE() ) Return values Returned: value can be one of the following values: LL_ADC_MULTI_INDEPENDENT LL_ADC_MULTI_DUAL_REG_SIMULT LL_ADC_MULTI_DUAL_REG_INTERL LL_ADC_MULTI_DUAL_INJ_SIMULT LL_ADC_MULTI_DUAL_INJ_ALTERN LL_ADC_MULTI_DUAL_REG_SIM_INJ_SIM LL_ADC_MULTI_DUAL_REG_SIM_INJ_ALT LL_ADC_MULTI_DUAL_REG_INT_INJ_SIM...
  • Page 734 LL ADC Generic Driver UM1940 mode): DMA transfer requests are stopped when number of DMA data transfers (number of ADC conversions) is reached. This ADC mode is intended to be used with DMA mode non- circular.Unlimited mode: DMA transfer requests are unlimited, whatever number of DMA data transfers (number of ADC conversions).
  • Page 735 UM1940 LL ADC Generic Driver DMA mode circular. If ADC DMA requests mode is set to unlimited and DMA is set to mode non-circular: when DMA transfers size will be reached, DMA will stop transfers of ADC conversions data ADC will raise an overrun error (overrun flag and interruption if enabled).
  • Page 736 LL ADC Generic Driver UM1940 Reference Manual to CCR DELAY LL_ADC_SetMultiTwoSamplingDelay LL API cross reference: LL_ADC_GetMultiTwoSamplingDelay Function name __STATIC_INLINE uint32_t LL_ADC_GetMultiTwoSamplingDelay (ADC_Common_TypeDef * ADCxy_COMMON) Function description Get ADC multimode delay between 2 sampling phases. Parameters ADCxy_COMMON: ADC common instance (can be set directly from CMSIS definition or by using helper macro __LL_ADC_COMMON_INSTANCE() ) Return values...
  • Page 737 UM1940 LL ADC Generic Driver LL_ADC_Disable Function name __STATIC_INLINE void LL_ADC_Disable (ADC_TypeDef * ADCx) Function description Disable the selected ADC instance. Parameters ADCx: ADC instance Return values None: Reference Manual to CR2 ADON LL_ADC_Disable LL API cross reference: LL_ADC_IsEnabled Function name __STATIC_INLINE uint32_t LL_ADC_IsEnabled (ADC_TypeDef * ADCx) Function description...
  • Page 738 LL ADC Generic Driver UM1940 Function description Start ADC group regular conversion from external trigger. Parameters ExternalTriggerEdge: This parameter can be one of the following values: LL_ADC_REG_TRIG_EXT_RISING LL_ADC_REG_TRIG_EXT_FALLING LL_ADC_REG_TRIG_EXT_RISINGFALLING ADCx: ADC instance Return values None: Notes ADC conversion will start at next trigger event (on the selected trigger edge) following the ADC start conversion command.
  • Page 739 UM1940 LL ADC Generic Driver Reference Manual to DR RDATA LL_ADC_REG_ReadConversionData32 LL API cross reference: LL_ADC_REG_ReadConversionData12 Function name __STATIC_INLINE uint16_t LL_ADC_REG_ReadConversionData12 (ADC_TypeDef * ADCx) Function description Get ADC group regular conversion data, range fit for ADC resolution 12 bits. Parameters ADCx: ADC instance Return values Value: between Min_Data=0x000 and Max_Data=0xFFF...
  • Page 740 LL ADC Generic Driver UM1940 Reference Manual to DR RDATA LL_ADC_REG_ReadConversionData8 LL API cross reference: LL_ADC_REG_ReadConversionData6 Function name __STATIC_INLINE uint8_t LL_ADC_REG_ReadConversionData6 (ADC_TypeDef * ADCx) Function description Get ADC group regular conversion data, range fit for ADC resolution 6 bits. Parameters ADCx: ADC instance Return values Value: between Min_Data=0x00 and Max_Data=0x3F...
  • Page 741 UM1940 LL ADC Generic Driver LL_ADC_INJ_StartConversionSWStart Function name __STATIC_INLINE void LL_ADC_INJ_StartConversionSWStart (ADC_TypeDef * ADCx) Function description Start ADC group injected conversion. Parameters ADCx: ADC instance Return values None: Notes On this STM32 serie, this function is relevant only for internal trigger (SW start), not for external trigger: If ADC trigger has been set to software start, ADC conversion starts immediately.If ADC trigger has been set to external trigger,...
  • Page 742 LL ADC Generic Driver UM1940 Parameters ADCx: ADC instance Return values None: Notes No more ADC conversion will start at next trigger event following the ADC stop conversion command. If a conversion is on-going, it will be completed. On this STM32 serie, there is no specific command to stop a conversion on-going or to stop ADC converting in continuous mode.
  • Page 743 UM1940 LL ADC Generic Driver Notes For devices with feature oversampling: Oversampling can increase data width, function for extended range may be needed: LL_ADC_INJ_ReadConversionData32. Reference Manual to JDR1 JDATA LL_ADC_INJ_ReadConversionData12 LL API cross JDR2 JDATA LL_ADC_INJ_ReadConversionData12 reference: JDR3 JDATA LL_ADC_INJ_ReadConversionData12 JDR4 JDATA LL_ADC_INJ_ReadConversionData12 LL_ADC_INJ_ReadConversionData10 __STATIC_INLINE uint16_t...
  • Page 744 LL ADC Generic Driver UM1940 LL API cross JDR2 JDATA LL_ADC_INJ_ReadConversionData8 reference: JDR3 JDATA LL_ADC_INJ_ReadConversionData8 JDR4 JDATA LL_ADC_INJ_ReadConversionData8 LL_ADC_INJ_ReadConversionData6 Function name __STATIC_INLINE uint8_t LL_ADC_INJ_ReadConversionData6 (ADC_TypeDef * ADCx, uint32_t Rank) Function description Get ADC group injected conversion data, range fit for ADC resolution 6 bits.
  • Page 745 UM1940 LL ADC Generic Driver Return values State: of bit (1 or 0). Reference Manual to SR OVR LL_ADC_IsActiveFlag_OVR LL API cross reference: LL_ADC_IsActiveFlag_JEOS __STATIC_INLINE uint32_t LL_ADC_IsActiveFlag_JEOS Function name (ADC_TypeDef * ADCx) Function description Get flag ADC group injected end of sequence conversions. Parameters ADCx: ADC instance Return values...
  • Page 746 LL ADC Generic Driver UM1940 Parameters ADCx: ADC instance Return values None: Reference Manual to SR OVR LL_ADC_ClearFlag_OVR LL API cross reference: LL_ADC_ClearFlag_JEOS Function name __STATIC_INLINE void LL_ADC_ClearFlag_JEOS (ADC_TypeDef * ADCx) Function description Clear flag ADC group injected end of sequence conversions. Parameters ADCx: ADC instance Return values...
  • Page 747 UM1940 LL ADC Generic Driver LL_ADC_IsActiveFlag_SLV1_EOCS Function name __STATIC_INLINE uint32_t LL_ADC_IsActiveFlag_SLV1_EOCS (ADC_Common_TypeDef * ADCxy_COMMON) Function description Get flag multimode ADC group regular end of unitary conversion or end of sequence conversions, depending on ADC configuration, of the ADC slave 1. Parameters ADCxy_COMMON: ADC common instance (can be set directly from CMSIS definition or by using helper macro...
  • Page 748 LL ADC Generic Driver UM1940 reference: LL_ADC_IsActiveFlag_SLV1_OVR Function name __STATIC_INLINE uint32_t LL_ADC_IsActiveFlag_SLV1_OVR (ADC_Common_TypeDef * ADCxy_COMMON) Function description Get flag multimode ADC group regular overrun of the ADC slave 1. Parameters ADCxy_COMMON: ADC common instance (can be set directly from CMSIS definition or by using helper macro __LL_ADC_COMMON_INSTANCE() ) Return values State: of bit (1 or 0).
  • Page 749 UM1940 LL ADC Generic Driver conversions of the ADC slave 1. Parameters ADCxy_COMMON: ADC common instance (can be set directly from CMSIS definition or by using helper macro __LL_ADC_COMMON_INSTANCE() ) Return values State: of bit (1 or 0). Reference Manual to CSR JEOC2 LL_ADC_IsActiveFlag_SLV1_JEOS LL API cross reference:...
  • Page 750 LL ADC Generic Driver UM1940 Reference Manual to CSR AWD2 LL_ADC_IsActiveFlag_SLV1_AWD1 LL API cross reference: LL_ADC_IsActiveFlag_SLV2_AWD1 Function name __STATIC_INLINE uint32_t LL_ADC_IsActiveFlag_SLV2_AWD1 (ADC_Common_TypeDef * ADCxy_COMMON) Function description Get flag multimode analog watchdog 1 of the ADC slave 2. Parameters ADCxy_COMMON: ADC common instance (can be set directly from CMSIS definition or by using helper macro __LL_ADC_COMMON_INSTANCE() ) Return values...
  • Page 751 UM1940 LL ADC Generic Driver Function description Enable interruption ADC group injected end of sequence conversions. Parameters ADCx: ADC instance Return values None: Reference Manual to CR1 JEOCIE LL_ADC_EnableIT_JEOS LL API cross reference: LL_ADC_EnableIT_AWD1 Function name __STATIC_INLINE void LL_ADC_EnableIT_AWD1 (ADC_TypeDef * ADCx) Function description Enable interruption ADC analog watchdog 1.
  • Page 752 LL ADC Generic Driver UM1940 LL_ADC_DisableIT_JEOS Function name __STATIC_INLINE void LL_ADC_DisableIT_JEOS (ADC_TypeDef * ADCx) Function description Disable interruption ADC group injected end of sequence conversions. Parameters ADCx: ADC instance Return values None: Reference Manual to CR1 JEOCIE LL_ADC_EnableIT_JEOS LL API cross reference: LL_ADC_DisableIT_AWD1 Function name...
  • Page 753 UM1940 LL ADC Generic Driver Return values State: of bit (1 or 0). Reference Manual to CR1 OVRIE LL_ADC_IsEnabledIT_OVR LL API cross reference: LL_ADC_IsEnabledIT_JEOS __STATIC_INLINE uint32_t LL_ADC_IsEnabledIT_JEOS Function name (ADC_TypeDef * ADCx) Function description Get state of interruption ADC group injected end of sequence conversions (0: interrupt disabled, 1: interrupt enabled).
  • Page 754 LL ADC Generic Driver UM1940 Function description Initialize some features of ADC common parameters (all ADC instances belonging to the same ADC common instance) and multimode (for devices with several ADC instances available). Parameters ADCxy_COMMON: ADC common instance (can be set directly from CMSIS definition or by using helper macro __LL_ADC_COMMON_INSTANCE() ) ADC_CommonInitStruct: Pointer to a...
  • Page 755 UM1940 LL ADC Generic Driver ERROR: ADC registers are not initialized Notes These parameters have an impact on ADC scope: ADC instance. Affects both group regular and group injected (availability of ADC group injected depends on STM32 families). Refer to corresponding unitary functions into Configuration of ADC hierarchical scope: ADC instance .
  • Page 756 LL ADC Generic Driver UM1940 The setting of these parameters by function LL_ADC_Init() is conditioned to ADC state: ADC instance must be disabled. This condition is applied to all ADC features, for efficiency and compatibility over all STM32 families. However, the different features can be set under different ADC state conditions (setting possible with ADC enabled without conversion on going, ADC enabled with conversion on going, ...) Each...
  • Page 757 UM1940 LL ADC Generic Driver going, ADC enabled with conversion on going, ...) Each feature can be updated afterwards with a unitary function and potentially with ADC in a different state than disabled, refer to description of each function for setting conditioned to ADC state.
  • Page 758 LL ADC Generic Driver UM1940 converted by either group regular or injected LL_ADC_AWD_CHANNEL_1_REG ADC analog watchdog monitoring of ADC external channel (channel connected to GPIO pin) ADCx_IN1, converted by group regular only LL_ADC_AWD_CHANNEL_1_INJ ADC analog watchdog monitoring of ADC external channel (channel connected to GPIO pin) ADCx_IN1, converted by group injected only LL_ADC_AWD_CHANNEL_1_REG_INJ...
  • Page 759 UM1940 LL ADC Generic Driver LL_ADC_AWD_CHANNEL_4_REG_INJ ADC analog watchdog monitoring of ADC external channel (channel connected to GPIO pin) ADCx_IN4, converted by either group regular or injected LL_ADC_AWD_CHANNEL_5_REG ADC analog watchdog monitoring of ADC external channel (channel connected to GPIO pin) ADCx_IN5, converted by group regular only LL_ADC_AWD_CHANNEL_5_INJ ADC analog watchdog monitoring of...
  • Page 760 LL ADC Generic Driver UM1940 connected to GPIO pin) ADCx_IN8, converted by group injected only LL_ADC_AWD_CHANNEL_8_REG_INJ ADC analog watchdog monitoring of ADC external channel (channel connected to GPIO pin) ADCx_IN8, converted by either group regular or injected LL_ADC_AWD_CHANNEL_9_REG ADC analog watchdog monitoring of ADC external channel (channel connected to GPIO pin) ADCx_IN9, converted by group regular only...
  • Page 761 UM1940 LL ADC Generic Driver converted by group regular only LL_ADC_AWD_CHANNEL_12_INJ ADC analog watchdog monitoring of ADC external channel (channel connected to GPIO pin) ADCx_IN12, converted by group injected only LL_ADC_AWD_CHANNEL_12_REG_INJ ADC analog watchdog monitoring of ADC external channel (channel connected to GPIO pin) ADCx_IN12, converted by either group regular or injected...
  • Page 762 LL ADC Generic Driver UM1940 LL_ADC_AWD_CHANNEL_16_REG ADC analog watchdog monitoring of ADC external channel (channel connected to GPIO pin) ADCx_IN16, converted by group regular only LL_ADC_AWD_CHANNEL_16_INJ ADC analog watchdog monitoring of ADC external channel (channel connected to GPIO pin) ADCx_IN16, converted by group injected only LL_ADC_AWD_CHANNEL_16_REG_INJ ADC analog watchdog monitoring of...
  • Page 763 UM1940 LL ADC Generic Driver converted by either group regular or injected LL_ADC_AWD_CH_VBAT_REG ADC analog watchdog monitoring of ADC internal channel connected to Vbat/3: Vbat voltage through a divider ladder of factor 1/3 to have Vbat always below Vdda, converted by group regular only LL_ADC_AWD_CH_VBAT_INJ ADC analog watchdog monitoring of...
  • Page 764 ADC instance: ADC1. LL_ADC_CHANNEL_VBAT ADC internal channel connected to Vbat/3: Vbat voltage through a divider ladder of factor 1/3 to have Vbat always below Vdda. On STM32F2, ADC channel available only on ADC instance: ADC1. LL_ADC_CHANNEL_TEMPSENSOR ADC internal channel connected to Temperature sensor.
  • Page 765 UM1940 LL ADC Generic Driver LL_ADC_SAMPLINGTIME_84CYCLES Sampling time 84 ADC clock cycles LL_ADC_SAMPLINGTIME_112CYCLES Sampling time 112 ADC clock cycles LL_ADC_SAMPLINGTIME_144CYCLES Sampling time 144 ADC clock cycles LL_ADC_SAMPLINGTIME_480CYCLES Sampling time 480 ADC clock cycles ADC common - Clock source LL_ADC_CLOCK_SYNC_PCLK_DIV2 ADC synchronous clock derived from AHB clock with prescaler division by 2 LL_ADC_CLOCK_SYNC_PCLK_DIV4 ADC synchronous clock derived from AHB clock...
  • Page 766 LL ADC Generic Driver UM1940 LL_ADC_FLAG_EOCS_SLV1 ADC flag ADC multimode slave 1 group regular end of unitary conversion or sequence conversions (to configure flag of end of conversion, use function LL_ADC_FLAG_EOCS_SLV2 ADC flag ADC multimode slave 2 group regular end of unitary conversion or sequence conversions (to configure flag of end of conversion, use function LL_ADC_FLAG_OVR_MST...
  • Page 767 UM1940 LL ADC Generic Driver ADC group injected - Sequencer ranks LL_ADC_INJ_RANK_1 ADC group injected sequencer rank 1 LL_ADC_INJ_RANK_2 ADC group injected sequencer rank 2 LL_ADC_INJ_RANK_3 ADC group injected sequencer rank 3 LL_ADC_INJ_RANK_4 ADC group injected sequencer rank 4 ADC group injected - Sequencer scan length LL_ADC_INJ_SEQ_SCAN_DISABLE ADC group injected sequencer disable (equivalent to sequencer of 1 rank: ADC...
  • Page 768 LL ADC Generic Driver UM1940 compare: input capture or output capture). Trigger edge set to rising edge (default setting). LL_ADC_INJ_TRIG_EXT_TIM4_CH1 ADC group injected conversion trigger from external IP: TIM4 channel 1 event (capture compare: input capture or output capture). Trigger edge set to rising edge (default setting). LL_ADC_INJ_TRIG_EXT_TIM4_CH2 ADC group injected conversion trigger from external IP: TIM4 channel 2 event (capture...
  • Page 769 UM1940 LL ADC Generic Driver stop: in this case, ADC group injected is controlled only from ADC group regular. ADC interruptions for configuration (interruption enable or disable) LL_ADC_IT_EOCS ADC interruption ADC group regular end of unitary conversion or sequence conversions (to configure flag of end of conversion, use function LL_ADC_IT_OVR ADC interruption ADC group regular overrun...
  • Page 770 LL ADC Generic Driver UM1940 LL_ADC_MULTI_REG_DMA_UNLMT_1 ADC multimode group regular conversions are transferred by DMA, one DMA channel for all ADC instances (DMA of ADC master), in unlimited mode: DMA transfer requests are unlimited, whatever number of DMA data transferred (number of ADC conversions) is reached.
  • Page 771 UM1940 LL ADC Generic Driver LL_ADC_MULTI_DUAL_INJ_ALTERN ADC dual mode enabled: group injected alternate trigger. Works only with external triggers (not internal SW start) LL_ADC_MULTI_DUAL_REG_SIM_INJ_SIM ADC dual mode enabled: Combined group regular simultaneous + group injected simultaneous LL_ADC_MULTI_DUAL_REG_SIM_INJ_ALT ADC dual mode enabled: Combined group regular simultaneous + group injected alternate trigger LL_ADC_MULTI_DUAL_REG_INT_INJ_SIM...
  • Page 772 LL ADC Generic Driver UM1940 sampling phases: 13 ADC clock cycles LL_ADC_MULTI_TWOSMP_DELAY_14CYCLES ADC multimode delay between two sampling phases: 14 ADC clock cycles LL_ADC_MULTI_TWOSMP_DELAY_15CYCLES ADC multimode delay between two sampling phases: 15 ADC clock cycles LL_ADC_MULTI_TWOSMP_DELAY_16CYCLES ADC multimode delay between two sampling phases: 16 ADC clock cycles LL_ADC_MULTI_TWOSMP_DELAY_17CYCLES ADC multimode delay between two...
  • Page 773 UM1940 LL ADC Generic Driver conversions) selected ADC group regular - Sequencer discontinuous mode LL_ADC_REG_SEQ_DISCONT_DISABLE ADC group regular sequencer discontinuous mode disable LL_ADC_REG_SEQ_DISCONT_1RANK ADC group regular sequencer discontinuous mode enable with sequence interruption every rank LL_ADC_REG_SEQ_DISCONT_2RANKS ADC group regular sequencer discontinuous mode enabled with sequence interruption every 2 ranks LL_ADC_REG_SEQ_DISCONT_3RANKS...
  • Page 774 LL ADC Generic Driver UM1940 LL_ADC_REG_RANK_14 ADC group regular sequencer rank 14 LL_ADC_REG_RANK_15 ADC group regular sequencer rank 15 LL_ADC_REG_RANK_16 ADC group regular sequencer rank 16 ADC group regular - Sequencer scan length LL_ADC_REG_SEQ_SCAN_DISABLE ADC group regular sequencer disable (equivalent to sequencer of 1 rank: ADC conversion on only 1 channel) LL_ADC_REG_SEQ_SCAN_ENABLE_2RANKS ADC group regular sequencer enable...
  • Page 775 UM1940 LL ADC Generic Driver polarity set to both rising and falling edges ADC group regular - Trigger source LL_ADC_REG_TRIG_SOFTWARE ADC group regular conversion trigger internal: SW start. LL_ADC_REG_TRIG_EXT_TIM1_CH1 ADC group regular conversion trigger from external IP: TIM1 channel 1 event (capture compare: input capture or output capture).
  • Page 776 LL ADC Generic Driver UM1940 setting). LL_ADC_REG_TRIG_EXT_TIM5_CH1 ADC group regular conversion trigger from external IP: TIM5 channel 1 event (capture compare: input capture or output capture). Trigger edge set to rising edge (default setting). LL_ADC_REG_TRIG_EXT_TIM5_CH2 ADC group regular conversion trigger from external IP: TIM5 channel 2 event (capture compare: input capture or output capture).
  • Page 777 UM1940 LL ADC Generic Driver LL_ADC_CHANNEL_x. Parameters: __CHANNEL__: This parameter can be one of the following values: LL_ADC_CHANNEL_0 LL_ADC_CHANNEL_1 LL_ADC_CHANNEL_2 LL_ADC_CHANNEL_3 LL_ADC_CHANNEL_4 LL_ADC_CHANNEL_5 LL_ADC_CHANNEL_6 LL_ADC_CHANNEL_7 LL_ADC_CHANNEL_8 LL_ADC_CHANNEL_9 LL_ADC_CHANNEL_10 LL_ADC_CHANNEL_11 LL_ADC_CHANNEL_12 LL_ADC_CHANNEL_13 LL_ADC_CHANNEL_14 LL_ADC_CHANNEL_15 LL_ADC_CHANNEL_16 LL_ADC_CHANNEL_17 LL_ADC_CHANNEL_18 LL_ADC_CHANNEL_VREFINT (1) LL_ADC_CHANNEL_TEMPSENSOR (1)(2) LL_ADC_CHANNEL_VBAT (1) Return value: Value: between Min_Data=0 and Max_Data=18...
  • Page 778 LL ADC Generic Driver UM1940 LL_ADC_CHANNEL_0 LL_ADC_CHANNEL_1 LL_ADC_CHANNEL_2 LL_ADC_CHANNEL_3 LL_ADC_CHANNEL_4 LL_ADC_CHANNEL_5 LL_ADC_CHANNEL_6 LL_ADC_CHANNEL_7 LL_ADC_CHANNEL_8 LL_ADC_CHANNEL_9 LL_ADC_CHANNEL_10 LL_ADC_CHANNEL_11 LL_ADC_CHANNEL_12 LL_ADC_CHANNEL_13 LL_ADC_CHANNEL_14 LL_ADC_CHANNEL_15 LL_ADC_CHANNEL_16 LL_ADC_CHANNEL_17 LL_ADC_CHANNEL_18 LL_ADC_CHANNEL_VREFINT (1) LL_ADC_CHANNEL_TEMPSENSOR (1)(2) LL_ADC_CHANNEL_VBAT (1) Notes: Example: __LL_ADC_DECIMAL_NB_TO_CHANNEL(4) will return a data equivalent to "LL_ADC_CHANNEL_4". __LL_ADC_IS_CHANNEL_INTER Description: Helper macro to determine whether the...
  • Page 779 UM1940 LL ADC Generic Driver LL_ADC_CHANNEL_15 LL_ADC_CHANNEL_16 LL_ADC_CHANNEL_17 LL_ADC_CHANNEL_18 LL_ADC_CHANNEL_VREFINT (1) LL_ADC_CHANNEL_TEMPSENSOR (1)(2) LL_ADC_CHANNEL_VBAT (1) Return value: Value: "0" if the channel corresponds to a parameter definition of a ADC external channel (channel connected to a GPIO pin). Value "1" if the channel corresponds to a parameter definition of a ADC internal channel.
  • Page 780 LL ADC Generic Driver UM1940 LL_ADC_CHANNEL_6 LL_ADC_CHANNEL_7 LL_ADC_CHANNEL_8 LL_ADC_CHANNEL_9 LL_ADC_CHANNEL_10 LL_ADC_CHANNEL_11 LL_ADC_CHANNEL_12 LL_ADC_CHANNEL_13 LL_ADC_CHANNEL_14 LL_ADC_CHANNEL_15 LL_ADC_CHANNEL_16 LL_ADC_CHANNEL_17 LL_ADC_CHANNEL_18 LL_ADC_CHANNEL_VREFINT (1) LL_ADC_CHANNEL_TEMPSENSOR (1)(2) LL_ADC_CHANNEL_VBAT (1) Return value: Returned: value can be one of the following values: LL_ADC_CHANNEL_0 LL_ADC_CHANNEL_1 LL_ADC_CHANNEL_2 LL_ADC_CHANNEL_3 LL_ADC_CHANNEL_4 LL_ADC_CHANNEL_5 LL_ADC_CHANNEL_6 LL_ADC_CHANNEL_7...
  • Page 781 UM1940 LL ADC Generic Driver __LL_ADC_IS_CHANNEL_INTER Description: NAL_AVAILABLE Helper macro to determine whether the internal channel selected is available on the ADC instance selected. Parameters: __ADC_INSTANCE__: ADC instance __CHANNEL__: This parameter can be one of the following values: LL_ADC_CHANNEL_VREFINT (1) LL_ADC_CHANNEL_TEMPSENSOR (1)(2) LL_ADC_CHANNEL_VBAT (1)
  • Page 782 LL ADC Generic Driver UM1940 LL_ADC_CHANNEL_10 LL_ADC_CHANNEL_11 LL_ADC_CHANNEL_12 LL_ADC_CHANNEL_13 LL_ADC_CHANNEL_14 LL_ADC_CHANNEL_15 LL_ADC_CHANNEL_16 LL_ADC_CHANNEL_17 LL_ADC_CHANNEL_18 LL_ADC_CHANNEL_VREFINT (1) LL_ADC_CHANNEL_TEMPSENSOR (1)(2) LL_ADC_CHANNEL_VBAT (1) __GROUP__: This parameter can be one of the following values: LL_ADC_GROUP_REGULAR LL_ADC_GROUP_INJECTED LL_ADC_GROUP_REGULAR_INJECTED Return value: Returned: value can be one of the following values: LL_ADC_AWD_DISABLE LL_ADC_AWD_ALL_CHANNELS_REG...
  • Page 783 UM1940 LL ADC Generic Driver LL_ADC_AWD_CHANNEL_8_REG_INJ LL_ADC_AWD_CHANNEL_9_REG LL_ADC_AWD_CHANNEL_9_INJ LL_ADC_AWD_CHANNEL_9_REG_INJ LL_ADC_AWD_CHANNEL_10_REG LL_ADC_AWD_CHANNEL_10_INJ LL_ADC_AWD_CHANNEL_10_REG_INJ LL_ADC_AWD_CHANNEL_11_REG LL_ADC_AWD_CHANNEL_11_INJ LL_ADC_AWD_CHANNEL_11_REG_INJ LL_ADC_AWD_CHANNEL_12_REG LL_ADC_AWD_CHANNEL_12_INJ LL_ADC_AWD_CHANNEL_12_REG_INJ LL_ADC_AWD_CHANNEL_13_REG LL_ADC_AWD_CHANNEL_13_INJ LL_ADC_AWD_CHANNEL_13_REG_INJ LL_ADC_AWD_CHANNEL_14_REG LL_ADC_AWD_CHANNEL_14_INJ LL_ADC_AWD_CHANNEL_14_REG_INJ LL_ADC_AWD_CHANNEL_15_REG LL_ADC_AWD_CHANNEL_15_INJ LL_ADC_AWD_CHANNEL_15_REG_INJ LL_ADC_AWD_CHANNEL_16_REG LL_ADC_AWD_CHANNEL_16_INJ LL_ADC_AWD_CHANNEL_16_REG_INJ LL_ADC_AWD_CHANNEL_17_REG LL_ADC_AWD_CHANNEL_17_INJ LL_ADC_AWD_CHANNEL_17_REG_INJ LL_ADC_AWD_CHANNEL_18_REG LL_ADC_AWD_CHANNEL_18_INJ LL_ADC_AWD_CHANNEL_18_REG_INJ LL_ADC_AWD_CH_VREFINT_REG (1) LL_ADC_AWD_CH_VREFINT_INJ (1) LL_ADC_AWD_CH_VREFINT_REG_INJ LL_ADC_AWD_CH_TEMPSENSOR_REG (1)(2)
  • Page 784 LL ADC Generic Driver UM1940 LL_ADC_GROUP_REGULAR)) __LL_ADC_ANALOGWD_SET_TH Description: RESHOLD_RESOLUTION Helper macro to set the value of ADC analog watchdog threshold high or low in function of ADC resolution, when ADC resolution is different of 12 bits. Parameters: __ADC_RESOLUTION__: This parameter can be one of the following values: LL_ADC_RESOLUTION_12B LL_ADC_RESOLUTION_10B...
  • Page 785 UM1940 LL ADC Generic Driver Notes: To be used with function LL_ADC_GetAnalogWDThresholds(). Example, with a ADC resolution of 8 bits, to get the value of analog watchdog threshold high (on 8 bits): < threshold_value_6_bits> = __LL_ADC_ANALOGWD_GET_THRESHOLD_ RESOLUTION (LL_ADC_RESOLUTION_8B, LL_ADC_GetAnalogWDThresholds(<ADCx param>, LL_ADC_AWD_THRESHOLD_HIGH) __LL_ADC_MULTI_CONV_DATA_ Description: MASTER_SLAVE...
  • Page 786 LL ADC Generic Driver UM1940 ADC instances) Refer to functions having argument "ADCxy_COMMON" as parameter. Description: __LL_ADC_IS_ENABLED_ALL_C OMMON_INSTANCE Helper macro to check if all ADC instances sharing the same ADC common instance are disabled. Parameters: __ADCXY_COMMON__: ADC common instance (can be set directly from CMSIS definition or by using helper macro Return value: Value: "0"...
  • Page 787 UM1940 LL ADC Generic Driver SOLUTION Helper macro to convert the ADC conversion data from a resolution to another resolution. Parameters: __DATA__: ADC conversion data to be converted __ADC_RESOLUTION_CURRENT__: Resolution of to the data to be converted This parameter can be one of the following values: LL_ADC_RESOLUTION_12B LL_ADC_RESOLUTION_10B LL_ADC_RESOLUTION_8B...
  • Page 788 "Avg_Slope". __TEMPSENSOR_TYP_CALX_V__: Device datasheet data: Temperature sensor voltage typical value (at temperature and Vref+ defined in parameters below) (unit: mV). On STM32F2, refer to device datasheet parameter "V25". __TEMPSENSOR_CALX_TEMP__: Device datasheet data: Temperature at which temperature sensor voltage (see parameter...
  • Page 789 UM1940 LL ADC Generic Driver calculation input, the analog reference voltage (Vref+) must be defined as it impacts the ADC LSB equivalent voltage. Analog reference voltage (Vref+) must be known from user board environment or can be calculated using ADC measurement.
  • Page 790: Ll Bus Generic Driver

    LL BUS Generic Driver UM1940 LL BUS Generic Driver 51.1 BUS Firmware driver API description 51.1.1 Detailed description of functions LL_AHB1_GRP1_EnableClock Function name __STATIC_INLINE void LL_AHB1_GRP1_EnableClock (uint32_t Periphs) Function description Enable AHB1 peripherals clock. Parameters Periphs: This parameter can be a combination of the following values: (*) value not defined in all devices.
  • Page 791 UM1940 LL BUS Generic Driver AHB1ENR ETHMACRXEN LL_AHB1_GRP1_EnableClock AHB1ENR ETHMACPTPEN LL_AHB1_GRP1_EnableClock AHB1ENR OTGHSEN LL_AHB1_GRP1_EnableClock AHB1ENR OTGHSULPIEN LL_AHB1_GRP1_EnableClock LL_AHB1_GRP1_IsEnabledClock Function name __STATIC_INLINE uint32_t LL_AHB1_GRP1_IsEnabledClock (uint32_t Periphs) Function description Check if AHB1 peripheral clock is enabled or not. Parameters Periphs: This parameter can be a combination of the following values: (*) value not defined in all devices.
  • Page 792 LL BUS Generic Driver UM1940 LL_AHB1_GRP1_IsEnabledClock AHB1ENR OTGHSEN LL_AHB1_GRP1_IsEnabledClock AHB1ENR OTGHSULPIEN LL_AHB1_GRP1_IsEnabledClock LL_AHB1_GRP1_DisableClock __STATIC_INLINE void LL_AHB1_GRP1_DisableClock Function name (uint32_t Periphs) Function description Disable AHB1 peripherals clock. Parameters Periphs: This parameter can be a combination of the following values: (*) value not defined in all devices. LL_AHB1_GRP1_PERIPH_GPIOA LL_AHB1_GRP1_PERIPH_GPIOB LL_AHB1_GRP1_PERIPH_GPIOC...
  • Page 793 UM1940 LL BUS Generic Driver AHB1ENR OTGHSULPIEN LL_AHB1_GRP1_DisableClock LL_AHB1_GRP1_ForceReset __STATIC_INLINE void LL_AHB1_GRP1_ForceReset (uint32_t Function name Periphs) Function description Force AHB1 peripherals reset. Parameters Periphs: This parameter can be a combination of the following values: (*) value not defined in all devices. LL_AHB1_GRP1_PERIPH_ALL LL_AHB1_GRP1_PERIPH_GPIOA LL_AHB1_GRP1_PERIPH_GPIOB...
  • Page 794 LL BUS Generic Driver UM1940 LL_AHB1_GRP1_PERIPH_GPIOC LL_AHB1_GRP1_PERIPH_GPIOD LL_AHB1_GRP1_PERIPH_GPIOE LL_AHB1_GRP1_PERIPH_GPIOF LL_AHB1_GRP1_PERIPH_GPIOG LL_AHB1_GRP1_PERIPH_GPIOH LL_AHB1_GRP1_PERIPH_GPIOI LL_AHB1_GRP1_PERIPH_CRC LL_AHB1_GRP1_PERIPH_DMA1 LL_AHB1_GRP1_PERIPH_DMA2 LL_AHB1_GRP1_PERIPH_ETHMAC (*) LL_AHB1_GRP1_PERIPH_OTGHS Return values None: Reference Manual to AHB1RSTR GPIOARST LL_AHB1_GRP1_ReleaseReset LL API cross AHB1RSTR GPIOBRST LL_AHB1_GRP1_ReleaseReset reference: AHB1RSTR GPIOCRST LL_AHB1_GRP1_ReleaseReset AHB1RSTR GPIODRST LL_AHB1_GRP1_ReleaseReset AHB1RSTR GPIOERST LL_AHB1_GRP1_ReleaseReset AHB1RSTR GPIOFRST LL_AHB1_GRP1_ReleaseReset AHB1RSTR GPIOGRST LL_AHB1_GRP1_ReleaseReset...
  • Page 795 UM1940 LL BUS Generic Driver LL_AHB1_GRP1_PERIPH_ETHMAC (*) LL_AHB1_GRP1_PERIPH_ETHMACTX (*) LL_AHB1_GRP1_PERIPH_ETHMACRX (*) LL_AHB1_GRP1_PERIPH_ETHMACPTP (*) LL_AHB1_GRP1_PERIPH_OTGHS LL_AHB1_GRP1_PERIPH_OTGHSULPI Return values None: Reference Manual to AHB1LPENR GPIOALPEN LL API cross LL_AHB1_GRP1_EnableClockLowPower reference: AHB1LPENR GPIOBLPEN LL_AHB1_GRP1_EnableClockLowPower AHB1LPENR GPIOCLPEN LL_AHB1_GRP1_EnableClockLowPower AHB1LPENR GPIODLPEN LL_AHB1_GRP1_EnableClockLowPower AHB1LPENR GPIOELPEN LL_AHB1_GRP1_EnableClockLowPower AHB1LPENR GPIOFLPEN LL_AHB1_GRP1_EnableClockLowPower AHB1LPENR GPIOGLPEN...
  • Page 796 LL BUS Generic Driver UM1940 LL_AHB1_GRP1_EnableClockLowPower LL_AHB1_GRP1_DisableClockLowPower Function name __STATIC_INLINE void LL_AHB1_GRP1_DisableClockLowPower (uint32_t Periphs) Function description Disable AHB1 peripheral clocks in low-power mode. Parameters Periphs: This parameter can be a combination of the following values: (*) value not defined in all devices. LL_AHB1_GRP1_PERIPH_GPIOA LL_AHB1_GRP1_PERIPH_GPIOB LL_AHB1_GRP1_PERIPH_GPIOC...
  • Page 797 UM1940 LL BUS Generic Driver LL_AHB1_GRP1_DisableClockLowPower AHB1LPENR BKPSRAMLPEN LL_AHB1_GRP1_DisableClockLowPower AHB1LPENR FLITFLPEN LL_AHB1_GRP1_DisableClockLowPower AHB1LPENR SRAM1LPEN LL_AHB1_GRP1_DisableClockLowPower AHB1LPENR SRAM2LPEN LL_AHB1_GRP1_DisableClockLowPower AHB1LPENR BKPSRAMLPEN LL_AHB1_GRP1_DisableClockLowPower AHB1LPENR DMA1LPEN LL_AHB1_GRP1_DisableClockLowPower AHB1LPENR DMA2LPEN LL_AHB1_GRP1_DisableClockLowPower AHB1LPENR ETHMACLPEN LL_AHB1_GRP1_DisableClockLowPower AHB1LPENR ETHMACTXLPEN LL_AHB1_GRP1_DisableClockLowPower AHB1LPENR ETHMACRXLPEN LL_AHB1_GRP1_DisableClockLowPower AHB1LPENR ETHMACPTPLPEN LL_AHB1_GRP1_DisableClockLowPower AHB1LPENR OTGHSLPEN LL_AHB1_GRP1_DisableClockLowPower AHB1LPENR OTGHSULPILPEN LL_AHB1_GRP1_DisableClockLowPower...
  • Page 798 LL BUS Generic Driver UM1940 Function description Check if AHB2 peripheral clock is enabled or not. Parameters Periphs: This parameter can be a combination of the following values: (*) value not defined in all devices. LL_AHB2_GRP1_PERIPH_DCMI (*) LL_AHB2_GRP1_PERIPH_CRYP (*) LL_AHB2_GRP1_PERIPH_HASH (*) LL_AHB2_GRP1_PERIPH_RNG LL_AHB2_GRP1_PERIPH_OTGFS Return values...
  • Page 799 UM1940 LL BUS Generic Driver Return values None: Reference Manual to AHB2RSTR DCMIRST LL_AHB2_GRP1_ForceReset LL API cross AHB2RSTR CRYPRST LL_AHB2_GRP1_ForceReset reference: AHB2RSTR HASHRST LL_AHB2_GRP1_ForceReset AHB2RSTR RNGRST LL_AHB2_GRP1_ForceReset AHB2RSTR OTGFSRST LL_AHB2_GRP1_ForceReset LL_AHB2_GRP1_ReleaseReset Function name __STATIC_INLINE void LL_AHB2_GRP1_ReleaseReset (uint32_t Periphs) Function description Release AHB2 peripherals reset.
  • Page 800 LL BUS Generic Driver UM1940 LL_AHB2_GRP1_EnableClockLowPower LL_AHB2_GRP1_DisableClockLowPower Function name __STATIC_INLINE void LL_AHB2_GRP1_DisableClockLowPower (uint32_t Periphs) Function description Disable AHB2 peripheral clocks in low-power mode. Parameters Periphs: This parameter can be a combination of the following values: (*) value not defined in all devices. LL_AHB2_GRP1_PERIPH_DCMI (*) LL_AHB2_GRP1_PERIPH_CRYP (*) LL_AHB2_GRP1_PERIPH_HASH (*)
  • Page 801 UM1940 LL BUS Generic Driver Reference Manual to AHB3ENR FSMCEN LL_AHB3_GRP1_IsEnabledClock LL API cross reference: LL_AHB3_GRP1_DisableClock Function name __STATIC_INLINE void LL_AHB3_GRP1_DisableClock (uint32_t Periphs) Function description Disable AHB3 peripherals clock. Parameters Periphs: This parameter can be a combination of the following values: LL_AHB3_GRP1_PERIPH_FSMC Return values None:...
  • Page 802 LL BUS Generic Driver UM1940 LL_AHB3_GRP1_EnableClockLowPower Function name __STATIC_INLINE void LL_AHB3_GRP1_EnableClockLowPower (uint32_t Periphs) Function description Enable AHB3 peripheral clocks in low-power mode. Parameters Periphs: This parameter can be a combination of the following values: LL_AHB3_GRP1_PERIPH_FSMC Return values None: Reference Manual to AHB3LPENR FSMCLPEN LL API cross LL_AHB3_GRP1_EnableClockLowPower...
  • Page 803 UM1940 LL BUS Generic Driver LL_APB1_GRP1_PERIPH_I2C1 LL_APB1_GRP1_PERIPH_I2C2 LL_APB1_GRP1_PERIPH_I2C3 LL_APB1_GRP1_PERIPH_CAN1 LL_APB1_GRP1_PERIPH_CAN2 LL_APB1_GRP1_PERIPH_PWR LL_APB1_GRP1_PERIPH_DAC1 Return values None: Reference Manual to APB1ENR TIM2EN LL_APB1_GRP1_EnableClock LL API cross APB1ENR TIM3EN LL_APB1_GRP1_EnableClock reference: APB1ENR TIM4EN LL_APB1_GRP1_EnableClock APB1ENR TIM5EN LL_APB1_GRP1_EnableClock APB1ENR TIM6EN LL_APB1_GRP1_EnableClock APB1ENR TIM7EN LL_APB1_GRP1_EnableClock APB1ENR TIM12EN LL_APB1_GRP1_EnableClock APB1ENR TIM13EN LL_APB1_GRP1_EnableClock APB1ENR TIM14EN LL_APB1_GRP1_EnableClock...
  • Page 804 LL BUS Generic Driver UM1940 LL_APB1_GRP1_PERIPH_USART2 LL_APB1_GRP1_PERIPH_USART3 LL_APB1_GRP1_PERIPH_UART4 LL_APB1_GRP1_PERIPH_UART5 LL_APB1_GRP1_PERIPH_I2C1 LL_APB1_GRP1_PERIPH_I2C2 LL_APB1_GRP1_PERIPH_I2C3 LL_APB1_GRP1_PERIPH_CAN1 LL_APB1_GRP1_PERIPH_CAN2 LL_APB1_GRP1_PERIPH_PWR LL_APB1_GRP1_PERIPH_DAC1 Return values State: of Periphs (1 or 0). Reference Manual to APB1ENR TIM2EN LL_APB1_GRP1_IsEnabledClock LL API cross APB1ENR TIM3EN LL_APB1_GRP1_IsEnabledClock reference: APB1ENR TIM4EN LL_APB1_GRP1_IsEnabledClock APB1ENR TIM5EN LL_APB1_GRP1_IsEnabledClock APB1ENR TIM6EN LL_APB1_GRP1_IsEnabledClock APB1ENR TIM7EN LL_APB1_GRP1_IsEnabledClock...
  • Page 805 UM1940 LL BUS Generic Driver LL_APB1_GRP1_PERIPH_TIM14 LL_APB1_GRP1_PERIPH_WWDG LL_APB1_GRP1_PERIPH_SPI2 LL_APB1_GRP1_PERIPH_SPI3 LL_APB1_GRP1_PERIPH_USART2 LL_APB1_GRP1_PERIPH_USART3 LL_APB1_GRP1_PERIPH_UART4 LL_APB1_GRP1_PERIPH_UART5 LL_APB1_GRP1_PERIPH_I2C1 LL_APB1_GRP1_PERIPH_I2C2 LL_APB1_GRP1_PERIPH_I2C3 LL_APB1_GRP1_PERIPH_CAN1 LL_APB1_GRP1_PERIPH_CAN2 LL_APB1_GRP1_PERIPH_PWR LL_APB1_GRP1_PERIPH_DAC1 Return values None: Reference Manual to APB1ENR TIM2EN LL_APB1_GRP1_DisableClock LL API cross APB1ENR TIM3EN LL_APB1_GRP1_DisableClock reference: APB1ENR TIM4EN LL_APB1_GRP1_DisableClock APB1ENR TIM5EN LL_APB1_GRP1_DisableClock APB1ENR TIM6EN LL_APB1_GRP1_DisableClock APB1ENR TIM7EN LL_APB1_GRP1_DisableClock APB1ENR TIM12EN LL_APB1_GRP1_DisableClock...
  • Page 806 LL BUS Generic Driver UM1940 LL_APB1_GRP1_PERIPH_TIM5 LL_APB1_GRP1_PERIPH_TIM6 LL_APB1_GRP1_PERIPH_TIM7 LL_APB1_GRP1_PERIPH_TIM12 LL_APB1_GRP1_PERIPH_TIM13 LL_APB1_GRP1_PERIPH_TIM14 LL_APB1_GRP1_PERIPH_WWDG LL_APB1_GRP1_PERIPH_SPI2 LL_APB1_GRP1_PERIPH_SPI3 LL_APB1_GRP1_PERIPH_USART2 LL_APB1_GRP1_PERIPH_USART3 LL_APB1_GRP1_PERIPH_UART4 LL_APB1_GRP1_PERIPH_UART5 LL_APB1_GRP1_PERIPH_I2C1 LL_APB1_GRP1_PERIPH_I2C2 LL_APB1_GRP1_PERIPH_I2C3 LL_APB1_GRP1_PERIPH_CAN1 LL_APB1_GRP1_PERIPH_CAN2 LL_APB1_GRP1_PERIPH_PWR LL_APB1_GRP1_PERIPH_DAC1 Return values None: Reference Manual to APB1RSTR TIM2RST LL_APB1_GRP1_ForceReset LL API cross APB1RSTR TIM3RST LL_APB1_GRP1_ForceReset reference: APB1RSTR TIM4RST LL_APB1_GRP1_ForceReset APB1RSTR TIM5RST LL_APB1_GRP1_ForceReset...
  • Page 807 UM1940 LL BUS Generic Driver Parameters Periphs: This parameter can be a combination of the following values: LL_APB1_GRP1_PERIPH_ALL LL_APB1_GRP1_PERIPH_TIM2 LL_APB1_GRP1_PERIPH_TIM3 LL_APB1_GRP1_PERIPH_TIM4 LL_APB1_GRP1_PERIPH_TIM5 LL_APB1_GRP1_PERIPH_TIM6 LL_APB1_GRP1_PERIPH_TIM7 LL_APB1_GRP1_PERIPH_TIM12 LL_APB1_GRP1_PERIPH_TIM13 LL_APB1_GRP1_PERIPH_TIM14 LL_APB1_GRP1_PERIPH_WWDG LL_APB1_GRP1_PERIPH_SPI2 LL_APB1_GRP1_PERIPH_SPI3 LL_APB1_GRP1_PERIPH_USART2 LL_APB1_GRP1_PERIPH_USART3 LL_APB1_GRP1_PERIPH_UART4 LL_APB1_GRP1_PERIPH_UART5 LL_APB1_GRP1_PERIPH_I2C1 LL_APB1_GRP1_PERIPH_I2C2 LL_APB1_GRP1_PERIPH_I2C3 LL_APB1_GRP1_PERIPH_CAN1 LL_APB1_GRP1_PERIPH_CAN2 LL_APB1_GRP1_PERIPH_PWR LL_APB1_GRP1_PERIPH_DAC1 Return values None:...
  • Page 808 LL BUS Generic Driver UM1940 LL_APB1_GRP1_EnableClockLowPower Function name __STATIC_INLINE void LL_APB1_GRP1_EnableClockLowPower (uint32_t Periphs) Function description Enable APB1 peripheral clocks in low-power mode. Parameters Periphs: This parameter can be a combination of the following values: LL_APB1_GRP1_PERIPH_TIM2 LL_APB1_GRP1_PERIPH_TIM3 LL_APB1_GRP1_PERIPH_TIM4 LL_APB1_GRP1_PERIPH_TIM5 LL_APB1_GRP1_PERIPH_TIM6 LL_APB1_GRP1_PERIPH_TIM7 LL_APB1_GRP1_PERIPH_TIM12 LL_APB1_GRP1_PERIPH_TIM13 LL_APB1_GRP1_PERIPH_TIM14...
  • Page 809 UM1940 LL BUS Generic Driver LL_APB1_GRP1_EnableClockLowPower APB1LPENR SPI3LPEN LL_APB1_GRP1_EnableClockLowPower APB1LPENR USART2LPEN LL_APB1_GRP1_EnableClockLowPower APB1LPENR USART3LPEN LL_APB1_GRP1_EnableClockLowPower APB1LPENR UART4LPEN LL_APB1_GRP1_EnableClockLowPower APB1LPENR UART5LPEN LL_APB1_GRP1_EnableClockLowPower APB1LPENR I2C1LPEN LL_APB1_GRP1_EnableClockLowPower APB1LPENR I2C2LPEN LL_APB1_GRP1_EnableClockLowPower APB1LPENR I2C3LPEN LL_APB1_GRP1_EnableClockLowPower APB1LPENR CAN1LPEN LL_APB1_GRP1_EnableClockLowPower APB1LPENR CAN2LPEN LL_APB1_GRP1_EnableClockLowPower APB1LPENR PWRLPEN LL_APB1_GRP1_EnableClockLowPower APB1LPENR DACLPEN LL_APB1_GRP1_EnableClockLowPower LL_APB1_GRP1_DisableClockLowPower Function name...
  • Page 810 LL BUS Generic Driver UM1940 LL_APB1_GRP1_PERIPH_CAN1 LL_APB1_GRP1_PERIPH_CAN2 LL_APB1_GRP1_PERIPH_PWR LL_APB1_GRP1_PERIPH_DAC1 Return values None: Reference Manual to APB1LPENR TIM2LPEN LL API cross LL_APB1_GRP1_DisableClockLowPower reference: APB1LPENR TIM3LPEN LL_APB1_GRP1_DisableClockLowPower APB1LPENR TIM4LPEN LL_APB1_GRP1_DisableClockLowPower APB1LPENR TIM5LPEN LL_APB1_GRP1_DisableClockLowPower APB1LPENR TIM6LPEN LL_APB1_GRP1_DisableClockLowPower APB1LPENR TIM7LPEN LL_APB1_GRP1_DisableClockLowPower APB1LPENR TIM12LPEN LL_APB1_GRP1_DisableClockLowPower APB1LPENR TIM13LPEN LL_APB1_GRP1_DisableClockLowPower APB1LPENR TIM14LPEN...
  • Page 811 UM1940 LL BUS Generic Driver LL_APB2_GRP1_EnableClock Function name __STATIC_INLINE void LL_APB2_GRP1_EnableClock (uint32_t Periphs) Function description Enable APB2 peripherals clock. Parameters Periphs: This parameter can be a combination of the following values: LL_APB2_GRP1_PERIPH_TIM1 LL_APB2_GRP1_PERIPH_TIM8 LL_APB2_GRP1_PERIPH_USART1 LL_APB2_GRP1_PERIPH_USART6 LL_APB2_GRP1_PERIPH_ADC1 LL_APB2_GRP1_PERIPH_ADC2 LL_APB2_GRP1_PERIPH_ADC3 LL_APB2_GRP1_PERIPH_SDIO LL_APB2_GRP1_PERIPH_SPI1 LL_APB2_GRP1_PERIPH_SYSCFG LL_APB2_GRP1_PERIPH_TIM9 LL_APB2_GRP1_PERIPH_TIM10...
  • Page 812 LL BUS Generic Driver UM1940 LL_APB2_GRP1_PERIPH_SPI1 LL_APB2_GRP1_PERIPH_SYSCFG LL_APB2_GRP1_PERIPH_TIM9 LL_APB2_GRP1_PERIPH_TIM10 LL_APB2_GRP1_PERIPH_TIM11 Return values State: of Periphs (1 or 0). Reference Manual to APB2ENR TIM1EN LL_APB2_GRP1_IsEnabledClock LL API cross APB2ENR TIM8EN LL_APB2_GRP1_IsEnabledClock reference: APB2ENR USART1EN LL_APB2_GRP1_IsEnabledClock APB2ENR USART6EN LL_APB2_GRP1_IsEnabledClock APB2ENR ADC1EN LL_APB2_GRP1_IsEnabledClock APB2ENR ADC2EN LL_APB2_GRP1_IsEnabledClock APB2ENR ADC3EN LL_APB2_GRP1_IsEnabledClock APB2ENR SDIOEN LL_APB2_GRP1_IsEnabledClock...
  • Page 813 UM1940 LL BUS Generic Driver APB2ENR SYSCFGEN LL_APB2_GRP1_DisableClock APB2ENR TIM9EN LL_APB2_GRP1_DisableClock APB2ENR TIM10EN LL_APB2_GRP1_DisableClock APB2ENR TIM11EN LL_APB2_GRP1_DisableClock LL_APB2_GRP1_ForceReset Function name __STATIC_INLINE void LL_APB2_GRP1_ForceReset (uint32_t Periphs) Function description Force APB2 peripherals reset. Parameters Periphs: This parameter can be a combination of the following values: LL_APB2_GRP1_PERIPH_ALL LL_APB2_GRP1_PERIPH_TIM1...
  • Page 814 LL BUS Generic Driver UM1940 LL_APB2_GRP1_PERIPH_SDIO LL_APB2_GRP1_PERIPH_SPI1 LL_APB2_GRP1_PERIPH_SYSCFG LL_APB2_GRP1_PERIPH_TIM9 LL_APB2_GRP1_PERIPH_TIM10 LL_APB2_GRP1_PERIPH_TIM11 Return values None: Reference Manual to APB2RSTR TIM1RST LL_APB2_GRP1_ReleaseReset LL API cross APB2RSTR TIM8RST LL_APB2_GRP1_ReleaseReset reference: APB2RSTR USART1RST LL_APB2_GRP1_ReleaseReset APB2RSTR USART6RST LL_APB2_GRP1_ReleaseReset APB2RSTR ADCRST LL_APB2_GRP1_ReleaseReset APB2RSTR SDIORST LL_APB2_GRP1_ReleaseReset APB2RSTR SPI1RST LL_APB2_GRP1_ReleaseReset APB2RSTR SYSCFGRST LL_APB2_GRP1_ReleaseReset APB2RSTR TIM9RST LL_APB2_GRP1_ReleaseReset APB2RSTR TIM10RST LL_APB2_GRP1_ReleaseReset...
  • Page 815 UM1940 LL BUS Generic Driver LL_APB2_GRP1_EnableClockLowPower APB2LPENR ADC2LPEN LL_APB2_GRP1_EnableClockLowPower APB2LPENR ADC3LPEN LL_APB2_GRP1_EnableClockLowPower APB2LPENR SDIOLPEN LL_APB2_GRP1_EnableClockLowPower APB2LPENR SPI1LPEN LL_APB2_GRP1_EnableClockLowPower APB2LPENR SYSCFGLPEN LL_APB2_GRP1_EnableClockLowPower APB2LPENR TIM9LPEN LL_APB2_GRP1_EnableClockLowPower APB2LPENR TIM10LPEN LL_APB2_GRP1_EnableClockLowPower APB2LPENR TIM11LPEN LL_APB2_GRP1_EnableClockLowPower LL_APB2_GRP1_DisableClockLowPower __STATIC_INLINE void Function name LL_APB2_GRP1_DisableClockLowPower (uint32_t Periphs) Function description Disable APB2 peripheral clocks in low-power mode.
  • Page 816: Bus Firmware Driver Defines

    LL BUS Generic Driver UM1940 APB2LPENR ADC3LPEN LL_APB2_GRP1_DisableClockLowPower APB2LPENR SDIOLPEN LL_APB2_GRP1_DisableClockLowPower APB2LPENR SPI1LPEN LL_APB2_GRP1_DisableClockLowPower APB2LPENR SYSCFGLPEN LL_APB2_GRP1_DisableClockLowPower APB2LPENR TIM9LPEN LL_APB2_GRP1_DisableClockLowPower APB2LPENR TIM10LPEN LL_APB2_GRP1_DisableClockLowPower APB2LPENR TIM11LPEN LL_APB2_GRP1_DisableClockLowPower 51.2 BUS Firmware driver defines 51.2.1 AHB1 GRP1 PERIPH LL_AHB1_GRP1_PERIPH_ALL LL_AHB1_GRP1_PERIPH_GPIOA LL_AHB1_GRP1_PERIPH_GPIOB LL_AHB1_GRP1_PERIPH_GPIOC LL_AHB1_GRP1_PERIPH_GPIOD LL_AHB1_GRP1_PERIPH_GPIOE LL_AHB1_GRP1_PERIPH_GPIOF LL_AHB1_GRP1_PERIPH_GPIOG...
  • Page 817 UM1940 LL BUS Generic Driver LL_AHB1_GRP1_PERIPH_SRAM2 AHB2 GRP1 PERIPH LL_AHB2_GRP1_PERIPH_ALL LL_AHB2_GRP1_PERIPH_DCMI LL_AHB2_GRP1_PERIPH_CRYP LL_AHB2_GRP1_PERIPH_HASH LL_AHB2_GRP1_PERIPH_RNG LL_AHB2_GRP1_PERIPH_OTGFS AHB3 GRP1 PERIPH LL_AHB3_GRP1_PERIPH_ALL LL_AHB3_GRP1_PERIPH_FSMC APB1 GRP1 PERIPH LL_APB1_GRP1_PERIPH_ALL LL_APB1_GRP1_PERIPH_TIM2 LL_APB1_GRP1_PERIPH_TIM3 LL_APB1_GRP1_PERIPH_TIM4 LL_APB1_GRP1_PERIPH_TIM5 LL_APB1_GRP1_PERIPH_TIM6 LL_APB1_GRP1_PERIPH_TIM7 LL_APB1_GRP1_PERIPH_TIM12 LL_APB1_GRP1_PERIPH_TIM13 LL_APB1_GRP1_PERIPH_TIM14 LL_APB1_GRP1_PERIPH_WWDG LL_APB1_GRP1_PERIPH_SPI2 LL_APB1_GRP1_PERIPH_SPI3 LL_APB1_GRP1_PERIPH_USART2 LL_APB1_GRP1_PERIPH_USART3 LL_APB1_GRP1_PERIPH_UART4 LL_APB1_GRP1_PERIPH_UART5 LL_APB1_GRP1_PERIPH_I2C1 LL_APB1_GRP1_PERIPH_I2C2 LL_APB1_GRP1_PERIPH_I2C3...
  • Page 818 LL BUS Generic Driver UM1940 LL_APB2_GRP1_PERIPH_ALL LL_APB2_GRP1_PERIPH_TIM1 LL_APB2_GRP1_PERIPH_TIM8 LL_APB2_GRP1_PERIPH_USART1 LL_APB2_GRP1_PERIPH_USART6 LL_APB2_GRP1_PERIPH_ADC1 LL_APB2_GRP1_PERIPH_ADC2 LL_APB2_GRP1_PERIPH_ADC3 LL_APB2_GRP1_PERIPH_SDIO LL_APB2_GRP1_PERIPH_SPI1 LL_APB2_GRP1_PERIPH_SYSCFG LL_APB2_GRP1_PERIPH_TIM9 LL_APB2_GRP1_PERIPH_TIM10 LL_APB2_GRP1_PERIPH_TIM11 LL_APB2_GRP1_PERIPH_ADC 818/1371 DocID028236 Rev 2...
  • Page 819: Ll Cortex Generic Driver

    UM1940 LL CORTEX Generic Driver LL CORTEX Generic Driver 52.1 CORTEX Firmware driver API description 52.1.1 Detailed description of functions LL_SYSTICK_IsActiveCounterFlag Function name __STATIC_INLINE uint32_t LL_SYSTICK_IsActiveCounterFlag (void ) Function description This function checks if the Systick counter flag is active or not. Return values State: of bit (1 or 0).
  • Page 820 LL CORTEX Generic Driver UM1940 Return values None: Reference Manual to STK_CTRL TICKINT LL_SYSTICK_EnableIT LL API cross reference: LL_SYSTICK_DisableIT __STATIC_INLINE void LL_SYSTICK_DisableIT (void ) Function name Function description Disable SysTick exception request. Return values None: Reference Manual to STK_CTRL TICKINT LL_SYSTICK_DisableIT LL API cross reference: LL_SYSTICK_IsEnabledIT...
  • Page 821 UM1940 LL CORTEX Generic Driver Return values None: Notes Setting this bit to 1 enables an interrupt-driven application to avoid returning to an empty main application. Reference Manual to SCB_SCR SLEEPONEXIT LL_LPM_EnableSleepOnExit LL API cross reference: LL_LPM_DisableSleepOnExit Function name __STATIC_INLINE void LL_LPM_DisableSleepOnExit (void ) Function description Do not sleep when returning to Thread mode.
  • Page 822 LL CORTEX Generic Driver UM1940 Return values None: Reference Manual to SCB_SHCSR MEMFAULTENA LL_HANDLER_EnableFault LL API cross reference: LL_HANDLER_DisableFault __STATIC_INLINE void LL_HANDLER_DisableFault (uint32_t Function name Fault) Function description Disable a fault in System handler control register (SHCSR) Parameters Fault: This parameter can be a combination of the following values: LL_HANDLER_FAULT_USG LL_HANDLER_FAULT_BUS...
  • Page 823 UM1940 LL CORTEX Generic Driver reference: LL_CPUID_GetParNo Function name __STATIC_INLINE uint32_t LL_CPUID_GetParNo (void ) Function description Get Part number. Return values Value: should be equal to 0xC23 for Cortex-M3 Reference Manual to SCB_CPUID PARTNO LL_CPUID_GetParNo LL API cross reference: LL_CPUID_GetRevision Function name __STATIC_INLINE uint32_t LL_CPUID_GetRevision (void ) Function description...
  • Page 824 LL CORTEX Generic Driver UM1940 Function description Check if MPU is enabled or not. Return values State: of bit (1 or 0). Reference Manual to MPU_CTRL ENABLE LL_MPU_IsEnabled LL API cross reference: LL_MPU_EnableRegion __STATIC_INLINE void LL_MPU_EnableRegion (uint32_t Function name Region) Function description Enable a MPU region.
  • Page 825 UM1940 LL CORTEX Generic Driver LL_MPU_REGION_SIZE_1KB or LL_MPU_REGION_SIZE_2KB or LL_MPU_REGION_SIZE_4KB or LL_MPU_REGION_SIZE_8KB or LL_MPU_REGION_SIZE_16KB or LL_MPU_REGION_SIZE_32KB or LL_MPU_REGION_SIZE_64KB or LL_MPU_REGION_SIZE_128KB or LL_MPU_REGION_SIZE_256KB or LL_MPU_REGION_SIZE_512KB or LL_MPU_REGION_SIZE_1MB or LL_MPU_REGION_SIZE_2MB or LL_MPU_REGION_SIZE_4MB or LL_MPU_REGION_SIZE_8MB or LL_MPU_REGION_SIZE_16MB or LL_MPU_REGION_SIZE_32MB or LL_MPU_REGION_SIZE_64MB or LL_MPU_REGION_SIZE_128MB or LL_MPU_REGION_SIZE_256MB or LL_MPU_REGION_SIZE_512MB or LL_MPU_REGION_SIZE_1GB or...
  • Page 826 LL CORTEX Generic Driver UM1940 Region) Function description Disable a region. Parameters Region: This parameter can be one of the following values: LL_MPU_REGION_NUMBER0 LL_MPU_REGION_NUMBER1 LL_MPU_REGION_NUMBER2 LL_MPU_REGION_NUMBER3 LL_MPU_REGION_NUMBER4 LL_MPU_REGION_NUMBER5 LL_MPU_REGION_NUMBER6 LL_MPU_REGION_NUMBER7 Return values None: Reference Manual to MPU_RNR REGION LL_MPU_DisableRegion LL API cross MPU_RASR ENABLE LL_MPU_DisableRegion reference: 52.2...
  • Page 827 UM1940 LL CORTEX Generic Driver LL_MPU_INSTRUCTION_ACCESS_ENABLE Instruction fetches enabled LL_MPU_INSTRUCTION_ACCESS_DISABLE Instruction fetches disabled MPU Region Number LL_MPU_REGION_NUMBER0 REGION Number 0 LL_MPU_REGION_NUMBER1 REGION Number 1 LL_MPU_REGION_NUMBER2 REGION Number 2 LL_MPU_REGION_NUMBER3 REGION Number 3 LL_MPU_REGION_NUMBER4 REGION Number 4 LL_MPU_REGION_NUMBER5 REGION Number 5 LL_MPU_REGION_NUMBER6 REGION Number 6 LL_MPU_REGION_NUMBER7...
  • Page 828 LL CORTEX Generic Driver UM1940 LL_MPU_REGION_SIZE_4MB 4MB Size of the MPU protection region LL_MPU_REGION_SIZE_8MB 8MB Size of the MPU protection region LL_MPU_REGION_SIZE_16MB 16MB Size of the MPU protection region LL_MPU_REGION_SIZE_32MB 32MB Size of the MPU protection region LL_MPU_REGION_SIZE_64MB 64MB Size of the MPU protection region LL_MPU_REGION_SIZE_128MB 128MB Size of the MPU protection region LL_MPU_REGION_SIZE_256MB...
  • Page 829: Ll Crc Generic Driver

    UM1940 LL CRC Generic Driver LL CRC Generic Driver 53.1 CRC Firmware driver API description 53.1.1 Detailed description of functions LL_CRC_ResetCRCCalculationUnit Function name __STATIC_INLINE void LL_CRC_ResetCRCCalculationUnit (CRC_TypeDef * CRCx) Function description Reset the CRC calculation unit. Parameters CRCx: CRC Instance Return values None: Reference Manual to...
  • Page 830 LL CRC Generic Driver UM1940 * CRCx) Function description Return data stored in the Independent Data(IDR) register. Parameters CRCx: CRC Instance Return values Value: stored in CRC_IDR register (General-purpose 8-bit data register). Notes This register can be used as a temporary storage location for one byte.
  • Page 831 UM1940 LL CRC Generic Driver __REG__: Register to be written __VALUE__: Value to be written in the register Return value: None LL_CRC_ReadReg Description: Read a value in CRC register. Parameters: __INSTANCE__: CRC Instance __REG__: Register to be read Return value: Register: value DocID028236 Rev 2 831/1371...
  • Page 832: Ll Dac Generic Driver

    LL DAC Generic Driver UM1940 LL DAC Generic Driver 54.1 DAC Firmware driver registers structures 54.1.1 LL_DAC_InitTypeDef Data Fields uint32_t TriggerSource uint32_t WaveAutoGeneration uint32_t WaveAutoGenerationConfig uint32_t OutputBuffer Field Documentation uint32_t LL_DAC_InitTypeDef::TriggerSource Set the conversion trigger source for the selected DAC channel: internal (SW start) or from external IP (timer event, external interrupt line).
  • Page 833 UM1940 LL DAC Generic Driver values: LL_DAC_CHANNEL_1 LL_DAC_CHANNEL_2 TriggerSource: This parameter can be one of the following values: LL_DAC_TRIG_SOFTWARE LL_DAC_TRIG_EXT_TIM8_TRGO LL_DAC_TRIG_EXT_TIM7_TRGO LL_DAC_TRIG_EXT_TIM6_TRGO LL_DAC_TRIG_EXT_TIM5_TRGO LL_DAC_TRIG_EXT_TIM4_TRGO LL_DAC_TRIG_EXT_TIM2_TRGO LL_DAC_TRIG_EXT_EXTI_LINE9 Return values None: Notes For conversion trigger source to be effective, DAC trigger must be enabled using function LL_DAC_EnableTrigger(). To set conversion trigger source, DAC channel must be disabled.
  • Page 834 LL DAC Generic Driver UM1940 reference: LL_DAC_SetWaveAutoGeneration Function name __STATIC_INLINE void LL_DAC_SetWaveAutoGeneration (DAC_TypeDef * DACx, uint32_t DAC_Channel, uint32_t WaveAutoGeneration) Function description Set the waveform automatic generation mode for the selected DAC channel. Parameters DACx: DAC instance DAC_Channel: This parameter can be one of the following values: LL_DAC_CHANNEL_1 LL_DAC_CHANNEL_2...
  • Page 835 UM1940 LL DAC Generic Driver Noise mode and parameters LFSR (linear feedback shift register). Parameters DACx: DAC instance DAC_Channel: This parameter can be one of the following values: LL_DAC_CHANNEL_1 LL_DAC_CHANNEL_2 NoiseLFSRMask: This parameter can be one of the following values: LL_DAC_NOISE_LFSR_UNMASK_BIT0 LL_DAC_NOISE_LFSR_UNMASK_BITS1_0 LL_DAC_NOISE_LFSR_UNMASK_BITS2_0...
  • Page 836 LL DAC Generic Driver UM1940 LL_DAC_NOISE_LFSR_UNMASK_BITS8_0 LL_DAC_NOISE_LFSR_UNMASK_BITS9_0 LL_DAC_NOISE_LFSR_UNMASK_BITS10_0 LL_DAC_NOISE_LFSR_UNMASK_BITS11_0 Reference Manual to CR MAMP1 LL_DAC_GetWaveNoiseLFSR LL API cross CR MAMP2 LL_DAC_GetWaveNoiseLFSR reference: LL_DAC_SetWaveTriangleAmplitude Function name __STATIC_INLINE void LL_DAC_SetWaveTriangleAmplitude (DAC_TypeDef * DACx, uint32_t DAC_Channel, uint32_t TriangleAmplitude) Function description Set the triangle waveform generation for the selected DAC channel: triangle mode and amplitude.
  • Page 837 UM1940 LL DAC Generic Driver channel: triangle mode and amplitude. Parameters DACx: DAC instance DAC_Channel: This parameter can be one of the following values: LL_DAC_CHANNEL_1 LL_DAC_CHANNEL_2 Return values Returned: value can be one of the following values: LL_DAC_TRIANGLE_AMPLITUDE_1 LL_DAC_TRIANGLE_AMPLITUDE_3 LL_DAC_TRIANGLE_AMPLITUDE_7 LL_DAC_TRIANGLE_AMPLITUDE_15 LL_DAC_TRIANGLE_AMPLITUDE_31 LL_DAC_TRIANGLE_AMPLITUDE_63...
  • Page 838 LL DAC Generic Driver UM1940 Parameters DACx: DAC instance DAC_Channel: This parameter can be one of the following values: LL_DAC_CHANNEL_1 LL_DAC_CHANNEL_2 Return values Returned: value can be one of the following values: LL_DAC_OUTPUT_BUFFER_ENABLE LL_DAC_OUTPUT_BUFFER_DISABLE Reference Manual to CR BOFF1 LL_DAC_GetOutputBuffer LL API cross CR BOFF2 LL_DAC_GetOutputBuffer reference:...
  • Page 839 UM1940 LL DAC Generic Driver LL_DAC_IsDMAReqEnabled Function name __STATIC_INLINE uint32_t LL_DAC_IsDMAReqEnabled (DAC_TypeDef * DACx, uint32_t DAC_Channel) Function description Get DAC DMA transfer request state of the selected channel. Parameters DACx: DAC instance DAC_Channel: This parameter can be one of the following values: LL_DAC_CHANNEL_1 LL_DAC_CHANNEL_2...
  • Page 840 LL DAC Generic Driver UM1940 LL_DAC_Enable Function name __STATIC_INLINE void LL_DAC_Enable (DAC_TypeDef * DACx, uint32_t DAC_Channel) Function description Enable DAC selected channel. Parameters DACx: DAC instance DAC_Channel: This parameter can be one of the following values: LL_DAC_CHANNEL_1 LL_DAC_CHANNEL_2 Return values None: Notes After enable from off state, DAC channel requires a delay for...
  • Page 841 UM1940 LL DAC Generic Driver LL_DAC_EnableTrigger Function name __STATIC_INLINE void LL_DAC_EnableTrigger (DAC_TypeDef * DACx, uint32_t DAC_Channel) Function description Enable DAC trigger of the selected channel. Parameters DACx: DAC instance DAC_Channel: This parameter can be one of the following values: LL_DAC_CHANNEL_1 LL_DAC_CHANNEL_2 Return values None:...
  • Page 842 LL DAC Generic Driver UM1940 Reference Manual to CR TEN1 LL_DAC_IsTriggerEnabled LL API cross CR TEN2 LL_DAC_IsTriggerEnabled reference: LL_DAC_TrigSWConversion Function name __STATIC_INLINE void LL_DAC_TrigSWConversion (DAC_TypeDef * DACx, uint32_t DAC_Channel) Function description Trig DAC conversion by software for the selected DAC channel. Parameters DACx: DAC instance DAC_Channel: This parameter can a combination of the...
  • Page 843 UM1940 LL DAC Generic Driver (DAC_TypeDef * DACx, uint32_t DAC_Channel, uint32_t Data) Function description Set the data to be loaded in the data holding register in format 12 bits left alignment (MSB aligned on bit 15), for the selected DAC channel.
  • Page 844 LL DAC Generic Driver UM1940 LL API cross LL_DAC_ConvertDualData12RightAligned reference: DHR12RD DACC2DHR LL_DAC_ConvertDualData12RightAligned LL_DAC_ConvertDualData12LeftAligned Function name __STATIC_INLINE void LL_DAC_ConvertDualData12LeftAligned (DAC_TypeDef * DACx, uint32_t DataChannel1, uint32_t DataChannel2) Function description Set the data to be loaded in the data holding register in format 12 bits left alignment (MSB aligned on bit 15), for both DAC channels.
  • Page 845 UM1940 LL DAC Generic Driver LL_DAC_CHANNEL_1 LL_DAC_CHANNEL_2 Return values Value: between Min_Data=0x000 and Max_Data=0xFFF Notes Whatever alignment and resolution settings (using functions "LL_DAC_ConvertData{8; 12}{Right; Left} Aligned()": LL_DAC_ConvertData12RightAligned(), ...), output data format is 12 bits right aligned (LSB aligned on bit 0). Reference Manual to DOR1 DACC1DOR LL_DAC_RetrieveOutputData LL API cross...
  • Page 846 LL DAC Generic Driver UM1940 LL_DAC_ClearFlag_DMAUDR2 Function name __STATIC_INLINE void LL_DAC_ClearFlag_DMAUDR2 (DAC_TypeDef * DACx) Function description Clear DAC underrun flag for DAC channel 2. Parameters DACx: DAC instance Return values None: Reference Manual to SR DMAUDR2 LL_DAC_ClearFlag_DMAUDR2 LL API cross reference: LL_DAC_EnableIT_DMAUDR1 Function name...
  • Page 847 UM1940 LL DAC Generic Driver LL_DAC_DisableIT_DMAUDR2 Function name __STATIC_INLINE void LL_DAC_DisableIT_DMAUDR2 (DAC_TypeDef * DACx) Function description Disable DMA underrun interrupt for DAC channel 2. Parameters DACx: DAC instance Return values None: Reference Manual to CR DMAUDRIE2 LL_DAC_DisableIT_DMAUDR2 LL API cross reference: LL_DAC_IsEnabledIT_DMAUDR1 Function name...
  • Page 848 LL DAC Generic Driver UM1940 DAC_Channel, LL_DAC_InitTypeDef * DAC_InitStruct) Function description Initialize some features of DAC instance. Parameters DACx: DAC instance DAC_Channel: This parameter can be one of the following values: LL_DAC_CHANNEL_1 LL_DAC_CHANNEL_2 DAC_InitStruct: Pointer to a LL_DAC_InitTypeDef structure Return values An: ErrorStatus enumeration value: SUCCESS: DAC registers are initialized ERROR: DAC registers are not initialized...
  • Page 849 UM1940 LL DAC Generic Driver LL_DAC_OUTPUT_BUFFER_ENABLE The selected DAC channel output is buffered: higher drive current capability, but also higher current consumption LL_DAC_OUTPUT_BUFFER_DISABLE The selected DAC channel output is not buffered: lower drive current capability, but also lower current consumption DAC registers compliant with specific purpose LL_DAC_DMA_REG_DATA_12BITS_RIGHT_ALIGNED DAC channel data holding...
  • Page 850 LL DAC Generic Driver UM1940 bit0, for the selected DAC channel LL_DAC_NOISE_LFSR_UNMASK_BITS1_0 Noise wave generation, unmask LFSR bits[1:0], for the selected DAC channel LL_DAC_NOISE_LFSR_UNMASK_BITS2_0 Noise wave generation, unmask LFSR bits[2:0], for the selected DAC channel LL_DAC_NOISE_LFSR_UNMASK_BITS3_0 Noise wave generation, unmask LFSR bits[3:0], for the selected DAC channel LL_DAC_NOISE_LFSR_UNMASK_BITS4_0 Noise wave generation, unmask LFSR...
  • Page 851 UM1940 LL DAC Generic Driver LL_DAC_TRIANGLE_AMPLITUDE_255 Triangle wave generation, amplitude of 255 LSB of DAC output range, for the selected DAC channel LL_DAC_TRIANGLE_AMPLITUDE_511 Triangle wave generation, amplitude of 512 LSB of DAC output range, for the selected DAC channel LL_DAC_TRIANGLE_AMPLITUDE_1023 Triangle wave generation, amplitude of 1023 LSB of DAC output range, for the selected DAC channel...
  • Page 852 LL DAC Generic Driver UM1940 returns value '0'. __LL_DAC_DIGITAL_SCALE Description: Helper macro to define the DAC conversion data full-scale digital value corresponding to the selected DAC resolution. Parameters: __DAC_RESOLUTION__: This parameter can be one of the following values: LL_DAC_RESOLUTION_12B LL_DAC_RESOLUTION_8B Return value: ADC: conversion data equivalent voltage value (unit: mVolt)
  • Page 853 UM1940 LL DAC Generic Driver AGE(). Common write and read registers macros LL_DAC_WriteReg Description: Write a value in DAC register. Parameters: __INSTANCE__: DAC Instance __REG__: Register to be written __VALUE__: Value to be written in the register Return value: None LL_DAC_ReadReg Description: Read a value in DAC register.
  • Page 854: Ll Dma Generic Driver

    LL DMA Generic Driver UM1940 LL DMA Generic Driver 55.1 DMA Firmware driver registers structures 55.1.1 LL_DMA_InitTypeDef Data Fields uint32_t PeriphOrM2MSrcAddress uint32_t MemoryOrM2MDstAddress uint32_t Direction uint32_t Mode uint32_t PeriphOrM2MSrcIncMode uint32_t MemoryOrM2MDstIncMode uint32_t PeriphOrM2MSrcDataSize uint32_t MemoryOrM2MDstDataSize uint32_t NbData uint32_t Channel uint32_t Priority uint32_t FIFOMode uint32_t FIFOThreshold uint32_t MemBurst...
  • Page 855 UM1940 LL DMA Generic Driver DMA_LL_EC_MEMORYThis feature can be modified afterwards using unitary function LL_DMA_SetMemoryIncMode(). uint32_t LL_DMA_InitTypeDef::PeriphOrM2MSrcDataSize Specifies the Peripheral data size alignment or Source data size alignment (byte, half word, word) in case of memory to memory transfer direction. This parameter can be a value of DMA_LL_EC_PDATAALIGNThis feature can be modified afterwards using unitary function LL_DMA_SetPeriphSize().
  • Page 856 LL DMA Generic Driver UM1940 55.2 DMA Firmware driver API description 55.2.1 Detailed description of functions LL_DMA_EnableStream Function name __STATIC_INLINE void LL_DMA_EnableStream (DMA_TypeDef * DMAx, uint32_t Stream) Function description Enable DMA stream. Parameters DMAx: DMAx Instance Stream: This parameter can be one of the following values: LL_DMA_STREAM_0 LL_DMA_STREAM_1 LL_DMA_STREAM_2...
  • Page 857 UM1940 LL DMA Generic Driver Function description Check if DMA stream is enabled or disabled. Parameters DMAx: DMAx Instance Stream: This parameter can be one of the following values: LL_DMA_STREAM_0 LL_DMA_STREAM_1 LL_DMA_STREAM_2 LL_DMA_STREAM_3 LL_DMA_STREAM_4 LL_DMA_STREAM_5 LL_DMA_STREAM_6 LL_DMA_STREAM_7 Return values State: of bit (1 or 0). Reference Manual to CR EN LL_DMA_IsEnabledStream LL API cross...
  • Page 858 LL DMA Generic Driver UM1940 LL_DMA_PRIORITY_MEDIUM or LL_DMA_PRIORITY_HIGH or LL_DMA_PRIORITY_VERYHIGH Return values None: Reference Manual to CR DIR LL_DMA_ConfigTransfer LL API cross CR CIRC LL_DMA_ConfigTransfer reference: CR PINC LL_DMA_ConfigTransfer CR MINC LL_DMA_ConfigTransfer CR PSIZE LL_DMA_ConfigTransfer CR MSIZE LL_DMA_ConfigTransfer CR PL LL_DMA_ConfigTransfer CR PFCTRL LL_DMA_ConfigTransfer LL_DMA_SetDataTransferDirection __STATIC_INLINE void LL_DMA_SetDataTransferDirection...
  • Page 859 UM1940 LL DMA Generic Driver LL_DMA_STREAM_3 LL_DMA_STREAM_4 LL_DMA_STREAM_5 LL_DMA_STREAM_6 LL_DMA_STREAM_7 Return values Returned: value can be one of the following values: LL_DMA_DIRECTION_PERIPH_TO_MEMORY LL_DMA_DIRECTION_MEMORY_TO_PERIPH LL_DMA_DIRECTION_MEMORY_TO_MEMORY Reference Manual to CR DIR LL_DMA_GetDataTransferDirection LL API cross reference: LL_DMA_SetMode __STATIC_INLINE void LL_DMA_SetMode (DMA_TypeDef * Function name DMAx, uint32_t Stream, uint32_t Mode) Function description...
  • Page 860 LL DMA Generic Driver UM1940 LL_DMA_STREAM_5 LL_DMA_STREAM_6 LL_DMA_STREAM_7 Return values Returned: value can be one of the following values: LL_DMA_MODE_NORMAL LL_DMA_MODE_CIRCULAR LL_DMA_MODE_PFCTRL Reference Manual to CR CIRC LL_DMA_GetMode LL API cross CR PFCTRL LL_DMA_GetMode reference: LL_DMA_SetPeriphIncMode Function name __STATIC_INLINE void LL_DMA_SetPeriphIncMode (DMA_TypeDef * DMAx, uint32_t Stream, uint32_t IncrementMode) Function description...
  • Page 861 UM1940 LL DMA Generic Driver LL_DMA_STREAM_6 LL_DMA_STREAM_7 Return values Returned: value can be one of the following values: LL_DMA_PERIPH_NOINCREMENT LL_DMA_PERIPH_INCREMENT Reference Manual to CR PINC LL_DMA_GetPeriphIncMode LL API cross reference: LL_DMA_SetMemoryIncMode Function name __STATIC_INLINE void LL_DMA_SetMemoryIncMode (DMA_TypeDef * DMAx, uint32_t Stream, uint32_t IncrementMode) Function description Set Memory increment mode.
  • Page 862 LL DMA Generic Driver UM1940 Return values Returned: value can be one of the following values: LL_DMA_MEMORY_NOINCREMENT LL_DMA_MEMORY_INCREMENT Reference Manual to CR MINC LL_DMA_GetMemoryIncMode LL API cross reference: LL_DMA_SetPeriphSize Function name __STATIC_INLINE void LL_DMA_SetPeriphSize (DMA_TypeDef * DMAx, uint32_t Stream, uint32_t Size) Function description Set Peripheral size.
  • Page 863 UM1940 LL DMA Generic Driver LL_DMA_PDATAALIGN_WORD Reference Manual to CR PSIZE LL_DMA_GetPeriphSize LL API cross reference: LL_DMA_SetMemorySize __STATIC_INLINE void LL_DMA_SetMemorySize Function name (DMA_TypeDef * DMAx, uint32_t Stream, uint32_t Size) Function description Set Memory size. Parameters DMAx: DMAx Instance Stream: This parameter can be one of the following values: LL_DMA_STREAM_0 LL_DMA_STREAM_1 LL_DMA_STREAM_2...
  • Page 864 LL DMA Generic Driver UM1940 Reference Manual to CR MSIZE LL_DMA_GetMemorySize LL API cross reference: LL_DMA_SetIncOffsetSize Function name __STATIC_INLINE void LL_DMA_SetIncOffsetSize (DMA_TypeDef * DMAx, uint32_t Stream, uint32_t OffsetSize) Function description Set Peripheral increment offset size. Parameters DMAx: DMAx Instance Stream: This parameter can be one of the following values: LL_DMA_STREAM_0 LL_DMA_STREAM_1 LL_DMA_STREAM_2...
  • Page 865 UM1940 LL DMA Generic Driver LL_DMA_SetStreamPriorityLevel Function name __STATIC_INLINE void LL_DMA_SetStreamPriorityLevel (DMA_TypeDef * DMAx, uint32_t Stream, uint32_t Priority) Function description Set Stream priority level. Parameters DMAx: DMAx Instance Stream: This parameter can be one of the following values: LL_DMA_STREAM_0 LL_DMA_STREAM_1 LL_DMA_STREAM_2 LL_DMA_STREAM_3 LL_DMA_STREAM_4...
  • Page 866 LL DMA Generic Driver UM1940 LL_DMA_SetDataLength Function name __STATIC_INLINE void LL_DMA_SetDataLength (DMA_TypeDef * DMAx, uint32_t Stream, uint32_t NbData) Function description Set Number of data to transfer. Parameters DMAx: DMAx Instance Stream: This parameter can be one of the following values: LL_DMA_STREAM_0 LL_DMA_STREAM_1 LL_DMA_STREAM_2...
  • Page 867 UM1940 LL DMA Generic Driver Function description Select Channel number associated to the Stream. Parameters DMAx: DMAx Instance Stream: This parameter can be one of the following values: LL_DMA_STREAM_0 LL_DMA_STREAM_1 LL_DMA_STREAM_2 LL_DMA_STREAM_3 LL_DMA_STREAM_4 LL_DMA_STREAM_5 LL_DMA_STREAM_6 LL_DMA_STREAM_7 Channel: This parameter can be one of the following values: LL_DMA_CHANNEL_0 LL_DMA_CHANNEL_1 LL_DMA_CHANNEL_2...
  • Page 868 LL DMA Generic Driver UM1940 Reference Manual to CR CHSEL LL_DMA_GetChannelSelection LL API cross reference: LL_DMA_SetMemoryBurstxfer Function name __STATIC_INLINE void LL_DMA_SetMemoryBurstxfer (DMA_TypeDef * DMAx, uint32_t Stream, uint32_t Mburst) Function description Set Memory burst transfer configuration. Parameters DMAx: DMAx Instance Stream: This parameter can be one of the following values: LL_DMA_STREAM_0 LL_DMA_STREAM_1 LL_DMA_STREAM_2...
  • Page 869 UM1940 LL DMA Generic Driver Reference Manual to CR MBURST LL_DMA_GetMemoryBurstxfer LL API cross reference: LL_DMA_SetPeriphBurstxfer Function name __STATIC_INLINE void LL_DMA_SetPeriphBurstxfer (DMA_TypeDef * DMAx, uint32_t Stream, uint32_t Pburst) Function description Set Peripheral burst transfer configuration. Parameters DMAx: DMAx Instance Stream: This parameter can be one of the following values: LL_DMA_STREAM_0 LL_DMA_STREAM_1 LL_DMA_STREAM_2...
  • Page 870 LL DMA Generic Driver UM1940 Reference Manual to CR PBURST LL_DMA_GetPeriphBurstxfer LL API cross reference: LL_DMA_SetCurrentTargetMem Function name __STATIC_INLINE void LL_DMA_SetCurrentTargetMem (DMA_TypeDef * DMAx, uint32_t Stream, uint32_t CurrentMemory) Function description Set Current target (only in double buffer mode) to Memory 1 or Memory 0.
  • Page 871 UM1940 LL DMA Generic Driver Reference Manual to CR CT LL_DMA_GetCurrentTargetMem LL API cross reference: LL_DMA_EnableDoubleBufferMode Function name __STATIC_INLINE void LL_DMA_EnableDoubleBufferMode (DMA_TypeDef * DMAx, uint32_t Stream) Function description Enable the double buffer mode. Parameters DMAx: DMAx Instance Stream: This parameter can be one of the following values: LL_DMA_STREAM_0 LL_DMA_STREAM_1 LL_DMA_STREAM_2...
  • Page 872 LL DMA Generic Driver UM1940 Function description Get FIFO status. Parameters DMAx: DMAx Instance Stream: This parameter can be one of the following values: LL_DMA_STREAM_0 LL_DMA_STREAM_1 LL_DMA_STREAM_2 LL_DMA_STREAM_3 LL_DMA_STREAM_4 LL_DMA_STREAM_5 LL_DMA_STREAM_6 LL_DMA_STREAM_7 Return values Returned: value can be one of the following values: LL_DMA_FIFOSTATUS_0_25 LL_DMA_FIFOSTATUS_25_50 LL_DMA_FIFOSTATUS_50_75...
  • Page 873 UM1940 LL DMA Generic Driver LL_DMA_STREAM_0 LL_DMA_STREAM_1 LL_DMA_STREAM_2 LL_DMA_STREAM_3 LL_DMA_STREAM_4 LL_DMA_STREAM_5 LL_DMA_STREAM_6 LL_DMA_STREAM_7 Return values None: Reference Manual to FCR DMDIS LL_DMA_EnableFifoMode LL API cross reference: LL_DMA_SetFIFOThreshold __STATIC_INLINE void LL_DMA_SetFIFOThreshold Function name (DMA_TypeDef * DMAx, uint32_t Stream, uint32_t Threshold) Function description Select FIFO threshold.
  • Page 874 LL DMA Generic Driver UM1940 LL_DMA_STREAM_3 LL_DMA_STREAM_4 LL_DMA_STREAM_5 LL_DMA_STREAM_6 LL_DMA_STREAM_7 Return values Returned: value can be one of the following values: LL_DMA_FIFOTHRESHOLD_1_4 LL_DMA_FIFOTHRESHOLD_1_2 LL_DMA_FIFOTHRESHOLD_3_4 LL_DMA_FIFOTHRESHOLD_FULL Reference Manual to FCR FTH LL_DMA_GetFIFOThreshold LL API cross reference: LL_DMA_ConfigFifo Function name __STATIC_INLINE void LL_DMA_ConfigFifo (DMA_TypeDef * DMAx, uint32_t Stream, uint32_t FifoMode, uint32_t FifoThreshold) Function description...
  • Page 875 UM1940 LL DMA Generic Driver Function description Configure the Source and Destination addresses. Parameters DMAx: DMAx Instance Stream: This parameter can be one of the following values: LL_DMA_STREAM_0 LL_DMA_STREAM_1 LL_DMA_STREAM_2 LL_DMA_STREAM_3 LL_DMA_STREAM_4 LL_DMA_STREAM_5 LL_DMA_STREAM_6 LL_DMA_STREAM_7 SrcAddress: Between 0 to 0xFFFFFFFF DstAddress: Between 0 to 0xFFFFFFFF Direction: This parameter can be one of the following values:...
  • Page 876 LL DMA Generic Driver UM1940 reference: LL_DMA_SetPeriphAddress Function name __STATIC_INLINE void LL_DMA_SetPeriphAddress (DMA_TypeDef * DMAx, uint32_t Stream, uint32_t PeriphAddress) Function description Set the Peripheral address. Parameters DMAx: DMAx Instance Stream: This parameter can be one of the following values: LL_DMA_STREAM_0 LL_DMA_STREAM_1 LL_DMA_STREAM_2 LL_DMA_STREAM_3...
  • Page 877 UM1940 LL DMA Generic Driver Reference Manual to M0AR M0A LL_DMA_GetMemoryAddress LL API cross reference: LL_DMA_GetPeriphAddress Function name __STATIC_INLINE uint32_t LL_DMA_GetPeriphAddress (DMA_TypeDef * DMAx, uint32_t Stream) Function description Get the Peripheral address. Parameters DMAx: DMAx Instance Stream: This parameter can be one of the following values: LL_DMA_STREAM_0 LL_DMA_STREAM_1 LL_DMA_STREAM_2...
  • Page 878 LL DMA Generic Driver UM1940 enabled. Reference Manual to PAR PA LL_DMA_SetM2MSrcAddress LL API cross reference: LL_DMA_SetM2MDstAddress Function name __STATIC_INLINE void LL_DMA_SetM2MDstAddress (DMA_TypeDef * DMAx, uint32_t Stream, uint32_t MemoryAddress) Function description Set the Memory to Memory Destination address. Parameters DMAx: DMAx Instance Stream: This parameter can be one of the following values: LL_DMA_STREAM_0 LL_DMA_STREAM_1...
  • Page 879 UM1940 LL DMA Generic Driver LL_DMA_DIRECTION_MEMORY_TO_MEMORY only. Reference Manual to PAR PA LL_DMA_GetM2MSrcAddress LL API cross reference: LL_DMA_GetM2MDstAddress Function name __STATIC_INLINE uint32_t LL_DMA_GetM2MDstAddress (DMA_TypeDef * DMAx, uint32_t Stream) Function description Get the Memory to Memory Destination address. Parameters DMAx: DMAx Instance Stream: This parameter can be one of the following values: LL_DMA_STREAM_0 LL_DMA_STREAM_1...
  • Page 880 LL DMA Generic Driver UM1940 LL_DMA_GetMemory1Address Function name __STATIC_INLINE uint32_t LL_DMA_GetMemory1Address (DMA_TypeDef * DMAx, uint32_t Stream) Function description Get Memory 1 address (used in case of Double buffer mode). Parameters DMAx: DMAx Instance Stream: This parameter can be one of the following values: LL_DMA_STREAM_0 LL_DMA_STREAM_1 LL_DMA_STREAM_2...
  • Page 881 UM1940 LL DMA Generic Driver Parameters DMAx: DMAx Instance Return values State: of bit (1 or 0). Reference Manual to LISR HTIF2 LL_DMA_IsActiveFlag_HT2 LL API cross reference: LL_DMA_IsActiveFlag_HT3 Function name __STATIC_INLINE uint32_t LL_DMA_IsActiveFlag_HT3 (DMA_TypeDef * DMAx) Function description Get Stream 3 half transfer flag. Parameters DMAx: DMAx Instance Return values...
  • Page 882 LL DMA Generic Driver UM1940 Return values State: of bit (1 or 0). Reference Manual to HISR HTIF6 LL_DMA_IsActiveFlag_HT6 LL API cross reference: LL_DMA_IsActiveFlag_HT7 __STATIC_INLINE uint32_t LL_DMA_IsActiveFlag_HT7 Function name (DMA_TypeDef * DMAx) Function description Get Stream 7 half transfer flag. Parameters DMAx: DMAx Instance Return values...
  • Page 883 UM1940 LL DMA Generic Driver Reference Manual to LISR TCIF2 LL_DMA_IsActiveFlag_TC2 LL API cross reference: LL_DMA_IsActiveFlag_TC3 Function name __STATIC_INLINE uint32_t LL_DMA_IsActiveFlag_TC3 (DMA_TypeDef * DMAx) Function description Get Stream 3 transfer complete flag. Parameters DMAx: DMAx Instance Return values State: of bit (1 or 0). Reference Manual to LISR TCIF3 LL_DMA_IsActiveFlag_TC3 LL API cross...
  • Page 884 LL DMA Generic Driver UM1940 reference: LL_DMA_IsActiveFlag_TC7 Function name __STATIC_INLINE uint32_t LL_DMA_IsActiveFlag_TC7 (DMA_TypeDef * DMAx) Function description Get Stream 7 transfer complete flag. Parameters DMAx: DMAx Instance Return values State: of bit (1 or 0). Reference Manual to HISR TCIF7 LL_DMA_IsActiveFlag_TC7 LL API cross reference: LL_DMA_IsActiveFlag_TE0...
  • Page 885 UM1940 LL DMA Generic Driver LL_DMA_IsActiveFlag_TE3 Function name __STATIC_INLINE uint32_t LL_DMA_IsActiveFlag_TE3 (DMA_TypeDef * DMAx) Function description Get Stream 3 transfer error flag. Parameters DMAx: DMAx Instance Return values State: of bit (1 or 0). Reference Manual to LISR TEIF3 LL_DMA_IsActiveFlag_TE3 LL API cross reference: LL_DMA_IsActiveFlag_TE4...
  • Page 886 LL DMA Generic Driver UM1940 LL_DMA_IsActiveFlag_TE7 Function name __STATIC_INLINE uint32_t LL_DMA_IsActiveFlag_TE7 (DMA_TypeDef * DMAx) Function description Get Stream 7 transfer error flag. Parameters DMAx: DMAx Instance Return values State: of bit (1 or 0). Reference Manual to HISR TEIF7 LL_DMA_IsActiveFlag_TE7 LL API cross reference: LL_DMA_IsActiveFlag_DME0...
  • Page 887 UM1940 LL DMA Generic Driver LL_DMA_IsActiveFlag_DME3 Function name __STATIC_INLINE uint32_t LL_DMA_IsActiveFlag_DME3 (DMA_TypeDef * DMAx) Function description Get Stream 3 direct mode error flag. Parameters DMAx: DMAx Instance Return values State: of bit (1 or 0). Reference Manual to LISR DMEIF3 LL_DMA_IsActiveFlag_DME3 LL API cross reference: LL_DMA_IsActiveFlag_DME4...
  • Page 888 LL DMA Generic Driver UM1940 LL_DMA_IsActiveFlag_DME7 Function name __STATIC_INLINE uint32_t LL_DMA_IsActiveFlag_DME7 (DMA_TypeDef * DMAx) Function description Get Stream 7 direct mode error flag. Parameters DMAx: DMAx Instance Return values State: of bit (1 or 0). Reference Manual to HISR DMEIF7 LL_DMA_IsActiveFlag_DME7 LL API cross reference: LL_DMA_IsActiveFlag_FE0...
  • Page 889 UM1940 LL DMA Generic Driver LL_DMA_IsActiveFlag_FE3 Function name __STATIC_INLINE uint32_t LL_DMA_IsActiveFlag_FE3 (DMA_TypeDef * DMAx) Function description Get Stream 3 FIFO error flag. Parameters DMAx: DMAx Instance Return values State: of bit (1 or 0). Reference Manual to LISR FEIF3 LL_DMA_IsActiveFlag_FE3 LL API cross reference: LL_DMA_IsActiveFlag_FE4...
  • Page 890 LL DMA Generic Driver UM1940 LL_DMA_IsActiveFlag_FE7 Function name __STATIC_INLINE uint32_t LL_DMA_IsActiveFlag_FE7 (DMA_TypeDef * DMAx) Function description Get Stream 7 FIFO error flag. Parameters DMAx: DMAx Instance Return values State: of bit (1 or 0). Reference Manual to HISR FEIF7 LL_DMA_IsActiveFlag_FE7 LL API cross reference: LL_DMA_ClearFlag_HT0...
  • Page 891 UM1940 LL DMA Generic Driver LL_DMA_ClearFlag_HT3 Function name __STATIC_INLINE void LL_DMA_ClearFlag_HT3 (DMA_TypeDef * DMAx) Function description Clear Stream 3 half transfer flag. Parameters DMAx: DMAx Instance Return values None: Reference Manual to LIFCR CHTIF3 LL_DMA_ClearFlag_HT3 LL API cross reference: LL_DMA_ClearFlag_HT4 Function name __STATIC_INLINE void LL_DMA_ClearFlag_HT4 (DMA_TypeDef * DMAx)
  • Page 892 LL DMA Generic Driver UM1940 LL_DMA_ClearFlag_HT7 Function name __STATIC_INLINE void LL_DMA_ClearFlag_HT7 (DMA_TypeDef * DMAx) Function description Clear Stream 7 half transfer flag. Parameters DMAx: DMAx Instance Return values None: Reference Manual to HIFCR CHTIF7 LL_DMA_ClearFlag_HT7 LL API cross reference: LL_DMA_ClearFlag_TC0 Function name __STATIC_INLINE void LL_DMA_ClearFlag_TC0 (DMA_TypeDef * DMAx)
  • Page 893 UM1940 LL DMA Generic Driver LL_DMA_ClearFlag_TC3 Function name __STATIC_INLINE void LL_DMA_ClearFlag_TC3 (DMA_TypeDef * DMAx) Function description Clear Stream 3 transfer complete flag. Parameters DMAx: DMAx Instance Return values None: Reference Manual to LIFCR CTCIF3 LL_DMA_ClearFlag_TC3 LL API cross reference: LL_DMA_ClearFlag_TC4 Function name __STATIC_INLINE void LL_DMA_ClearFlag_TC4 (DMA_TypeDef * DMAx)
  • Page 894 LL DMA Generic Driver UM1940 LL_DMA_ClearFlag_TC7 Function name __STATIC_INLINE void LL_DMA_ClearFlag_TC7 (DMA_TypeDef * DMAx) Function description Clear Stream 7 transfer complete flag. Parameters DMAx: DMAx Instance Return values None: Reference Manual to HIFCR CTCIF7 LL_DMA_ClearFlag_TC7 LL API cross reference: LL_DMA_ClearFlag_TE0 Function name __STATIC_INLINE void LL_DMA_ClearFlag_TE0 (DMA_TypeDef * DMAx)
  • Page 895 UM1940 LL DMA Generic Driver LL_DMA_ClearFlag_TE3 Function name __STATIC_INLINE void LL_DMA_ClearFlag_TE3 (DMA_TypeDef * DMAx) Function description Clear Stream 3 transfer error flag. Parameters DMAx: DMAx Instance Return values None: Reference Manual to LIFCR CTEIF3 LL_DMA_ClearFlag_TE3 LL API cross reference: LL_DMA_ClearFlag_TE4 Function name __STATIC_INLINE void LL_DMA_ClearFlag_TE4 (DMA_TypeDef * DMAx)
  • Page 896 LL DMA Generic Driver UM1940 LL_DMA_ClearFlag_TE7 Function name __STATIC_INLINE void LL_DMA_ClearFlag_TE7 (DMA_TypeDef * DMAx) Function description Clear Stream 7 transfer error flag. Parameters DMAx: DMAx Instance Return values None: Reference Manual to HIFCR CTEIF7 LL_DMA_ClearFlag_TE7 LL API cross reference: LL_DMA_ClearFlag_DME0 Function name __STATIC_INLINE void LL_DMA_ClearFlag_DME0 (DMA_TypeDef * DMAx)
  • Page 897 UM1940 LL DMA Generic Driver LL_DMA_ClearFlag_DME3 Function name __STATIC_INLINE void LL_DMA_ClearFlag_DME3 (DMA_TypeDef * DMAx) Function description Clear Stream 3 direct mode error flag. Parameters DMAx: DMAx Instance Return values None: Reference Manual to LIFCR CDMEIF3 LL_DMA_ClearFlag_DME3 LL API cross reference: LL_DMA_ClearFlag_DME4 Function name __STATIC_INLINE void LL_DMA_ClearFlag_DME4...
  • Page 898 LL DMA Generic Driver UM1940 LL_DMA_ClearFlag_DME7 Function name __STATIC_INLINE void LL_DMA_ClearFlag_DME7 (DMA_TypeDef * DMAx) Function description Clear Stream 7 direct mode error flag. Parameters DMAx: DMAx Instance Return values None: Reference Manual to HIFCR CDMEIF7 LL_DMA_ClearFlag_DME7 LL API cross reference: LL_DMA_ClearFlag_FE0 Function name __STATIC_INLINE void LL_DMA_ClearFlag_FE0...
  • Page 899 UM1940 LL DMA Generic Driver LL_DMA_ClearFlag_FE3 Function name __STATIC_INLINE void LL_DMA_ClearFlag_FE3 (DMA_TypeDef * DMAx) Function description Clear Stream 3 FIFO error flag. Parameters DMAx: DMAx Instance Return values None: Reference Manual to LIFCR CFEIF3 LL_DMA_ClearFlag_FE3 LL API cross reference: LL_DMA_ClearFlag_FE4 Function name __STATIC_INLINE void LL_DMA_ClearFlag_FE4 (DMA_TypeDef * DMAx)
  • Page 900 LL DMA Generic Driver UM1940 LL_DMA_ClearFlag_FE7 Function name __STATIC_INLINE void LL_DMA_ClearFlag_FE7 (DMA_TypeDef * DMAx) Function description Clear Stream 7 FIFO error flag. Parameters DMAx: DMAx Instance Return values None: Reference Manual to HIFCR CFEIF7 LL_DMA_ClearFlag_FE7 LL API cross reference: LL_DMA_EnableIT_HT Function name __STATIC_INLINE void LL_DMA_EnableIT_HT (DMA_TypeDef * DMAx, uint32_t Stream)
  • Page 901 UM1940 LL DMA Generic Driver Reference Manual to CR TEIE LL_DMA_EnableIT_TE LL API cross reference: LL_DMA_EnableIT_TC Function name __STATIC_INLINE void LL_DMA_EnableIT_TC (DMA_TypeDef * DMAx, uint32_t Stream) Function description Enable Transfer complete interrupt. Parameters DMAx: DMAx Instance Stream: This parameter can be one of the following values: LL_DMA_STREAM_0 LL_DMA_STREAM_1 LL_DMA_STREAM_2...
  • Page 902 LL DMA Generic Driver UM1940 Function description Enable FIFO error interrupt. Parameters DMAx: DMAx Instance Stream: This parameter can be one of the following values: LL_DMA_STREAM_0 LL_DMA_STREAM_1 LL_DMA_STREAM_2 LL_DMA_STREAM_3 LL_DMA_STREAM_4 LL_DMA_STREAM_5 LL_DMA_STREAM_6 LL_DMA_STREAM_7 Return values None: Reference Manual to FCR FEIE LL_DMA_EnableIT_FE LL API cross reference: LL_DMA_DisableIT_HT...
  • Page 903 UM1940 LL DMA Generic Driver LL_DMA_STREAM_6 LL_DMA_STREAM_7 Return values None: Reference Manual to CR TEIE LL_DMA_DisableIT_TE LL API cross reference: LL_DMA_DisableIT_TC Function name __STATIC_INLINE void LL_DMA_DisableIT_TC (DMA_TypeDef * DMAx, uint32_t Stream) Function description Disable Transfer complete interrupt. Parameters DMAx: DMAx Instance Stream: This parameter can be one of the following values: LL_DMA_STREAM_0 LL_DMA_STREAM_1...
  • Page 904 LL DMA Generic Driver UM1940 LL_DMA_DisableIT_FE Function name __STATIC_INLINE void LL_DMA_DisableIT_FE (DMA_TypeDef * DMAx, uint32_t Stream) Function description Disable FIFO error interrupt. Parameters DMAx: DMAx Instance Stream: This parameter can be one of the following values: LL_DMA_STREAM_0 LL_DMA_STREAM_1 LL_DMA_STREAM_2 LL_DMA_STREAM_3 LL_DMA_STREAM_4 LL_DMA_STREAM_5 LL_DMA_STREAM_6...
  • Page 905 UM1940 LL DMA Generic Driver LL_DMA_STREAM_2 LL_DMA_STREAM_3 LL_DMA_STREAM_4 LL_DMA_STREAM_5 LL_DMA_STREAM_6 LL_DMA_STREAM_7 Return values State: of bit (1 or 0). Reference Manual to CR TEIE LL_DMA_IsEnabledIT_TE LL API cross reference: LL_DMA_IsEnabledIT_TC Function name __STATIC_INLINE uint32_t LL_DMA_IsEnabledIT_TC (DMA_TypeDef * DMAx, uint32_t Stream) Function description Check if Transfer complete interrup is enabled.
  • Page 906 LL DMA Generic Driver UM1940 LL API cross reference: LL_DMA_IsEnabledIT_FE Function name __STATIC_INLINE uint32_t LL_DMA_IsEnabledIT_FE (DMA_TypeDef * DMAx, uint32_t Stream) Function description Check if FIFO error interrup is enabled. Parameters DMAx: DMAx Instance Stream: This parameter can be one of the following values: LL_DMA_STREAM_0 LL_DMA_STREAM_1 LL_DMA_STREAM_2...
  • Page 907 UM1940 LL DMA Generic Driver LL_DMA_DeInit Function name uint32_t LL_DMA_DeInit (DMA_TypeDef * DMAx, uint32_t Stream) Function description De-initialize the DMA registers to their default reset values. Parameters DMAx: DMAx Instance Stream: This parameter can be one of the following values: LL_DMA_STREAM_0 LL_DMA_STREAM_1 LL_DMA_STREAM_2...
  • Page 908 LL DMA Generic Driver UM1940 DIRECTION LL_DMA_DIRECTION_PERIPH_TO_MEMORY Peripheral to memory direction LL_DMA_DIRECTION_MEMORY_TO_PERIPH Memory to peripheral direction LL_DMA_DIRECTION_MEMORY_TO_MEMORY Memory to memory direction MODE LL_DMA_DOUBLEBUFFER_MODE_DISABLE Disable double buffering mode LL_DMA_DOUBLEBUFFER_MODE_ENABLE Enable double buffering mode FIFOSTATUS 0 LL_DMA_FIFOSTATUS_0_25 0 < fifo_level < 1/4 LL_DMA_FIFOSTATUS_25_50 1/4 <...
  • Page 909 UM1940 LL DMA Generic Driver LL_DMA_OFFSETSIZE_PSIZE Peripheral increment offset size is linked to the PSIZE LL_DMA_OFFSETSIZE_FIXEDTO4 Peripheral increment offset size is fixed to 4 (32-bit alignment) PBURST LL_DMA_PBURST_SINGLE Peripheral burst single transfer configuration LL_DMA_PBURST_INC4 Peripheral burst of 4 beats transfer configuration LL_DMA_PBURST_INC8 Peripheral burst of 8 beats transfer configuration LL_DMA_PBURST_INC16...
  • Page 910 LL DMA Generic Driver UM1940 Return value: DMAx __LL_DMA_GET_STREAM Description: Convert DMAx_Streamy into LL_DMA_STREAM_y. Parameters: __STREAM_INSTANCE__: DMAx_Streamy Return value: LL_DMA_CHANNEL_y __LL_DMA_GET_STREAM_INSTANCE Description: Convert DMA Instance DMAx and LL_DMA_STREAM_y into DMAx_Streamy. Parameters: __DMA_INSTANCE__: DMAx __STREAM__: LL_DMA_STREAM_y Return value: DMAx_Streamy Common Write and read registers macros LL_DMA_WriteReg Description: Write a value in DMA register.
  • Page 911: Ll Exti Generic Driver

    UM1940 LL EXTI Generic Driver LL EXTI Generic Driver 56.1 EXTI Firmware driver registers structures 56.1.1 LL_EXTI_InitTypeDef Data Fields uint32_t Line_0_31 FunctionalState LineCommand uint8_t Mode uint8_t Trigger Field Documentation uint32_t LL_EXTI_InitTypeDef::Line_0_31 Specifies the EXTI lines to be enabled or disabled for Lines in range 0 to 31 This parameter can be any combination of EXTI_LL_EC_LINE FunctionalState LL_EXTI_InitTypeDef::LineCommand...
  • Page 912 LL EXTI Generic Driver UM1940 LL_EXTI_LINE_14 LL_EXTI_LINE_15 LL_EXTI_LINE_16 LL_EXTI_LINE_17 LL_EXTI_LINE_18 LL_EXTI_LINE_19 LL_EXTI_LINE_20 LL_EXTI_LINE_21 LL_EXTI_LINE_22 LL_EXTI_LINE_ALL_0_31 Return values None: Notes The reset value for the direct or internal lines (see RM) is set to 1 in order to enable the interrupt by default. Bits are set automatically at Power on.
  • Page 913 UM1940 LL EXTI Generic Driver Return values None: Notes The reset value for the direct or internal lines (see RM) is set to 1 in order to enable the interrupt by default. Bits are set automatically at Power on. Please check each device line mapping for EXTI Line availability Reference Manual to IMR IMx LL_EXTI_DisableIT_0_31...
  • Page 914 LL EXTI Generic Driver UM1940 reference: LL_EXTI_EnableEvent_0_31 Function name __STATIC_INLINE void LL_EXTI_EnableEvent_0_31 (uint32_t ExtiLine) Function description Enable ExtiLine Event request for Lines in range 0 to 31. Parameters ExtiLine: This parameter can be one of the following values: LL_EXTI_LINE_0 LL_EXTI_LINE_1 LL_EXTI_LINE_2 LL_EXTI_LINE_3 LL_EXTI_LINE_4...
  • Page 915 UM1940 LL EXTI Generic Driver LL_EXTI_LINE_4 LL_EXTI_LINE_5 LL_EXTI_LINE_6 LL_EXTI_LINE_7 LL_EXTI_LINE_8 LL_EXTI_LINE_9 LL_EXTI_LINE_10 LL_EXTI_LINE_11 LL_EXTI_LINE_12 LL_EXTI_LINE_13 LL_EXTI_LINE_14 LL_EXTI_LINE_15 LL_EXTI_LINE_16 LL_EXTI_LINE_17 LL_EXTI_LINE_18 LL_EXTI_LINE_19 LL_EXTI_LINE_20 LL_EXTI_LINE_21 LL_EXTI_LINE_22 LL_EXTI_LINE_ALL_0_31 Return values None: Notes Please check each device line mapping for EXTI Line availability Reference Manual to EMR EMx LL_EXTI_DisableEvent_0_31 LL API cross reference:...
  • Page 916 LL EXTI Generic Driver UM1940 LL_EXTI_LINE_16 LL_EXTI_LINE_17 LL_EXTI_LINE_18 LL_EXTI_LINE_19 LL_EXTI_LINE_20 LL_EXTI_LINE_21 LL_EXTI_LINE_22 LL_EXTI_LINE_ALL_0_31 Return values State: of bit (1 or 0). Notes Please check each device line mapping for EXTI Line availability Reference Manual to EMR EMx LL_EXTI_IsEnabledEvent_0_31 LL API cross reference: LL_EXTI_EnableRisingTrig_0_31 Function name...
  • Page 917 UM1940 LL EXTI Generic Driver this case, both generate a trigger condition. Please check each device line mapping for EXTI Line availability Reference Manual to RTSR RTx LL_EXTI_EnableRisingTrig_0_31 LL API cross reference: LL_EXTI_DisableRisingTrig_0_31 Function name __STATIC_INLINE void LL_EXTI_DisableRisingTrig_0_31 (uint32_t ExtiLine) Function description Disable ExtiLine Rising Edge Trigger for Lines in range 0 to 31.
  • Page 918 LL EXTI Generic Driver UM1940 LL_EXTI_IsEnabledRisingTrig_0_31 Function name __STATIC_INLINE uint32_t LL_EXTI_IsEnabledRisingTrig_0_31 (uint32_t ExtiLine) Function description Check if rising edge trigger is enabled for Lines in range 0 to 31. Parameters ExtiLine: This parameter can be a combination of the following values: LL_EXTI_LINE_0 LL_EXTI_LINE_1 LL_EXTI_LINE_2...
  • Page 919 UM1940 LL EXTI Generic Driver LL_EXTI_LINE_7 LL_EXTI_LINE_8 LL_EXTI_LINE_9 LL_EXTI_LINE_10 LL_EXTI_LINE_11 LL_EXTI_LINE_12 LL_EXTI_LINE_13 LL_EXTI_LINE_14 LL_EXTI_LINE_15 LL_EXTI_LINE_16 LL_EXTI_LINE_18 LL_EXTI_LINE_19 LL_EXTI_LINE_20 LL_EXTI_LINE_21 LL_EXTI_LINE_22 Return values None: Notes The configurable wakeup lines are edge-triggered. No glitch must be generated on these lines. If a falling edge on a configurable interrupt line occurs during a write operation in the EXTI_FTSR register, the pending bit is not set.
  • Page 920 LL EXTI Generic Driver UM1940 LL_EXTI_LINE_16 LL_EXTI_LINE_18 LL_EXTI_LINE_19 LL_EXTI_LINE_20 LL_EXTI_LINE_21 LL_EXTI_LINE_22 Return values None: Notes The configurable wakeup lines are edge-triggered. No glitch must be generated on these lines. If a Falling edge on a configurable interrupt line occurs during a write operation in the EXTI_FTSR register, the pending bit is not set.
  • Page 921 UM1940 LL EXTI Generic Driver Notes Please check each device line mapping for EXTI Line availability Reference Manual to FTSR FTx LL_EXTI_IsEnabledFallingTrig_0_31 LL API cross reference: LL_EXTI_GenerateSWI_0_31 Function name __STATIC_INLINE void LL_EXTI_GenerateSWI_0_31 (uint32_t ExtiLine) Function description Generate a software Interrupt Event for Lines in range 0 to 31. Parameters ExtiLine: This parameter can be a combination of the following values:...
  • Page 922 LL EXTI Generic Driver UM1940 (uint32_t ExtiLine) Function description Check if the ExtLine Flag is set or not for Lines in range 0 to 31. Parameters ExtiLine: This parameter can be a combination of the following values: LL_EXTI_LINE_0 LL_EXTI_LINE_1 LL_EXTI_LINE_2 LL_EXTI_LINE_3 LL_EXTI_LINE_4 LL_EXTI_LINE_5...
  • Page 923 UM1940 LL EXTI Generic Driver LL_EXTI_LINE_8 LL_EXTI_LINE_9 LL_EXTI_LINE_10 LL_EXTI_LINE_11 LL_EXTI_LINE_12 LL_EXTI_LINE_13 LL_EXTI_LINE_14 LL_EXTI_LINE_15 LL_EXTI_LINE_16 LL_EXTI_LINE_18 LL_EXTI_LINE_19 LL_EXTI_LINE_20 LL_EXTI_LINE_21 LL_EXTI_LINE_22 Return values @note: This bit is set when the selected edge event arrives on the interrupt Notes This bit is set when the selected edge event arrives on the interrupt line.
  • Page 924: Exti Firmware Driver Defines

    LL EXTI Generic Driver UM1940 LL_EXTI_LINE_20 LL_EXTI_LINE_21 LL_EXTI_LINE_22 Return values None: Notes This bit is set when the selected edge event arrives on the interrupt line. This bit is cleared by writing a 1 to the bit. Please check each device line mapping for EXTI Line availability Reference Manual to PR PIFx LL_EXTI_ClearFlag_0_31...
  • Page 925 UM1940 LL EXTI Generic Driver LL_EXTI_LINE_3 Extended line 3 LL_EXTI_LINE_4 Extended line 4 LL_EXTI_LINE_5 Extended line 5 LL_EXTI_LINE_6 Extended line 6 LL_EXTI_LINE_7 Extended line 7 LL_EXTI_LINE_8 Extended line 8 LL_EXTI_LINE_9 Extended line 9 LL_EXTI_LINE_10 Extended line 10 LL_EXTI_LINE_11 Extended line 11 LL_EXTI_LINE_12 Extended line 12 LL_EXTI_LINE_13...
  • Page 926 LL EXTI Generic Driver UM1940 __VALUE__: Value to be written in the register Return value: None LL_EXTI_ReadReg Description: Read a value in EXTI register. Parameters: __REG__: Register to be read Return value: Register: value 926/1371 DocID028236 Rev 2...
  • Page 927: Ll Gpio Generic Driver

    UM1940 LL GPIO Generic Driver LL GPIO Generic Driver 57.1 GPIO Firmware driver registers structures 57.1.1 LL_GPIO_InitTypeDef Data Fields uint32_t Pin uint32_t Mode uint32_t Speed uint32_t OutputType uint32_t Pull uint32_t Alternate Field Documentation uint32_t LL_GPIO_InitTypeDef::Pin Specifies the GPIO pins to be configured. This parameter can be any value of GPIO_LL_EC_PIN uint32_t LL_GPIO_InitTypeDef::Mode Specifies the operating mode for the selected pins.
  • Page 928 LL GPIO Generic Driver UM1940 LL_GPIO_PIN_0 LL_GPIO_PIN_1 LL_GPIO_PIN_2 LL_GPIO_PIN_3 LL_GPIO_PIN_4 LL_GPIO_PIN_5 LL_GPIO_PIN_6 LL_GPIO_PIN_7 LL_GPIO_PIN_8 LL_GPIO_PIN_9 LL_GPIO_PIN_10 LL_GPIO_PIN_11 LL_GPIO_PIN_12 LL_GPIO_PIN_13 LL_GPIO_PIN_14 LL_GPIO_PIN_15 Mode: This parameter can be one of the following values: LL_GPIO_MODE_INPUT LL_GPIO_MODE_OUTPUT LL_GPIO_MODE_ALTERNATE LL_GPIO_MODE_ANALOG Return values None: Notes I/O mode can be Input mode, General purpose output, Alternate function mode or Analog.
  • Page 929 UM1940 LL GPIO Generic Driver LL_GPIO_PIN_14 LL_GPIO_PIN_15 Return values Returned: value can be one of the following values: LL_GPIO_MODE_INPUT LL_GPIO_MODE_OUTPUT LL_GPIO_MODE_ALTERNATE LL_GPIO_MODE_ANALOG Notes I/O mode can be Input mode, General purpose output, Alternate function mode or Analog. Warning: only one pin can be passed as parameter. Reference Manual to MODER MODEy LL_GPIO_GetPinMode LL API cross...
  • Page 930 LL GPIO Generic Driver UM1940 reference: LL_GPIO_GetPinOutputType Function name __STATIC_INLINE uint32_t LL_GPIO_GetPinOutputType (GPIO_TypeDef * GPIOx, uint32_t Pin) Function description Return gpio output type for several pins on dedicated port. Parameters GPIOx: GPIO Port Pin: This parameter can be one of the following values: LL_GPIO_PIN_0 LL_GPIO_PIN_1 LL_GPIO_PIN_2...
  • Page 931 UM1940 LL GPIO Generic Driver LL_GPIO_PIN_6 LL_GPIO_PIN_7 LL_GPIO_PIN_8 LL_GPIO_PIN_9 LL_GPIO_PIN_10 LL_GPIO_PIN_11 LL_GPIO_PIN_12 LL_GPIO_PIN_13 LL_GPIO_PIN_14 LL_GPIO_PIN_15 Speed: This parameter can be one of the following values: LL_GPIO_SPEED_FREQ_LOW LL_GPIO_SPEED_FREQ_MEDIUM LL_GPIO_SPEED_FREQ_HIGH LL_GPIO_SPEED_FREQ_VERY_HIGH Return values None: Notes I/O speed can be Low, Medium, Fast or High speed. Warning: only one pin can be passed as parameter.
  • Page 932 LL GPIO Generic Driver UM1940 LL_GPIO_SPEED_FREQ_HIGH LL_GPIO_SPEED_FREQ_VERY_HIGH Notes I/O speed can be Low, Medium, Fast or High speed. Warning: only one pin can be passed as parameter. Refer to datasheet for frequency specifications and the power supply and load conditions for each speed. Reference Manual to OSPEEDR OSPEEDy LL_GPIO_GetPinSpeed LL API cross...
  • Page 933 UM1940 LL GPIO Generic Driver port. Parameters GPIOx: GPIO Port Pin: This parameter can be one of the following values: LL_GPIO_PIN_0 LL_GPIO_PIN_1 LL_GPIO_PIN_2 LL_GPIO_PIN_3 LL_GPIO_PIN_4 LL_GPIO_PIN_5 LL_GPIO_PIN_6 LL_GPIO_PIN_7 LL_GPIO_PIN_8 LL_GPIO_PIN_9 LL_GPIO_PIN_10 LL_GPIO_PIN_11 LL_GPIO_PIN_12 LL_GPIO_PIN_13 LL_GPIO_PIN_14 LL_GPIO_PIN_15 Return values Returned: value can be one of the following values: LL_GPIO_PULL_NO LL_GPIO_PULL_UP LL_GPIO_PULL_DOWN...
  • Page 934 LL GPIO Generic Driver UM1940 LL_GPIO_AF_4 LL_GPIO_AF_5 LL_GPIO_AF_6 LL_GPIO_AF_7 LL_GPIO_AF_8 LL_GPIO_AF_9 LL_GPIO_AF_10 LL_GPIO_AF_11 LL_GPIO_AF_12 LL_GPIO_AF_13 LL_GPIO_AF_14 LL_GPIO_AF_15 Return values None: Notes Possible values are from AF0 to AF15 depending on target. Warning: only one pin can be passed as parameter. Reference Manual to AFRL AFSELy LL_GPIO_SetAFPin_0_7 LL API cross...
  • Page 935 UM1940 LL GPIO Generic Driver LL_GPIO_AF_14 LL_GPIO_AF_15 Reference Manual to AFRL AFSELy LL_GPIO_GetAFPin_0_7 LL API cross reference: LL_GPIO_SetAFPin_8_15 __STATIC_INLINE void LL_GPIO_SetAFPin_8_15 Function name (GPIO_TypeDef * GPIOx, uint32_t Pin, uint32_t Alternate) Function description Configure gpio alternate function of a dedicated pin from 8 to 15 for a dedicated port.
  • Page 936 LL GPIO Generic Driver UM1940 (GPIO_TypeDef * GPIOx, uint32_t Pin) Function description Return gpio alternate function of a dedicated pin from 8 to 15 for a dedicated port. Parameters GPIOx: GPIO Port Pin: This parameter can be one of the following values: LL_GPIO_PIN_8 LL_GPIO_PIN_9 LL_GPIO_PIN_10...
  • Page 937 UM1940 LL GPIO Generic Driver LL_GPIO_PIN_6 LL_GPIO_PIN_7 LL_GPIO_PIN_8 LL_GPIO_PIN_9 LL_GPIO_PIN_10 LL_GPIO_PIN_11 LL_GPIO_PIN_12 LL_GPIO_PIN_13 LL_GPIO_PIN_14 LL_GPIO_PIN_15 LL_GPIO_PIN_ALL Return values None: Notes When the lock sequence has been applied on a port bit, the value of this port bit can no longer be modified until the next reset.
  • Page 938 LL GPIO Generic Driver UM1940 reference: LL_GPIO_IsAnyPinLocked Function name __STATIC_INLINE uint32_t LL_GPIO_IsAnyPinLocked (GPIO_TypeDef * GPIOx) Function description Return 1 if one of the pin of a dedicated port is locked. Parameters GPIOx: GPIO Port Return values State: of bit (1 or 0). Reference Manual to LCKR LCKK LL_GPIO_IsAnyPinLocked LL API cross...
  • Page 939 UM1940 LL GPIO Generic Driver LL_GPIO_PIN_15 LL_GPIO_PIN_ALL Return values State: of bit (1 or 0). Reference Manual to IDR IDy LL_GPIO_IsInputPinSet LL API cross reference: LL_GPIO_WriteOutputPort Function name __STATIC_INLINE void LL_GPIO_WriteOutputPort (GPIO_TypeDef * GPIOx, uint32_t PortValue) Function description Write output data register for the port. Parameters GPIOx: GPIO Port PortValue: Level value for each pin of the port...
  • Page 940 LL GPIO Generic Driver UM1940 LL_GPIO_PIN_9 LL_GPIO_PIN_10 LL_GPIO_PIN_11 LL_GPIO_PIN_12 LL_GPIO_PIN_13 LL_GPIO_PIN_14 LL_GPIO_PIN_15 LL_GPIO_PIN_ALL Return values State: of bit (1 or 0). Reference Manual to ODR ODy LL_GPIO_IsOutputPinSet LL API cross reference: LL_GPIO_SetOutputPin __STATIC_INLINE void LL_GPIO_SetOutputPin Function name (GPIO_TypeDef * GPIOx, uint32_t PinMask) Function description Set several pins to high level on dedicated gpio port.
  • Page 941 UM1940 LL GPIO Generic Driver PinMask: This parameter can be a combination of the following values: LL_GPIO_PIN_0 LL_GPIO_PIN_1 LL_GPIO_PIN_2 LL_GPIO_PIN_3 LL_GPIO_PIN_4 LL_GPIO_PIN_5 LL_GPIO_PIN_6 LL_GPIO_PIN_7 LL_GPIO_PIN_8 LL_GPIO_PIN_9 LL_GPIO_PIN_10 LL_GPIO_PIN_11 LL_GPIO_PIN_12 LL_GPIO_PIN_13 LL_GPIO_PIN_14 LL_GPIO_PIN_15 LL_GPIO_PIN_ALL Return values None: Reference Manual to BSRR BRy LL_GPIO_ResetOutputPin LL API cross reference: LL_GPIO_TogglePin...
  • Page 942 LL GPIO Generic Driver UM1940 Reference Manual to ODR ODy LL_GPIO_TogglePin LL API cross reference: LL_GPIO_DeInit Function name ErrorStatus LL_GPIO_DeInit (GPIO_TypeDef * GPIOx) Function description De-initialize GPIO registers (Registers restored to their default values). Parameters GPIOx: GPIO Port Return values An: ErrorStatus enumeration value: SUCCESS: GPIO registers are de-initialized ERROR: Wrong GPIO Port...
  • Page 943 UM1940 LL GPIO Generic Driver LL_GPIO_AF_3 Select alternate function 3 LL_GPIO_AF_4 Select alternate function 4 LL_GPIO_AF_5 Select alternate function 5 LL_GPIO_AF_6 Select alternate function 6 LL_GPIO_AF_7 Select alternate function 7 LL_GPIO_AF_8 Select alternate function 8 LL_GPIO_AF_9 Select alternate function 9 LL_GPIO_AF_10 Select alternate function 10 LL_GPIO_AF_11...
  • Page 944 LL GPIO Generic Driver UM1940 LL_GPIO_PIN_14 Select pin 14 LL_GPIO_PIN_15 Select pin 15 LL_GPIO_PIN_ALL Select all pins Pull Up Pull Down LL_GPIO_PULL_NO Select I/O no pull LL_GPIO_PULL_UP Select I/O pull up LL_GPIO_PULL_DOWN Select I/O pull down Output Speed LL_GPIO_SPEED_FREQ_LOW Select I/O low output speed LL_GPIO_SPEED_FREQ_MEDIUM Select I/O medium output speed LL_GPIO_SPEED_FREQ_HIGH...
  • Page 945: Ll I2C Generic Driver

    UM1940 LL I2C Generic Driver LL I2C Generic Driver 58.1 I2C Firmware driver registers structures 58.1.1 LL_I2C_InitTypeDef Data Fields uint32_t PeripheralMode uint32_t ClockSpeed uint32_t DutyCycle uint32_t OwnAddress1 uint32_t TypeAcknowledge uint32_t OwnAddrSize Field Documentation uint32_t LL_I2C_InitTypeDef::PeripheralMode Specifies the peripheral mode. This parameter can be a value of I2C_LL_EC_PERIPHERAL_MODEThis feature can be modified afterwards using unitary function LL_I2C_SetMode().
  • Page 946 LL I2C Generic Driver UM1940 Parameters I2Cx: I2C Instance. Return values None: Reference Manual to CR1 PE LL_I2C_Enable LL API cross reference: LL_I2C_Disable Function name __STATIC_INLINE void LL_I2C_Disable (I2C_TypeDef * I2Cx) Function description Disable I2C peripheral (PE = 0). Parameters I2Cx: I2C Instance.
  • Page 947 UM1940 LL I2C Generic Driver Reference Manual to CR2 DMAEN LL_I2C_DisableDMAReq_TX LL API cross reference: LL_I2C_IsEnabledDMAReq_TX Function name __STATIC_INLINE uint32_t LL_I2C_IsEnabledDMAReq_TX (I2C_TypeDef * I2Cx) Function description Check if DMA transmission requests are enabled or disabled. Parameters I2Cx: I2C Instance. Return values State: of bit (1 or 0).
  • Page 948 LL I2C Generic Driver UM1940 reference: LL_I2C_DMA_GetRegAddr Function name __STATIC_INLINE uint32_t LL_I2C_DMA_GetRegAddr (I2C_TypeDef * I2Cx) Function description Get the data register address used for DMA transfer. Parameters I2Cx: I2C Instance. Return values Address: of data register Reference Manual to DR DR LL_I2C_DMA_GetRegAddr LL API cross reference: LL_I2C_EnableClockStretching...
  • Page 949 UM1940 LL I2C Generic Driver Return values State: of bit (1 or 0). Reference Manual to CR1 NOSTRETCH LL_I2C_IsEnabledClockStretching LL API cross reference: LL_I2C_EnableGeneralCall __STATIC_INLINE void LL_I2C_EnableGeneralCall Function name (I2C_TypeDef * I2Cx) Function description Enable General Call. Parameters I2Cx: I2C Instance. Return values None: Notes...
  • Page 950 LL I2C Generic Driver UM1940 Function description Set the Own Address1. Parameters I2Cx: I2C Instance. OwnAddress1: This parameter must be a value between Min_Data=0 and Max_Data=0x3FF. OwnAddrSize: This parameter can be one of the following values: LL_I2C_OWNADDRESS1_7BIT LL_I2C_OWNADDRESS1_10BIT Return values None: Reference Manual to OAR1 ADD0 LL_I2C_SetOwnAddress1...
  • Page 951 UM1940 LL I2C Generic Driver Reference Manual to OAR2 ENDUAL LL_I2C_DisableOwnAddress2 LL API cross reference: LL_I2C_IsEnabledOwnAddress2 Function name __STATIC_INLINE uint32_t LL_I2C_IsEnabledOwnAddress2 (I2C_TypeDef * I2Cx) Function description Check if Own Address1 acknowledge is enabled or disabled. Parameters I2Cx: I2C Instance. Return values State: of bit (1 or 0).
  • Page 952 LL I2C Generic Driver UM1940 LL_I2C_DUTYCYCLE_16_9 Return values None: Reference Manual to CCR DUTY LL_I2C_SetDutyCycle LL API cross reference: LL_I2C_GetDutyCycle Function name __STATIC_INLINE uint32_t LL_I2C_GetDutyCycle (I2C_TypeDef * I2Cx) Function description Get the Duty cycle (Fast mode only). Parameters I2Cx: I2C Instance. Return values Returned: value can be one of the following values: LL_I2C_DUTYCYCLE_2...
  • Page 953 UM1940 LL I2C Generic Driver LL_I2C_SetRiseTime Function name __STATIC_INLINE void LL_I2C_SetRiseTime (I2C_TypeDef * I2Cx, uint32_t RiseTime) Function description Configure the SCL, SDA rising time. Parameters I2Cx: I2C Instance. RiseTime: This parameter must be a value between Min_Data=0x02 and Max_Data=0x3F. Return values None: Notes This bit can only be programmed when the I2C is disabled...
  • Page 954 LL I2C Generic Driver UM1940 Function description Get the SCL high and low period. Parameters I2Cx: I2C Instance. Return values Value: between Min_Data=0x004 and Max_Data=0xFFF, except in FAST DUTY mode where Min_Data=0x001. Reference Manual to CCR CCR LL_I2C_GetClockPeriod LL API cross reference: LL_I2C_ConfigSpeed Function name...
  • Page 955 UM1940 LL I2C Generic Driver Reference Manual to CR1 SMBUS LL_I2C_SetMode LL API cross CR1 SMBTYPE LL_I2C_SetMode reference: CR1 ENARP LL_I2C_SetMode LL_I2C_GetMode Function name __STATIC_INLINE uint32_t LL_I2C_GetMode (I2C_TypeDef * I2Cx) Function description Get peripheral mode. Parameters I2Cx: I2C Instance. Return values Returned: value can be one of the following values: LL_I2C_MODE_I2C LL_I2C_MODE_SMBUS_HOST...
  • Page 956 LL I2C Generic Driver UM1940 Notes Macro IS_SMBUS_ALL_INSTANCE(I2Cx) can be used to check whether or not SMBus feature is supported by the I2Cx Instance. SMBus Device mode: SMBus Alert pin is not drived (can be used as a standard GPIO) and Alert Response Address Header acknowledge is disabled.
  • Page 957 UM1940 LL I2C Generic Driver Notes Macro IS_SMBUS_ALL_INSTANCE(I2Cx) can be used to check whether or not SMBus feature is supported by the I2Cx Instance. Reference Manual to CR1 ENPEC LL_I2C_DisableSMBusPEC LL API cross reference: LL_I2C_IsEnabledSMBusPEC Function name __STATIC_INLINE uint32_t LL_I2C_IsEnabledSMBusPEC (I2C_TypeDef * I2Cx) Function description Check if SMBus Packet Error Calculation (PEC) is enabled or...
  • Page 958 LL I2C Generic Driver UM1940 LL_I2C_IsEnabledIT_TX Function name __STATIC_INLINE uint32_t LL_I2C_IsEnabledIT_TX (I2C_TypeDef * I2Cx) Function description Check if the TXE Interrupt is enabled or disabled. Parameters I2Cx: I2C Instance. Return values State: of bit (1 or 0). Reference Manual to CR2 ITEVTEN LL_I2C_IsEnabledIT_TX LL API cross CR2 ITBUFEN LL_I2C_IsEnabledIT_TX...
  • Page 959 UM1940 LL I2C Generic Driver LL_I2C_EnableIT_EVT Function name __STATIC_INLINE void LL_I2C_EnableIT_EVT (I2C_TypeDef * I2Cx) Function description Enable Events interrupts. Parameters I2Cx: I2C Instance. Return values None: Notes Any of these events will generate interrupt : Start Bit (SB) Address sent, Address matched (ADDR) 10-bit header sent (ADD10) Stop detection (STOPF) Byte transfer finished (BTF) Any of these events will generate interrupt if Buffer interrupts are enabled too(using unitary function...
  • Page 960 LL I2C Generic Driver UM1940 LL_I2C_EnableIT_BUF Function name __STATIC_INLINE void LL_I2C_EnableIT_BUF (I2C_TypeDef * I2Cx) Function description Enable Buffer interrupts. Parameters I2Cx: I2C Instance. Return values None: Notes Any of these Buffer events will generate interrupt if Events interrupts are enabled too(using unitary function LL_I2C_EnableIT_EVT()) : Receive buffer not empty (RXNE) Transmit buffer empty (TXE) Reference Manual to...
  • Page 961 UM1940 LL I2C Generic Driver Return values None: Notes Macro IS_SMBUS_ALL_INSTANCE(I2Cx) can be used to check whether or not SMBus feature is supported by the I2Cx Instance. Any of these errors will generate interrupt : Bus Error detection (BERR) Arbitration Loss (ARLO) Acknowledge Failure(AF) Overrun/Underrun (OVR) SMBus Timeout detection (TIMEOUT) SMBus PEC error detection (PECERR) SMBus Alert pin event detection (SMBALERT)
  • Page 962 LL I2C Generic Driver UM1940 Parameters I2Cx: I2C Instance. Return values State: of bit (1 or 0). Notes RESET: When next data is written in Transmit data register. SET: When Transmit data register is empty. Reference Manual to SR1 TXE LL_I2C_IsActiveFlag_TXE LL API cross reference: LL_I2C_IsActiveFlag_BTF...
  • Page 963 UM1940 LL I2C Generic Driver LL_I2C_IsActiveFlag_ADDR Function name __STATIC_INLINE uint32_t LL_I2C_IsActiveFlag_ADDR (I2C_TypeDef * I2Cx) Function description Indicate the status of Address sent (master mode) or Address matched flag (slave mode). Parameters I2Cx: I2C Instance. Return values State: of bit (1 or 0). Notes RESET: Clear default value.
  • Page 964 LL I2C Generic Driver UM1940 Parameters I2Cx: I2C Instance. Return values State: of bit (1 or 0). Notes RESET: Clear default value. SET: When a Stop condition is detected. Reference Manual to SR1 STOPF LL_I2C_IsActiveFlag_STOP LL API cross reference: LL_I2C_IsActiveFlag_BERR __STATIC_INLINE uint32_t LL_I2C_IsActiveFlag_BERR Function name (I2C_TypeDef * I2Cx)
  • Page 965 UM1940 LL I2C Generic Driver reference: LL_I2C_IsActiveSMBusFlag_PECERR Function name __STATIC_INLINE uint32_t LL_I2C_IsActiveSMBusFlag_PECERR (I2C_TypeDef * I2Cx) Function description Indicate the status of SMBus PEC error flag in reception. Parameters I2Cx: I2C Instance. Return values State: of bit (1 or 0). Notes Macro IS_SMBUS_ALL_INSTANCE(I2Cx) can be used to check whether or not SMBus feature is supported by the I2Cx Instance.
  • Page 966 LL I2C Generic Driver UM1940 LL_I2C_IsActiveFlag_BUSY Function name __STATIC_INLINE uint32_t LL_I2C_IsActiveFlag_BUSY (I2C_TypeDef * I2Cx) Function description Indicate the status of Bus Busy flag. Parameters I2Cx: I2C Instance. Return values State: of bit (1 or 0). Notes RESET: Clear default value. SET: When a Start condition is detected.
  • Page 967 UM1940 LL I2C Generic Driver LL_I2C_IsActiveSMBusFlag_SMBDEFAULT Function name __STATIC_INLINE uint32_t LL_I2C_IsActiveSMBusFlag_SMBDEFAULT (I2C_TypeDef * I2Cx) Function description Indicate the status of SMBus Device default address reception (Slave mode). Parameters I2Cx: I2C Instance. Return values State: of bit (1 or 0). Notes Macro IS_SMBUS_ALL_INSTANCE(I2Cx) can be used to check whether or not SMBus feature is supported by the I2Cx Instance.
  • Page 968 LL I2C Generic Driver UM1940 LL_I2C_ClearFlag_ADDR Function name __STATIC_INLINE void LL_I2C_ClearFlag_ADDR (I2C_TypeDef * I2Cx) Function description Clear Address Matched flag. Parameters I2Cx: I2C Instance. Return values None: Notes Clearing this flag is done by a read access to the I2Cx_SR1 register followed by a read access to the I2Cx_SR2 register.
  • Page 969 UM1940 LL I2C Generic Driver LL API cross reference: LL_I2C_ClearFlag_ARLO Function name __STATIC_INLINE void LL_I2C_ClearFlag_ARLO (I2C_TypeDef * I2Cx) Function description Clear Arbitration lost flag. Parameters I2Cx: I2C Instance. Return values None: Reference Manual to SR1 ARLO LL_I2C_ClearFlag_ARLO LL API cross reference: LL_I2C_ClearFlag_OVR Function name...
  • Page 970 LL I2C Generic Driver UM1940 Instance. Reference Manual to SR1 TIMEOUT LL_I2C_ClearSMBusFlag_TIMEOUT LL API cross reference: LL_I2C_ClearSMBusFlag_ALERT Function name __STATIC_INLINE void LL_I2C_ClearSMBusFlag_ALERT (I2C_TypeDef * I2Cx) Function description Clear SMBus Alert flag. Parameters I2Cx: I2C Instance. Return values None: Notes Macro IS_SMBUS_ALL_INSTANCE(I2Cx) can be used to check whether or not SMBus feature is supported by the I2Cx Instance.
  • Page 971 UM1940 LL I2C Generic Driver Parameters I2Cx: I2C Instance. Return values State: of bit (1 or 0). Reference Manual to CR1 SWRST LL_I2C_IsResetEnabled LL API cross reference: LL_I2C_AcknowledgeNextData Function name __STATIC_INLINE void LL_I2C_AcknowledgeNextData (I2C_TypeDef * I2Cx, uint32_t TypeAcknowledge) Function description Prepare the generation of a ACKnowledge or Non ACKnowledge condition after the address receive match code or next received byte.
  • Page 972 LL I2C Generic Driver UM1940 Reference Manual to CR1 STOP LL_I2C_GenerateStopCondition LL API cross reference: LL_I2C_EnableBitPOS Function name __STATIC_INLINE void LL_I2C_EnableBitPOS (I2C_TypeDef * I2Cx) Function description Enable bit POS (master/host mode). Parameters I2Cx: I2C Instance. Return values None: Notes In that case, the ACK bit controls the (N)ACK of the next byte received or the PEC bit indicates that the next byte in shift register is a PEC.
  • Page 973 UM1940 LL I2C Generic Driver (I2C_TypeDef * I2Cx) Function description Indicate the value of transfer direction. Parameters I2Cx: I2C Instance. Return values Returned: value can be one of the following values: LL_I2C_DIRECTION_WRITE LL_I2C_DIRECTION_READ Notes RESET: Bus is in read transfer (peripheral point of view). SET: Bus is in write transfer (peripheral point of view).
  • Page 974 LL I2C Generic Driver UM1940 LL API cross reference: LL_I2C_EnableSMBusPECCompare Function name __STATIC_INLINE void LL_I2C_EnableSMBusPECCompare (I2C_TypeDef * I2Cx) Function description Enable transfer or internal comparison of the SMBus Packet Error byte (transmission or reception mode). Parameters I2Cx: I2C Instance. Return values None: Notes Macro IS_SMBUS_ALL_INSTANCE(I2Cx) can be used to...
  • Page 975 UM1940 LL I2C Generic Driver Reference Manual to CR1 PEC LL_I2C_IsEnabledSMBusPECCompare LL API cross reference: LL_I2C_GetSMBusPEC Function name __STATIC_INLINE uint32_t LL_I2C_GetSMBusPEC (I2C_TypeDef * I2Cx) Function description Get the SMBus Packet Error byte calculated. Parameters I2Cx: I2C Instance. Return values Value: between Min_Data=0x00 and Max_Data=0xFF Notes Macro IS_SMBUS_ALL_INSTANCE(I2Cx) can be used to check whether or not SMBus feature is supported by the I2Cx...
  • Page 976 LL I2C Generic Driver UM1940 I2C_InitStruct. Parameters I2Cx: I2C Instance. I2C_InitStruct: pointer to a LL_I2C_InitTypeDef structure. Return values An: ErrorStatus enumeration value: SUCCESS: I2C registers are initialized ERROR: Not applicable LL_I2C_DeInit Function name uint32_t LL_I2C_DeInit (I2C_TypeDef * I2Cx) Function description De-initialize the I2C registers to their default reset values.
  • Page 977 UM1940 LL I2C Generic Driver LL_I2C_SR1_ADD10 10-bit header sent (master mode) LL_I2C_SR1_STOPF Stop detection flag (slave mode) LL_I2C_SR1_RXNE Data register not empty (receivers) LL_I2C_SR1_TXE Data register empty (transmitters) LL_I2C_SR1_BERR Bus error LL_I2C_SR1_ARLO Arbitration lost LL_I2C_SR1_AF Acknowledge failure flag LL_I2C_SR1_OVR Overrun/Underrun LL_I2C_SR1_PECERR PEC Error in reception (SMBus mode) LL_I2C_SR1_TIMEOUT...
  • Page 978 LL I2C Generic Driver UM1940 Mhz. Parameters: __PCLK__: This parameter must be a value of peripheral clock (in Hz). Return value: Value: of peripheral clock (in Mhz) Description: __LL_I2C_FREQ_MHZ_TO_HZ Convert Peripheral Clock Frequency in Parameters: __PCLK__: This parameter must be a value of peripheral clock (in Mhz).
  • Page 979 UM1940 LL I2C Generic Driver Compute Speed Standard clock range to a Clock Control Register (I2C_CCR_CCR) value. Parameters: __PCLK__: This parameter must be a value of peripheral clock (in Hz). __SPEED__: This parameter must be a value lower than 100kHz (in Hz). Return value: Value: between Min_Data=0x004 and Max_Data=0xFFF.
  • Page 980 LL I2C Generic Driver UM1940 Return value: Value: between Min_Data=0xF0 and Max_Data=0xF6 __LL_I2C_10BIT_HEADER_READ Description: Convert a 10-Bits address to a 10-Bits header with Read direction. Parameters: __ADDRESS__: This parameter must be a value of a 10-Bits slave address. Return value: Value: between Min_Data=0xF1 and Max_Data=0xF7 Common Write and read registers Macros...
  • Page 981: Ll I2S Generic Driver

    UM1940 LL I2S Generic Driver LL I2S Generic Driver 59.1 I2S Firmware driver registers structures 59.1.1 LL_I2S_InitTypeDef Data Fields uint32_t Mode uint32_t Standard uint32_t DataFormat uint32_t MCLKOutput uint32_t AudioFreq uint32_t ClockPolarity Field Documentation uint32_t LL_I2S_InitTypeDef::Mode Specifies the I2S operating mode. This parameter can be a value of I2S_LL_EC_MODEThis feature can be modified afterwards using unitary function LL_I2S_SetTransferMode().
  • Page 982 LL I2S Generic Driver UM1940 Return values None: Reference Manual to I2SCFGR I2SMOD LL_I2S_Enable LL API cross I2SCFGR I2SE LL_I2S_Enable reference: LL_I2S_Disable __STATIC_INLINE void LL_I2S_Disable (SPI_TypeDef * SPIx) Function name Function description Disable I2S peripheral. Parameters SPIx: SPI Instance Return values None: Reference Manual to I2SCFGR I2SE LL_I2S_Disable...
  • Page 983 UM1940 LL I2S Generic Driver Function description Get I2S data frame length. Parameters SPIx: SPI Instance Return values Returned: value can be one of the following values: LL_I2S_DATAFORMAT_16B LL_I2S_DATAFORMAT_16B_EXTENDED LL_I2S_DATAFORMAT_24B LL_I2S_DATAFORMAT_32B Reference Manual to I2SCFGR DATLEN LL_I2S_GetDataFormat LL API cross I2SCFGR CHLEN LL_I2S_GetDataFormat reference: LL_I2S_SetClockPolarity...
  • Page 984 LL I2S Generic Driver UM1940 LL_I2S_STANDARD_PHILIPS LL_I2S_STANDARD_MSB LL_I2S_STANDARD_LSB LL_I2S_STANDARD_PCM_SHORT LL_I2S_STANDARD_PCM_LONG Return values None: Reference Manual to I2SCFGR I2SSTD LL_I2S_SetStandard LL API cross I2SCFGR PCMSYNC LL_I2S_SetStandard reference: LL_I2S_GetStandard Function name __STATIC_INLINE uint32_t LL_I2S_GetStandard (SPI_TypeDef * SPIx) Function description Get I2S standard protocol. Parameters SPIx: SPI Instance Return values...
  • Page 985 UM1940 LL I2S Generic Driver Parameters SPIx: SPI Instance Return values Returned: value can be one of the following values: LL_I2S_MODE_SLAVE_TX LL_I2S_MODE_SLAVE_RX LL_I2S_MODE_MASTER_TX LL_I2S_MODE_MASTER_RX Reference Manual to I2SCFGR I2SCFG LL_I2S_GetTransferMode LL API cross reference: LL_I2S_SetPrescalerLinear Function name __STATIC_INLINE void LL_I2S_SetPrescalerLinear (SPI_TypeDef * SPIx, uint8_t PrescalerLinear) Function description Set I2S linear prescaler.
  • Page 986 LL I2S Generic Driver UM1940 Reference Manual to I2SPR ODD LL_I2S_SetPrescalerParity LL API cross reference: LL_I2S_GetPrescalerParity Function name __STATIC_INLINE uint32_t LL_I2S_GetPrescalerParity (SPI_TypeDef * SPIx) Function description Get I2S parity prescaler. Parameters SPIx: SPI Instance Return values Returned: value can be one of the following values: LL_I2S_PRESCALER_PARITY_EVEN LL_I2S_PRESCALER_PARITY_ODD Reference Manual to...
  • Page 987 UM1940 LL I2S Generic Driver Reference Manual to I2SPR MCKOE LL_I2S_IsEnabledMasterClock LL API cross reference: LL_I2S_IsActiveFlag_RXNE Function name __STATIC_INLINE uint32_t LL_I2S_IsActiveFlag_RXNE (SPI_TypeDef * SPIx) Function description Check if Rx buffer is not empty. Parameters SPIx: SPI Instance Return values State: of bit (1 or 0). Reference Manual to SR RXNE LL_I2S_IsActiveFlag_RXNE LL API cross...
  • Page 988 LL I2S Generic Driver UM1940 reference: LL_I2S_IsActiveFlag_UDR Function name __STATIC_INLINE uint32_t LL_I2S_IsActiveFlag_UDR (SPI_TypeDef * SPIx) Function description Get underrun error flag. Parameters SPIx: SPI Instance Return values State: of bit (1 or 0). Reference Manual to SR UDR LL_I2S_IsActiveFlag_UDR LL API cross reference: LL_I2S_IsActiveFlag_FRE Function name...
  • Page 989 UM1940 LL I2S Generic Driver Reference Manual to SR OVR LL_I2S_ClearFlag_OVR LL API cross reference: LL_I2S_ClearFlag_UDR Function name __STATIC_INLINE void LL_I2S_ClearFlag_UDR (SPI_TypeDef * SPIx) Function description Clear underrun error flag. Parameters SPIx: SPI Instance Return values None: Reference Manual to SR UDR LL_I2S_ClearFlag_UDR LL API cross reference:...
  • Page 990 LL I2S Generic Driver UM1940 Return values None: Reference Manual to CR2 RXNEIE LL_I2S_EnableIT_RXNE LL API cross reference: LL_I2S_EnableIT_TXE __STATIC_INLINE void LL_I2S_EnableIT_TXE (SPI_TypeDef * Function name SPIx) Function description Enable Tx buffer empty IT. Parameters SPIx: SPI Instance Return values None: Reference Manual to CR2 TXEIE LL_I2S_EnableIT_TXE...
  • Page 991 UM1940 LL I2S Generic Driver Parameters SPIx: SPI Instance Return values None: Reference Manual to CR2 TXEIE LL_I2S_DisableIT_TXE LL API cross reference: LL_I2S_IsEnabledIT_ERR Function name __STATIC_INLINE uint32_t LL_I2S_IsEnabledIT_ERR (SPI_TypeDef * SPIx) Function description Check if ERR IT is enabled. Parameters SPIx: SPI Instance Return values State: of bit (1 or 0).
  • Page 992 LL I2S Generic Driver UM1940 Return values None: Reference Manual to CR2 RXDMAEN LL_I2S_EnableDMAReq_RX LL API cross reference: LL_I2S_DisableDMAReq_RX __STATIC_INLINE void LL_I2S_DisableDMAReq_RX Function name (SPI_TypeDef * SPIx) Function description Disable DMA Rx. Parameters SPIx: SPI Instance Return values None: Reference Manual to CR2 RXDMAEN LL_I2S_DisableDMAReq_RX LL API cross reference:...
  • Page 993 UM1940 LL I2S Generic Driver Reference Manual to CR2 TXDMAEN LL_I2S_DisableDMAReq_TX LL API cross reference: LL_I2S_IsEnabledDMAReq_TX Function name __STATIC_INLINE uint32_t LL_I2S_IsEnabledDMAReq_TX (SPI_TypeDef * SPIx) Function description Check if DMA Tx is enabled. Parameters SPIx: SPI Instance Return values State: of bit (1 or 0). Reference Manual to CR2 TXDMAEN LL_I2S_IsEnabledDMAReq_TX LL API cross...
  • Page 994 LL I2S Generic Driver UM1940 SUCCESS: SPI registers are de-initialized ERROR: SPI registers are not de-initialized LL_I2S_Init Function name ErrorStatus LL_I2S_Init (SPI_TypeDef * SPIx, LL_I2S_InitTypeDef * I2S_InitStruct) Function description Initializes the SPI/I2S registers according to the specified parameters in I2S_InitStruct. Parameters SPIx: SPI Instance I2S_InitStruct: pointer to a LL_I2S_InitTypeDef structure...
  • Page 995 UM1940 LL I2S Generic Driver 59.3 I2S Firmware driver defines 59.3.1 Audio Frequency LL_I2S_AUDIOFREQ_192K Audio Frequency configuration 192000 Hz LL_I2S_AUDIOFREQ_96K Audio Frequency configuration 96000 Hz LL_I2S_AUDIOFREQ_48K Audio Frequency configuration 48000 Hz LL_I2S_AUDIOFREQ_44K Audio Frequency configuration 44100 Hz LL_I2S_AUDIOFREQ_32K Audio Frequency configuration 32000 Hz LL_I2S_AUDIOFREQ_22K Audio Frequency configuration 22050 Hz LL_I2S_AUDIOFREQ_16K...
  • Page 996 LL I2S Generic Driver UM1940 Prescaler Factor LL_I2S_PRESCALER_PARITY_EVEN Odd factor: Real divider value is = I2SDIV * 2 LL_I2S_PRESCALER_PARITY_ODD Odd factor: Real divider value is = (I2SDIV * 2)+1 I2s Standard LL_I2S_STANDARD_PHILIPS I2S standard philips LL_I2S_STANDARD_MSB MSB justified standard (left justified) LL_I2S_STANDARD_LSB LSB justified standard (right justified) LL_I2S_STANDARD_PCM_SHORT...
  • Page 997: Ll Iwdg Generic Driver

    UM1940 LL IWDG Generic Driver LL IWDG Generic Driver 60.1 IWDG Firmware driver API description 60.1.1 Detailed description of functions LL_IWDG_Enable Function name __STATIC_INLINE void LL_IWDG_Enable (IWDG_TypeDef * IWDGx) Function description Start the Independent Watchdog. Parameters IWDGx: IWDG Instance Return values None: Notes Except if the hardware watchdog option is selected...
  • Page 998 LL IWDG Generic Driver UM1940 (IWDG_TypeDef * IWDGx) Function description Disable write access to IWDG_PR, IWDG_RLR and IWDG_WINR registers. Parameters IWDGx: IWDG Instance Return values None: Reference Manual to KR KEY LL_IWDG_DisableWriteAccess LL API cross reference: LL_IWDG_SetPrescaler Function name __STATIC_INLINE void LL_IWDG_SetPrescaler (IWDG_TypeDef * IWDGx, uint32_t Prescaler) Function description Select the prescaler of the IWDG.
  • Page 999 UM1940 LL IWDG Generic Driver LL_IWDG_SetReloadCounter Function name __STATIC_INLINE void LL_IWDG_SetReloadCounter (IWDG_TypeDef * IWDGx, uint32_t Counter) Function description Specify the IWDG down-counter reload value. Parameters IWDGx: IWDG Instance Counter: Value between Min_Data=0 and Max_Data=0x0FFF Return values None: Reference Manual to RLR RL LL_IWDG_SetReloadCounter LL API cross reference:...
  • Page 1000: Iwdg Firmware Driver Defines

    LL IWDG Generic Driver UM1940 LL_IWDG_IsReady Function name __STATIC_INLINE uint32_t LL_IWDG_IsReady (IWDG_TypeDef * IWDGx) Function description Check if all flags Prescaler, Reload & Window Value Update are reset or not. Parameters IWDGx: IWDG Instance Return values State: of bits (1 or 0). Reference Manual to SR PVU LL_IWDG_IsReady LL API cross...

Table of Contents

Save PDF