2017-11-15 11:49 PM
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-interrupt2017-11-16 11:06 PM
:(
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.
2017-11-16 11:55 PM
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 ?
2017-11-17 01:49 AM
2017-11-17 02:17 AM
And did you cross-check with the reference manual of your undisclosed MCU, if this is what you expect ?
2017-11-17 02:28 AM
Thanks for your reply.
Sorry, I use STM32F072RB chip.
2017-11-17 04:06 AM
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 ?