cancel
Showing results for 
Search instead for 
Did you mean: 

How can I view the number of ADC conversions per second?

MGH745
Associate II
 
Mikael
1 ACCEPTED SOLUTION

Accepted Solutions

ADC DMA isnt designed for one sample buffer, or better say your complete callback cant be more instruction cycles as one conversion when you set one as buffer = next not practical chaos

Your code is in IRQ and next IRQ arrive = stop working

View solution in original post

8 REPLIES 8
MGH745
Associate II

 

Hello
I am using STM32G030 but my question is not specific to G series

 

How can I view the number of ADC conversions per second?

 

For example I can put Counter++ in (DMA circular )HAL_ADC_ConvCpltCallback  And get it in seconds using a timer?

 

The G030 has a 12-bit ADC with 2Ms/s

 

ADC clock of 32 MHz divided by 2 = 16 MHz (12.5 + 1.5) should be 1.1Msample/s? is not it?

 

Is this practical?

 
 
 
 
 
 
 
 
 
Mikael

Your question is not practical. ADC have docu and on init you define speed of conversion . 

Some years ago i here ask why MX not shown this values , when ADC is configured. I mean still not show, then you need calc this. For example 

MM1_0-1712486267857.png

STM32G0-Analog-ADC-ADC.pdf

I am testing it right now
When I put ADC_SAMPLETIME_160CYCLES_5, the counter shows the number 92486. But when I set it to ADC_SAMPLETIME_79CYCLES_5, it stops working

 
Mikael

ADC DMA isnt designed for one sample buffer, or better say your complete callback cant be more instruction cycles as one conversion when you set one as buffer = next not practical chaos

Your code is in IRQ and next IRQ arrive = stop working

I understood the problem

Is your solution that more channels should be used in this case?

Can you tell me a little more simply what is meant by ADC DMA isnt designed for one sample buffer?

I appreciate you

 
 
 
Mikael

You set buffer length for example 1000 and ADC + DMA do job ofload MCU  fill buffer and one IRQ on half 500 and second on 1000 initiate your job in code to do somethink with samples.

You mean that, for example, in this microcontroller, 2.5Msample/s for one channel cannot be achieved

How to know the buffer cycle limit for IRQ so that it does not get stuck?

 

I think it is 100k samples for each buffer for this micro

 
Mikael

I mean, what do we calculate that doesn't stop according to the number of channels (buffer length) in the IRQ.

 
Mikael