STM32L071 getting stuck in adc initialization

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

Moderators: RoccoMarco, barthess

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

STM32L071 getting stuck in adc initialization

Postby rafaeldantas » Wed Apr 20, 2022 10:36 pm

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

Re: STM32L071 getting stuck in adc initialization

Postby Giovanni » Thu Apr 21, 2022 12:40 am

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

Postby rafaeldantas » Thu Apr 21, 2022 3:26 pm

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

Re: STM32L071 getting stuck in adc initialization

Postby Giovanni » Thu Apr 21, 2022 5:07 pm

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

Postby rafaeldantas » Thu Apr 21, 2022 5:37 pm

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


Return to “STM32 Support”

Who is online

Users browsing this forum: No registered users and 11 guests