AnsweredAssumed Answered

Overrun flag set immediately after starting ADC conversion

Question asked by Third Eye on Apr 28, 2016
Hello everyone,

I have a problem with the following ADC1 initialisation code with a STM8S003F3.

01.void ADC_StartNtcMeasurement(void)
02.{
03.   ADC1_DeInit();
04. 
05.   ADC1_Init(ADC1_CONVERSIONMODE_CONTINUOUS, //ADC1_ConversionMode
06.             ADC_CHANNEL_NTC,            //ADC1_Channel
07.             ADC1_PRESSEL_FCPU_D8,       //ADC1_PrescalerSelection
08.             ADC1_EXTTRIG_TIM,           //ADC1_ExtTrigger (not used)
09.             DISABLE,                    //ADC1_ExtTriggerState
10.             ADC1_ALIGN_RIGHT,           //ADC1_Align (Byte order)
11.             ADC1_SCHMITTTRIG_CHANNEL0,  //ADC1_SchmittTriggerChannel
12.             DISABLE);                    //ADC1_SchmittTriggerState
13. 
14.   ADC1_DataBufferCmd(ENABLE); //Buffered mode
15. 
16.   ADC1_StartConversion();
17.}


As soon as ADC1_StartConversion() is executed (it sets the ADON bit), the OVR bit in ADC1->CR3 is set.
After the initialisation I wait in a while loop until the EOC flag is then. Then I read out all 10 hardware buffer registers.
It seems to work fine but I don't want to ignore the OVR flag. But at the moment I have to, otherwise I would not get any measuring value.

Any idea?

Thanks.
Third Eye

Outcomes