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...