Skip to main content
Explorer
June 14, 2022
Solved

LSE clock is off by 5% on Nucleo-L4R5ZI

  • June 14, 2022
  • 10 replies
  • 3018 views

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?

    This topic has been closed for replies.
    Best answer by SFahr

    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!

    10 replies

    Graduate II
    June 14, 2022

    Missing or wrong quartz load capacitors?

    Graduate II
    June 14, 2022

    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.

    Super User
    June 14, 2022

    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

    SFahrAuthor
    Explorer
    June 15, 2022

    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.

    Super User
    June 15, 2022

    >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

    SFahrAuthor
    Explorer
    June 15, 2022

    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.

    Super User
    June 15, 2022

    > 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

    SFahrAuthorAnswer
    Explorer
    June 15, 2022

    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!

    Super User
    June 15, 2022

    Thanks for coming back with the solution.

    JW

    SFahrAuthor
    Explorer
    June 15, 2022

    By the way:

    I just realized that you can output the LSE clock directly to MCO (PA8 on STM32L4R5ZI), so you can scope the decoupled LSE signal directly.

    SFahrAuthor
    Explorer
    June 20, 2022

    Hi,

    I just tested 3 other Nucleo-L4R5ZI boards: They were all fine with the factory capacitors. It looks like only that one specimen I had on the table was faulty.