cancel
Showing results for 
Search instead for 
Did you mean: 

ADC+DMA+TIM: Sampling time

reza
Associate
Posted on November 01, 2016 at 16:12

Hi everyone, 

I have a general question regarding the sampling time when triggering ADC in DMA mode by using a timer event update.

Let�s say I have a DMA buffer with size N. Is it possible to take one ADC sample per each timer trigger and fill in this buffer?  Is there any way that I only get a DMA buffer complete interrupt after acquisition of these N samples?

A little background on my problem:

Sampling 1024 data points from the input signal using ADC+DMA. However, even after using maximum possible clock pre-scalers ADC_CLOCKPRESCALER_PCLK_DIV8 and ADC_SAMPLETIME_480CYCLES for the ADC, the sampling time is high and I cannot see enough periods from my input signal. I cannot increase the buffer size due to memory and processing time restrictions.

I tried to see if using a timer as a trigger for the ADC can solve the issue and can help to reduce the sampling time. But as I have observed, the timer triggers conversion of the whole buffer, not the samples of the buffer. Thus, the sampling frequency still is determined by the main clock and the pre-scaler values.

Any suggestion on how to get around this problem would be appreciated. 

#stm32-adc-dma-tim-sampling
1 REPLY 1
Posted on November 01, 2016 at 16:26

You don't show the code, or detail which STM32 is being used.

The DMA TC fires when the whole buffer fills, HT when half of it fills. Often you want to double the buffer size and use HT/TC so you are processing data that is changing underneath you.

If you are triggering with a timer, don't use continuous mode?

 

Tips, Buy me a coffee, or three.. PayPal Venmo
Up vote any posts that you find helpful, it shows what's working..