2022-02-15 03:05 AM
As indicated by an4759, I am trying to use the 50Hz mains reference to improve the RTC accuracy of an STM32F413ZH.
However, the results I get are much worse than without using the reference:
LSE only: 0.6s/day
LSE+50Hz: 7.5s/day
(test duration 4 days)
According to an4759, with the reference, you should get an accuracy of about 0.6s/month.
To perform the tests I have started a project activating the reference in CUBEMX, without any calibration.
I have obtained the 50Hz signal with an optocoupled circuit, and I have introduced this signal by GPIO PB15 of the NUCLEO-413ZH.
Theoretically, the reference is working, the question is that it advances the time much faster than without the reference. Here you can also see the measurement of the 1Hz calibration signal measured with a "Frequency Counter".
It can be seen how the reference mechanism is acting trying to adjust the 1Hz signal, but the average obtained and therefore the time delay, worsen.
What can I be doing wrong?
Thanks!
Solved! Go to Solution.
2022-02-15 05:27 AM
The mains grid frequency fluctuates, based on varying load and changes in supply; this is even more pronounced these days since the indiscriminate spread of the unregulatable pseudo-green power sources.
Here is an example "grid time" deviation graph for the mutually interlocked European grid (source: https://gridradar.net/en/net-time :(
so, for example if you would start your measurement at around 11.Feb and finished 14.Feb, with perfect locking to the european grid you'd see a >20 sec deviation.
JW
2022-02-15 04:02 AM
Welcome, @Manuel Corrales, to the community!
AN4759 also states in section 2.7: "The reference clock (50 Hz or 60 Hz) must have a higher precision than the 32.768 kHz LSE clock."
Did you verify the 50Hz signal for its precision?
Regards
/Peter
2022-02-15 04:48 AM
I do not understand exactly what you are referring to precisely in this case. Because the same section you can also read the following:
"The reference clock may have a large local deviation (e.g. in the 500 ppm range), but in the long term it should be much more accurate than 32 kHz quartz".
Thanks!
2022-02-15 05:17 AM
Correct.
And is the long-term accuracy of the 50Hz signal much more accurate than that of the LSE?
2022-02-15 05:27 AM
The mains grid frequency fluctuates, based on varying load and changes in supply; this is even more pronounced these days since the indiscriminate spread of the unregulatable pseudo-green power sources.
Here is an example "grid time" deviation graph for the mutually interlocked European grid (source: https://gridradar.net/en/net-time :(
so, for example if you would start your measurement at around 11.Feb and finished 14.Feb, with perfect locking to the european grid you'd see a >20 sec deviation.
JW
2022-02-15 06:12 AM
Perfect, now I understand everything.
I was really hoping that the network would be less fluctuating or at least more balanced in the short term, but I see that it is not.
I see that using this reference is for the very long term and that there may be days when you end up with many seconds of difference that you will recover several days later, or not.
Thank you!
Best regards!
2022-02-15 07:05 AM
That's an extremely good summary:
> end up with many seconds of difference that you will recover several days later, or not
For this reason, there are now other ways to synchronise an RTC: NTP time servers, time transmitters such as WWV, JJY or DCF77, the 1PPS signal from a GPS receiver, etc.
When your question is answered, please mark this topic as answered by choosing Select as Best for the preferred answer. This will help other users find that answer faster.
/Peter