cancel
Showing results for 
Search instead for 
Did you mean: 

ADC1 Extended Calibration on NUCLEO-U575ZI-Q board never finishes

Skfir
Senior

Hello again everybody.

I have run into the following problem: I try calibrate the ADC1 and plain calibration seems to work just fine (apparently), but as soon as I try to follow the Extended Calibration procedure, described on page 1007 of the Holy User Guide, then the ADCAL bit never clears. Could please someone point out what is the problem? Here is a snippet of my clumsy code:

void ADC_init(void){
	PWR->SVMCR |= (PWR_SVMCR_ASV);	//Removing Analog supply (VDDA) isolation, necessary in order to power ADC1 LDO up
	//**Internal reference buffer init
	RCC->APB3ENR |= (RCC_APB3ENR_VREFEN);	//Power the reference buffer
	__NOP();
	__NOP();
	RCC->SRDAMR |= (RCC_SRDAMR_VREFAMEN);	//Enable reference buffer during sleep mode
	//!!!__!!! Unsolder SB3 bridge on the board
	VREFBUF->CSR = 0;	//Reference out pin is now connected to the reference buffer and the buffer is disabled
	VREFBUF->CSR |= (3 << VREFBUF_CSR_VRS_Pos);	//2.5V reference selected
	VREFBUF->CSR |= VREFBUF_CSR_ENVR;	//Reference buffer enabled
	while(!(VREFBUF->CSR & VREFBUF_CSR_VRR)){}	//Waiting for the reference voltage to stabilize
	//**Powering up ADC1
	ADC12_COMMON->CCR |= (ADC_CCR_PRESC_3);	//ADC1 clock/8 (ADC1 clock must be less than 55MHZ)
	RCC->AHB2ENR1 |= (RCC_AHB2ENR1_ADC12EN);	//Enable ADC1
	ADC1->CR &= ~(ADC_CR_DEEPPWD);	//Exit ADC1 power down mode
	ADC1->CR |= ADC_CR_ADVREGEN;	//Enable ADC1 LDO
	while(!(ADC1->ISR & ADC_ISR_LDORDY)){}	//Wait for the LDO to get ready
	//**Extended calibration
	ADC1->CR |= ADC_CR_ADCALLIN;	//Set the linear calibration bit 
	ADC1->CALFACT &= ~(ADC_CALFACT_CAPTURE_COEF + 
        ADC_CALFACT_LATCH_COEF);	
	ADC1->CR |= ADC_CR_ADEN;	//Enabling ADC1
	while(!(ADC1->ISR & ADC_ISR_ADRDY)){}	//Waiting for the ADC1 to get ready
	ADC1->CR |= (0b1001 << ADC_CR_CALINDEX0_Pos); 
	ADC1->CALFACT2 = 0x00020000;
	ADC1->CALFACT |= ADC_CALFACT_LATCH_COEF;	
	ADC1->CALFACT &= ~(ADC_CALFACT_LATCH_COEF);
	ADC1->CR |= ADC_CR_ADCAL;	//Starting extended calibration
	while(ADC1->CR & ADC_CR_ADCAL){}	//GOT STUCK HERE
	while(ADC1->CR & ADC_CR_ADEN){}		//Making sure all is done
	//**
}

 The Extended calibration procedure starts at line 19. Thank you!

2 REPLIES 2
CMYL
ST Employee

Hi @Skfir​ 

can you check your STM32U5 chip revision ?

Note below page 996, table 227 (Table 227. ADC features(1) (continued)) says that " 2. The extended calibration mode is not supported on devices revision X."

Best Regards,

Younes

Hello Younes. There is no any "X" character on the chip, so I presume it is not the x revision... At least it seems so.