Skip to main content
Tarloth
Associate
November 2, 2022
Question

How to use RTC with battery backup in a 32 pin package?

  • November 2, 2022
  • 8 replies
  • 3841 views

Hi, I did never ask in this forum but used STM32 MCUs for years. Allways I use 48+ pin parts and all work like a charm. I'm very happy with the family and did stop to use other Cortex brands years ago. 

In 2019 I did work in a project that did involves 2k units and use STM32F042K6T6. All working ok, but to overcome the future chips shortage I bought in excess of units to use in the next project that implies the use of RTC calendar and backup registers. COVID and other issues delayed the project until last month that have had the time to start it. When I was finishing the design, last week I notice that parts with less than 36 pins din't have VBat. 

Datasheet announces RTC backuped with VBat as a feature of the entire family and NOTHING say's about "in packages less than 48 pins this function it's not available". When I check with other stm32F devices in 32 or 20 pin packages the same occurs, NO Vbat.

Exist any alternative to overcome this issue? I'm not really comfortable buying a lot of more expensive parts only to have the battery backuped RTC that is announced for all the packages in the datasheet. By the way, what it's the sense of have a full featured RTC even with backup registers if I never can use it when VDD is disconnected? I need to reprogram the device every time that power is off?

Thanks in advance and sorry for my bad english

This topic has been closed for replies.

8 replies

Tesla DeLorean
Guru
November 3, 2022

No pins for OSC32 either.

On the L series the VBAT was absent too, the idea being it's already battery powered. On those you go into STANDBY to cut power usage,

Tips, Buy me a coffee, or three.. PayPal VenmoUp vote any posts that you find helpful, it shows what's working..
Tarloth
TarlothAuthor
Associate
November 4, 2022

Tesla, thanks for your answer. Yes, but I need to add a battery and a charger circuit! I not need a circuit that works on battery, only need a RTC working!. Nothing it's said in the datasheet about this limitation. Osc32 it's not a problem to me, I can calibrate internal oscillator with good aproximation for this aplication using external crystall when vdd it's present. By the way, CAN + USB not working together either

Tarloth
TarlothAuthor
Associate
November 24, 2022

Any idea? I'm pretty sure that this omission in the data sheet is false advertising from ST. Other features that are not present with less than 48 pins are clearly and unambiguously noted. I have used thousands of ST units with complete success, it is a shame to throw so many years of trust to the floor for this bad move by the company.

waclawek.jan
Super User
November 24, 2022

I feel your pain but face it. The VBAT pad is simply not brought out to a pin, and there's no way to undo that.

JW

Tarloth
TarlothAuthor
Associate
November 24, 2022

Perfect, you answer the obvious here. Vbat isn't at any pin, congratulations, I say that in the first post.

Then my question is: How I can use the RTC when VDD it's off? 

Datasheet says that RTC and register backup is a feature of all the parts, not only the 48 pin part! How is connected internally the Vbat pin when it's no externally connected? How can maintain working the oscillator and all the devices in the VBAT domain (and only those internal devices)? They are simply disconnected? Or internally vbat it's connected to VDD and I need to OR'ing the VDD with a battery and detect when VDD it's off? I need to put ideal diodes to avoid power losses and take off the filter capacitors out of these to avoid battery discharge? 

I asking for a valid and probed ST engineering answer to overcome this issue. NOBODY AT ST ANSWER OR SAY NOTHING. I insist, nothing in the datasheet notice about this issue in low pin count packages but it do in other internal features as Vssa, less SPI, Less I2C, etc, features that are missing in low pin packages! If the datasheet would said "Available only in Vbat pin packages" then there would be no problem at all, customer buy this part to use RTC only with VDD.

Peter BENSCH
Technical Moderator
November 25, 2022

I can completely understand that you are dissatisfied in this case, however the community relies primarily on mutual help between users (see About Community, General Use).

In addition to the community, you can also get direct and personal support via Online Support OLS, alternatively you can contact your local distributor or the nearest ST office.

Regards

/Peter

In order 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.
Andreas Bolsch
Lead III
November 25, 2022

See AN4718. Except for two Schottky diodes, it's purely a software issue. You won't get down to the very same current draw as with VBAT pin, but still acceptable.

Tarloth
TarlothAuthor
Associate
November 25, 2022

Andreas, THANKS for your answer. I did read this application note, similar to all solutions in internet for MCU's without dedicated Vbat pin, and would be nice that exist the same AN for F series for few reasons, first of all it's that L series it's designed to be used in a battery environment and F series not.

The C's to filter VDD in STM32F series drain from battery, if it is connected to VDD's, almost as much current than the RTC. I did measure with 5x100nf+2x4.7Uf+1uF murata X53 a total drainage of 1.4 uA, typical RTC drainage at 3.3 volt it's 1uA. 

This reduce the battery life to half in the better case. It's acceptable? Yeeeees, but the extra coin cell in the next year cost more than change to an LQFP48 package and use specific Vbat pin. 

If I add the cost and PCB space of the diodes, using a 32 pin package the situation gets worse. If I need to control a transistor to connect or disconnect coin cell from MCU use the same or more pins that "I did gain" when st did replaced the Vbat pin for a port pin. In all cases it's preferable to buy a 48 pin package. 

