2010-11-22 02:42 PM
ADC reset calibration fails. Ideas why?
2011-05-17 05:15 AM
ST advise, ''Before starting a calibration the ADC must have been in power-off state (ADON bit = ‘0’) for at least two ADC clock cycles.''
But ... your code looks very like mine (which works). void ADC_Configuration(void) { ADC_InitTypeDef ADC_InitStructure; //ADC_ContinuousConvMode conversion in Continuous or Single mode //ADC_DataAlign ADC data alignment is left or right. //ADC_ExternalTrigConv external trigger for conversion of regular channels //ADC_Mode ADC to operate in independent or dual mode //ADC_NbrOfChannel channels converted using sequencer for regular channel group. range 1..16 //ADC_ScanConvMode scan (multichannels) or single (one channel) mode //Deinitialize the ADCx peripheral registers to their default reset values. ADC_DeInit(ADC1); //ADC1 Configuration ADC_InitStructure.ADC_ContinuousConvMode = DISABLE; ADC_InitStructure.ADC_DataAlign = ADC_DataAlign_Right; ADC_InitStructure.ADC_ExternalTrigConv = ADC_ExternalTrigConv_None; ADC_InitStructure.ADC_Mode = ADC_Mode_Independent; ADC_InitStructure.ADC_NbrOfChannel = 1; ADC_InitStructure.ADC_ScanConvMode = DISABLE; ADC_Init(ADC1, &ADC_InitStructure); //Enable ADC1 powers ADC for first time (CR2_ADON was 0) ADC_Cmd(ADC1, ENABLE); ADC_ResetCalibration(ADC1); while(ADC_GetResetCalibrationStatus(ADC1)); ADC_StartCalibration(ADC1); while(ADC_GetCalibrationStatus(ADC1)); } I wonder if you have a high level of optimisation which is messing up the status check. Do you have a valid VRef? I don't know if this is required.2011-05-17 05:15 AM
VRef is all good... If I comment out the reset cal line it is all good. The CAL commmand works perfectly every time. Just the RSTCAL command that doesn't. Optimisation is turned off.
2011-05-17 05:15 AM
The function uses SET and RESET. Have you possibly re-defined them somehow? I think this has previously been a problem for some people.
2011-05-17 05:15 AM
Did you solve this problem?