Skip to content

A customized DMA (Direct Memory Access) driver for STM32F4 microcontrollers. Features memory-to-memory and peripheral data transfers, interrupt handling, and FIFO configuration for optimized CPU utilization.

Notifications You must be signed in to change notification settings

mariamashraf731/STM32F4-DMA-Driver

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

2 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

⚡ STM32F4 DMA Driver (Direct Memory Access)

Platform Language Peripheral IDE

📌 Project Overview

This repository contains a High-Performance DMA Driver developed for the STM32F401 Microcontroller. The driver enables direct data transfer between memory and peripherals without CPU intervention, significantly optimizing system performance and reducing CPU load.

It demonstrates deep knowledge of the AMBA Bus Matrix, Stream/Channel configuration, and Interrupt Handling in ARM Cortex-M4 architectures.

⚙️ Key Features

  • Memory-to-Memory Transfer: Efficient bulk data copying.
  • Peripheral-to-Memory: (e.g., ADC data acquisition).
  • Memory-to-Peripheral: (e.g., UART/SPI transmission).
  • Interrupt Management: Handling Transfer Complete, Half Transfer, and Transfer Error interrupts.
  • Circular Mode Support: Continuous data buffering for real-time signal processing.

🛠️ Technical Architecture

DMA Controller Configuration

The driver configures the DMA streams based on the STM32F4 architecture:

  • Stream Selection: Maps specific peripherals to DMA streams.
  • Priority Levels: manages arbitration between multiple streams (Low, Medium, High, Very High).
  • FIFO vs. Direct Mode: Configures data packing/unpacking and burst transfers.

File Structure

  • Core/Src/DMA.c: Core implementation of DMA initialization and IRQ handlers.
  • Core/Inc/DMA.h: Configuration macros and function prototypes.
  • Core/Src/main.c: Example application demonstrating data transfer.

🚀 Usage Example

#include "DMA.h"

// Define source and destination buffers
uint32_t src_buffer[100];
uint32_t dest_buffer[100];

int main(void) {
    HAL_Init();
    
    // Initialize DMA for Mem-to-Mem transfer
    DMA_Config_t dmaConfig;
    dmaConfig.Direction = DMA_MEMORY_TO_MEMORY;
    dmaConfig.DataSize = DMA_DATA_32BIT;
    dmaConfig.Mode = DMA_NORMAL;
    
    DMA_Init(&dmaConfig);
    
    // Start Transfer
    DMA_Start((uint32_t)src_buffer, (uint32_t)dest_buffer, 100);
    
    while (1) {
        // CPU is free to do other tasks here!
    }
}

🔧 Hardware Requirements

  • MCU: STM32F401CCU6 (Black Pill) or similar STM32F4 Discovery board.
  • Debugger: ST-Link V2.

👨‍💻 Skills Demonstrated

  • Bare-Metal Programming.
  • System Optimization & Throughput Analysi
  • ARM Cortex-M4 Architectur
  • Peripheral Driver Developme

About

A customized DMA (Direct Memory Access) driver for STM32F4 microcontrollers. Features memory-to-memory and peripheral data transfers, interrupt handling, and FIFO configuration for optimized CPU utilization.

Topics

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages