2016-04-28 01:42 AM
Hello everyone,
I have a problem with the following ADC1 initialisation code with a STM8S003F3.
void ADC_StartNtcMeasurement(void)
{
ADC1_DeInit();
ADC1_Init(ADC1_CONVERSIONMODE_CONTINUOUS, //ADC1_ConversionMode
ADC_CHANNEL_NTC, //ADC1_Channel
ADC1_PRESSEL_FCPU_D8, //ADC1_PrescalerSelection
ADC1_EXTTRIG_TIM, //ADC1_ExtTrigger (not used)
DISABLE, //ADC1_ExtTriggerState
ADC1_ALIGN_RIGHT, //ADC1_Align (Byte order)
ADC1_SCHMITTTRIG_CHANNEL0, //ADC1_SchmittTriggerChannel
DISABLE); //ADC1_SchmittTriggerState
ADC1_DataBufferCmd(ENABLE); //Buffered mode
ADC1_StartConversion();
}
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 #overrun-ovr