2022-02-23 02:28 AM
Hi ST team,
I referred the Application notes from the ST's for RTC temperature compensation
Using STM8AL3189 MCU , Which has both positive and negative ppm compensation using CALM and CALP
From the APP notes, ACC(ppm) = crystal deviation + k * (T -T0)^2;
How to find the crystal deviations room temperature. i followed as per app notes
32768 Hz prescalar value , CALOUT is 512Hz
when measured using the logic analyzer i get 512.030Hz
((512/512.030) - 1) * 1000000 = >
0.99994140968302638517274378454387 - 1 * 1000000
-5.8590316973614827256215456125618e-5 * 1000000
-58.5 PPM
it is correct ? any suggestion helps to move forward
Thanks in advance
Regards,
Anand
2022-02-23 03:45 AM
Yes, your calculation is correct. But you should also take into account the possible error in the frequency measurement (here your logic analyzer).
Regards
/Peter
2022-02-23 03:53 AM
Thanks for the response Peter,
Can you suggest, how much it may be a possible error in the frequency measurement
then my final formula will become
acc(ppm) = -58.5 + -0.04 * ( T - T0) ^2;
Can you please tell me, how frequently do I need to update the CALM and CALP values to compensate for the temperature drift?
Really appreciated, in the difficult time replay us early help us thanks in advance
Any correction in formula please let me know
Regards,
Anand
2022-02-23 04:21 AM
First of all, you must be aware that the measured frequency of 512Hz is derived directly from the 32kHz LSE. The Smooth Calibration does not correct the LSE frequency, but masks or adds individual pulses for the RTC within a 32-seconds cycle (precisely a cycle of 2^20 RTC clock pulses), depending on the value of CALM/CALP. An essentially identical procedure is also used by the STM32, which I explained some time ago in a similar thread.
Update rate
Because corrections are only made once per 32-seconds cycle, you should not adjust the values of CALM/CALP more often than once in 32 seconds.
Once again: after changing CALM/CALP you will not be able to measure any change in the output frequency (512Hz) - apart from drift due to e.g. temperature. In order to determine a possible deviation of the RTC, you must permanently compare / measure the 512Hz with a very precise reference and update CALM/CALP in intervals of ≥32s.
Regards
/Peter
2022-02-23 05:53 AM
Hi Peter,
Thanks a lot most of the questions get answered.
I have gone through the link as well
I have a query on update rate,
for on each temperature change, should I need to update once, or how it is peter?
for example
room temp is 25*c then only once I will update the CALM and CALP
after temp reaches 26*C then only once I will update the CALM and CALP?
is it like this or some range on every 3 *C degree variation of temp, only once need to update?
Question is, what temperature changes do I need to calculate the CALM and CALP, and with the change in temp how long do I need to update the CALM and CALP register only one or more exactly how many times approx after 32 seconds?
This help us to complete our implementation
Thanks,
Anand.
2022-02-23 07:59 AM
Let's recap if I understood correctly: you want to calibrate only at the time of manufacture of the system and then use the temperature curve of the crystal to recalibrate, right?
However, it is rare that someone wants to correct the frequency deviation of a crystal blindly, so to speak, without measuring it again accurately and only using the current temperature.
Unfortunately, it is difficult to give a general recommendation for this, because the crystal frequency depends not only on the temperature, but also, for example, on ageing processes, mechanical stress and the drive power (keyword current drive).
That is why it is currently up-to-you.
Regards
/Peter
2022-02-23 07:06 PM
Yes, you are right,
By the way, in our running system, again measuring the crystal accuracy is not possible.
This means once will measure the crystal deviation at room temperature
But the doubt here is, After the how frequently CALM and CALP value need to update into RTC register after 32 seconds window period on temperature changes??
For example, temp rises to 28*C from 25*C, then should I need to update the CALM and CALP only once after 32 seconds, or how frequently need to update to compensate for the temperature drift?
Will this way can achieve the temperature drift to 0, peter ??
Thanks,
Anand.
2022-02-24 01:01 AM
The frequency of the correction can only be estimated by you, as the frequency depends on the parameters already mentioned.
You will not be able to bring the temperature drift to zero, because the smooth calibration corrects with ±9bit resolution (±512), but still discrete with a step size of approx. ±0.95ppm. If you want to push the accuracy to the extreme, you could continuously compare the time of the RTC with a reference time and adjust CALM/CALP so that in the long term (e.g. in days) the average time is correct.
If you need a more precise frequency, you can also use a TCXO or similar precision oscillator, which is definitely more predictable than painstakingly determining the temperature curve of individual crystals and trying to correct it - whereby it can look completely different after a few months or at the latest years due to drift effects.
That's all I can say on the subject.
Good luck!
If the problem is resolved, please mark this topic as answered by selecting Select as best. This will help other users find that answer faster.
/Peter