cancel
Showing results for 
Search instead for 
Did you mean: 

RTC Accuracy - STM32L475

dtarrago
Senior
Posted on August 29, 2017 at 14:43

According to pre-fixed parameters when setting up the RTC (PREDIV_A=127m PREDIV_S=255) and in accordance with AN4759, if I use a reccomended 32.768KHz (LSE) crystal, I should have a 512Hz signal at PC13 pin (STM32L475) when setting up RTC-Calendar and this pin is enabled as a calibration output.

I have tested this signal with two different PCB's (four layer boards) and with also two different recommended crystals, and I measure a signal (PC13) that is quite below 512Hz:

- In one of the boards, I had to fix PREDIV_A to 125 in order to get 512Hz (With default values, signal ouput is 504Hz).

- In the second board, PREDIV_A has to be set to 126 to get a 512Hz signal (508Hz with default values).

Furthermore, this error is noticed in the RTC calendar itself: delays of a few seconds in just two hours!!!!!

In both cases, RTC-Calendar and calibration output have been set up by means of Cube.

According to this behaviour, this would mean that the crystal is oscillating at about 300Hz difference, what is quite a huge difference!!!!

We have also tested different load capacitors with both tested crystals and the results are quite similar (by default, we had 5p6 capacitors, but last test was with 3p3 capacitors and result was the same).

Finally, and what is the most amazing thing: if the STM32L4 is replaced with a STM32F103, the RTC delay disappears!!!

Do you know which can be the reason of the problem related with this RTC unaccuracy??

#stm32l4 #lse #rtc
14 REPLIES 14
Posted on August 30, 2017 at 15:02

What's the U1 crystal part on board ♯ 2

I prefer how the capacitors are routed on the second design.

Tips, Buy me a coffee, or three.. PayPal Venmo
Up vote any posts that you find helpful, it shows what's working..
Posted on August 30, 2017 at 15:44

U1 is another crystal of the recommended ones: NX3215SA 6pF by NDK.

Regards,

Dani

Posted on August 30, 2017 at 15:45

It is routed in layer-3: both boards are 4-layer:

    - Layer-1: TOP (components and signal routing)

    - Layer-2: GND

    - Layer-3: Power/Voltage lines

    - Layer-4: Signal routing

Posted on August 30, 2017 at 15:57

Okay but where is it connected to? A battery? Is there anything else connected to that line? How is its return routed?

Note that VBAT pin supplies both the LSE oscillator and the PC13 pin.

If there are significant high-frequency currents flowing in the ground plane, the multiple vias around the crystal may be detrimental, too.

JW

Posted on August 30, 2017 at 16:21

Hello Daniel,

there really seems to be a coupling between PC13 (RTC_OUT) and PC14 (OSC32_IN).

As you have already noticed, the problem can be solved by remapping RTC_OUT signal to PB2.

You can also try to lower the LSE drive level (medium low drive capability recommended) 

or modify the PCB layout so that the LSE crystal is placed as close as possible to OSC32_IN/OSC32_OUT pins

and the RTC_OUT trace is led under the microcontroller, if possible, or place GND layer between LSE crystal and RTC_OUT trace.

Let me apologize for the inconvenience.