11-STM32F1 -DMA(1)基本框架
创始人
2025-05-30 13:05:10
0

11-STM32F1 -DMA(1)

DMA:Data Memory Access,直接存储器访问。数据从一个地方搬运到另外一个地方,不占用CPU。

STM32-DMA

STM32有两个DMA,其中DMA2只存在大容量和互联型产品。

DMA1有7个通道,DMA2有5个通道。

DMA三种使用方式:

  1. 外设到存储器(P->M)。
  2. 存储器到外设(M->P)。
  3. 存储器到存储器(M->M)。

基本框架

DMA基本框架.png

DMA框架可以分为三部分:DMA请求,DMA通道,DMA仲裁器

  1. DMA请求

    来自外设设备。

  2. 通道

    DMA1有7条通道,DMA2有5道通道。

    DMA1请求映像:

    在这里插入图片描述

    DMA2请求映像:

    在这里插入图片描述

  3. 仲裁器

    • 软件阶段:通道优先级,PL[1:0]
    • 硬件阶段:通道编号小的优先级高,DMA1的优先级高于DMA2的优先级。

DMA初始化结构体

typedef struct
{uint32_t DMA_PeripheralBaseAddr; /*!< Specifies the peripheral base address for DMAy Channelx. */uint32_t DMA_MemoryBaseAddr;     /*!< Specifies the memory base address for DMAy Channelx. */uint32_t DMA_DIR;                /*!< Specifies if the peripheral is the source or destination.This parameter can be a value of @ref DMA_data_transfer_direction */uint32_t DMA_BufferSize;         /*!< Specifies the buffer size, in data unit, of the specified Channel. The data unit is equal to the configuration set in DMA_PeripheralDataSizeor DMA_MemoryDataSize members depending in the transfer direction. */uint32_t DMA_PeripheralInc;      /*!< Specifies whether the Peripheral address register is incremented or not.This parameter can be a value of @ref DMA_peripheral_incremented_mode */uint32_t DMA_MemoryInc;          /*!< Specifies whether the memory address register is incremented or not.This parameter can be a value of @ref DMA_memory_incremented_mode */uint32_t DMA_PeripheralDataSize; /*!< Specifies the Peripheral data width.This parameter can be a value of @ref DMA_peripheral_data_size */uint32_t DMA_MemoryDataSize;     /*!< Specifies the Memory data width.This parameter can be a value of @ref DMA_memory_data_size */uint32_t DMA_Mode;               /*!< Specifies the operation mode of the DMAy Channelx.This parameter can be a value of @ref DMA_circular_normal_mode.@note: The circular buffer mode cannot be used if the memory-to-memorydata transfer is configured on the selected Channel */uint32_t DMA_Priority;           /*!< Specifies the software priority for the DMAy Channelx.This parameter can be a value of @ref DMA_priority_level */uint32_t DMA_M2M;                /*!< Specifies if the DMAy Channelx will be used in memory-to-memory transfer.This parameter can be a value of @ref DMA_memory_to_memory */
}DMA_InitTypeDef;

DMA初始化结构体主要分为三部分

  1. 数据从哪里来,要到哪里去。

      uint32_t DMA_PeripheralBaseAddr;uint32_t DMA_MemoryBaseAddr;     uint32_t DMA_DIR;      uint32_t DMA_M2M;              
    
  2. 传输数据的个数,传输数据的大小。

      uint32_t DMA_BufferSize;        uint32_t DMA_PeripheralInc;      uint32_t DMA_MemoryInc;          uint32_t DMA_PeripheralDataSize; uint32_t DMA_MemoryDataSize;    
    
  3. 什么时候传输结束,以及优先级

      uint32_t DMA_Mode;             uint32_t DMA_Priority;      
    

当PSIZE和MSIZE不相同时,DMA模块按照下表进行数据对齐。

在这里插入图片描述

相关内容

热门资讯

技术实力与社区贡献的双重认可!... 社区成员又添喜讯!近日,经过 Apache IoTDB 项目管理委员会的...
市民文明公约 市民文明公约  建设文明城市,提高市民素质是关键。文明公约的推行,能使市民自觉遵守公民基本道德规范和...
公司会议纪要经典范文 公司会议纪要经典范文  公司会议纪要经典范文(精选12篇)  在平日的学习、工作或生活中,在处理事务...
LIO-SAM实现地面分割思路 本人最近在研究lio-sam,不得不感叹作者Tixiao Shan的实力,...
店长工作职责 店长工作职责店长工作职责1店长是店面的核心人物,店长必须服从公司总部的统一指挥,积极配合总部的各项营...
个人工作履历表格 个人工作履历表格个人工作履历表格照片性别 男 出生日期 1980年9月4日民族 汉 婚姻状况 未 政...
Java注解怎么用 什么是注解 Java的注解(Annotation)是一种元数据ÿ...
脱不下孔乙己的长衫,现代的年轻... “如果我没读过书,我还可以做别的工作,可我偏偏读过书”“学历本该是我的敲...
Python3处理手写笔记 导语利用Python实现手写笔记的压缩与增强。至于起因大概是:这个内容很有趣。。。——...
单位员工工作守则 单位员工工作守则范本(通用10篇)  单位员工工作守则是怎样的?应该怎么去写呢?以下是小编帮大家整理...
公司安全管理规章制度 公司安全管理规章制度(通用10篇)  在社会一步步向前发展的今天,制度在生活中的使用越来越广泛,制度...
师范专业自荐信 师范专业自荐信模板锦集六篇  在当下的社会中,自荐信在我们的生活愈发常见,在写作上,自荐信也具有一定...
企业管理的规章制度 关于企业管理的规章制度(精选5篇)  随着社会一步步向前发展,制度的使用频率呈上升趋势,制度是指一定...
编程题]组队竞赛(Java实现... 🎉🎉🎉点进来你就是我的人了 博主主页:...
用JS+CSS打造你自己的弹幕... 文章目录前言主要内容实现方法DOM方法显现效果代码CANVAS方法显现效果代码总结更多宝藏 前言 ...
提档函 提档函范文  提档函怎么写?下面是小编给大家整理收集的提档函范文,欢迎大家阅读与参考。  提档函范文...
网吧管理制度 网吧管理制度(精选5篇)  在学习、工作、生活中,制度对人们来说越来越重要,制度泛指以规则或运作模式...
商调函 关于商调函范文  你知道商调函如何写吗?那么,下面是小编给大家整理收集的关于商调函范文,供大家阅读参...
活动方案流程 活动方案流程  一、活动概述  1、活动介绍  2017年客户答谢会,通过会议、庆典、晚会、参观、旅...
Windows OpenGL ... 零基础 OpenGL ES 学习路线推荐 : OpenGL ES 学习目录 >> OpenGL ES...