cancel
Showing results for 
Search instead for 
Did you mean: 

About STM32F429 ADC value acquisition

tasabao
Associate II

Hello everyone, I'm using the STM32CubeIDE , then I would like to ask about the ADC configuration for the STM32F429 board. Currently, I want to distinguish a sine wave input ranging from 10kHz to 3MHz, the ADC parameters are set as follows:
(1) APB 1 peripheral: 36 MHz
(2) Clocks Prescaler: Divided by 2
(3) Sampling Time: 3 Cycles

 

Additionally, the TIM is set to 72 MHz, with PSC: 0 and ARR: 11.  How should I configure it? Thank you, everyone!

8 REPLIES 8
Danish1
Lead II

What aspects of the sine wave are you trying to distinguish?

Is it just to see if there is or isn’t a sine-wave at the input?

Or do you want to measure both frequency and amplitude in order to detect changes in either of them?

Nyquist sampling theory tells us that you need to sample at least twice the frequency of the incoming waveform. So for 3MHz you would need 6MSamples/s. I don’t think a standard stm32 ADC can do that. So you might need to choose between having additional hardware or relaxing the measurement requirements.

Hello, thank you for your reply.
I want to read the sine wave generated by my circuit, use the ADC to capture 4095 data points, and then use FFT to obtain the frequency and amplitude.
I would also like to ask if using multiple ADC channels can measure higher frequency ranges?
And how should I configure TIM and ADC, and which is more important?
I’ve searched various articles online but still don’t understand. Thank you!

TDK
Guru

I doubt you're going to successfully read a 3 MHz sine wave. The ADC sampling rate is limited.

Regardless, the procedure for reading frequency is:

  • Set up a circular DMA buffer for the ADC at a fast sampling rate
  • On the half- and full-complete interrupt callbacks, perform the FFT of the first and second halves of the buffer.
If you feel a post has answered your question, please click "Accept as Solution".
MasterT
Lead

>>> STM32F429

How is that : (1) APB 1 peripheral: 36 MHz. 

Data sheet tels F429 runs  at 180 MHz. Have you mistyped F103?

HI, thank you for your response. Based on my calculations, the highest sampling rate I can achieve is 2.4 MSPS (36M/15). According to Nyquist's theorem, if I need to sample 1024 points for a 10kHz sine wave, the required sampling frequency would be 10k * 2 * 1024 = 20.48 MHz. If I reduce the FFT requirement to 100 points, then the required sampling frequency would be 10k * 2 * 100 = 2 MHz. Does this mean that I cannot meet my requirements using the STM32F429?

HI, thank you for your response.I made a mistake in the values; the APB2 is 72 MHz, and as shown in the figure, the maximum achievable rate is 36 MHz. 

1727494274396.jpg

Yes, you cannot measure a 3 MHz sine wave with a sample rate of less than 2x that frequency, or 6 MSPS. That is beyond the capabilities of a single ADC. You can do dual or triple interleaved mode, but the programming and post-processing is considerably more complicated. You will have considerable noise on the circuit as well at those speeds. Might be better ways to accomplish what you want. Probably aren't going to be able to take an FFT continuously at those rates, but you could do snapshots.

STM32™'s ADC modes and their applications

If you feel a post has answered your question, please click "Accept as Solution".

Thank you for your response. I would like to ask if my calculation is correct. If I only need to measure a 1 MHz sine wave, but my FFT requires 100 points, is it still impossible to use the STM32F429 for this measurement?