Library 63- DMA for STM32F4xx

Having each stream on separate bits for checking flags has really annoying for me! I had to made a library for DMA which will handle all that stuff any maybe a little more for me because it is really stressfull, when I have to change DMA stream. Then you have to change interrupt handler function name, all flag bit locations and so on. Too much work for easily fail and bug is here!

To enable/disable interrupts, get/clear flags, you have to pass only which stream and which flag for transfer complete, error, half complete….



  • Easy checking and clearing DMA interrupt flags
  • Easy interrupt handling for DMA stream
  • Enable/Disable interrupts


    • STM32F4xx
    • STM32F4xx DMA
    • STM32F4xx MISC
  • TM
    • defines.h
    • attributes.h

Interrupt handling

Library has implemented all DMA stream interrupt handlers for easy interrupt handling for user. The problem happen when some libraries from me also uses interrupt handler internally.

One example is FATFS library. DMA for SDIO is DMA2_Stream3 and function DMA2_Stream3_IRQHandler() is also implemented in my DMA and FATFS library. If you use both libs, error will happen. To prevent this errors I’ve added support to disable interrupt handler inside DMA library from me. To disable it, open defines.h file and add defines:

Functions and enumerations


DMA result with IRQ

DMA result with IRQ

Project is available on my Github, download library below.


Owner of this site. Application engineer, currently employed by STMicroelectronics. Exploring latest technologies and owner of different libraries posted on Github.

You may also like...

Read before commenting!

Before you make a new comment, make sure you agree with things listed below:

  • - Read post to make sure if it is already posted what you are asking for,
  • - Make sure you have the latest version of libraries used in your project,
  • - Make a clean and grammatically correct written message,
  • - Report as many details as possible, including what have you done so far,
  • - Do NOT post any code here. Use Pastebin,
  • - Do NOT post any error codes here. Use Pastebin,
  • - Specify STM32Fxxx family and used Discovery/EVAL/Nucleo or custom made board,
  • - Make sure your clock is set correct for PLL,
  • - If you are using my HAL drivers, please check this post how to start.
Comment will be deleted on breaking these rules without notification!