January 2020 AN2867 Rev 12 1/54
1
AN2867
Application note
Oscillator design guide for STM8AF/AL/S, STM32 MCUs and MPUs
Introduction
Many designers know oscillators based on Pierce-Gate topology (hereinafter referred to as
Pierce oscillators), but not all of them really understand how they operate, and only a few
master their design. In practice, limited attention is paid to the oscillator design, until it is
found that it does not operate properly (usually when the product where it is embedded is
already being produced). A crystal not working as intended results in project delays if not
overall failure.
The oscillator must get the proper amount of attention during the design phase, well before
moving to manufacturing, to avoid the nightmare scenario of products being returned from
the field.
This application note introduces the Pierce oscillator basics and provides guidelines for the
oscillator design. It also shows how to determine the different external components, and
provides guidelines for correct PCB design and for selecting suitable crystals and external
components.
To speed-up the application development the recommended crystals (HSE and LSE) for the
products listed in Table 1 are detailed in Section 5: Recommended resonators for STM32
MCUs / MPUs and Section 6: Recommended crystals for STM8AF/AL/S microcontrollers.
Table 1. Applicable products
Type Product categories
Microcontrollers
STM8S Series, STM8AF Series and STM8AL Series
STM32 32-bit Arm Cortex MCUs
Microprocessors STM32 Arm Cortex MPUs
www.st.com
List of tables AN2867
2/54 AN2867 Rev 12
List of tables
1 Quartz crystal properties and model . . . . . . . . . . . . . . . . . . . . . . . . . . . . 6
2 Oscillator theory . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 8
2.1 Negative resistance . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 8
2.2 Transconductance . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 9
2.3 Negative-resistance oscillator principles . . . . . . . . . . . . . . . . . . . . . . . . . . 9
3 Pierce oscillator design . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 11
3.1 Introduction to Pierce oscillators . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .11
3.2 Feedback resistor . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .11
3.3 Load capacitance . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 12
3.4 Oscillator transconductance . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 13
3.5 Drive level and external resistor calculation . . . . . . . . . . . . . . . . . . . . . . . 14
3.5.1 Calculating the drive level . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 14
3.5.2 Another drive level measurement method . . . . . . . . . . . . . . . . . . . . . . . 15
3.5.3 Calculating the external resistor . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 16
3.6 Startup time . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 16
3.7 Crystal pullability . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 17
3.8 Safety factor . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 18
3.8.1 Definition . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 18
3.8.2 Measurement methodology . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 19
3.8.3 Safety factor for STM32 and STM8 oscillators . . . . . . . . . . . . . . . . . . . 19
4 Guidelines to select a suitable crystal
and external components . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 20
4.1 Low-speed oscillators embedded in STM32 MCUs / MPUs . . . . . . . . . . . 20
4.2 Detailed steps to select an STM32-compatible crystal . . . . . . . . . . . . . . . 23
5 Recommended resonators for STM32 MCUs / MPUs . . . . . . . . . . . . . 26
5.1 STM32-compatible high-speed resonators . . . . . . . . . . . . . . . . . . . . . . . 26
5.2 STM32-compatible low-speed resonators . . . . . . . . . . . . . . . . . . . . . . . . 26
6 Recommended crystals for STM8AF/AL/S microcontrollers . . . . . . . 40