cancel
Showing results for 
Search instead for 
Did you mean: 

STM32F072RB HSE/32 RTC calibration

FCope.1
Associate II

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

1 ACCEPTED SOLUTION

Accepted Solutions

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

JW

View solution in original post

5 REPLIES 5

> 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

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

 

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

JW

FCope.1
Associate II

@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