Skip to main content
Associate
March 10, 2026
Solved

STM32H7 RTC accuracy with 32.768 kHz LSE quartz in VDD mode and VBAT mode

  • March 10, 2026
  • 3 replies
  • 530 views

Hello,

in our design with STM32H753ZIT6 I've adjusted the C0G load capacitors on the LSE 32.768 kHz crystal so that the real-time clock is now very accurate (less than 1 second error in 24 hours). I've always performed the calibration in VBAT mode at a voltage between 2.3 and 3.2 V.

However, now I've noticed that in normal VDD mode with active controller, the real-time clock is running significantly too slow, with an error of 90 seconds in 24 hours. I've ruled out the VBAT supply voltage as the cause. Any ideas what could be causing this large error in normal VDD mode?

Thank you!

Best answer by ChrSch

I did the test with the calibration signal at PC13.

Here is the signal in VBAT mode. (I turned the persistence of the scope to infinity.) The edged are very stable at the same position.

20260317_114100.jpg

 

And here the signal in normal running mode, again with infinity persistence:

20260317_114755.jpg

There is a significant jitter. If I stop the CPU with the debugger, the frequency is stable again.

I have no explanation, why the frequency is not 512 Hz.

 

I changed the setting for the drive strength to medium-low and to medium-high (regarding the errata). With both setting I can achieve a stable frequency (of 512 HZ! ?:-/) in battery and powered-up mode. I decided to use the real medium-high mode and I'm performing a long-term measurement now. I hope this solves my issue.

3 replies

mbarg.1
Senior III
March 10, 2026

I would rule out any cristal or Vxx or chip related problem - it seem you are switching from crystal to LSI oscillator running 32kHz.

Usually large error like this are due to selecting wrong oscillator.

ChrSchAuthor
Associate
March 10, 2026

Thank you for the quick reply.

I had a similar thought, but isn't this sufficient:

Unbenannt.png
PeriphClkInitStruct.RTCClockSelection = RCC_RTCCLKSOURCE_LSE;

in the SystemClock_Config() function.

AScha.3
Super User
March 10, 2026

Or other possible problem:

in run  mode with VDD , you have switching signals close to crystal or the RTC pins, most sensitive is next pin to RTC pins (PC13) ; this can "disturb" the 32khz .... 

and obviously this is quiet when cpu is not powered.

+

How did you do calibration in VBAT mode , cpu not running to do "smooth calibration" ?

"If you feel a post has answered your question, please click ""Accept as Solution""."
waclawek.jan
Super User
March 10, 2026

It's not necessarily PC13 which disturbs the LSE (although that may do that a lot). Any other signal in the oscillator's vicinity may do that. And, maybe even more importantly, also currents flowing through common ground tracks/planes.

It may be hard to capture a disturbance whih causes 1000ppm deviation, especially if the source is some sudden burst. You can test this hypothesis, though, by running the circuit under VDD with a firmware which is "quiet", i.e.does not exercise its outputs, and also with no external input signals.

You can also increase LSE drive, but I personally would recommend to track down the disturbance's source first.

Unless you do something directly with the RTC, such as put it into INIT mode often; that's not LSE-related.

JW

LCE
Principal II
March 10, 2026

Completely independent of noise and crystal:

wasn't there a problem in RTC initialisation that might produce some sub-second reset, if that is done each time the CPU "wakes up" or is re-started ?

... which would not apply if the CPU is never sleeping.

Can't find the thread right now.

I have something like this in my H7 source:

/* RTC - only init if off, otherwise lose subseconds */
	if( (RCC->BDCR & RCC_BDCR_RTCEN) != RCC_BDCR_RTCEN ) RtcInit();