1
\$\begingroup\$

I am measuring the voltage with the STM32L011K4 MCU. When the processor goes into low power sleep mode, I start reading the wrong values from an ADC. I think the reason is caused by the system clock settings. Because in low power mode only the LSI clock is running and the ADC is working with the MSI clock. So when the system clock changes, the ADC starts reading meaningless values. How to set the ADC before and after low power mode?

\$\endgroup\$
1
\$\begingroup\$

Because in low power mode only the LSI clock is running and the ADC is working with the MSI clock.

Actually, in low power mode the system runs on MSI, and the ADC runs by default on HSI16. You can however change the latter with the CKMODE[1:0] bits of the ADC_CFGR2 register. See 13.4.4 ADC clock (CKMODE, PRESC[3:0], LFMEN) in the Reference Manual.

enter image description here

\$\endgroup\$

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.