cancel
Showing results for 
Search instead for 
Did you mean: 

About the drift of the RTC of STM32F407VET6

juntakei
Associate II

Hello everyone, I'm Jun and I live in Japan.

The board is a custom board based on BLACK_F407VE, and is for hobby engine control. The crystal oscillator is ABS07-LR-32.768kHz-6 (load capacitance 6pF) recommended by STM.
The development environment is Visual Studio Code and PlatformIO. The framework is Arduino.
The program was modified from the sample program SimpleRTC in the library that comes with PlatformIO so that the hour and minute can be set. In addition, RTC_CALIB can be output to a port.
There are three boards, and a 3V battery is attached to VBAT. Set the time in the RTC, turn off the power, and refer to the RTC one hour later. One board has 0 drift, and the other two boards advance significantly. The power is turned on and off only once each when setting and referencing.

NO1:
Capacitors on both ends of the crystal are 12pF
RTC_CALIB=Average of 1 minute 511.94Hz
RTC value after 1 hour = 39 seconds ahead

NO2:
Capacitors on both ends of the crystal are 6pF
RTC_CALIB=Average of 1 minute 511.99Hz
RTC value after 1 hour = 101 seconds ahead

NO3:
Capacitors on both ends of the crystal are 12pF
RTC_CALIB=Average of 1 minute 511.94Hz
RTC value after 1 hour = Almost 0 seconds ahead

So here are my questions.

1. I'm using Visual Studio Code and PlatformIO as my development environment, but can I ask a question here? I think the library and HAL are STM programs.

2. The library has the following signature. Isn't 2020 outdated?
/**
*************************************************
* @file STM32RTC.cpp
* @author Frederic Pillon
* @brief Provides a RTC interface for Arduino
*
*********************************************
* @attention
*
* <h2><center>&copy; COPYRIGHT(c) 2020 STMicroelectronics</center></h2>

3. Since RTC‗CALIB is almost 512Hz, can we assume that there is no problem with the capacitance of the capacitors on both ends of the crystal (6pF even for 12pF) or the artwork on the board?

4. Why does the RTC value advance so much on some boards even though the RTC‗CALIB is almost 512Hz?

5. Is there anything I can do to find out the cause?

<This text was translated from Japanese to English by Google Translate>

11 REPLIES 11

No it means if the settings are wrong things won't work correctly, the clocks will stop or time will diverge, per your complaints. 

You're going to need to dig into the source of your drivers or go to web site focused on Arduino 

Tips, Buy me a coffee, or three.. PayPal Venmo
Up vote any posts that you find helpful, it shows what's working..

Thank you for your reply.

I think there is a problem with the clock source after all.
Thank you.