Skip to main content
FCope.1
Associate II
Nov 3, 2020 3:30 PM UTC
Solved

STM32F072RB HSE/32 RTC calibration

Hi,

l'm using the STM32F072RB for a programmable periodic wakeup of a system.

I have some troubles in the RTC calibration.

I have a 8MHz crystal oscillator connected to HSE and, since I won't put in stop/standby mode the mcu, I would like to use it as reference.

I searched a lot in forums and application notes but I couldn't find how to calibrate it.

I achieved a 12s / 4h offset by setting RTC_SYNCH_PREDIV, but every change was driving to a bigger delay.

Another option could be to use LSI and calibrate this against HSE clock.

Any advice?

Thanks.

Filippo

This topic has been closed for replies.
waclawek.jan
waclawek.janBest answer
Super User
Nov 3, 2020 5:30 PM UTC

RCC_BDTR=0x8218, that means RTCSEL=0b10 i.e. LSI oscillator clock used as RTC clock.

JW

5 replies

waclawek.jan
Super User
Nov 3, 2020 3:55 PM UTC

> I achieved a 12s / 4h offset

That's >800ppm, surely way worse than expected precision of HSE.

Read out and post content of relevant RCC and RTC registers.

JW

FCope.1
FCope.1Author
Associate II
Nov 3, 2020 4:07 PM UTC

thanks for the quick feedback. The oscillator is ABM3-8.000MHZ-D2Y-T, should have a -+50ppm precision.

waclawek.jan
waclawek.janBest answer
Super User
Nov 3, 2020 5:30 PM UTC

RCC_BDTR=0x8218, that means RTCSEL=0b10 i.e. LSI oscillator clock used as RTC clock.

JW

FCope.1
FCope.1Author
Associate II
Nov 4, 2020 9:39 AM UTC

@Community member​ Thanks! I was changing the clock configuration with cubeMX but I had a piece of code which was reconfiguring the RCC code afterwards.

I cleaned up the code, fixed the prescalers (async -> 0x7f, sync-> 0x7A0 ) and now seems to behave better.

I'll make a test now to see which precision I can achieve now.

Thanks again,

Filippo