STM32G071 ADC calibration issue? Topic is solved

Report here problems in any of ChibiOS components. This forum is NOT for support.
Dzarda
Posts: 21
Joined: Sat Feb 28, 2015 2:28 pm
Has thanked: 7 times
Been thanked: 5 times

Re: STM32G071 ADC calibration issue?

Post 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
User avatar
Giovanni
Site Admin
Posts: 14891
Joined: Wed May 27, 2009 8:48 am
Has thanked: 1202 times
Been thanked: 996 times

Re: STM32G071 ADC calibration issue?

Post 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
Dzarda
Posts: 21
Joined: Sat Feb 28, 2015 2:28 pm
Has thanked: 7 times
Been thanked: 5 times

Re: STM32G071 ADC calibration issue?

Post 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
User avatar
Giovanni
Site Admin
Posts: 14891
Joined: Wed May 27, 2009 8:48 am
Has thanked: 1202 times
Been thanked: 996 times

Re: STM32G071 ADC calibration issue?

Post 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
Dzarda
Posts: 21
Joined: Sat Feb 28, 2015 2:28 pm
Has thanked: 7 times
Been thanked: 5 times

Re: STM32G071 ADC calibration issue?

Post by Dzarda »

I feel like a fool, it ADCEN is now set and calibration succeeds... No idea what fixed it. Now trying to backtrack.
Dzarda
Posts: 21
Joined: Sat Feb 28, 2015 2:28 pm
Has thanked: 7 times
Been thanked: 5 times

Re: STM32G071 ADC calibration issue?

Post 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.
User avatar
Giovanni
Site Admin
Posts: 14891
Joined: Wed May 27, 2009 8:48 am
Has thanked: 1202 times
Been thanked: 996 times

Re: STM32G071 ADC calibration issue?

Post by Giovanni »

Hi,

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

Giovanni
User avatar
Giovanni
Site Admin
Posts: 14891
Joined: Wed May 27, 2009 8:48 am
Has thanked: 1202 times
Been thanked: 996 times

Re: STM32G071 ADC calibration issue?

Post by Giovanni »

bumping as self-reminder

not sure if this is still applicable, need to check
User avatar
FXCoder
Posts: 403
Joined: Sun Jun 12, 2016 4:10 am
Has thanked: 188 times
Been thanked: 134 times

Re: STM32G071 ADC calibration issue?

Post by FXCoder »

Anyone who had G0 ADC issues should now re-test with the latest from trunk.
User avatar
Giovanni
Site Admin
Posts: 14891
Joined: Wed May 27, 2009 8:48 am
Has thanked: 1202 times
Been thanked: 996 times

Re: STM32G071 ADC calibration issue?

Post by Giovanni »

Can anybody confirm if this can be closed with latest changes?

Giovanni
Post Reply