2020-11-03 07:30 AM
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
Solved! Go to Solution.
2020-11-03 09:30 AM
RCC_BDTR=0x8218, that means RTCSEL=0b10 i.e. LSI oscillator clock used as RTC clock.
JW
2020-11-03 07:55 AM
> 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
2020-11-03 08:07 AM
2020-11-03 08:08 AM
2020-11-03 09:30 AM
RCC_BDTR=0x8218, that means RTCSEL=0b10 i.e. LSI oscillator clock used as RTC clock.
JW
2020-11-04 01:39 AM
@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