Author Topic: STM32F042x RTC without VBAT and LSE  (Read 3133 times)

0 Members and 1 Guest are viewing this topic.

Offline cryptonTopic starter

  • Contributor
  • Posts: 30
  • Country: ee
STM32F042x RTC without VBAT and LSE
« on: September 07, 2017, 01:58:17 pm »
Hello!

Attention: this post might need extended time to delve into.  :-[

Perhaps anyone of you has experience implementing STM32's RTC, that Doesn't have low frequency crystal option?

I want to keep logging real time clock when the main supply (12V) is turned off - nothing else (no comms, no bells and whistles).
I do have some other alternatives (such as separate RTC chip, or another package or family of STM), but I don't want to jump to any other solution without knowing how much more complex or expensive the solution becomes using this STM. So I would like to understand the metrics and also learn something along the way, when things are limited.

I have currently selected STM32F042G6U6 (UFQFPN28) which doesn't have dedicated VBAT pin for RTC use - thus also no LSE crystal possibility.
I am using this particular STM and package merely because I'm using it only as a CAN tranceiver (to USART), it's small and cheap!

Absence of VBAT and LSE leads to many related issues, for which I have some ways to address them, but I am not sure about some details.

In general:
1) I can only use HSE for the RTC
2) I have to make external circuitry to power the chip from coin cell when main power is off.
3) Since I use HSE, I can only use Sleep Mode as the low power mode (otherwise the crystal won't work) and thus power consumption is rather high to maintain decent life time.

So all in all I want to confirm my assumptions and worries and maybe I have to look for another STM (f.i with 48pins that has VBAT)...



In more detail:
1) I haven't been able to figure out, is it better to use as low frequency crystal as possible (4MHz) or the highest possible (32MHz) to get 1Hz RTC frequency?

a) This STM has fixed prescaler, until it becomes RTC_CLK - I understand I can then further divide it with registry values.
348833-0

In appnote AN3371:
Quote
"Increasing the value of the asynchronous prescaler reduces the power consumption". So it MIGHT be better to use some higher frequency crystal with low load capacitance requirements, so I could divide it first hand with higher prescaler...? Then again, driving the crystal faster should consume more..

Lets say Asynch predivider set to 125 (it is very high so, consumption should be low) and Synchronous predivider to 1000. Would this be correct ?



2) Powering the chip, when main supply is off.

There are several ways. In general I would be using diode OR-ing from 3V3 rail and measuring my main 12V supply from resistor divider to either get interrupt from sudden power loss or measure it via ADC if it get's too low so STM can do last minute operations - like switch to coin cell backup power.

But for actual wiring I am not sure:
a) Can I just get away with powering VDD pin only?

- It seems that the RTC and backup registers are connected only through this rail. So I should be able to get away powering only this rail

BUT

Quote
"The VDDA voltage level must be always greater or equal to the VDD voltage level and must be established first.."

Bummer. So am I correct that I still have to power VDD ?
I would definitely not power VDDIO2 from the coin cell (I think I can decrease consumption with that).



3) I can run the RTC in low power mode Sleep mode only and in that configuration [ HSE Bypass = true and PLL=off, 8MHz clock assumption (peripheral disabled)], the consumption could be up to 0.9mA IDD and 5.5uA IDDA.
I can fit only 11mAh coin cell, thus leaving me around like what... 11000uAh / 905.5uA = 12h of expected lifetime.
I currently don't see any other possble way to decrease this consumption with HSE RTC....


So all in all I want to confirm my assumptions and worries and maybe I have to look for another STM (f.i with 48pins that has VBAT)...

Thank you, if you're reached so far. Any comments would be very appreciated!


  [1]: http://www.st.com/content/ccc/resource/technical/document/datasheet/52/ad/d0/80/e6/be/40/ad/DM00105814.pdf/files/DM00105814.pdf/jcr:content/translations/en.DM00105814.pdf
« Last Edit: September 08, 2017, 07:22:50 am by crypton »
 

Offline colorado.rob

  • Frequent Contributor
  • **
  • Posts: 419
  • Country: us
