2023-02-06 02:17 AM
Hello,
We are using STM32L412 RTC with STM32CubeIDE.
Previously we are using
Crystal - 32.768 Khz SMD Crystal YXC YSX306GA 8.0 x 3.8 mm
load capacitance - 10pf 0805
In Previous Crystal we get about 6 seconds of RTC drift,
to solve this issue, study the application note AN2867 : https://www.st.com/resource/en/application_note/cd00221665-oscillator-design-guide-for-stm8afals-stm32-mcus-and-mpus-stmicroelectronics.pdf
and from this used below setup:
Crytsal - ABRACON ABS25-32.768KHZ-6-T Crystal, 32.768 kHz, SMD, 8mm x 3.8mm, 20 ppm
load capacitance - 6pF 0805
But In new setup we are getting 24-30 seconds of drifiting.
As we are following all guidlines mention in application notes, as compared to previous crystal, but getting more rtc drift (almost 4 time of previous rtc drift)
Please help us to solve this issue.
Thank You
Solved! Go to Solution.
2023-03-13 12:04 AM
We finally solved this issue and concluded, using (Cl1*Cl2)/(Cl1+Cl2)=load_capacitance.
So our value for c1=c2=12pf.
Thank to all for your valuable suggestion and time.
2023-02-06 02:57 AM
The deviation (6s/d -> 69ppm, 24...30s/d -> 278...347ppm) is much too large for normal crystals, so the causes must be found.
How did you set up your clock tree?
What does your layout at and around LSE look like?
Are there any tracks with switching edges near the LSE components?
Regards
/Peter
2023-02-06 03:28 AM
No Switching Edge Component near crystal
Schematic for crystal:
PCB Layout:
no component or tracks below XTAL on bottom of PCB
2023-02-06 04:00 AM
Well, first of all, the clock scheme looks ok.
You have connected the crystal using very short tracks to the STM32L412C, but GND looks very suspicious: no GND area under the crystal, no guard ring around crystal and its C's, no shortest possible connection from GND (crystal, C's) to the GND of the STM32L412C.
I always have a standard statement for this:
But please don't forget to layout GND accordingly, i.e. shaped like a (GND) hand holding a stone (crystal), where the "hand" must be separated from the rest of the GND layer and only connected via the "arm" to the closest GND pin of the STM32, see AN2867, section 7.2, fig. 14...16. I hope that the linguistic picture illustrates this in an understandable way?
Unfortunately, we don't see where GND is routed from the crystal + C's to the STM32 in your case, nor do we know the circuit, so we can't rule out the possibility that interference pulses are interspersed somewhere that lead to the observed deviation.
Regards
/Peter
2023-02-06 06:41 AM
As an experiment to confirm Peter's suspicion, try to mount C63/C65 "upright" so that only the crystal-connected terminal is soldered down, and then using shortest possible wires connect their "upper" other ends to the ground terminal of C62.
You may also try to mount the crystal a bit slanted so that its ground terminals are not connected to the pads, and connect those terminals to the same ground as the two crystals [EDIT see Peter's comment below] capacitors [/EDIT]
JW
2023-02-06 01:32 PM
Thanks Jan, but in your last sentence you probbly meant "...and connect those (crystal) terminals to the same ground as the two crystals capacitors."
/Peter
2023-02-07 12:11 AM
This is bottom and top view of PCB.
Due to size and placement issues, we can't use crystal guard rings, and Crystal GND direct connection to MCU GND is not possible, it is done through via's (Shown in Green Circle).
Please review this.
2023-02-07 03:43 AM
LSE oscillator is ultra low power, so any small disturbance can influence it. That's why it's important that it does not share ground with any other circuitry on the board: any current flowing together with the LSE current can influence LSE.
You also can try to play with RCC_BDCR.LSEDRV, but I would recommend you to make the experiment I outlined above first.
JW
2023-02-07 04:00 AM
Just to make sure:
there are only TOP and BOTTOM layers, no mid-layer(s) with an unbroken GND-plane?
If there's a GND plane and not much switching / power stuff going on in the vicinity of the crystal, it should be okay.
But, if there is no GND plane, then send the person who did the PCB layout back to school. ;)
A 4-layer PCB these days doesn't cost much, and with 2 layers it might be quite hard to do a good layout with sensitive components and high speed / power stuff.
2023-02-07 06:13 AM
this is 2 layer PCB