2023-12-11 06:08 AM - edited 2023-12-12 01:27 AM
We are using STM32H723 on a custom board.
Right now, we are not measuring RTC calibration, we just have a possibility for the user to manually insert values of CALM and CALP elements in RTC_CALR register. We want to inform the user about resulting frequency (in the form of PPM correction). How to do this calculation when disregarding CALWx bits is clear to me.
What I do not get is, how are CALW8 and CALW16 bits related to PPM calculation and what exactly they do.
I saw this thread (the same calculation "FCAL = FRTCCLK x [1 + (CALP x 512 - CALM) / (2^20 + CALM - CALP x 512)]" is in the RM): https://community.st.com/t5/stm32-mcus-products/how-to-convert-accuracy-ppm-to-calp-calm-values-when-calibrate/m-p/89406
Also, in the reference manual RM0468:
register description:
And in appnote AN4759:
EDIT: I kept convoluting the question with my thoughts, I will keep it simple:
Does changing value of CALW8 and CALW16 change the calculation of resulting RTC frequency or not? E.g., does the formula FCAL = FRTCCLK x [1 + (CALP x 512 - CALM) / (2^20 + CALM - CALP x 512)] stay always the same disregarding the value of CALWx bits or not?
Thanks.
2023-12-11 10:50 PM - edited 2023-12-12 01:38 AM
EDIT: I think now I finally understand it. CALW bit does not change the resulting correction calculation. CALP and CALM are treated as if they were added/subtracted over whole 32-second period, but the real window can be changed to 16 seconds or 8 seconds. This is why for 16 seconds, CALM is >= 2 and for 8 seconds, CALM is >= 4.