# Supercap charging circuit for RTC backup on STM32

I'm asking for a reliable/simple/cheap circuit for the VBAT section of a STM32 design, powered at VDD=3.3V, that will safeguard the built-in RTC (based on 32768 Hz Xtall) for like 10 days.

Based on C = t⋅I/ΔU, its looks like a 1F supercap will do (I'm taking t = 864000s, I = 1.2uA, ΔU = 1.1V, see below). I need a charging circuit that

• does not fry the supercap;
• does not fry the STM32 or prevent it from starting-up reliably (in particular: I do not see a specification for what happens when VDD=3.3V, VBAT<2V)
• does not add significantly to the STM32 power drain on VBAT;
• delivers proper VBAT quickly (0.2 s) including after full discharge, so that the RTC is always available soon after power-on reset;
• brings the supercap to near full charge soon enough after VDD is applied (perhaps 80% after 50 s), so that testing leaves a decent reserve.

The simplest I can think of is

Any criticism? Suggestion on the diode (perhaps a Schottky would be better) or other component? Alternative?

A most relevant section of the STM32(F100) data sheet is:

• Can the MCU accept the slow rise time on VBAT? Sep 16, 2014 at 10:52
• use a simple reset-monitor with a 3V threshold, which will hold the STM32 in reset until the VBAT line gets above 3V? Sep 16, 2014 at 11:11
• @fgrieu here is one by ON Semi which has typical 1.6uA quiescent current onsemi.com/pub_link/Collateral/NCP308-D.PDF EDIT: I found one for 150nA from TI ti.com/product/tps3839a09 Sep 16, 2014 at 11:50
• That's pretty much exactly the circuit that I use for STM32F407 RTC's Vbat. A 2K2 resistor works fine. I built the first one about 12 months ago, it has seen regular usage, and haven't had any problems with it or several others since. Sep 17, 2014 at 6:43
• So I'm way late to this question but found it because I plan to do a similar thing. The STM32 RTC works fine even with absolutely no Vbat present, in which case it runs off Vdd but will obviously lose state when Vdd is withdrawn. So I don't think you need to worry about the power-up sequence; it should be fine even if it took a couple of minutes for Vbat to come up as long as power was not lost before C1 is charged. I think you could reasonably put R1 in series with D1 instead of D1, but the 1.5uA*22R voltage loss under load is probably not relevant! And make D1 a Schottky; you want low Vf Jan 13, 2016 at 23:34

I find the circuit proposed in the picture perfectly fine.

Your worry about VBAT being lower than VCC is mostly mitigated by your diode right across those two rails. The power-on delay introduced by this diode would be so minuscule, that it is not worth considering.

Also, frying the supercap mostly depends on a particular type. Some of these have rather low allowed currents. This is mainly due to their high ESR. During current flow, this causes heating and damages the part. Some types don't have their maximum currents explicitly stated. In such case you need to rely on the ESR value and a wattage the package can reasonably deal with (sometimes also given in datasheets).

In the end, you adjust your $R_1$ to be a compromise between charging time and charging current. $22\Omega$ sounds good for starters. Keep in mind that you will almost never discharge to 0 volts. Also, charging current in this case drops exponentially, so you will only draw $100\tilde- 200 mA$ for a few seconds.

I've put together a circuit very similar to this in the past and I think, based on that, you'll be just fine with something like this, especially if it's not a critical application.

A couple of considerations: Check out your specific supercap to see how best to charge it. You'll want to avoid charging to too quickly if it has a high ESR. Also, certain types of supercaps hold more charge if you charge them slowly (I'm thinking of Panasonic's "Gold" electric double layer supercaps). Although you'll be losing more as you discharge your capacitor, these two considerations could mean it's worth increasing the value of R1. For maximum lifetime you'll have to balance these factors.

Also, I think a Schottky is a great idea if you're looking to get a little more charge out of your cap. The one thing I'd look out for there is that Schottky's can have horrendous reverse leakage current at high temperatures, so if this would be in an environment that gets toasty you could lose a lot of battery life.

does not fry the STM32 or prevent it from starting-up reliably (in particular: I do not see a specification for what happens when VDD=3.3V, VBAT<2V)

Looking at the Device power supply scheme of STM32F3XX you can see there is a power switch. I guess it's all the same for all the ST32 families, but you better check It's controlled by Vdd, if it's present Vbat is only "monitorable" with ADC but does not take any action for what concerns RTC etc. So just for this question, I think with your circuit you can play safe

The STM32G070CB/KB/RB datasheet chapter 3.7.6 VBAT operation writes: "An internal circuit for charging the battery on VBAT pin can be activated if the VDD voltage is within a valid range."

So you might not need the diode if you activate this feature.

• If you read the datasheet, the F100 which this old question is about does not have this feature, so talking about features that the G070 has is useless. Sep 26 at 7:22