AnsweredAssumed Answered

Understanding ADC Sampling

Question asked by roofie01 on Sep 16, 2014
Latest reply on Sep 16, 2014 by roofie01
I have a simple operation to perform with the STM32F4 (on a Discovery board) but the solution escapes me. Mostly from the fact that, even after looking at sample code and reading the manual, I don't quite get it (yet)

//pseudo code
1 - configure peripherals
2 - begin sampling in background, sample at 1KHz rate
3 - sample until buffer has 2000 ADC samples
4 - when sampling complete, trigger interrupt (should take 2 seconds for buffer to fill)
5 - process samples - ADC should still be buffering next sample block
6 - go back to #4

Seemingly simple, but I do not understand how to get the ADC configured so it samples at the correct rate- in this case, 1Khz. The key is, the sampling rate must be near exact for the fft to perform correctly. Part of it is - in continuous mode, while using DMA to fill the buffer in the background, I don't quite understand the relationship between the Timer's interrupt rate and the sampling frequency.

I need to do some fft processing after the buffer is filled, but do not want that to happen in a timer-driven ADC acquisition because of the fft processing demands.

Can someone point my beak in the right direction on this? A post where there might sample code ( I searched but cannot find) or an explanation.

Thank you in advance...