cancel
Showing results for 
Search instead for 
Did you mean: 

adc time conversion

Damiano Balzani
Associate III
Posted on February 22, 2018 at 11:15

hi everybody,

i 'm setting the ADC on STM32L051x6.

it works correctly but i have problem with conversion time. It is about 8us. To measure it i'm using a signal that is setted high at the start of conversion and low at the end of conversion.

The start of conversion is triggered on a timer event and i use

LL_GPIO_SetOutputPin(GPIOA, PA6); 

to set signal.

I'm tryng to reduce this time. 

Can somebody help me?

this is the setting code for ADC

void LED_CURRENT_ADC_Init(void)

{

LL_ADC_SetClock(ADC1, LL_ADC_CLOCK_SYNC_PCLK_DIV1);

LL_ADC_SetSamplingTimeCommonChannels(ADC1, LL_ADC_SAMPLINGTIME_1CYCLE_5);

LL_ADC_SetResolution(ADC1, LL_ADC_RESOLUTION_12B);

LL_ADC_SetDataAlignment(ADC1, LL_ADC_DATA_ALIGN_RIGHT);

LL_ADC_REG_SetSequencerChannels(ADC1, LL_ADC_CHANNEL_3);

LL_ADC_REG_SetContinuousMode(ADC1, LL_ADC_REG_CONV_SINGLE); 

LL_ADC_ClearFlag_ADRDY(ADC1);

LL_ADC_EnableIT_EOC(ADC1);

LL_ADC_Enable(ADC1);

}

this is the adc IRQ

void ADC1_COMP_IRQHandler(void)

{

LL_ADC_ClearFlag_EOC(ADC1);

LL_GPIO_ResetOutputPin(SENS_LINEVALID_CPLD_PROGn_PORT, SENS_LINEVALID_CPLD_PROGn_PIN);

}

#conversion #adc-sampling-time
1 ACCEPTED SOLUTION

Accepted Solutions
henry.dick
Senior II
Posted on February 22, 2018 at 15:00

Take a look at the data sheet. Understand the sampling and conversion timing requirements. 

It it is easy to get within 2us per manual conversion. 

View solution in original post

2 REPLIES 2
AvaTar
Lead
Posted on February 22, 2018 at 13:17

Not sure what you mean.

To measure it i'm using a signal that is setted high at the start of conversion and low at the end of conversion.

That does not matter.

In the first step, the ADC samples the external signal for the defined sampling time (by connecting it to the S&H capacitor).

Then, the S&H capacitor is disconnected from the external signal, and switched over to the internal conversion circuitry.

'Conversion time' is the number of ADC clock cycles it takes to create the digital representation of the external voltage from the S&H capacitor.

Changes of the external signal during this time are irrelevant.

I'm tryng to reduce this time.

What time, exactly ?

Conversion time is basically fixed by ADC clock and resolution.

henry.dick
Senior II
Posted on February 22, 2018 at 15:00

Take a look at the data sheet. Understand the sampling and conversion timing requirements. 

It it is easy to get within 2us per manual conversion.