cancel
Showing results for 
Search instead for 
Did you mean: 

Stm32f103 samples per second adc

fdin
Associate II

Hello, I'm using a stm32F103 to read 10 channel from the ADC in continuos mode. The ADC clock is 12Mhz and the sampling time is 28.5 cycles for all channels. the convertion time for one channel is ((28.5+12.5)/12Mhz) = 3.41 us. Since i'm using adc in continuos mode, after this 3,41us the next channel will be read and this read will take another 3.41 us and the same thing for the next eight channels. So in 34.1 us each channel has one sample. So each channel in one second are reading (1000000/34,1) = 29325 samples. I just want to a confirmation for this calculations if possible, Thanks!

5 REPLIES 5
raptorhal2
Lead

How is the data being saved? Allow for that overhead.

 

I'm using DMA to send the data to a buffer.

raptorhal2
Lead

What happens when the buffer is full?

when the adc finishes the convertion the dma send this data to this buffer, when the adc finishes the next conversion the dma will overwrite the data in the buffer with this new data.

raptorhal2
Lead

You haven't described any logic to read the buffer before the data gets overwritten.

I believe there is a DMA buffer half full flag that can be sensed. When that happens read and save the first 5 values while the conversions continue. When the DMA buffer count = 0, read and save the last 5 values. If that can't be done fast enough, the conversion sequence needs to be paused until the values are saved. That is overhead.