cancel
Showing results for 
Search instead for 
Did you mean: 

LSE clock is off by 5% on Nucleo-L4R5ZI

SFahr
Associate III

Hi, I made a minimum CubeIDE project for a Nucleo-L4R5ZI. It clocks the RTC from LSE using the X2 quartz (NX3215SA-32.768kHz-EXS00A-MU00525) and outputs a 512Hz calibration signal on PC13. The output frequency is only ~492Hz which is a deviation of ~5%. I couldn't find any reasonable explanation. Any ideas?

1 ACCEPTED SOLUTION

Accepted Solutions
SFahr
Associate III

Hi,

I just swapped the capacitors C36 and C35 on the Nucleo-L4R5ZI from 2.7pF to 10pF (NP0).

Now the calibration output is perfect 512Hz even for lowest LSEDrive.

Thanks for your support!

View solution in original post

11 REPLIES 11
Uwe Bonnes
Principal III

Missing or wrong quartz load capacitors?

Loading (load caps + PCB characteristics)

Drive Strength

Calibration Settings

Looks to be a 6pF crystal, check if placed components better matched to 9 or 12pF standard crystals.

Tips, Buy me a coffee, or three.. PayPal Venmo
Up vote any posts that you find helpful, it shows what's working..

How do you measure it?

Also, are you sure you drive RTC thus the 512Hz output from LSE, not from LSI? Read out and check/post the relevant RCC registers. content.

JW

SFahr
Associate III

Thanks for your answers.

Since the Nucleo144 is a standard design from ST I suppose the hardware should be okay... According to the datasheet the capacitors are 2.7pF and there's no series resistor, but why would they put the wrong capacitors on the board?

I use the standard settings generated by CubeIDE (LSEDrive =low).

I measured with an oscilloscope (Keysight MSOX6004A). And I'm sure it is LSE, because I switched to LSI and then I get ~502Hz which is good as LSI clock is ~32000Hz.

I will check with some other Nucleos today and report back.

>why would they put the wrong capacitors on the board?

Rightness or wrongness of the capacitors is not absolute, it depends on the crystal and particularities of layout.​

> I measured with an oscilloscope

The question really was, how trustworthy the measurement was, and if you can verify it by measuring a known precise frequency source. Some older oscilloscopes were not exactly precise timing-wise, although it's probably not the case of HP even if it's the Keysight era.​

> I use the standard settings generated by CubeIDE (LSEDrive =low).

Try the others. It's easy and fast, you don't need to write any code, you can do it directly in debugger, and you then also see if it really changed in the given register (backup domain can be tricky and not all state transitions are always allowed, see related portions of RM).

​JW

SFahr
Associate III

Okay, I've got some news:

First, I tried the same thing with an Nucleo-F429ZI. Here the calibration output is perfectly 512Hz.

(Averaged for ~1000 Samples)

Next I tried the Nucleo-L4R5ZI with different LSEDrive settings:

Low = 492Hz ; MediumLow = 508Hz ; MediumHigh = 530Hz ; High = 529Hz

(Averaged for ~1000 Samples)

The source code for both MCUs is almost identical, the major difference is that there is the LSEDrive config for the L4R5ZI (which is missing for the F429ZI).

One thing I noticed:

For the F429ZI I can scope the Quartz signals at OSC32_IN and OSC32_OUT very well and they look like clean sinoids.

For the L4R5ZI I can only scope the Quartz signal at OSC32_OUT and it looks distorted. I cannot scope any signal at OSC32_IN at all, even with highest LSEDrive.

It seems like the F429ZI drives the Quartz quite a bit stronger than the L4R5ZI.

> different LSEDrive settings:

> Low = 492Hz ; MediumLow = 508Hz ; MediumHigh = 530Hz ; High = 529Hz

This sounds to be very wrong. Check schematics/layout - aren't there some on-board circuits, or some track stubs (e.g. to the outward connector) connected trough solder bridges? If yes, disconnect them.

Try a different crystal - different specimen, different type, maybe use that from the 'F429 board.

Read AN2867. The 'F4_g1 oscillator in 'F429 should be equivalent to the Low setting of the 'L4 oscillator.

JW

SFahr
Associate III

Hi,

I just swapped the capacitors C36 and C35 on the Nucleo-L4R5ZI from 2.7pF to 10pF (NP0).

Now the calibration output is perfect 512Hz even for lowest LSEDrive.

Thanks for your support!

Thanks for coming back with the solution.

JW