Skip to main content
LMore.2
Associate II
February 6, 2025
Question

Micro without VBAT pin - detect 'Main' or 'Backup' power

  • February 6, 2025
  • 1 reply
  • 917 views

I am starting a new project with the STM32L432. I need the RTC, but I don't understand how to manage the backup battery. This microcontroller doesn't have a dedicated VBAT pin. From what I understand, both the main power supply and the backup battery should be connected to the single power supply pin, and somehow the microcontroller should enter STANDBY mode when it detects that the main power supply is missing and is running on the backup battery to consume as little power as possible. Is that correct? But how does the microcontroller know which power source is supplying it, and how does it exit STANDBY mode when the main power supply returns? Is there a code and an example circuit diagram? Thank you

1 reply

Andrew Neil
Super User
February 6, 2025

@LMore.2 wrote:

I am starting a new project with the STM32L432. I need the RTC, but I don't understand how to manage the backup battery.


That was answered here:

https://community.st.com/t5/stm32-mcus-products/stm32c071-lqfp-32pin-need-some-help-for-first-time-design/m-p/766955/highlight/true#M271867

 


@LMore.2 wrote:

This microcontroller doesn't have a dedicated VBAT pin. From what I understand, both the main power supply and the backup battery should be connected to the single power supply pin,


Correct - as stated in @TDK's solution above

 


@LMore.2 wrote:

 But how does the microcontroller know which power source is supplying it, 


That will depend entirely on your power supply design.

You have to design your power supply so that it can switch between "main" and "backup" power sources, and give a signal to the STM32 indicating which one is currently in use.

There are chips which can do this, or you can make a discrete design.

 

PS:

Here's an example

 

AndrewNeil_3-1738839901296.png

The diodes will "choose" between the Main & Backup power.

The 'Power Sense' input to the STM32 allows it to "see" when Main power is available - if the Main power is not available, it can conclude that it must be running on Backup power.

 

Note that this has nothing really to do with the STM32; this is general to anything that has Main & Backup power - it's a power supply design issue, rather than an STM32 issue.

 

"Power Path" would be a good search term ...

A complex system that works is invariably found to have evolved from a simple system that worked.A complex system designed from scratch never works and cannot be patched up to make it work.
LMore.2
LMore.2Author
Associate II
February 6, 2025

Hi Andrew,

something like this one?

LMore2_0-1738841422052.png

PB0 (vbus_detect) report information when 5V is present or missing. If missing power from USB, MCU go in STANDBY, when power return MCU exit from sleep on 'PIN change'. Is it correct?. Any better schematic solution? Which chip can do this? Thanks

 

 

 

Andrew Neil
Super User
February 6, 2025

When the USB power is removed, that will apply battery power to the output of the U7 regulator - which may not be a good idea ...

What kind of battery is it? Does it need charging?

 

PS:

Here's an example of an IC power-path controller without battery charging:

https://www.analog.com/en/products/ltc4412.html

 

Adding discrete power-path control to a charger IC:

https://ww1.microchip.com/downloads/en/appnotes/01149c.pdf

 

Some charger ICs which include power-path control:

https://www.microchip.com/en-us/product/mcp73871

https://www.ti.com/lit/ug/sluu332/sluu332.pdf

A complex system that works is invariably found to have evolved from a simple system that worked.A complex system designed from scratch never works and cannot be patched up to make it work.