2017-03-20 09:53 PM
Hello!
STM32F103ZE Problem in use ADC Init.While (ADC_GetFlagStatus (ADC1, ADC_FLAG_ADONS) == RESET); An infinite loop occurs.Why does the 'ADC_FLAG_ADONS' Flag fail to initialize?What is the solution for infinite loops?Initialization function.
void AdcInit(void)
{ ADC_InitTypeDef ADC_InitStructure; RCC_APB2PeriphClockCmd(RCC_APB2Periph_ADC1, ENABLE); /* ADC1 configuration ------------------------------------------------------*/ADC_InitStructure.ADC_Mode = ADC_Mode_Independent;
ADC_InitStructure.ADC_ScanConvMode = ENABLE; ADC_InitStructure.ADC_ContinuousConvMode = ENABLE; ADC_InitStructure.ADC_ExternalTrigConv = ADC_ExternalTrigConv_None; ADC_InitStructure.ADC_DataAlign = ADC_DataAlign_Right; ADC_InitStructure.ADC_NbrOfChannel = 1; ADC_Init(ADC1, &ADC_InitStructure);/* ADC1 regular channel14 configuration */
// ADC_RegularChannelConfig(ADC1, ADC_Channel_8, 1, ADC_SampleTime_239Cycles5); /* Enable ADC1 */ ADC_Cmd(ADC1, ENABLE);/* Enable ADC1 reset calibaration register */
ADC_ResetCalibration(ADC1); /* Check the end of ADC1 reset calibration register */ while(ADC_GetResetCalibrationStatus(ADC1)); /* Start ADC1 calibaration */ ADC_StartCalibration(ADC1); /* Check the end of ADC1 calibration */ while(ADC_GetCalibrationStatus(ADC1));}
#stm32 #adc-cal #adc-init