I am beginning to wonder if this is an issue with CubeMX? I recently posted an issue I am having below on the ADC of the STM32L073 chip. Its a small application created with CubeMX and have checked it many times, and still have the same issues as in the link below. I wanted to check it many times (most of the day) before thinking it must be a CubeMX issue. The 'HAL_ADC_ConvCpltCallback' was only called once on one channel , even though 3 channels have been added. The if (__HAL_ADC_GET_FLAG(hadc, ADC_IT_EOC)) code was executed, and straight after the "if (__HAL_ADC_GET_FLAG(hadc, ADC_IT_EOS))" was also executed. This makes me think that it is setup for only 1 channel to convert.
why does ADC_FLAG_EOS get called after each channel? << link to issue
I have it working, but more like a work around. Within CubeMX I have 'Discontinues convertion mode ' Enabled. And within the HAL_ADC_ConvCpltCallback(..) routine I done the following, just to check to see if it works: In my main.cpp routine I call HAL_ADC_Start_IT(&hadc); to start convertion, then:
if (__HAL_ADC_GET_FLAG(hadc, ADC_IT_EOC)) //check convertion on channel
ADC_index=0; //after the 3 channels converted reset
HAL_ADC_Start_IT(hadc); //restart on next channel
//this time, the below got called only once as expected, after the 3 ADC_IT_EOC above were executed.
if (__HAL_ADC_GET_FLAG(hadc, ADC_IT_EOS))
Anyone suggest the best way to go from here regarding this?