2018-03-04 10:57 PM
Hello there,
I am using an STM32L4 family MCU. In an application, the RTC peripheral is utilized and clocked from an external crystal:
The problem I have noticed just now is that with time, the RTC timer looses sync. It is not easy to notice in short periods of time, but after leaving the application to log time for entire weekend, I noticed that the RTC timer is over 20 minutes later after my PC timer (they were both synced before the weekend).
What could be the cause of this problem? Its hard to believe for me that the RTC timer is simply this low precision, as I am using an external crystal. I would appreciate all help.
#precision #stm32l4 #rtc Note: this post was migrated and contained many threaded conversations, some content may be missing.2018-03-11 02:37 PM
...it's not about frequency, it's about the ultra-high impedances. The additional capacitance of the board (could be on the order of 1 to 2 pF) can make the difference. You may want to try to reduce the capacitors to 3,3 or 4,7 pF as a quick test. This change might save you the day.
2018-03-11 03:28 PM
Anything will make a difference, including the guy blowing his candle 2 continents away.
That's not the point. The point is will it make a material difference? The biggest difference comes from the side of small load capacitance. Luckily, the pin capacitance helps, as will as the high q from the crystal.
Again, focus on why this thing is 6000ppm off. With that much error, something that makes 20 to 30ppn makes practically zero difference.
2018-03-11 03:37 PM
You bet it does: it's not that less capacitance would bring the crystal on the frequency, rather would possibly make the crystal be part of the oscillator. At 6000 ppm off-frequency, the crystal acts as a simple capacitor and the STM oscillator is free running, as if there would be no crystal in the circuit. For me there is no question about it. The goal here is to make the crystal become part of the circuit. I have seen this several times in my long, long career.
2018-03-11 04:15 PM
Google the load curve of a typical 32k crystal.
It will help you with some perspectives. No theory needed.
2018-03-12 12:05 PM
So would you recommend this oscillator?
https://www.tme.eu/gb/details/32.768k-26smd-sr/smd-quartz-crystals/sr-passives/32768k-26smd-sr/
With the case soldered to GND?
2018-03-14 02:31 AM
The datasheet states that the can should not be soldered, but only glued:
Mazur.Grzegorz
could you please elaborate on what did you mean exacly to solder the case?2018-03-14 06:06 AM
I was reading today an ST document about hardware design and I got into this:
What about using a MEMS oscillator like this
http://www.abracon.com/Oscillators/ASTMKJ.pdf
to get rid of the crystal circuit tuning mess? Did anyone tried this approach?
2018-03-14 09:09 AM
I have used some mems oscillators - and found them to be nothing special vs. the regular crystal. they do consume considerably less energy than the regulator oscillators.
I think they are useful in two areas:
1. low power consumption - obviously;
2. tough environment where you are concerned about a crystal not getting to oscillation.
I don't think there is much to gain here by going to an external oscillator, including a mems oscillator.
2018-03-16 02:39 AM
Please check also the firmware behavior.
If the CPU is waking up periodically from low power mode in some intervals (for example from standby mode) then it can go through function which is configuring the LSE clock (startup code). Usually this function enables LSE clock - but please check if the function which is enabling LSE clock firstly not disables it (for example by masking bit in register) and then immediately enables it (setting bit in register). Problem is that the startup of XTALL is quite slow - which can lead to delaying the time in RTC (delay depends from wakeup interval setting).
2018-03-16 06:07 AM
Lukasz is already aware of this, see
https://community.st.com/0D50X00009XkhQJSAZ
and his answer to it.JW