STM32L071 getting stuck in adc initialization

ChibiOS public support forum for topics related to the STMicroelectronics STM32 family of micro-controllers.

Moderator: RoccoMarco

Post Reply
rafaeldantas
Posts: 3
Joined: Wed Apr 20, 2022 10:08 pm
Been thanked: 1 time

STM32L071 getting stuck in adc initialization

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

Re: STM32L071 getting stuck in adc initialization

Post by Giovanni »

Hi,

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

ChibiOS version?

Giovanni
rafaeldantas
Posts: 3
Joined: Wed Apr 20, 2022 10:08 pm
Been thanked: 1 time

Re: STM32L071 getting stuck in adc initialization

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

Re: STM32L071 getting stuck in adc initialization

Post 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
rafaeldantas
Posts: 3
Joined: Wed Apr 20, 2022 10:08 pm
Been thanked: 1 time

Re: STM32L071 getting stuck in adc initialization

Post 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
Post Reply