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
Location: Brno, Czech Republic
Has thanked: 7 times
Been thanked: 5 times

Re: STM32G071 ADC calibration issue?  Topic is solved

Postby Dzarda » Sun Jun 27, 2021 9:37 pm

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: 14444
Joined: Wed May 27, 2009 8:48 am
Location: Salerno, Italy
Has thanked: 1074 times
Been thanked: 921 times
Contact:

Re: STM32G071 ADC calibration issue?

Postby Giovanni » Mon Jun 28, 2021 7:10 am

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
Location: Brno, Czech Republic
Has thanked: 7 times
Been thanked: 5 times

Re: STM32G071 ADC calibration issue?

Postby Dzarda » Mon Jun 28, 2021 2:20 pm

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: 14444
Joined: Wed May 27, 2009 8:48 am
Location: Salerno, Italy
Has thanked: 1074 times
Been thanked: 921 times
Contact:

Re: STM32G071 ADC calibration issue?

Postby Giovanni » Mon Jun 28, 2021 2:30 pm

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
Location: Brno, Czech Republic
Has thanked: 7 times
Been thanked: 5 times

Re: STM32G071 ADC calibration issue?

Postby Dzarda » Mon Jun 28, 2021 3:14 pm

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
Location: Brno, Czech Republic
Has thanked: 7 times
Been thanked: 5 times

Re: STM32G071 ADC calibration issue?

Postby Dzarda » Wed Jun 30, 2021 5:00 pm

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: 14444
Joined: Wed May 27, 2009 8:48 am
Location: Salerno, Italy
Has thanked: 1074 times
Been thanked: 921 times
Contact:

Re: STM32G071 ADC calibration issue?

Postby Giovanni » Wed Jun 30, 2021 5:23 pm

Hi,

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

Giovanni

User avatar
Giovanni
Site Admin
Posts: 14444
Joined: Wed May 27, 2009 8:48 am
Location: Salerno, Italy
Has thanked: 1074 times
Been thanked: 921 times
Contact:

Re: STM32G071 ADC calibration issue?

Postby Giovanni » Fri Mar 18, 2022 10:40 am

bumping as self-reminder

not sure if this is still applicable, need to check

User avatar
FXCoder
Posts: 384
Joined: Sun Jun 12, 2016 4:10 am
Location: Sydney, Australia
Has thanked: 180 times
Been thanked: 130 times

Re: STM32G071 ADC calibration issue?

Postby FXCoder » Thu Aug 25, 2022 8:10 am

Anyone who had G0 ADC issues should now re-test with the latest from trunk.

User avatar
Giovanni
Site Admin
Posts: 14444
Joined: Wed May 27, 2009 8:48 am
Location: Salerno, Italy
Has thanked: 1074 times
Been thanked: 921 times
Contact:

Re: STM32G071 ADC calibration issue?

Postby Giovanni » Sun Sep 18, 2022 8:59 am

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

Giovanni


Return to “Bug Reports”

Who is online

Users browsing this forum: No registered users and 7 guests