cancel
Showing results for 
Search instead for 
Did you mean: 

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

AMP HF
Associate II
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
6 REPLIES 6
AMP HF
Associate II
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
Lead
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 ?

175767CGIL2
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 ?

Posted on November 17, 2017 at 10:28

Thanks for your reply.

Sorry, I use STM32F072RB chip. 

Posted on November 17, 2017 at 12:06

Have you checked what those set bits in the ISR mean, i.e. does it match with your EOC/EOS macros ?

I currently can't download the reference manual, seems an issue of the ST website.

In the first and second image/snapshot, why is the state of the IER different for the (supposedly) same settings ?