8 posts / 0 new
Last post
csq
Offline
Last seen:1 year 2 months ago
Joined:2018-08-05 08:56
SUOTA adc采样速率没有datasheet说的那么高

for(int i=0;i<100;i++){
adc_init (GP_ADC_SE GP_ADC_SIGN 0);
adc_enable_channel(3);
adc_sample4[i] = adc_get_sample();
adc_disable();

adc_init (GP_ADC_SE GP_ADC_SIGN 0);
adc_enable_channel(0);
adc_sample1[i] = adc_get_sample();
adc_disable();

adc_init(GP_ADC_SE, GP_ADC_SIGN, 0);
adc_enable_channel(2);
adc_sample3[i] = adc_get_sample();
adc_disable();

adc_init (GP_ADC_SE GP_ADC_SIGN 0);
adc_enable_channel(1);
adc_sample2[i] = adc_get_sample();
adc_disable();
}
我用adc采样,然而在经过100个循环后,总共400次,时间已经经过了ms级
Features
• 10-bit dynamic ADC with 65 ns conversion time

Keywords:
Device:
FvD_Dialog
Offline
Last seen:3 weeks 1 day ago
Staff
Joined:2013-12-05 14:41
Dear csq,

Dear csq,

Sorry, I'm answering in english.

We are looking into your code and will try to optimize it.

Kind regards

FvD_Dialog

csq
Offline
Last seen:1 year 2 months ago
Joined:2018-08-05 08:56
So how can I use the ADC in

So how can I use the ADC in high rate?

CYibin
Offline
Last seen:4 months 2 days ago
Staff
Joined:2017-12-14 02:48
你好,

你好,

这种计算方式不严谨。

你的代码里,采样时间应该只占了很少的一部分,代码损耗(for 循环、函数调用)、ADC 初始化等占用的时间,比采样时间高多了。

请问你项目需要实现什么功能?需要多快的采样速度?

csq
Offline
Last seen:1 year 2 months ago
Joined:2018-08-05 08:56
利用adc采集对高频调制信号的接收,大概1Mhz

利用adc采集对高频调制信号的接收,大概1Mhz,我主要在库里面没找到别的连续adc采样的相关库函数,或者最快能采多少

CYibin
Offline
Last seen:4 months 2 days ago
Staff
Joined:2017-12-14 02:48
Hi csq,

Hi csq,

理论可达 3.3 Msample/s。

ADC 初始化(20us)并运行之后,转化时间是接近 1us,处理转化的数据需要 4us,故理论最大采样速度是 16/5 = 3.3Msamples/s

实际上在把转化完成的数据存储到 ram 的过程中,还会有一些其它代码运行时间的损耗,故很难达到该理论值。

你是想 ADC 采样速率能达到 1Mhz 还是说想对 1Mhz 的波形进行采样?

csq
Offline
Last seen:1 year 2 months ago
Joined:2018-08-05 08:56
对1Mhz的波形进行采样

对1Mhz的波形进行采样,底层的函数
adc_get_sample{

int cnt = ADC_TIMEOUT;
SetBits16(GP_ADC_CTRL_REG, GP_ADC_START, 1);
while (cnt-- && (GetWord16(GP_ADC_CTRL_REG) & GP_ADC_START) != 0x0000);
SetWord16(GP_ADC_CLEAR_INT_REG, 0x0000); // Clear interrupt
return GetWord16(GP_ADC_RESULT_REG);
}
这个貌似没有连续读取模式

CYibin
Offline
Last seen:4 months 2 days ago
Staff
Joined:2017-12-14 02:48
你好,

你好,

3.3Mhz 是理论能达到的采样速率,实际上,由于 ram 的限制,芯片主频的限制(16MHz),还有额外的、处理代码的开销,可能并不适用“对1Mhz的波形进行采样”这种应用场景