cancel
Showing results for 
Search instead for 
Did you mean: 

How to get ADC to work after STOP0 Mode STM32WB5

EAdam.2
Associate

Using an STM32WB5. Using the ADC for some slow periodic measurements. Its working fine. Then added in STOP0:

LL_PWR_SetPowerMode( LL_PWR_MODE_STOP0 )

The ADC does not recovered on STOP exit. Value of:

hadc->Instance->ISR

is causing a hang in:

HAL_ADC_PollForConversion() in stm32wbxx_hal_adc.c

Value is 0x03 whereas before STOP mode it was 0x0F.

Tried to do a

HAL_ADC_DeInit()

Followed by:

MX_ADC1_Init()

either before going into STOP mode or after. Either way results in ISR goes to 0 and still hangs. 

Doing a Sleep,

LL_LPM_EnableSleep()

instead of a STOP and ISR value is good and no hangs.

Any suggestions for getting STOPx to work with ADC?

2 REPLIES 2
Remy ISSALYS
ST Employee

Hello,

In the STOP0 mode, ADC clock is stopped, so ADC cannot be used. General recommendation here is disable the ADC before going to the STOP0 mode. If ADC is not disabled correctly, it will consume the current, so it make sense disable correctly before going to STOP0 mode.

Then restart the ADC as usual after the exit from STOP0.

Best Regards

Thanks for the recommendations but I've tried that.

I am doing:

HAL_ADC_DeInit()

before entering STOP0. Then:

MX_ADC1_Init()

after exiting STOP0.

But ISR in:

HAL_ADC_PollForConversion()

is 0x0. So that didn't help.

Is HAL_ADC_DeInit() then MX_ADC1_Init() the correct functions to use?