Skip to main content
Bogdan
Senior
January 8, 2026
Question

RTC frequency not accurate on STM32F103C8 - high ppm value on tamper pin

  • January 8, 2026
  • 3 replies
  • 430 views

Hello,

 

i am using a stm32f103 mcu to provide rtc functionality.

 

I am using a external crystal  of 32768 hz for the rtc block.

The crystal is rated at 6pf load. +/- 20ppm  PN:   QT1C-32.768KDZB-T

 

Apart from this i have also implemented a external gps module   to provide a  "reference time" via uart.

Upon power on, the mcu configure the rtc counter with values for  hours,minutes,seconds  taken from the  the gps,   then i just display them on a lcd.

My problem is the time drift  on the rtc when comparing the time from the gps

For example, after 10 hours of functionality,  my  rtc clock drifts with 7-8 seconds when compared with the gps time.

 

I have tried to measure the rtc clock on the tamper pin, and here things start to show up

The measured frequency on the tamper pin ( PC13)    is 512.295hz.

this is giving a huge ppm diference   of about 576 ppm.

 

I have tried with several instruments to measure the tamper frequency,  but all are measuring mostly the same deviation of  .295 hz

 

I have also tried a workarround to disable all the remaining preripherals, leaving only the rtc functionality,  the same tamper freq deviation is measured.

I have also tried to create a simple CubeMX project only with the rtc tamper functionality, and the same deviation is measured

 

To be honest i am starting to run out of ideas, any sugestions could help.

a insight of the pcb layout for the X1  rtc crystal.

Bogdan_0-1767854821055.png

3 replies

RobK1
Associate II
January 8, 2026

Where are the load capacitors for the crystal?

Peter BENSCH
Technical Moderator
January 8, 2026

There are a few uncertainties:

  • Are you absolutely sure that this is a genuine device and not one of the many counterfeits produced by Asian manufacturers?
  • The measured +576 ppm at PC13 corresponds to a deviation of almost 21 seconds over a 10-hour measurement period, but you observed 7...8 seconds?
  • Your layout is only shown for the crystal X1 and does not include the additional layers between X1 and MCU?
  • What type of load capacitors are used?

With regard to the layout in particular, please refer to Appnote AN2867, which provides further information. The community also offers several tips on how to lay out the highly sensitive LSE, e.g. in this Knowledge Base article or here.

Regards
/Peter

Bogdan
BogdanAuthor
Senior
January 8, 2026

Hello Peter,

the device is genuine. I have a stock of them from a uk distribuitor, bought some years ago.

Concerning the layout,   there are no aditional layers conected to the crystal.   Underneath  the top layer there is only a solid GND layer.

What concerns me is Robk1 remark regarding the external capacitors wich i have not considered in the design, i am not sure if these are mandatory.

I will study the AN2867 document aswell.

I will try to port the SW to another board using the same mcu,  and this one has footprints for the crystal capacitors.

I will come back with details

Bogdan
BogdanAuthor
Senior
January 8, 2026

I am back with good news,  after added the load capacitors on the crystal the ppm value improved significantly

Using 4.3pf on the crystal,  i measure 512.045 hz

Using 8pf i measure 511.95hz

I will study in detail AN2867 until i find a suitable value for the load capacitors.

Thank you.

RobK1
Associate II
January 8, 2026

I guess you've answered your own question then :)

 


@Bogdan wrote:

i am not sure if these are mandatory.