cancel
Showing results for 
Search instead for 
Did you mean: 

ADC and DMA on STM32F303

DetlefS
Associate III

Hi,

I run ADC1 with DMA on my STM32F303RE with 72MHz clock. 

I take the number of samples flowing into the circular buffer per timeunit.  I calculate a sample freq. of 1.305 Megasamples per second Ms/s.

When I look at the sampled known signal I calculate a sample frequency of 1.518Ms/s.

I'm losing samples somewhere !? 

Where? Is it due to ADC or DMA? 

ADC setup: Independent mode,Synchronous clock mode divided by 4, 12Bit, scan disable, continuous enable, enable regular conversions enable, 

DMA setup: ADC1 DMA1 CHANNEL1, circular buffer 15*1024*uint16_t, increment address memory, half word

THX

Cheers

Detlef

 

2 REPLIES 2
Simon V.
ST Employee

Hello,

If ADC frequency is 72MHz/4 and sampling duration is 1.5 cycles and conversion duration 12.5 for 12bits then STM32F3 sampling rate is (72/4) / (1.5+12.5) = 1.28e6 samples per seconds while you are calculating 1.305 => can you please share your formula ?

How do you proceed to calculate the ADC sampling rate ? Are you using a sinus or a square waveform ?

 

Thanks in advance,

Regards,

Simon

To give better visibility on the answered topics, please click on Accept as Solution on the reply which solved your issue or answered your question.

Hi Simon,

I lost track how I ended up with 1.305 Ms/s. 

>>How do you proceed to calculate the ADC sampling rate ? Are you using a sinus or a square waveform ?

I sampled DCF77, which is 77.5kHz with better than 1e-8 accuracy. I got the sample freq. from my PLL.

I solved it by using a timer to kick the ADC. This setup is good enough to calculate the uC clock to be off by 144Hz ;)).

Big fun.

Cheers

Detlef