cancel
Showing results for 
Search instead for 
Did you mean: 

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

HKowa.1
Associate

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.

2 REPLIES 2
HKowa.1
Associate
A.RIOTTE
ST Employee

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