cancel
Showing results for 
Search instead for 
Did you mean: 

STM32 ADC sample rate

Jshan.1
Associate

Hi, I'm using adc single channel with interrupt. the sample time is set as 56 cycles, and the adc clock is (108MHz/4=27MHz). So the sample rate is 27MHz/(56+12)=397KHz. I also using DAC to generate a sinewave with the frequency of 1KHz. If what I calculate is correct, I will get 2.5 periods of sinewave when I sample 1000 points. however, I plot the data in matlab, I get more than 4 periods. I am confused which part is wrong.

thanks0693W000003RduYQAS.png0693W000003RduTQAS.png

3 REPLIES 3

Which STM32?

Switch on compiler optimization.

Toggle a pin at ADC ISR entry and exit, and observe on oscilloscope/LA, to see its execution time.

JW

TDK
Guru

Calling a HAL ADC conversion complete interrupt every 68 cycles (397KHz) is unlikely to work. Use DMA or reduce the sample rate or optimize the ISR by eliminating HAL.

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

If I understood correctly, AHB or APB respective to ADC is 108MHz, so it's 4x or 8x that, i.e. 272 or 544 cycles. Maybe that is marginally viable if optimization is switched on.

JW