cancel
Showing results for 
Search instead for 
Did you mean: 

Issue with ADC conversion time.

vasudev
Associate II

Hi, I am developing digital control for power electronics for which ADC conversion time is critically. In stm32f334r8 reference manual I saw it takes only 0.19us at lowest sampling time i.e 1.5 cycles. when I tried to measure the adc conversion time , its about 1.8us which is not acceptable if my mesurment is correct. 

This is how I mesured ADC conversion time:-

adc is triggred by HRTIM Timer A compare unite 2 at some compare value which generates interrupt where I set a gpio pin and after the ADC EOC(end of conversion) there is an ADC interrupt where I reset the gpio which was set at HRTIM Timer A interrupt. So the time on duration of gpio should give conversion time. The gpio pin is at high speed mode. ADC clock is at 72MHZ which is max for stm32f334r8. So I need your help in this. And yes its only one channel. 

vasudev_0-1699768983742.png

 

 

6 REPLIES 6
STOne-32
ST Employee

Dear @vasudev,

I would suggest to check the clock input to the fast ADC if it is 72MHz. 

IMG_5570.jpeg

IMG_5573.jpeg

 Hope it helps,

STOne-32

vasudev
Associate II

vasudev_0-1699774975224.png

yes the ADC clock input is 72MHZ and also i am using fast adc channel .

AScha.3
Chief III

>I tried to measure the adc conversion time

but what you do, is measure of : HAL-call (using HAL bad idea here)+ADC conv.time + INT call time .

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

that makes sense but i am using LL functions . will it also cause latency ? wat is the best way to measure the conversion time then ?

>will it also cause latency ? 

no no, this all working with zero-point-energy and infinite speed. :)

why you want measure the conversion time then ? not trusting the manual or STM at all ?

it will convert in exactly the time that you set in its register setup.

just to see, that you didnt it wrong - make a loop , 1000 conversion in continuous mode, and set/reset the led then.

so this time /1000 is ( conversion + poll_for_conversion time + loop time ) .

or better :

set adc in continuous mode, and dma to transfer 1000 result. test time (with your led) from dma start to ready (int).

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

yaa , there significant around 400ns latency with gpio, which adds up to mesurment error of conversion time. So i wil now trust the manual blindly :beaming_face_with_smiling_eyes:.