cancel
Showing results for 
Search instead for 
Did you mean: 

Battery status and sleep of stm32 processor

ZKURT.1
Senior

Hi, I am using stm32l0 series. my device will work with battery. I want to put it in sleep mode when it is not working so that the battery does not run out. Then I want to be able to see the battery status. But I have no idea how to do it. What I want to ask are:

1- How can I put my processor to sleep and wake it up?

2- How can I find out the battery status instantly?

Can you guide me?

2 REPLIES 2
TDK
Guru

There are examples for the low power modes in the CubeMX repository. Here is one:

https://github.com/STMicroelectronics/STM32CubeL0/blob/a7b74aed35ecb7baeadeb16107aa8fddb6823589/Projects/NUCLEO-L053R8/Examples/PWR/PWR_SLEEP/readme.txt

There are also examples for using the ADC, which can be used to read VBAT.

If you feel a post has answered your question, please click "Accept as Solution".
JBURB
ST Employee

Hi,

to achieve the lowest power consumption you could go in standby mode and rely on the independent watchdog to restart the device and perform a measure. In that case the power consumption is in the µA range. On wakeup you can measure the internal reference voltage using ADC, this will provide you the ratio between vrefint and VDDA/VDD.

If you just need to take care of a low battery, you could rely on PVD to wake up the device when VDD goes too low (7 levels available). In that case the device could enter stop mode with vrefint and PVD enabled.

Br,

Jacky

To give better visibility on the answered topics, please click on Accept as Solution on the reply which solved your issue or answered your question.