Page 2 of 3

Re: STM32G071 ADC calibration issue?

Posted: Sun Jun 27, 2021 9:37 pm
by Dzarda
Hi, I'm having probably the same issue on the L072. Happens in v20.3.3 and v21.6.1.

ADCv1/hal_adc_lld.c:

Code: Select all

  ...
  /* Regulator enabled and stabilized before calibration.*/
  adc_lld_vreg_on(ADC1);

  ADC1->CR |= ADC_CR_ADCAL;
  while (ADC1->CR & ADC_CR_ADCAL) ///// Forever young
    ;
  ADC1->CR = 0;
  rccDisableADC1();
}


Peripheral while stuck:

adc.png


Tried both STM32_ADC_CKMODE_PCLK_DIV4 and STM32_ADC_CKMODE_ADCCLK

Re: STM32G071 ADC calibration issue?

Posted: Mon Jun 28, 2021 7:10 am
by Giovanni
Hi,

I tested ADC initialization on an STM32L053 Nucleo board, it does not get stuck in there.

Do you have?

Code: Select all

#define STM32_ADC_CLOCK_ENABLED             TRUE
...
#define STM32_ADC_ADC1_CKMODE               STM32_ADC_CKMODE_ADCCLK


What compiler are you using?

Giovanni

Re: STM32G071 ADC calibration issue?

Posted: Mon Jun 28, 2021 2:20 pm
by Dzarda
Thank you for the effort Giovanni,
Using GCC 9.3.1

I'm having trouble comprehending the behaviour. ADC clock is enabled but the ENR stays at zero...

adc2.png

Re: STM32G071 ADC calibration issue?

Posted: Mon Jun 28, 2021 2:30 pm
by Giovanni
I don't know, is it still zero while it is running in the loop?

You may try to change it from the debugger too.

Giovanni

Re: STM32G071 ADC calibration issue?

Posted: Mon Jun 28, 2021 3:14 pm
by Dzarda
I feel like a fool, it ADCEN is now set and calibration succeeds... No idea what fixed it. Now trying to backtrack.

Re: STM32G071 ADC calibration issue?

Posted: Wed Jun 30, 2021 5:00 pm
by Dzarda
Previous problem with ADCEN not turning on and CAL forever loop is not reproducible.

But had to switch clock from STM32_ADC_CKMODE_PCLK_DIV4 to STM32_ADC_CKMODE_ADCCLK in order to get samples.

Re: STM32G071 ADC calibration issue?

Posted: Wed Jun 30, 2021 5:23 pm
by Giovanni
Hi,

Re-opening this topic because there is still the clock problem to be investigated, TBD.

Giovanni

Re: STM32G071 ADC calibration issue?

Posted: Fri Mar 18, 2022 10:40 am
by Giovanni
bumping as self-reminder

not sure if this is still applicable, need to check

Re: STM32G071 ADC calibration issue?

Posted: Thu Aug 25, 2022 8:10 am
by FXCoder
Anyone who had G0 ADC issues should now re-test with the latest from trunk.

Re: STM32G071 ADC calibration issue?

Posted: Sun Sep 18, 2022 8:59 am
by Giovanni
Can anybody confirm if this can be closed with latest changes?

Giovanni