2022-01-18 11:07 PM
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?
2022-01-19 06:45 AM
There are examples for the low power modes in the CubeMX repository. Here is one:
There are also examples for using the ADC, which can be used to read VBAT.
2022-01-19 07:08 AM
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.