Skip to main content
AMP HF
Associate II
Nov 16, 2017 7:49 AM UTC
Question

In MX_ADC_Init: what's the difference between ADC_EOC_SEQ_CONV and ADC_EOC_SINGLE_CONV

Posted on November 16, 2017 at 08:49

MCU: STM32F072RB

hadc.Init.EOCSelection = ADC_EOC_SINGLE_CONV;

I have try to set 

hadc.Init.EOCSelection as 

ADC_EOC_SINGLE_CONV and ADC_EOC_SEQ_CONV to take a look in debug mode using Keil 5.

void HAL_ADC_ConvCpltCallback(ADC_HandleTypeDef* hadc)

{

unsigned char avg_num = 4;

if(__HAL_ADC_GET_FLAG(hadc,ADC_FLAG_EOC))

{

Adc_raw[adc_id] = HAL_ADC_GetValue(hadc);

adc_id++;

}

if(__HAL_ADC_GET_FLAG(hadc,ADC_FLAG_EOS))

{

adc_id = 0;

Adc_Vref = 3300*Adc_raw[0]/4095;

avg_id++;

}

}

Whatever I choose the EOCSelection, the 2 if condition would be ingoing.

So could someone tell me what's the difference between 

ADC_EOC_SINGLE_CONV and 

ADC_EOC_SEQ_CONV?

Thanks.

#adc-trigger #stm-32f07 #stm32-adc-interrupt
This topic has been closed for replies.

6 replies

AMP HF
AMP HFAuthor
Associate II
Nov 17, 2017 7:06 AM UTC
Posted on November 17, 2017 at 08:06

:(

until now, no one reply this question. Am I not clearly describe my issue?

I use 5 channels ADC.

When I set 

hadc.Init.EOCSelection = ADC_EOC_SINGLE_CONV;

after the last conversation, the condition  

__HAL_ADC_GET_FLAG(hadc,ADC_FLAG_EOS) also could be true.

Also, if I set

hadc.Init.EOCSelection = ADC_EOC_SEQ_CONV ;

the condition __HAL_ADC_GET_FLAG(hadc,ADC_FLAG_EOC) could be ture too.

So it make me confused. 

AvaTar
Senior III
Nov 17, 2017 7:55 AM UTC
Posted on November 17, 2017 at 08:55

I don't know the Cube code. What do this __HAL_ADC_GET_FLAG macros expand to ?

If you stop the debugger in the callback function, what is the state of the ADC status register ?

AMP HF
AMP HFAuthor
Associate II
Nov 17, 2017 9:49 AM UTC
175767CGIL2
AvaTar
Senior III
Nov 17, 2017 10:17 AM UTC
Posted on November 17, 2017 at 10:17

And did you cross-check with the reference manual of your undisclosed MCU, if this is what you expect ?