cancel
Showing results for 
Search instead for 
Did you mean: 

How to calibrate RTC on STM32F411CEU6

asnweriok
Associate II

Hello everyone! I have stm32f411ceu6 dev board, and I decided to use RTC. But it's going slower than time on reference clock. I use 32768 oscillator, which is soldered on the board. Can I calibrate this thing? 

8 REPLIES 8

> But it's going slower than time on reference clock.

How much?

> Can I calibrate this thing?

Yes. The details are described in RTC smooth digital calibration subchapter of RTC chapter in RM0383. (There's also "coarse calibration" but there's little reason to use it, it's there for historical reasons).

JW

asnweriok
Associate II

Thanks for your answer! In half an hour, the RTC fell behind by 5 minutes.

This is such a huge deviation that I'm not sure it it can be explained even by using LSI instead of LSE; but at any rate, start with reading out RCC_BDCR and checking whether RTC is set to be clocked from LSI, and if LSE runs at all.

Are you trying to use some of the power-saving modes including the VBAT mode (powering down the mcu while running RTC from battery connected to VBAT?

Do you use CubeMX/Cube/HAL?

JW

asnweriok
Associate II

I use STM32CubeMX and PlatformIO. But I think it cannot be a reason. And I don't use any power saving modes

AScha.3
Chief III

which board ?  this:

AScha3_0-1696318672759.png

(on one of mine the 32k crystal was damaged ! )

If you feel a post has answered your question, please click "Accept as Solution".

Yes, mine is same

just check: is the board clean? any flux remains around the 32k crystal + caps is a no go.

if not sure, clean (isopropanol or aceton) .

If you feel a post has answered your question, please click "Accept as Solution".

So, during the 30-minute test period, power was on all the time, there was no reset performed, and you don't use any power-save mode, correct?

Read out RCC_BDCR and check whether RTC is set to be clocked from LSI, and if LSE runs at all. You can try to output LSE to MCO if it's a possibility in this mcu and measure its frequency.

For experiments I'd also suggest to use genuine ST boards like Nucleo from reputable source. While black pills are so far not widely known to use counterfeited chips like the blue pills do, I wouldn't exclude that possibility either.

JW