Page 1 of 1

STM32L071 getting stuck in adc initialization

Posted: Wed Apr 20, 2022 10:36 pm
by rafaeldantas
Hi all!

I'm using STM32L071 chip and after enabling the ADC(ADCv1) my code get stuck at adc_lld_init() function, digging a bit I filtered that it's being locked in the calibration procedure in the following code:

Code: Select all

 ADC1->CR |= ADC_CR_ADCAL;
 while (ADC1->CR & ADC_CR_ADCAL)
    ;


Probably my calibration flag is not being reset by HW. Anyone have faced this issue before and/or have adc working properly for this chip?

Appreciate any help.

Re: STM32L071 getting stuck in adc initialization

Posted: Thu Apr 21, 2022 12:40 am
by Giovanni
Hi,

Which is the ADC clock source? look into your mcuconf.h.

ChibiOS version?

Giovanni

Re: STM32L071 getting stuck in adc initialization

Posted: Thu Apr 21, 2022 3:26 pm
by rafaeldantas
The current ADC clock source is STM32_ADC_CKMODE_ADCCLK and I'm at commit 14935 (ver20.3.1 I guess) https://osdn.net/projects/chibios/scm/svn/commits/14935

Rafael

Re: STM32L071 getting stuck in adc initialization

Posted: Thu Apr 21, 2022 5:07 pm
by Giovanni
Hi,

Could you try STM32_ADC_CKMODE_PCLK_DIV2 and see if it makes past that point?

BTW, that revision is very old and unsupported, I recommend using a recent trunk or a released version, lots of bugs have been fixed, some in that ADC driver too.

Giovanni

Re: STM32L071 getting stuck in adc initialization

Posted: Thu Apr 21, 2022 5:37 pm
by rafaeldantas
Hi,

Tried the change in ADC clock to STM32_ADC_CKMODE_PCLK_DIV2 and still getting locked at that same point, I will try the update for a recent released/trunk version and let you know the result... Thanks.

Rafael