cancel
Showing results for 
Search instead for 
Did you mean: 

STM32L475 LSE crystal oscillator doesn't tune correctly - gmCrit value on datasheet is very low

JGerb
Associate III

Please help if you can, but please do me the courtesy of reading in full before replying:

We have a product using STM32L475 with a 32768Hz clock on the LSE. When I attempt to tune the crystal oscillator to within the performance spec of the crystal . I am unable to get the accuracy stated in the crystal datasheet. Either the crystal runs way too fast or it doesn't start reliably.

I am using app note AN2867 (Crystal oscillator design guide). The crystal is an Abracon ABS07-32.768KHZ-7-T : Cl =7pF, Cs =1.1pF, ESR=70k, +/-20ppm). Errors range from >150ppm (for CL1 =CL2 = 6.8pF) to > 250ppm (CL1=CL2=4.7pF).

If I increase the CL1, CL2 values I can improve on the accuracy, however, the oscillator fails to start reliably. Using the equation in section 4.2 of AN2867, with the crystal specs as mentioned above, I get a gmCrit value of 0.779uA/V, which, the AN states should be 5x lower than the STM32 gm value. Thus the gm value should be at least 3.9uA/V.

However, even if I select LSEDRV[1:0] = 11 (High drive capability), this only gives me 2.7uA/V. And I would prefer not to waste that much current.

You may say at this point, choose a better crystal. And I have looked, but to find a crystal with 20ppm (i'd have liked 10) accuracy and both low enough ESR and capacitance to make it work, is pretty hard. If we assume Cstray on the PCB plus the stray capacitance of the pin comes to more than 6pF already, the lowest we can go is a crystal with Cl of 6pF. And there aren't many that have lower ESR than 70kΩ.

So I looked at what the STM32L476 DISCO board uses. Surprise surprise, they use a cheap 12.5pF crystal , but, despite what AN2867 says, they are using 4.7pF capacitors with their cheap crystal, i.e. they are running their crystal very fast indeed.So they also haven't solved this.

Is there in fact ANY crystal that works well with the L4 range on the LSE? Or are there errors in AN2867 or my calculations? Because right now, the calculations seem to show there is a problem, and I am seeing that problem on the PCB. And before you ask, I have tested this on multiple boards, there is adequate shielding on the PCB around the crystal, no contamination (I clean after each soldering), and I am using a GPS disciplined oscillator to check the frequency measurement is spot on.

Please help!

2 REPLIES 2

> the oscillator fails to start reliably.

Specify.

It may sound as a paradox, but better oscillator design leads to longer startup times. The oscillator starts up by picking up and amplifying external noise... So, you don't want to use a timeout less than several minutes, if you are confident in your oscillator design.

Also, the fact that with 6.8pF load capacitors you get way higher frequency than expected might indicate that the stray capacitances are less than you expect/estimate. Which package do you use?

> STM32L476 DISCO board ... using 4.7pF capacitors ... running their crystal very fast indeed.

Just out of curiosity, did you actually measure it?

JW

Thanks!

Sometimes the oscillator will start after only a second, but other times it won't start at all. This can lead me on a wild goose chase. Once it does start however, it has no problem with running usually, except at sub -30C where I have seen it stop. Startup reliability does improve with higher drive strength, so i am testing on lower levels but will use a higher level in production.

I currently have a 15 second timeout on the startup, but I only flag an error if it fails, i don't stop anything - the LSE is critical to my wake-up timing. On the few occasions when I did leave it for several minutes I didn't observe a startup, but I will make a note to wait longer in future (I took Horowitz and Hill's advice of waiting for a few seconds without checking it myself). However, at the lower levels it is difficult to reproduce, one has to remove all power and batteries for several minutes to be sure the oscillator isn't still running on the capacitors across the VBAT domain.

A lot of my tests so far have been at room temperature, but the ones at elevated and low temperatures point to it getting a little worse with both higher and lower temperature, though the lower temperature range may have had some slight condensation too.

I'm using the LQFP64 package, and working on the datasheet typical of 5pF pin capacitance, however, I have been informed by ST that 5pF is more of a maximum, and 2-5pF, with 3pF typical, is more accurate. Even if I work on stray PCB capacitance of 0.5pF, this puts it at 3.5pF Cs - if I take 2*(7-3.5) = 7pF, but my 6.8pF is still resulting in > 100 odd ppm too fast. 10pF seems to be the right value - I run only 10-15ppm too fast then on the 2 boards I tried it on. However, reliable startup is then the problem. But if 10pF is the right value, that points to my total capacitance, PCB + pin, being only 2pF. I might design in slightly lower at 9.1 or 8.2pF just to have more margin, and use the CALR register to offset the error.

I didn't actually measure the STM32L476 DISCO board, (I confess I have one here, but the thought of fighting with eclipse any more was too much for me), but the CL1 and CL2 values for 12.5pF and Cs=5pF should be 15pF, so we can be sure it's running fast. And if I use my assumed values for Cs of 2pF, then they should have used ~25pF!

It would be good to hear back from ST what crystal part numbers will work (according to the recommendations in AN2867, especially the one about gm > gmCrit by a factor of 5), as the mainstream parts don't meet the requirements, unless they're sub 6pF or have low ESR values.

Annoyingly, the two boards I'm using now have both started reliably several times in a row. I may need to wait longer between tests.