Re: STM32F042x RTC without VBAT and LSE
« Reply #1 on: September 08, 2017, 03:39:37 am »
If you are just doing usart to can, why do you need to remain powered on?  Just power off when you lose 12v.
 

Online JPortici

  • Super Contributor
  • ***
  • Posts: 3452
  • Country: it
Re: STM32F042x RTC without VBAT and LSE
« Reply #2 on: September 08, 2017, 06:00:06 am »
what do you need the RTC for? i don't see a reason why you would
« Last Edit: September 08, 2017, 06:01:58 am by JPortici »
 

Offline cryptonTopic starter

  • Contributor
  • Posts: 30
  • Country: ee
Re: STM32F042x RTC without VBAT and LSE
« Reply #3 on: September 08, 2017, 07:23:10 am »
Aah, my apologies, I probably didn't explain that too well (or at all  |O)

RTC - well I need this to keep/count real time when the main supply goes off.

There has nothing to do with the communications, I merely tried to explain Why I use that certain package (not like 48 pin package which does have VBAT pin for instance) - size is important and it was dirt cheap for CAN to USART interface.

BUT I want to count time for timestamps, like when the main supply goes off and on and for many other logging reasons.

I would like to assess those details to see how complicated or more expensive that would become, I do have thought of other alternatives (separate RTC chip, using some other package or other series STM), but I don't want to jump to any other solution without knowing the metrics behind this one.

Hope this clarifies. Also added this to my original post.

 
 

Offline colorado.rob

  • Frequent Contributor
  • **
  • Posts: 419
  • Country: us
Re: STM32F042x RTC without VBAT and LSE
« Reply #4 on: September 08, 2017, 12:46:15 pm »
In that case, use an LSE oscillator.  Find an L0, L1 or L4 part.  The STM32L432KC should be able to do what need.  I just mention that part because it is small and I am familiar with it. No matter what I would use an L part over an F part for new designs.  I'd assume that there are L0 parts that will do what you need.
 
The following users thanked this post: crypton

Offline krho

  • Regular Contributor
  • *
  • Posts: 222
  • Country: si
Re: STM32F042x RTC without VBAT and LSE
« Reply #5 on: September 08, 2017, 07:54:31 pm »
According to CubeMX there is no L0 part with CAN. I know for certain that L4 parts have it, but it won't be 1$@100pcs
 

Offline cryptonTopic starter

  • Contributor
  • Posts: 30
  • Country: ee
Re: STM32F042x RTC without VBAT and LSE
« Reply #6 on: September 19, 2017, 08:40:48 am »
[..] No matter what I would use an L part over an F part for new designs.

Could you emphasize on Why ? Just because it's later series; it tends to be more available ... ?

OK, I'll look into some other series chip, cause separate RTC chip seems to get more costly.
 

Offline lucazader

  • Regular Contributor
  • *
  • Posts: 221
  • Country: au
Re: STM32F042x RTC without VBAT and LSE
« Reply #7 on: October 16, 2017, 05:26:23 am »
You could change to the STM32F042C4 Part.

The C4Tx variant is a 48LQFP version of the part you are using. it has pins for LSE and for Vbat for the RTC.
It does cost slightly more ($2.12 USD vs $1.77 USD in the mentioned 100pcs volume), But for that extra cost you get to have a much simpler design and easier time software wise. And at the small volumes of 100 devices this trade off is probably quite worth it.

If you need a slightly smaller variant then look at the STM32F042C4Ux part it is a 48UFQFPN footprint so it has no leads. so is only 7x7mm

Anyway that's my 2c
 

Offline Jeroen3

  • Super Contributor
  • ***
  • Posts: 4068
  • Country: nl
  • Embedded Engineer
    • jeroen3.nl
Re: STM32F042x RTC without VBAT and LSE
« Reply #8 on: October 16, 2017, 06:03:43 am »
Or you get like an STM32F072. You can make USB to CAN the size of a thumb drive.
It even has "crystal-less USB" if you dare to go that route.
« Last Edit: October 16, 2017, 06:06:46 am by Jeroen3 »
 


Share me

Digg  Facebook  SlashDot  Delicious  Technorati  Twitter  Google  Yahoo
Smf