2024-10-12 08:43 AM
Hello all,
I want to use the STM32WB5MMG module for a project which requires an RTC.
The datasheet states the module integrates a 32.774 kHz LSE crystal. That seems a bit strange to me because the standard clock for LSE is normally 32.768 kHz. Checking the reference manual RM0434 there does not seem to be any reference to using a 32.774 kHz clock.
I would like the RTC time to be as accurate as possible, is 32.774 kHz ok to use for the RTC? I guess I would need to somehow offset the faster clock to keep correct time.
Here are some calculations I did, which I have no idea if they are correct.
It seems that a 32.774 kHz clock divided by 2^15 = 1.000183105.
That equals 0.001000183 ms offset from the ideal 1 second per clock period.
Multiply by the number of seconds in a day, 0.001000183×86400 seconds = 86ms offset per day.
If you have any thoughts on the matter, let me know!
Thanks!
-Eric
Solved! Go to Solution.
2024-10-12 09:07 AM - edited 2024-10-12 09:16 AM
Welcome @EricNava, to the community!
please see the errata ES0525, section 2.1.1 for some more information about this rather unusual 32774Hz crystal.
To get a 1Hz output, you can correct it e.g. using smooth calibration, see RM0434, section 29.4.11.
Hope this helps?
Regards
/Peter
2024-10-12 09:07 AM - edited 2024-10-12 09:16 AM
Welcome @EricNava, to the community!
please see the errata ES0525, section 2.1.1 for some more information about this rather unusual 32774Hz crystal.
To get a 1Hz output, you can correct it e.g. using smooth calibration, see RM0434, section 29.4.11.
Hope this helps?
Regards
/Peter
2024-10-12 09:15 AM
Hi Peter,
Thank you for pointing that out, I should have thought to look at the errata. I guess to use the RTC with the LSE, I will need to do a calibration with the module's 1Hz or 512Hz output.
Thanks for you help
2024-10-12 09:19 AM
I changed my previous comment while you are replying: you can correct the deviation of 183ppm via Smooth Calibration.
2024-10-12 09:28 AM
How to for Smooth Calibration: see this thread.
2024-10-12 09:28 AM
No worries Peter, thank you for linking the smooth calibration info!