硬汉嵌入式论坛

 找回密码
 立即注册
查看: 1035|回复: 3
收起左侧

[技术讨论] ADC采样不定长度数据,使用DMA传输问题

[复制链接]

5

主题

19

回帖

34

积分

新手上路

积分
34
发表于 2022-3-16 14:54:31 | 显示全部楼层 |阅读模式
用的是ADUCM410的单片机,在使用DMA传输ADC的采样数据时,定义DMA数据长度位3000,ADC采样的数据长度在1000~3000之间变化。
在信号开始时,AD开始采样,采样一个周期
DMA配置为PING-PONG模式
DMA传输第一个周期时,采样1000个值,占数组的0~999;读取数据后,清零数组;
DMA传输第二个周期时,采样1000个值,但是占数组的1000~1999,我想让它继续放到数组的0~999,但是并没有;读取后清零;
DMA传输第三个周期时,采样1000个值,占数组2000~2999。
当三轮传输后,DMA的数据长度为0,不再进行传输。

查阅资料后,可以将DMA运行模式配置为循环模式,再配置输入引脚中断,在完成一个信号周期采样后,进入引脚中断,重新配置DMA以解决问题。
但查阅数据手册,发现DMA运行模式仅有下图中几种,没有找到循环模式?
DMA模式.PNG
请大神指导,该如何解决该问题?
回复

使用道具 举报

1万

主题

6万

回帖

10万

积分

管理员

Rank: 9Rank: 9Rank: 9

积分
107077
QQ
发表于 2022-3-16 15:14:13 | 显示全部楼层
ADUCM410的pingpong是怎么个用法,应该也是循环采集模式。循环模式就是连续不停采集。

回复

使用道具 举报

210

主题

1045

回帖

1685

积分

至尊会员

More we do, more we can do.

积分
1685
发表于 2022-3-16 16:05:37 | 显示全部楼层
看来是真·乒-乓,不过也能满足楼主的需求

In ping pong mode, the controller performs a DMA cycle using one of the data structures and then performs a DMA cycle using the other
data structure. The controller continues to alternate between using the primary and alternate data structures until it reads a data structure
that is invalid, or the host processor disables the channel.
This mode is useful for transferring data from peripheral to memory using different buffers in the memory. In a typical application, the
host must configure both primary and alternate data structures before starting the transfer. As the transfer progresses, the host can
subsequently configure primary or alternate control data structures in the interrupt service routine when the corresponding transfer ends.
The DMA controller interrupts the processor after the completion of transfers associated with each control data structure. The individual
transfers using either the primary or alternate control data structure work the same as a basic DMA transfer
回复

使用道具 举报

5

主题

19

回帖

34

积分

新手上路

积分
34
 楼主| 发表于 2022-4-1 09:17:53 | 显示全部楼层
搞定了,是主副数据结构没有清零,倒是第二次传输时,把上一次的数据一起传了
回复

使用道具 举报

您需要登录后才可以回帖 登录 | 立即注册

本版积分规则

QQ|小黑屋|Archiver|手机版|硬汉嵌入式论坛

GMT+8, 2024-5-17 03:52 , Processed in 0.165214 second(s), 28 queries .

Powered by Discuz! X3.4 Licensed

Copyright © 2001-2023, Tencent Cloud.

快速回复 返回顶部 返回列表