Skip to main content
FCope.1
Associate II
November 3, 2020
Solved

STM32F072RB HSE/32 RTC calibration

  • November 3, 2020
  • 5 replies
  • 2237 views

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.
Best answer by waclawek.jan

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

JW

5 replies

waclawek.jan
Super User
November 3, 2020

> 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
November 3, 2020

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
November 3, 2020

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

JW

FCope.1
FCope.1Author
Associate II
November 4, 2020

@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