Skip to main content
Associate
March 21, 2024
Question

Stm32f103 samples per second adc

  • March 21, 2024
  • 5 replies
  • 1870 views

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!

This topic has been closed for replies.

5 replies

raptorhal2
Lead
March 21, 2024

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

 

fdinAuthor
Associate
March 25, 2024

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

raptorhal2
Lead
March 25, 2024

What happens when the buffer is full?

fdinAuthor
Associate
March 26, 2024

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
March 26, 2024

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.