cancel
Showing results for 
Search instead for 
Did you mean: 

RTC - CALW bits and calibration PPM calculation

heveskar
Senior

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: 

heveskar_0-1702302680585.png

register description:

heveskar_2-1702303622398.png

And in appnote AN4759:

heveskar_0-1702371558418.png

heveskar_1-1702302749588.png

 

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.

1 REPLY 1
heveskar
Senior

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.