Dma Firmware Driver Api Description; How To Use This Driver - ST STM32F2 User Manual

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

Advertisement

HAL DMA Generic Driver
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

DMA Firmware driver API description

15.2.1

How to use this driver

1.
Enable and configure the peripheral to be connected to the DMA Stream (except for
internal SRAM/FLASH memories: no initialization is necessary) please refer to
Reference manual for connection between peripherals and DMA requests.
2.
For a given Stream, program the required configuration through the following
parameters: Transfer Direction, Source and Destination data formats, Circular, Normal
or peripheral flow control mode, Stream Priority level, Source and Destination
Increment mode, FIFO mode and its Threshold (if needed), Burst mode for Source
and/or Destination (if needed) using HAL_DMA_Init() function. Prior to
HAL_DMA_Init() the clock must be enabled for DMA through the following macros:
__HAL_RCC_DMA1_CLK_ENABLE() or __HAL_RCC_DMA2_CLK_ENABLE().
Polling mode IO operation
Use HAL_DMA_Start() to start DMA transfer after the configuration of Source address
and destination address and the Length of data to be transferred.
Use HAL_DMA_PollForTransfer() to poll for the end of current transfer, in this case a
fixed Timeout can be configured by User depending from his application.
Use HAL_DMA_Abort() function to abort the current transfer.
Interrupt mode IO operation
Configure the DMA interrupt priority using HAL_NVIC_SetPriority()
Enable the DMA IRQ handler using HAL_NVIC_EnableIRQ()
Use HAL_DMA_Start_IT() to start DMA transfer after the configuration of Source
address and destination address and the Length of data to be transferred. In this case
the DMA interrupt is configured
Use HAL_DMA_IRQHandler() called under DMA_IRQHandler() Interrupt subroutine
At the end of data transfer HAL_DMA_IRQHandler() function is executed and user can
add his own function by customization of function pointer XferCpltCallback and
XferErrorCallback (i.e a member of DMA handle structure).
1.
Use HAL_DMA_GetState() function to return the DMA state and
HAL_DMA_GetError() in case of error detection.
2.
Use HAL_DMA_Abort_IT() function to abort the current transfer In Memory-to-
Memory transfer mode, Circular mode is not allowed. The FIFO is used mainly to
reduce bus usage and to allow data packing/unpacking: it is possible to set different
192/1371
DocID028236 Rev 2
UM1940

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

Table of Contents

Save PDF