cancel
Showing results for 
Search instead for 
Did you mean: 

STM32H7xx RTC accuracy problems

JOwen.1
Associate II

Have several boards with problems keeping time accurately. We calibrate each board in factory test, but some boards have very large errors in the 1 Hz calibration signal and very jittery frequency readings. To make it more interesting, when there is less activity on the PCA the calibration clock output tends to stabilize at a frequency that can be calibrated.

We have tried changing the 32 KHz crystal and load cap's, but that does not seem to have any effect. Boards that exhibit this problem can loose several minutes of time in 24 hours - not acceptable for a modern clock!

Clues:

  1. When the calibration output goes wonky, it typically drops slightly. For example, it might go from a stable reading of 0.999962 Hz to 0.998637 Hz and jump around a good bit.
  2. The same board can be good or bad. For example a board on our tester can output a good or bad frequency on a given power cycle. Also, when we load a very simple test program that only turns on the calibration output and not much else, all boards we have tried put out a good calibration signal - even if they were putting out a bad cal signal a minute ago with the original software.

Anyone have any ideas what we can try to get around this problem? Thanks for any advice here!

38 REPLIES 38

Sounds like digital noise gets coupled into the oscillator, whatever the path is (I'd start with suspecting ground routing).

Have you tried to experiment with the oscillator drive strength (RCC_BDCR.LSEDRV)?

What is PCA?

JW

Jack Peacock_2
Senior III

What you describe sounds like crosstalk on the OSC line pair picked up from other circuitry on the board. Check to make sure you have no traces running parallel to the OSC pair, and no traces cross underneath. Bring up your other peripherals one at a time, watching the RTC frequency to determine when the crosstalk occurs.

You have checked to make sure the capacitors are matched to the crystal? Do you have a load resistor on one of the OSC lines?

Jack Peacock

JOwen.1
Associate II

0693W000001qw60QAA.jpg0693W000001qw5vQAA.jpgThanks for the responses.

I have tried different drive strengths for the low frequency crystal. Did not seem to affect the operation except for a slight change in frequency - but everything was operating normally when I was testing drive strength. The PCA is a custom board for industrial controls equipment.

We did have trouble with this crystal originally with some boards not wanting to start up (oscillate). I had used a 10 pF load cap crystal, but apparently this CPU prefers a lower capacitance crystal. I wound up using the same crystal (6 pF load capacitance) and load caps (1.5 pF caps) as used on an eval board and have not had any trouble starting up since. I do NOT have a resistor in series with the crystal. Do I need one? The eval board I have did not have any resistance installed (0 ohm resistor).

Routing on the top of the board is clean, but there are other traces on other layers below the crystal (see pictures). I'll try to keep that area clear (all layers) on the next version and maybe put a ground pour on the layer just under the top layer.

I'd be more wary of the exact ground routing from the capacitors, keeping it separated from any digital ground and connecting it the shortest possible way to the nearest VSS pin.

JW

JOwen.1
Associate II

Yes, I'm starting to suspect I need to isolate the crystal more from surrounding traces. AN2867 recommends a separate ground plan under the crystal along with guard traces and I did not do that in this design.

JOwen.1
Associate II

Got more information on this. About 2.5% of the boards made have the problem of an unstable RTC frequency. Changing the 'H743 CPU fixed them (changing the crystal and cap's did not fix them).

After looking at the layout some more, I'm not convinced that the problem is caused by layout. The layer under the top layer is ground, so the crystal should be fairly well protected from other traces. I'm still going to try to improve the layout with guard traces and an isolated ground plane below the crystal, but the current layout would be considered good for most CPU's.

Can someone tell me what crystals/load caps/drive strengths they have used that seemed to work well on the H7 micros?

Although I am using a crystal and load cap's used in ST's eval board, maybe they are marginal for this CPU. If someone had a combination that worked well, I would rather use it than what I'm currently using. For reference, I'm currently using 1.5 pF load caps with a NX3215SA-32.768KHZ-EXS00A-MU00 crystal (6 pF load capacitance). The drive strength is set to high, but setting it to low did not fix the problem on boards with the jittery clock.

> Changing the 'H743 CPU fixed them

Today, I've fixed a problem (not 'H7 and not crystal/LSE related) by removing a mcu, washing the board beneath it and putting back the same mcu (read: removed soldering or PCB manufacturing residuum).

JW

> Changing the 'H743 CPU fixed them

Oh, and you are surely familiar with the Errata, namely 2.2.14 LSE oscillator driving capability selection bits are swapped, which pertains to rev.Y only.

JW

JOwen.1
Associate II

Thank you for the response!

We tried washing the problem boards, but it did not help. I'm using the TQFP package, so the pins are exposed and should be washable if there was residue around them.

Yes, I did read about the drive bits being wrong, but we are using high drive (0x11) so this would not be an issue for us. We also tried low drive settings, but it did not seem to make any difference with the boards that were misbehaving.

I've even gone through AN2867 - a very painful narrative on crystal selection that in the end does not help much except to recommend various part numbers that should be compatible with CPU families (how many out there have used an etalon crystal or tried to measure the current through a tiny surface mount crystal?). The suggested layouts were helpful too.

Instead of AN2867, all ST needs to do for a given CPU is to list crystal part numbers, nominal load capacitor values, and the recommended drive strength. That would save everyone a lot of trouble, especially with the finicky 32 KHz crystals.