Close

Choosing crystals

A project log for Heartbeat Logger

A portable device that logs a snippet of your heart at the push of a button.

Ole Andreas UtstumoOle Andreas Utstumo 03/06/2019 at 20:130 Comments

For selecting a crystal that is compatible with their microcontrollers, STM has a design guide that comes in handy:

https://www.st.com/content/ccc/resource/technical/document/application_note/c6/eb/5e/11/e3/69/43/eb/CD00221665.pdf/files/CD00221665.pdf/jcr:content/translations/en.CD00221665.pdf


Under section 4.2 we find a handy checklist we can follow:

Step 1

The oscillation loop maximal critical gain parameter (Gm_critmax) is indeed specified in the STM32L432KB datasheet:

So let's go straight to section 4.2:

Let's check out one of the crystals I went with in the KiCAD library:So C_0 is between 2.0 and 0.6 pF. For the ESR:

We can set ESR = 35 k. We settle for a mid range load capacitance of 6 pF, which means our g_mcrit is calculated to be

g_mcrit = 0.28 µA/V

Which seems to be within the limits of the lowest drive level specified in the datasheet.

Speaking of drive level...
There is a section in the guideline document detailing this. In short, the current flowing in and out of the crystal needs to be limited for safe operation. I might look at that when the circuit is constructed. I might also turn a blind eye to it, and assume it's going to work out well.

Step 2

Skipping to section 3.3:
Which should mean that with a C_L= 6 pF and an assumed C_s = 5 pF, we're short of 1 pF, which we'll add by using two 2 pF caps in parallel (as seen by the crystal). We're not going to fine tune the crystal.

Step 3
Hopping to section 3.8:
Further reading reveals that determining R_ADD involves adding resistance in series with the crystal until the oscillator is unable to start. Looking at the safety factor comparison table, it seems like LSE oscillators like this might  be more stable in general... I feel I'm going to not bother unless there are any obvious issues ;-)

Step 4
We're assuming the lowest drive level of the STM32 won't overdrive the crystal. We could check on that when it's all soldered up, but we're done here for now.

In summary:
Crystal of choice: Seiko Epson MC-405
https://www.mouser.se/datasheet/2/137/C-405_en-1109182.pdf
Load compensation caps: 2 x 2 pF (assumed 5 pF parasitic load)
No further trimming or tuning

Discussions