1 year, 8 months ago.

STM32F401re and RTC Accuracy with ext. OSC

Hello, i need your help! I have one costumised embedded board with STM32F401re MCU and 32.768 kHz external oscilator. The problem is, i have very bad accuracy of the rtc clock - ~ 20 min / 8 month.

How it is possible that the accuracy is so bad?

Thanks in advance.

Sh. Hasani

2 Answers

1 year, 8 months ago.

Hi Shpejtim,

Mbed is tested for up to 95% accuracy for RTC. The error that you have described amounts to less than 5%. I suspect it may be something about the calibration of the device. Please see https://www.st.com/content/ccc/resource/technical/document/application_note/group0/71/b8/5f/6a/8e/d5/45/0a/DM00226326/files/DM00226326.pdf/jcr:content/translations/en.DM00226326.pdf

Thanks,

Naveen

Team mbed.

1 year, 8 months ago.

what is the spec on the external oscillator?

Calibration is often necessary. The quality (ppm) of the crystal and the selection of the value and type of load capacitors also has significant effect on the oscillator. Wrong load capacitors can cause very minor changes to the fundamental frequency, but it only takes a few ppm to throw things off. The crystal also has an accuracy spec based upon temperature, so you may need to dynamically change calibration based upon the temperature if the device is subject to environmental changes. A 20 ppm crystal may have an error of 1 minute per month., worse with incorrect load capacitors. Crystals are electromechanical devices and thus are subject to ageing as well. However, this leads to the magic realm and it is very difficult to qualify.