cancel
Showing results for 
Search instead for 
Did you mean: 

STM32 RTC Issue

harish2
Associate
Posted on July 02, 2012 at 15:20

I am using STM32 Microcontroller in my product. I am using 32.768 KHz as RTC Crsytal. At the Tamper/RTC pin (pin 2) ideally i should get 512 Hz for calibration . But i am getting 976 Hz so instead of 1 sec update i am getting 2 sec update ? What is the cause of this issue

5 REPLIES 5
Posted on July 02, 2012 at 16:18

What is the cause of this issue

That you are routing the 8 MHz HSE thru the /128 and /64 paths. (976.5625 Hz)

http://www.st.com/internet/com/TECHNICAL_RESOURCES/TECHNICAL_LITERATURE/APPLICATION_NOTE/CD00167326.pdf

Tips, buy me a coffee, or three.. PayPal Venmo Up vote any posts that you find helpful, it shows what's working..
harish2
Associate
Posted on July 03, 2012 at 15:38

I have done some experiments.I am not able to cause of 2 sec update.At RTC / Tamper pin i am getting 976 Hz signal which is HSE/128 and then divide by 64 . In this case my external 32.768 Khz crystal is not oscillating.But when i put my RTC battery out and again put in the circuit the RTC section works well and there is now 1 sec update and RTC/Tamper pin i am getting 512 Hz signal. Why now it starts working well (Reset in oscillator circuit inside uC) ? Any person who knows the cause ? Clive do you know the cause.

ColdWeather
Senior
Posted on July 03, 2012 at 16:50

It's a well known issue about the RTC oscillator being critical to the crystal and couple capacitance at its terminals: sometimes it does not start. The behaviour is also temperature dependent: the lower the ambient temperature the worse the RTC start-up.

Programming the RTC register, pay attention to the back-up domain access rules: some bits must be set before (see manuals).

In my device I solved the issue with the unreliable RTC start-up as follows:

1). try to switch the RTC LSE on.

2). wait for the LSE on for about 50ms.

3). if not successfull, switch to the LSI (setting properly the divider for LSI of about 40kHz) and go to the main program.

Out of the main program a process tries to restart the LSE again (steps 1-2).

If the RTC is battery supplied (my case, too), the LSE stays stable once started.

Posted on July 03, 2012 at 17:00

I'm not sure exactly what part you're using, but I'll guess that you aren't setting the RTC properly, or enabling/unlocking the PWR/BKP.

What does you RTC initialization code look like?

The PWR/BKP domain needs to be unlocked before you can start the LSE

Tips, buy me a coffee, or three.. PayPal Venmo Up vote any posts that you find helpful, it shows what's working..
abelloni
Associate II
Posted on December 15, 2013 at 16:43

I am using STM32 Microcontroller in my product. I am using 32.768 KHz as RTC Crsytal. At the Tamper/RTC pin (pin 2) ideally i should get 512 Hz for calibration . But i am getting 976 Hz so instead of 1 sec update i am getting 2 sec update ? What is the cause of this issue