[Yichuang ETEB-6001DPX Review] Part 5 Testing the Maximum Sampling Rate of ADC
[Copy link]
A basic parameter
Check the basic parameters in the manual
You can see the basic information, 12Bit SAR ADC sampling rate can reach up to 4MBPS
I don't know if this 4M is a single channel or the maximum sampling rate of dual ADC sampling.
Look at the data sheet again
The conversion cycle is fixed at 13 CLKs, while the ST one is configurable.
Two ADC sampling
Let's make a single-channel sampling. There are all the built-in routines, but my built-in routine lacks header files and cannot be compiled. Let's try making one by myself.
ET's ADC structure is relatively simplified
STM32
ADC is configured as SRPWM trigger
Test the experimental results
The external 1.1V test is more accurate
Three ADC sampling rate maximum test
The sampling rate of the ADC must be less than the conversion rate. Common units are ksps and Msps, which represent kilo/million samples per second.
To calculate this sampling rate
The method I use is to use a timer to sample. The 15 channels of an ADC are sampled together. The timing time is A. If the sampling of 15 channels can be completed within time A, it means that the sampling rate is > A/15. The timing time of PITIMER is continuously adjusted until the sampling of 15 channels cannot be completed, and the maximum sampling rate is obtained.
ADC configuration code
static void ADC_Config(void)
{
uint8_t i;
ADC_InitTypeDef stInit;
/* 复位ADC,并开启该外设的时钟 */
ADC_DeInit(ADC0);
/* 校准ADC */
ADC_StartCalibration(ADC0);
/* 初始化ADC */
ADC_StructInit(&stInit);
stInit.virtualChannelMask = ADC_VIRTUAL_CHANNELALL;
stInit.workMode = ADC_WORK_MODE_SINGLE;
stInit.trigMode = ADC_TRIGGER_MODE_CONTINUOUS;
stInit.trigger = ADC0_TRIGGER_PIT0;
ADC_Init(ADC0, &stInit);
/* 将所有的虚拟通道都映射到模拟通道0 */
for(i = 0; i < 16; i++)
{
ADC_ACRemapSingle(ADC0, (uint16_t)BIT_MASK(i), ADC_ANALOG_CHANNEL0);
}
/* 选择虚拟通道事件冲突的处理方式 */
ADC_EventConflictSel(ADC0, ADC_EVT_CONFLICT_DEAL_LOW_PRIORITY_QUEUE);
/* 开启中断功能 */
ADC_ITEnable(ADC0,ADC_IT_RESULT_VC15);
ADC_ITUnMask(ADC0,ADC_IT_RESULT_VC15);
NVIC_EnableIRQ(ADC0_IRQn);
/* 使能ADC */
ADC_CoreEnable(ADC0);
/* 使能虚拟通道 */
ADC_VCEnable(ADC0, ADC_VIRTUAL_CHANNELALL);
}
Start debugging PITIMER 100MHz
Manually modify the value of period continuously. When it is changed to 359-1, the ADC completion interrupt cannot be entered. This is the limit value.
100M/360*15 = 1500/360 M = 4.16666M
Matches the manual
|