Skip to main content
HKowa.1
Associate
May 21, 2023 5:32 PM UTC
Question

Can't get ADC to work in HeartRate example on STM32WB15 when CFG_LPM_SUPPORTED is set to 1.

I've modified basic HeartRate project to run an ADC inside of the task. However this results in adc always returning 0. Sometimes whole application hangs. However when CFG_LPM_SUPPORTED is set to 0. Everything works fine. I've already created github issiue and suposedly HAL is to blame. Any input would be helpfull.

This topic has been closed for replies.

2 replies

HKowa.1
HKowa.1Author
Associate
May 21, 2023 5:32 PM UTC
ST Employee
Jul 21, 2023 2:34 PM UTC

Hello @HKowa.1

It looks like the HSI clock is not enabled when the application is waking-up up from stop mode. 

To confirm, you can either enable the HSI clock in your HAL_ADC_MspInit function (using __HAL_RCC_HSI_ENABLE())

or you can try to use another clock source for the ADC (PeriphClkInitStruct.AdcClockSelection= RCC_ADCCLKSOURCE_SYSCLK;)

Best regards