当前位置:网站首页>SMT32H7系列DMA和DMAMUX的一点理解
SMT32H7系列DMA和DMAMUX的一点理解
2022-07-05 09:20:00 【若水千点】
DMA和DMAMUX
DMA:无CPU参与下直接进行数据搬运的控制器
DMAMUX:建立DMA请求和DMA通道之间的映射关系,类似于路由的功能。无DMAMUX的MCU,DMA请求和DMA通道的映射关系是固定的,不能由软件修改。有了DMAMUX可以将DMA请求和DMA通道由软件联系起来,实现自定义链接。
以STM32H743为例:
DMAMUX1:DMAMUX1_Channel0-15对应DMA1_Stream0-7和DMA2_Stream0-7。
DMAMUX2:DMAMUX2_Channel0-7对应BDMA_Channel0-7。
具体见下图,理解仅供参考。
触发发生器的例子
1.比如外部中断EXTI触发存储器到存储器/外设的DMA请求
无DMAMUX的情况下:因为EXTI本身没有DMA请求,但EXTI要触发DMA只能在EXTI中断中启动DMA,配置好存储器到存储器/外设的DMA后,然后再EXTI中断中启动DMA。
有DMAMUX的情况下:触发信号HAL_DMAMUX1_REQ_GEN_EXTI0和信号发生器DMA_REQUEST_GENERATORx关联相当于EXTI0具有了DMA请求,然后配置好DMA传输通道,配置好EXTI0,EXTI0就能触发DMA实现DMA传输了。这里边可能MCU已经做好EXTI边沿信号和DMA启动的关联了,不然和在EXTI中断中启动DMA又有什么区别呢。(猜测,没用过)
2.比如GPIO触发DMA请求实现存储器到GPIO的数据传输
无DMAMUX的情况下:GPIO本身没有DMA请求,要实现存储器到GPIO的DMA传输需要借用一个DMA请求,我当初用的是TIM_UP的DMA请求(当然也可以用其它信号,只要能产生DMA请求就行),然后在DMA配置中按照存储器到外设的DMA配置就行,我用这个可以实现输出一段固定波形的信号,信号的CLK和TIM周期一致,如果这段波形要周期性出现可以用另一个定时器,在定时器中断中使能DMA。
本质上是外设1->存储器->外设2的传输,外设1有DMA请求,外设2没有DMA请求,用外设1的请求干外设2的事情。
有DMAMUX的情况下:触发信号HAL_DMAMUX1_REQ_GEN_LPTIM1_OUT和信号发生器DMA_REQUEST_GENERATORx关联产生的DMA请求用作GPIO的DMA请求,然后配置DMA传输通道,配置LPTIM定时器,则启动DMA后,LPTIM定时器每次产生1个DMA请求,发送1个数据。如果DMA是循环模式则会根据NDTR循环传输,如果是正常模式则NDTR传完后DMA自动关闭。
同步发生器的例子
同步信号主要用于周期启动DMA
1.定时进行串口DMA发送数据
无DMAMUX的情况:串口都有DMA请求,不需要触发发生器,直接通过外设请求和DMA传输通道关联,但是我要定时发送串口数据,则需要在一个定时器中断中启动串口DMA发送。
有DMAMUX的情况:先进行串口外设和DMA传输通道的关联,然后选择同步信号HAL_DMAMUX1_SYNC_LPTIM1_OUT关联DMAMUX,配置LPTIM实现周期发出同步信号启动DMA。
同步信号是用来启动DMA的,不是DMA的请求,DMA的请求来自串口。
重点理解:
1.触发信号和同步信号都是固定的
2.理解触发信号HAL_DMAMUX1_REQ_GEN_LPTIM1_OUT和HAL_DMAMUX1_SYNC_LPTIM1_OUT在两个项目中应用的区别。
触发信号相当于DMA请求信号,同步信号相当于DMA启动信号。
触发信号多用于外设1->存储器->外设2的类型,同步信号多用于存储器->外设里的周期性启动DMA的情况。
在触发信号HAL_DMAMUX1_REQ_GEN_LPTIM1_OUT下,每一次触发信号引起一次DMA请求,而一次定时器的DMA请求只能传输一个DMA数据块。
在同步信号HAL_DMAMUX1_SYNC_LPTIM1_OUT下,一次同步信号启动一次DMA,DMA会传输完设定长度的数据,而不是单个数据块。
只是理解,没有过多验证。
边栏推荐
- 生成对抗网络
- [technical school] spatial accuracy of binocular stereo vision system: accurate quantitative analysis
- Svg optimization by svgo
- Applet (use of NPM package)
- C # draw Bezier curve with control points for lattice images and vector graphics
- Luo Gu p3177 tree coloring [deeply understand the cycle sequence of knapsack on tree]
- Applet network data request
- Alibaba's ten-year test brings you into the world of APP testing
- Blue Bridge Cup provincial match simulation question 9 (MST)
- OpenGL - Model Loading
猜你喜欢
Nodejs modularization
Applet (subcontracting)
Kotlin introductory notes (VIII) collection and traversal
Add discount recharge and discount shadow ticket plug-ins to the resource realization applet
C语言-从键盘输入数组二维数组a,将a中3×5矩阵中第3列的元素左移到第0列,第3列以后的每列元素行依次左移,原来左边的各列依次绕到右边
Nodemon installation and use
信息與熵,你想知道的都在這裏了
The research trend of map based comparative learning (gnn+cl) in the top paper
Kotlin introductory notes (II) a brief introduction to kotlin functions
AUTOSAR from getting started to mastering 100 lectures (103) -dbc file format and creation details
随机推荐
Nips2021 | new SOTA for node classification beyond graphcl, gnn+ comparative learning
Driver's license physical examination hospital (114-2 hang up the corresponding hospital driver physical examination)
Applet network data request
LeetCode 556. 下一个更大元素 III
Codeforces round 684 (Div. 2) e - green shopping (line segment tree)
STM32简易多级菜单(数组查表法)
Applet data attribute method
一次 Keepalived 高可用的事故,让我重学了一遍它
Understanding rotation matrix R from the perspective of base transformation
Blue Bridge Cup provincial match simulation question 9 (MST)
Transfer learning and domain adaptation
2310. 个位数字为 K 的整数之和
Composition of applet code
2020 "Lenovo Cup" National College programming online Invitational Competition and the third Shanghai University of technology programming competition
Multiple solutions to one problem, asp Net core application startup initialization n schemes [Part 1]
Multiple linear regression (gradient descent method)
C # compare the differences between the two images
Summary of "reversal" problem in challenge Programming Competition
Talking about the difference between unittest and pytest
C language - input array two-dimensional array a from the keyboard, and put 3 in a × 5. The elements in the third column of the matrix are moved to the left to the 0 column, and the element rows in ea