For all of this I ask to ST that warning in the datasheet that RTC and register backup it's only available in 48 pin packages with Vbat pin.

Thanks for your answer, was more constructive than others, Oring the external VDD and the coin cell was my first impulse but in a cost analysis it's better that I buy new MCU batch with 48 pin package and maybe use this 32 pin units in any project in the future that not use RTC.

THANKS AGAIN

waclawek.jan
Super User
November 25, 2022

> If the datasheet would said "Available only in Vbat pin packages"

Wouldn't it be strange the datasheet to say "VBAT pin is available only in VBAT pin packages"? :) I agree that documentation can always be improved, but in this case, as you remarked yourself, RTC is still in fact usable albeit in a limited fashion. And, as Clive pointed out above, in the 32-pin (and less) packages, you don't have OSC32 pins either, so you can't use RTC in its full capacity anyway.

Coincidentally, we've had a thread here recently, where a similarly frustrated user complained that only a limited subset of bootloader options is available on the lower-pin-count deiveces, and also those are in conflict with similarly limited options for peripherals connections. While some such limitations are obvious - e.g. if all pins for a peripheral are available only in higher-pin-count packages - some are rather convoluted - e.g. if *most* pins for a peripheral are available on the lower-pin-count package but those are not sufficient for *every* possible configuration of a peripheral. What to do in that case?

What could be done instead of writing a bunch of "this and that does not work in this and that peripheral" - which will lead to DS bloat and half-truths such as "there's no FSMC in 'F4 below 144 pins" (which is not true, FSMC is still there just not usable for its most common purpose - ST corrected that one later but there was discussion around it) - it might perhaps be better to write an appnote discussing issues arising from omitting pins in depth, perhaps with a bunch of examples like this one; and the add link to that appnote to every smaller-than-maximum-pin-count STM32's web folder. @Imen DAHMEN​  , can such "broad request" be brought up in some way?

> How is connected internally the Vbat pin when it's no externally connected?

It is probably left unconnected, but in fact it does not matter, both ways the result is the same: if there's no VDD, there's no VBAT; and if there's valid VDD, VBAT is internally switched to VDD exactly as it is when VBAT pin is present.

So, in both cases, you need to keep VDD powered, if you want RTC to run.

JW

Tarloth
TarlothAuthor
Associate
November 25, 2022

"Wouldn't it be strange the datasheet to say "VBAT pin is available only in VBAT pin packages"?"

Sorry for my bad english, I refer to that several time and you deliberately misrepresents what I said. The complete phrase it's " RTC and backup registers are available only in Vbat pin packages".

" And, as Clive pointed out above, in the 32-pin (and less) packages, you don't have OSC32 pins either, so you can't use RTC in its full capacity anyway."

I answer that, LSI it's in VDDA domain that can be energized without Vdd. "The VDDA voltage level must be always greater or equal to the VDD voltage"

"where a similarly frustrated user complained that only a limited subset of boot loader options is available on the lower-pin-count devices, and also those are in conflict with similarly limited options for peripherals connections."

ALL OF THAT have warnings in the datasheets.

"there's no FSMC in 'F4 below 144 pins"

AGAIN, that's it's warned !!!! In the datasheet, FOR EXAMPLE https://www.st.com/resource/en/datasheet/stm32f405rg.pdf Table 2 WARNING for the R package NO FSMC and in note 1 of the same table SAYS "For the LQFP100 and WLCSP90 packages, only FSMC Bank1 or Bank2 are available...."

CATCH MY POINT?

When a FEATURE announced to ALL the family it's NOT present a appropriate warning CLEARLY mark that some device it's not present or crippled!

" it might perhaps be better to write an appnote discussing issues arising from omitting pins in depth, perhaps with a bunch of examples like this one; and the add link to that appnote to every smaller-than-maximum-pin-count STM32's web folder. @Imen DAHMEN (ST Employee)​ , can such "broad request" be brought up in some way?"

Finally!!!! Some common sense here and not unconditional brand defense! Bravo! Please, ST, warning this in all less than 48 pin packages and ALL would be ok, I use the part when I not need RTC without VDD.

"It is probably left unconnected, but in fact it does not matter,"

If it's connected I can use it to perhaps (I not verify that) measure the VDD voltage.

waclawek.jan
Super User
November 25, 2022

One more thing, which you maybe overlooked:

> Osc32 it's not a problem to me, I can calibrate internal oscillator with good aproximation for this aplication

No, you can't use any of the internal oscillators in VBAT mode. Only LSE works in VBAT mode.

0693W00000WJVqsQAH.png 

JW

Tarloth
TarlothAuthor
Associate
November 25, 2022

Jan, I did use thousands of units of STM32 MCU with more than 64 pin with RTC and Vbat, and use 2 thousand of the 32 pin in an application that not use RTC, I carefully read datasheets and design in function of that. Allways the missing features are warning in the family table description.

I not bother with OSC32 when I see that are not present in less than 48 pin packages, because a "friend", a designer of another company, when can't use (cost issues) a extra crystal, connect VDDA to VBAT (with their schottky's) and he disconnect by software all the vdda domain but the LSI (and I think that IWDG is on too). I never used it but seems correct. I did see their proyects working, when I will have some time in the future I will change some development board to do this and check how he do this.