I have and STM32f3 Discovery Board, and I'm trying to use 4 ADC channels. This is my read function:
int ADC_read(int channel)
{
ADC_RegularChannelConfig(ADC1, channel, 1, ADC_SampleTime_7Cycles5);
ADC_StartConversion(ADC1);
while (ADC_GetFlagStatus(ADC1, ADC_FLAG_EOC) != SET);
return ADC_GetConversionValue(ADC1);
}
everything goes perfectly well, until suddenly program stucks in the while loop. is there a way to avoid putting a ADC_FLAG_EOC in a loop? or just some other way to make my program work?