Skip to main content
November 29, 2022
Solved

STM32H743, ADC_CAL flag is not cleared

  • November 29, 2022
  • 2 replies
  • 870 views

Hello.

I try to use ADC with STM32H743II. The problem is that the calibration flag is not reset.

//ADC1
RCC->AHB1ENR |= RCC_AHB1ENR_ADC12EN;
 
//Exit DEEP Sleep
ADC1->CR = 0;
while(ADC1->CR != 0)
{
 ADC1->CR = 0;
};
 
//Enable LDO
ADC1->CR = ADC_CR_ADVREGEN;
//dump delay, for LDO startup
for(uint32_t i=0; i<0x10000; i++){
 __NOP();
 };
 
//Start CAL
ADC1->CR |= ADC_CR_ADCAL;
while(ADC1->CR & ADC_CR_ADCAL){__NOP();}; //Program stop here forever

This code worked in another project.

If remove the calibration, then the ADC works (I use 2 regular channel with DMA).

Why can't the flag ADC_CR_CAL be reset?

This topic has been closed for replies.
Best answer by waclawek.jan

Make sure you have selected a valid clock first.

JW

2 replies

waclawek.jan
waclawek.janBest answer
Super User
November 30, 2022

Make sure you have selected a valid clock first.

JW

November 30, 2022

You're right! I checked the clock again, it turned out that one divider was not correctly selected.

It worked now, thanks a lot.