AN2867 Application note Oscillator design guide for STM8S, STM8A and STM32 microcontrollers Introduction Most designers are familiar with oscillators (Pierce-Gate topology), but few really understand how they operate, let alone how to properly design an oscillator. In practice, most designers do not even really pay attention to the oscillator design until they realize the oscillator does not operate properly (usually when it is already being produced). This should not happen. Many systems or projects are delayed in their deployment because of a crystal not working as intended. The oscillator should receive its proper amount of attention during the design phase, well before the manufacturing phase. The designer would then avoid the nightmare scenario of products being returned. This application note introduces the Pierce oscillator basics and provides some guidelines for a good oscillator design. It also shows how to determine the different external components and provides guidelines for a good PCB for the oscillator. This document finally contains an easy guideline to select suitable crystals and external components, and it lists some recommended crystals (HSE and LSE) for STM32 and STM8A/S microcontrollers in order to quick start development. Refer to Table 1 for the list of applicable products. Table 1. Applicable products Type Product categories STM8S Series Microcontrollers STM8AF Series, STM8AL Series STM32 32-bit ARM Cortex MCUs. August 2015 DocID15287 Rev 10 1/42 www.st.com 1 List of tables AN2867 List of tables 1 Quartz crystal properties and model . . . . . . . . . . . . . . . . . . . . . . . . . . . . 6 2 Oscillator theory . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 8 3 4 5 2/42 2.1 Negative resistance . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 8 2.2 Transconductance . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 9 2.3 Negative-resistance oscillator principles . . . . . . . . . . . . . . . . . . . . . . . . . . 9 Pierce oscillator design . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 11 3.1 Introduction to pierce oscillators . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .11 3.2 RF feedback resistor . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 12 3.3 CL load capacitance . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 13 3.4 Oscillator transconductance . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 13 3.5 Drive level (DL) and external resistor (RExt) calculation . . . . . . . . . . . . . 15 3.5.1 Calculating drive level (DL) . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 15 3.5.2 Another drive level measurement method . . . . . . . . . . . . . . . . . . . . . . . 16 3.5.3 Calculating external resistor (RExt) . . . . . . . . . . . . . . . . . . . . . . . . . . . . 16 3.6 Startup time . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 17 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 Guidelines for selecting suitable crystal and external components . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 20 4.1 Low-speed oscillators embedded into STM32 microcontrollers . . . . . . . . 20 4.2 Detailed steps to select an STM32-compatible crystal . . . . . . . . . . . . . . . 23 Some recommended resonators for STM32 microcontrollers . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 26 5.1 STM32-compatible high-speed resonators . . . . . . . . . . . . . . . . . . . . . . . 26 5.2 STM32-compatible low-speed resonators . . . . . . . . . . . . . . . . . . . . . . . . 27 DocID15287 Rev 10 AN2867 6 7 List of tables Some recommended crystals for STM8A/S microcontrollers . . . . . . . 29 6.1 Part numbers of recommended crystal oscillators . . . . . . . . . . . . . . . . . . 29 6.2 Part numbers of recommended ceramic resonators . . . . . . . . . . . . . . . . 29 Tips for improving oscillator stability . . . . . . . . . . . . . . . . . . . . . . . . . . 30 7.1 PCB design guidelines . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 30 7.2 PCB design examples . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 32 7.3 Soldering guidelines . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 36 8 Reference documents . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 37 9 FAQs . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 38 10 Conclusion . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 39 11 Revision history . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 40 DocID15287 Rev 10 3/42 3 List of tables AN2867 List of tables Table 1. Table 2. Table 3. Table 4. Table 5. Table 6. Table 7. Table 8. Table 9. Table 10. Table 11. Table 12. 4/42 Applicable products . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1 Example of equivalent circuit parameters . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 7 Typical feedback resistor values for given frequencies . . . . . . . . . . . . . . . . . . . . . . . . . . . 12 Safety Factor (Sf) for STM32 and STM8 oscillators . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 19 LSE oscillators embedded into STM32 microcontrollers . . . . . . . . . . . . . . . . . . . . . . . . . . 22 HSE oscillators embedded in STM32 microcontrollers. . . . . . . . . . . . . . . . . . . . . . . . . . . . 26 Recommended crystal resonators for LSE oscillator embedded in STM32 microcontrollers . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 28 KYOCERA . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 29 Recommendable conditions (for consumer) . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 29 Recommendable conditions (for CAN-BUS). . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 29 Frequently asked questions . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 38 Document revision history . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 40 DocID15287 Rev 10 AN2867 List of figures List of figures Figure 1. Figure 2. Figure 3. Figure 4. Figure 5. Figure 6. Figure 7. Figure 8. Figure 9. Figure 10. Figure 11. Figure 12. Figure 13. Figure 14. Figure 15. Figure 16. Figure 17. Figure 18. Figure 19. Quartz crystal model . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 6 Impedance representation in the frequency domain. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 6 I-V curve of a dipole showing a negative transresistance area (in purple) . . . . . . . . . . . . . . 9 Block diagram of a typical oscillation loop based on a crystal resonator . . . . . . . . . . . . . . 10 Pierce-oscillator circuitry . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 11 Inverter transfer function . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 12 Current drive measurement with a current probe . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 15 Negative resistance measurement methodology description . . . . . . . . . . . . . . . . . . . . . . . 19 Classification of low-speed crystal resonators available on the market . . . . . . . . . . . . . . . 20 Recommended layout for an oscillator circuit . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 31 PCB with separated GND plane and guard ring around the oscillator . . . . . . . . . . . . . . . . 32 GND plane . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 32 Signals around the oscillator. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 32 Preliminary design (PCB design guidelines not respected) . . . . . . . . . . . . . . . . . . . . . . . . 33 Final design (all design guidelines have been respected) . . . . . . . . . . . . . . . . . . . . . . . . . 34 GND plane . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 34 Top layer view. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 34 PCB guidelines not respected . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 35 PCB guidelines respected . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 36 DocID15287 Rev 10 5/42 5 Quartz crystal properties and model 1 AN2867 Quartz crystal properties and model A quartz crystal is a piezoelectric device transforming electric energy to mechanical energy and vice versa. The transformation occurs at the resonant frequency. The quartz crystal can be modeled as follows: Figure 1. Quartz crystal model & 4 /P 5P &P 069 C0: represents the shunt capacitance resulting from the capacitor formed by the electrodes Lm: (motional inductance) represents the vibrating mass of the crystal Cm: (motional capacitance) represents the elasticity of the crystal Rm: (motional resistance) represents the circuit losses The impedance of the crystal is given by the following equation (assuming that Rm is negligible): (1) 2 w × Lm × Cm – 1 j Z = ---- × --------------------------------------------------------------------------------w ( C + C ) – w2 × L × C × C 0 m m m 0 Figure 2 represents the impedance in the frequency domain. Figure 2. Impedance representation in the frequency domain ,PSHGDQFH ,QGXFWLYHEHKDYLRU WKHTXDUW]RVFLOODWHV &DSDFLWLYHEHKDYLRU QRRVFLOODWLRQ $UHDRISDUDOOHO UHVRQDQFH)S )V )D )UHTXHQF\ 3KDVHGHJ )UHTXHQF\ ± DLE 6/42 DocID15287 Rev 10 AN2867 Quartz crystal properties and model Fs is the series resonant frequency when the impedance Z = 0. Its expression can be deduced from equation (1) as follows: (2) 1 F s = -----------------------------2π L C m m Fa is the anti-resonant frequency when impedance Z tends to infinity. Using equation (1), it is expressed as follows: (3) F a = F Cm 1 + --------s C0 The region delimited by Fs and Fa is usually called the area of parallel resonance (shaded area in Figure 2). In this region, the crystal operates in parallel resonance and behaves as an inductance that adds an additional phase equal to 180 ° in the loop. Its frequency Fp (or FL: load frequency) has the following expression: (4) Cm F p = F s 1 + ------------------------------ 2 ( C 0 + C L ) From equation (4), it appears that the oscillation frequency of the crystal can be tuned by varying CL load capacitance. This is why in their datasheets, crystal manufacturers indicate the exact CL required to make the crystal oscillate at the nominal frequency. Table 2 gives an example of equivalent crystal circuit component values to have a nominal frequency of 8 MHz. Table 2. Example of equivalent circuit parameters Equivalent component Value Rm 8Ω Lm 14.7 mH Cm 0.027 pF C0 5.57 pF Using equations (2), (3) and (4) we can determine Fs, Fa and Fp of this crystal: F s = 7988768 Hz and F a = 8008102 Hz . If the load capacitance CL at the crystal electrodes is equal to 10 pF, the crystal will oscillate at the following frequency: F p = 7995695 Hz . To have an oscillation frequency of exactly 8 MHz, CL should be equal to 4.02 pF. DocID15287 Rev 10 7/42 41 Oscillator theory 2 AN2867 Oscillator theory Oscillators are one of the backbone components of modern digital ICs. They can be classified into different sub-families depending on their topology and operating principles. To each oscillator sub-family corresponds a more suitable mathematical model that can be used to study the oscillator behavior and theoretically determine its performance. This section deals only with harmonic oscillators (relaxation oscillators are not within the scope of this application note) with a particular focus on Pierce-oscillator topology (see Section 3: Pierce oscillator design for details). This restricted scope is due to the fact that all the oscillators embedded in STM32 microcontrollers covered by this document that require external passive components (external resonator, load capacitors, etc.) are of the previously mentioned type and topology. The harmonic oscillator family can be divided into two main sub-families: • Negative-resistance oscillators • Positive-feedback oscillators. These two sub-families of oscillators are similar for what regards the output waveform. They deliver an oscillating waveform at the desired frequency. This waveform is typically composed of a fundamental sine-waveform at the desired frequency plus a sum of overtone harmonics (at frequencies multiple of the fundamental one) due to the nonlinearity of some components of the oscillation loop. These two sub-families differ in their operating principles. This difference also implies a different mathematical model to describe and analyze each sub-family. Positive-feedback oscillators are generally modeled using the famous Barkhausen model where an oscillator should fulfill the Barkhausen criterion to be able to maintain a stable oscillation at the desired frequency. Negative-resistance oscillators could be described by the Barkhausen model. However this approach is not adequate. The most suitable approach to analyze a negative-resistance oscillator is by using the negative-resistance model as described in E. Vittoz’s paper ([1]). Since STM32 low-speed external (LSE) oscillator and high-speed external (HSE) oscillators were both designed following the negative-resistance principle, this section focuses on the presentation of the negative-resistance model. 2.1 Negative resistance Theoretically speaking, a negative resistance would be a dipole that absorbs heat and converts the energy into an electrical current proportional to the applied voltage but flowing in the opposite direction (exactly the opposite mechanism of an electrical resistance). In the real word such a dipole does not exist. In fact the term “negative resistance” is a misnomer of the “negative transresistance” which is defined by the ratio of a given voltage variation (∆V) divided by the induced current variation (∆I). Unlike the resistance which is always positive, the transresistance (also known as differential resistance) can be either positive or negative. Figure 3 gives the current-voltage curve for a dipole that shows a negative transresistance region. It is obvious that the V/I ratio is always positive. However this is not the case for the ∆V/∆I ratio. 8/42 DocID15287 Rev 10 AN2867 Oscillator theory The part of the I-V curve represented in purple shows a negative transresistance: V(D) – V(C ) ΔV -------- = --------------------------------- < 0 ΔI I( D) – I(C) while the parts of the curve in blue shows a positive transresistance: ΔV V( B) – V(A ) -------- = -------------------------------- > 0 I( B) – I(A ) ΔI Figure 3. I-V curve of a dipole showing a negative transresistance area (in purple) 2.2 Transconductance Like the conductance which is defined as the inverse of the resistance, the transconductance is also defined as the inverse of the transresistance. Transconductance can also be defined as the differential conductance which expressed by the formula: ΔV -------ΔI 2.3 Negative-resistance oscillator principles An oscillation loop is made of two branches (see Figure 4): • The active branch of the oscillation loop which is composed of the oscillator itself. This branch is responsible for providing enough energy at startup to make the oscillation start and build up until it reaches the stable oscillation phase. When a stable oscillation is reached, the oscillator branch provides enough energy to compensate for the oscillation loop passive branch losses. • The passive branch is mainly composed of the resonator, the two load capacitors and all the parasitic capacitances. DocID15287 Rev 10 9/42 41 Oscillator theory AN2867 Figure 4. Block diagram of a typical oscillation loop based on a crystal resonator 3DVVLYH%UDQFK $FWLYH%UDQFK ;WDO 670 & 06Y9 Following the small signals theory and when the active branch (oscillator part) is correctly biased, the latter should have its transconductance equal to the passive branch conductance in order to maintain a stable oscillation around the oscillator biasing voltage. However, at startup, the oscillator transconductance should be higher than (multiple of) the conductance of the passive part of the oscillation loop to maximize the possibility to build up the oscillation from inherent noise of the oscillation loop. Please note that an excessive oscillator transconductance compared to the oscillation loop passive branch conductance may also saturate the oscillation loop and cause a startup failure. In order to ensure the oscillator ability to startup successfully and maintain stable oscillation, a ratio between the negative resistance of the oscillation loop and the crystal maximal equivalent series resistance (ESR) is specified: for STM32 and STM8 microcontrollers, it is recommended to have a ratio higher than x5 for the HSE oscillators and higher than x3 for the LSE oscillators. 10/42 DocID15287 Rev 10 AN2867 3 Pierce oscillator design Pierce oscillator design This section describes the different parameters and how to determine their values in order to be compliant with the Pierce oscillator design. 3.1 Introduction to pierce oscillators Pierce oscillators are variants of Colpitts oscillators which are widely used in conjunction with crystal resonators. A Pierce oscillator requires a reduced set of external components which results in a lower final design cost. In addition, the Pierce oscillator is known for its stable oscillation frequency when paired with a crystal resonator, in particular a quartzcrystal resonator. Figure 5. Pierce-oscillator circuitry 0LFURFRQWUROOHU 5) ,Q Y 26&B,1 26&B287 4 & / &V 5 ([W & / DLE Inv: the internal inverter that works as an amplifier Q: crystal quartz or a ceramic resonator RF: internal feedback resistor RExt: external resistor to limit the inverter output current CL1 and CL2: are the two external load capacitances Cs: stray capacitance is the addition of the microcontroller pin capacitance (OSC_IN and OSC_OUT) and the PCB capacitance: it is a parasitic capacitance. DocID15287 Rev 10 11/42 41 Pierce oscillator design 3.2 AN2867 RF feedback resistor In most STMicroelectronics microcontrollers, RF is embedded in the oscillator circuitry. Its role is to make the inverter act as an amplifier. The feedback resistor is connected between Vin and Vout so as to bias the amplifier at Vout = Vin and force it to operate in the linear region (shaded area in Figure 6). The amplifier amplifies the noise (for example, the thermal noise of the crystal) within the range of serial to parallel frequency (Fa, Fa). This noise causes the oscillations to start up. In some cases, if RF is removed after the oscillations have stabilized, the oscillator continues to operate normally. Figure 6. Inverter transfer function /LQHDUDUHDWKHLQYHUWHUDFWVDVDQDPSOLILHU 9RXW 9'' 6DWXUDWLRQ UHJLRQ 6DWXUDWLRQ UHJLRQ a9'' 9 '' 9LQ DLE Table 3 provides typical values of RF. Table 3. Typical feedback resistor values for given frequencies 12/42 Frequency Feedback resistor range 32.768 kHz 10 to 25 MΩ 1 MHz 5 to 10 MΩ 10 MHz 1 to 5 MΩ 20 MHz 470 kΩ to 5 MΩ DocID15287 Rev 10 AN2867 3.3 Pierce oscillator design CL load capacitance The load capacitance is the terminal capacitance of the circuit connected to the crystal oscillator. This value is determined by the external capacitors CL1 and CL2 and the stray capacitance of the printed circuit board and connections (Cs). The CL value is specified by the crystal manufacturer. Mainly, for the frequency to be accurate, the oscillator circuit has to show the same load capacitance to the crystal as the one the crystal was adjusted for. Frequency stability mainly requires that the load capacitance be constant. The external capacitors CL1 and CL2 are used to tune the desired value of CL to reach the value specified by the crystal manufacturer. The following equation gives the expression of CL: C L1 × C L2 C L = -------------------------- + C s C L1 + C L2 Example of CL1 and CL2 calculation: For example if the CL value of the crystal is equal to 15 pF and, assuming that Cs = 5 pF, then: C L1 × C L2 C L – C s = -------------------------- = 10 pF . That is: C L1 = C L2 = 20 pF . C L1 + C L2 3.4 Oscillator transconductance Theoretically, to make the oscillation start and build up until it reaches a stable oscillation phase, the oscillator should provide sufficient gain that at the same time compensates for the oscillation loop losses and provide the energy that makes the oscillation build up. When the oscillation becomes stable, the equality between the oscillator provided power and the oscillation loop dissipated power is achieved. Practically speaking and due to tolerances on passive component values and their dependency on environmental parameters (e.g. temperature), a ratio of x1 between the oscillator gain and the oscillation loop critical gain is not recommended. This will induce a too long oscillator startup time and might even prevent the oscillator from starting up. This section describes the two approaches that can be used to check if an STM32 oscillator can be paired with a given resonator in order to ensure that the oscillation is started and maintained under the specified conditions for both resonator and oscillator. The approach depends on how the oscillator parameters are specified in the microcontroller datasheet: • • If the oscillation loop maximal critical gain parameter (gm_crit_max) is specified, it is important to make sure that the oscillation loop critical gain (gmcrit) is smaller than the specified parameter. If the oscillator transconductance parameter (gm) is specified, make sure that the gain margin ratio (gainmargin) is bigger than x5. Below the calculation formulas for both gmcrit and gainmargin. gm gain m arg in = --------------g mcrit where: gm is the oscillator transconductance specified in the microcontroller datasheet. Note that the HSE oscillator transconductance is in the range of a dozens of mA/V while LSE DocID15287 Rev 10 13/42 41 Pierce oscillator design AN2867 oscillator transconductance ranges from a few µA/V to a few dozens of µA/V depending on the product. gmcrit is defined as the minimal transconductance of an oscillator required to maintain a stable oscillation when it is a part of the oscillation loop for which this parameter is relevant. gmcrit is computed from oscillation-loop passive components parameters. Assuming that CL1 equals CL2, and that the crystal sees the same CL on its pads as the value given by the crystal manufacturer, gmcrit is expressed as follows: 2 g mcrit = 4 × ESR × ( 2πF ) × ( C 0 + C L ) 2 where ESR = equivalent series resistance C0 is the crystal shunt capacitance. CL is the crystal nominal load capacitance. F is the crystal nominal oscillation frequency. For example, to design the oscillation loop for the HSE oscillator embedded into an STM32F1 microcontroller which a transconductance value (gm) equal to 25 mA/V, we choose a quartz crystal from Fox, with the following characteristics: frequency = 8 MHz C0 = 7 pF CL = 10 pF ESR = 80 Ω . To check if this crystal will oscillate with an STM32F1 microcontroller, let us calculate gmcrit: 6 2 – 12 g mcrit = 4 × 80 × ( 2 × π × 8 ×10 ) × ( 7 ×10 – 12 2 + 10 ×10 ) = 0,23 mA ⁄ V Calculating the gain margin gives: gm 25 gain m arg in = --------------- = ----------- = 107 0,23 g mcrit The gain margin is sufficient to start the oscillation and the “gain margin greater than 5” condition is reached. The oscillator is expected to reach a stable oscillation after a typical delay specified by the microcontroller datasheet. If an insufficient gain margin is found (gainmargin < 5), the oscillation might start up under typical conditions (achieved in laboratory conditions) when designing and testing the final application. However, this does not guarantee that the oscillation will start up in operating conditions. As a result, it is highly recommended that the selected crystal has a gain margin higher than or equal to 5. Try to select a crystal with a lower ESR or/and a lower CL. Whatever the specified parameter, the oscillator transconductance (gm) or the oscillation loop maximal critical gain (gm_crit_max), the conversion between these two parameters is possible, if need be. The relation between these two parameters is given by the below formula: gm G m_crit_max = ------5 14/42 DocID15287 Rev 10 AN2867 3.5 Pierce oscillator design Drive level (DL) and external resistor (RExt) calculation The drive level (DL) and external resistor value (RExt) are closely related and will be addressed in the same section. 3.5.1 Calculating drive level (DL) The drive level is the power dissipated in the crystal. It has to be limited otherwise the quartz crystal can fail due to excessive mechanical vibration. The maximum drive level is specified by the crystal manufacturer, usually in mW. Exceeding this maximum value may lead to the crystal being damaged or to a shorter device lifetime. 2 The drive level is given by the following formula: DL = ESR × IQ , where: • ESR is the equivalent series resistor (specified by the crystal manufacturer): • IQ is the current flowing through the crystal in RMS. This current can be displayed on an oscilloscope as a sine wave. The current value can be read as the peak-to-peak value (IPP). When using a current probe (as shown in Figure 7), the voltage scale of an oscilloscope may be converted into 1mA/1mV. C0 2 ESR = R m × 1 + ------- CL Figure 7. Current drive measurement with a current probe &U\VWDO 7RRVFLOORVFRSH &XUUHQWSUREH DLE So as described previously, when tuning the current with the potentiometer, the current through the crystal does not exceed IQmax RMS (assuming that the current through the crystal is sinusoidal). Thus IQmax RMS is given by: I Qmax RMS = DL max I Qmax PP ----------------- = -----------------------ESR 2 2 Therefore the current through the crystal (peak-to-peak value read on the oscilloscope) should not exceed a maximum peak-to-peak current (IQmaxPP) equal to: 2 × DL max I Qmax PP = 2 × --------------------------ESR Hence the need for an external resistor (RExt) (refer to Section 3.5.3) when IQ exceeds IQmaxPP. The addition of RExt then becomes mandatory and it is added to ESR in the expression of IQmax. DocID15287 Rev 10 15/42 41 Pierce oscillator design 3.5.2 AN2867 Another drive level measurement method The drive level can be computed as: DL= I²QRMS × ESR, where IQRMS is the RMS AC current. This current can be calculated by measuring the voltage swing at the amplifier input with a low-capacitance oscilloscope probe (no more than 1 pF). The amplifier input current is negligible with respect to the current through CL1, so we can assume that the current through the crystal is equal to the current flowing through CL1. Therefore the RMS voltage at this point is related to the RMS current by: I QRMS = 2πF × V RMS × C tot , with: • F = crystal frequency • V pp V RMS = ----------- , where: Vpp is the voltage peak-to-peak measured at CL1 level 2 2 • Ctot = CL1 + (Cs/2) + Cprobe where: – CL1 is the external load capacitance at the amplifier input – Cs is the stray capacitance – Cprobe is the probe capacitance) 2 2 ESR × ( π × F × C tot ) × ( V pp ) Therefore the drive level, DL, is given by: DL = -------------------------------------------------------------------------------. 2 This DL value must not exceed the drive level specified by the crystal manufacturer. 3.5.3 Calculating external resistor (RExt) The role of this resistor is to limit the drive level of the crystal. With CL2, it forms a low-pass filter that forces the oscillator to start at the fundamental frequency and not at overtones (prevents the oscillator from vibrating at 3, 5, 7 etc. times the fundamental frequency). If the power dissipated in the crystal is higher than the value specified by the crystal manufacturer, the external resistor RExt becomes mandatory to avoid overdriving the crystal. If the power dissipated in the selected quartz is less than the drive level specified by the crystal manufacturer, the insertion of RExt is not recommended and its value is then 0 Ω. An initial estimation of RExt is obtained by considering the voltage divider formed by RExt/CL2. Thus, the value of RExt is equal to the reactance of CL2. 1 2πFC 2 Therefore: RExt = ------------------ . Let us put: • oscillation frequency F = 8 MHz • CL2 = 15 pF Then: R Ext = 1326 Ω The recommended way of optimizing RExt is to first choose CL1 and CL2 as explained earlier and to connect a potentiometer in the place of RExt. The potentiometer should be initially set to be approximately equal to the capacitive reactance of CL2. It should then be adjusted as required until an acceptable output and crystal drive level are obtained. Caution: After calculating RExt it is recommended to recalculate the gain margin (refer to Section 3.4: Oscillator transconductance) to make sure that the addition of RExt has no effect on the oscillation condition. That is, the value of RExt has to be added to ESR in the expression of gmcrit and gm >> gmcrit must also remain true: gm >> gmcrit = 4 × (ESR + RExt) × (2 × PI × F)² × (C0 + CL)² 16/42 DocID15287 Rev 10 AN2867 Pierce oscillator design Note: If RExt is too low, there is no power dissipation in the crystal. If RExt is too high, there is no oscillation: the oscillation condition is not reached. 3.6 Startup time The startup time is the time required by the oscillation to start up and then build up until it reaches a stable oscillation phase. The startup time depends, among other factors, on the Q-factor of the resonator used. If the oscillator is paired with a quartz-crystal resonator characterized by its high Q-factor then the startup time will be higher if a ceramic resonator is used (ceramic resonators are know for their poor Q-factor compared to quartz-crystal resonators). The startup time also depends on the external components, CL1 and CL2, and on the crystal frequency. The higher the crystal nominal frequency, the lower the start up time. In addition the startup problems are usually due to the fact that the gain margin is not properly dimensioned (as explained previously). This is caused either by CL1 and CL2 being too small or too large, or by the ESR being too high. As an example, an oscillator paired with a few-MHz nominal frequency crystal resonator would typically start up after a delay of few ms. The startup time of a 32.768 kHz crystal ranges from 1 to 5 s. 3.7 Crystal pullability Crystal pullabilty, also known as crystal sensitivity, measures the impact of small variations of the load capacitance seen by the crystal on the oscillation frequency shifting. This parameter usually has more importance when dealing with low-speed oscillators, since they are used to clock time-keeping functions (such as real-time clock functions). When the final application is still in design stage, the influence of this parameter on the lowspeed oscillator accuracy (and consequently on all the time-keeping functions clocked by this oscillator) is not so obvious. This is due to the fact that the designer fine tunes the load capacitors until the desired oscillation frequency is obtained. When the design reaches production stage. it is frozen and all the passive components including the load capacitors have their values well defined. Any change of the load capacitance will directly induce a shift of the oscillation frequency. Changes in the capacitive load (CL) seen by the crystal may be thought of as due to inadequate operation environment and only happening when the final design is not properly operated. In practice, this is not true since changes of the load capacitance are rather frequent and must by taken into account by the designer. The main contributors to the capacitive load (CL) seen by the oscillator are the following: • The capacitance of the load capacitors CL1 and CL2 • The stray capacitance of the PCB paths • The parasitic capacitance of the oscillator pins. Any change on the capacitances listed above directly shifts the oscillation frequency. When the design is in production stage, many of these capacitance values cannot be accurately controlled. Selecting a crystal with low-pullability will limit the influence of such production uncertainties on the final oscillation frequency accuracy. Generally speaking, the higher the load capacitance (CL) of a crystal, the lower its pullability. As an example, let us consider a crystal with a pullability of 45 PPM/pF. To fine tune the oscillation frequency, this crystal is loaded by two C0G ceramic capacitors, CL1 and CL2, with equal capacitances equal to 7 pF. C0G ceramic capacitors have a tolerance value of DocID15287 Rev 10 17/42 41 Pierce oscillator design AN2867 ± 5% of their nominal value. From crystal point of view, the two load capacitors are mounted in series which means that their contribution to the CL is (CL1 = CL2)/2. As CL1 equals CL2, the tolerance on their contribution to CL remains the same and is equal to ± 5%. Now if we consider that all the remaining contributors to the CL are maintained to their nominal values at design stage (to assess the frequency shift magnitude induced only by load capacitor tolerances), then the load capacitance seen by the crystal (CL) will either decrease by 0.175 pF or increase by the same value. This will induce an oscillation shift of: 0.175 pF × 45 PPM/pF = ~7.8 PPM (~0.7 s/day for a time-keeping function such as RTC) The above example shows that the lower the pullability, the lower the impact of small load capacitance deviation on the frequency shifting. Crystal pullability is an important factor when defining the final application PPM budget. 6 Pullability ( PPM ⁄ pF ) C m ×10 = -------------------------------------22 × ( C0 + CL ) Where Cm is the crystal motional capacitance C0 is the crystal shunt capacitance CL is the crystal nominal load capacitance Next sections give a more detailed description on how to calibrate the oscillation frequency and how to estimate the final accuracy uncertainty (PPM) budget. 3.8 Safety factor 3.8.1 Definition Resonators (such as crystal resonators) are well known to undergo aging effects. They manifest themselves over time in a deviation of resonator parameters from their initial values defined by the resonator specifications. Among the affected parameters there is the resonator ESR which value depends on the surrounding environmental conditions such as moisture and temperature. The oscillator transconductance also depends on the microcontroller power supply voltage and on the temperature. The safety factor parameter allows to qualify the oscillator safe operation under the operating conditions and during the application life. It measures the ability of the oscillator not to fail under operating conditions. The safety factor is defined as the ratio between the oscillator negative resistance and the resonator ESR. It is given by the below formula: R ADD + Crystal ESR Oscillator negative resistance S f = ------------------------------------------------------------------------------ = --------------------------------------------------------Crystal ESR Crystal ESR 18/42 DocID15287 Rev 10 AN2867 3.8.2 Pierce oscillator design Measurement methodology To measure the oscillator negative resistance, a resistance is added in series with the resonator as described in Figure 8. The oscillator negative resistance is the value of smallest series resistance that will prevent the oscillator from starting up successfully. In practice, this is achieved by conducting several experiments in which the value of the series resistance is slightly increased compared to the previous experiment. This sequence of experiments should stop when the oscillator is not able to start up correctly. This allows determining the oscillator negative resistance which is equal to the value of the added series resistance. Figure 8. Negative resistance measurement methodology description 670 4 5$'' &/ &/ 06Y9 3.8.3 Safety factor for STM32 and STM8 oscillators Table 4 gives a summary of the safety factors for the oscillators embedded in STM32 and STM8 microcontrollers. It should be noted that for the LSE oscillator, the oscillation is considered safe for a safety factor higher than or equal to x3, while for the HSE oscillator, the oscillation is considered safe starting from a safety factor higher than or equal to x5. Table 4. Safety Factor (Sf) for STM32 and STM8 oscillators(1) Assurance level Safety Factor (Sf) Sf ≥ 5 HSE LSE Safe Very Safe 3 ≤ Sf < 5 Sf < 3 Not Safe Safe Not Safe 1. Safe and very safe oscillations are shown in green while not safe oscillation is show in orange. DocID15287 Rev 10 19/42 41 Guidelines for selecting suitable crystal and external components 4 Guidelines for selecting suitable crystal and external components 4.1 Low-speed oscillators embedded into STM32 microcontrollers AN2867 The low-speed resonator market provides a wide range of crystal resonators. Selecting the most adequate one for a given design depends on many parameters. Below a list of the most important parameters that must be taken into account (only technical factors are listed): • Crystal size or footprint • Crystal load capacitance (CL) • Oscillation frequency offset (PPM) • Startup time. A trade-off between the above parameters must be found depending on the key design criteria. Figure 9 shows that the resonators available on the market can be divided into two categories depending on the above mentioned factors and trade-offs. Figure 9. Classification of low-speed crystal resonators available on the market &U\VWDOORDGFDSDFLWDQFH +LJK S) u/RZ'ULIW u,QFUHDVHG5REXVWQHVV DJDLQVWQRLV\HQYLURQPHQWV 0HGLXP S) /RZSRZHU /RZ S) 0HGLXP /RZ +LJK /6(GULYHOHYHOJPBFULWBPD[ 06Y9 A resonator with a relatively big load-capacitance (such as 12.5 pF) will require more power for the oscillator to drive the oscillation loop at the resonator nominal frequency. Designs targeting low-power consumption (e.g. RTC application powered by coin-batteries requiring very long autonomy) are consequently more likely to use resonators with relatively small load capacitance. On the other side, big load capacitance resonators have a much smaller pullabilty compared to resonators with small load capacitance. As a result, designs without severe constraints on power consumption tend to use big load capacitance crystals to reduce pullability. 20/42 DocID15287 Rev 10 AN2867 Guidelines for selecting suitable crystal and external components One of the key emerging areas where crystal resonators are massively used is the handheld wearable appliance consumer market (e.g. smart phones, Bluetooth kits). For this market segment the crystal size is of critical importance. However it is widely known that smallfootprint crystals come always with high crystal ESR. For this kind of designs, the choice may be harder if the target design has severe constraints in terms of power consumption (which almost always happens). In this case, choose a crystal with a load capacitance as small as possible to optimize power consumption even if this compromises pullabilty. In addition, crystals with high ESR may have a slightly longer startup time. If there are no constraints on crystal size, then it is recommended to choose a crystal with an ESR as small as possible. In noisy environment (which it is almost always the case for industrial applications), if there are no constraints on power consumption, it is recommended to choose crystals with high load capacitance. These crystals will require a high-drive current from the oscillator while being more robust against noise and external perturbations. Another advantage is that the design pullability will be minimized. Depending on which STM32 microcontroller is used, all the resonator families listed below can be compatible with your design or only some of them. STM32 microcontrollers embed two types of low-speed oscillator (LSE): • Constant-gain low-speed oscillators This type of LSE oscillators features a constant gain which makes them compatible only with a few crystal groups mentioned above. For example, LSE oscillators embedded into STM32F2 and STM32L1 microcontrollers target designs with severe power consumption constraint. The selected crystal should consequently have a low load capacitance and a moderate ESR. LSE oscillators embedded into STM32F1 microcontrollers target crystal resonators with moderate ESR and moderate load capacitance. • Configurable-gain low-speed oscillators LSE oscillators belonging to this family have the main advantage to be compatible with a large number of crystals. Almost no constraint will be induced by the STM32 microcontroller embedding this kind of LSE oscillator. This large list of compatible resonator crystals allows to focus only on design constraints (e.g. power consumption, footprint) when selecting a compatible resonator. These LSE oscillators are divided into two categories: – Dynamically (on-the-fly) modifiable gain LSE oscillators The gain of this type of LSE oscillators can be changed either before starting the oscillator or after enabling it. – Statically modifiable gain LSE oscillators The gain can be changed only when the LSE oscillator is turned off. If the oscillator transconductance has to be increased or decreased, the LSE must be turned off first. Table 5 gives the list of low-speed oscillators (LSE) embedded into the STM32 microcontrollers. Caution: When the gain is modified either statically or on-the-fly, the calibration of the oscillation frequency must be re-adjusted to estimate the final accuracy uncertainty (PPM) budget. Caution: In STM32F0 and STM32F3 MCUs, High drive mode (gm_crit_max = 5 µA/V) should be used only with 12.5 pF crystals to avoid saturating the oscillation loop and causing a startup failure. When used with a low CL crystal (eg CL=6 pF), the oscillation frequency jitter and duty cycle may be distorted. DocID15287 Rev 10 21/42 41 • F4_G1: STM32F4 series with LSE generation 1 This category corresponds to STM32F401/405/ 407/427/429xx MCUs that feature LSE oscillators with non-modifiable transconductance • F4_G2: STM32F4 series with LSE generation 2 This category corresponds to STM32F411/446/469/479xx that feature LSE oscillators with statically-modifiable transconductance. Table 5. LSE oscillators embedded into STM32 microcontrollers(1) STM32F0/F3 Drive-level Medium High High STM32F1/T STM32F2 F4_G1 F4_G2 STM32L0/L4 STM32L1 STM32F7 NA NA NA Low High Low Medium Low Medium High High NA Low Unit DocID15287 Rev 10 Low Medium Low gm_min 5 8 15 25 5 2.8 2.8 2.8 7.5 2.5 3.75 8.5 13.5 3 2.4 3.75 8.5 13.5 gm_crit_max 1 1.6 3 5 1 0.56 0.56 0.56 1.5 0.5 0.75 1.7 2.7 0.6 0.48 0.75 1.7 2.7 Medium Medium Low high High µA/V 1. Color code: Blue: LSE oscillators with transconductance modifiable on the fly (dynamically). Green: LSE oscillators with non-modifiable transconductance. Gray: LSE oscillators with statically-modifiable transconductance. Guidelines for selecting suitable crystal and external components 22/42 For simplification purposes, the following terms will be used in Table 5: LSE oscillators embedded into STM32 microcontrollers: AN2867 AN2867 4.2 Guidelines for selecting suitable crystal and external components Detailed steps to select an STM32-compatible crystal This section describes the procedure recommended to select suitable crystal/external components. The whole procedure is divided into three main steps: Step 1: Check the resonator compatibility with the selected STM32 microcontroller To check the compatibility between the selected crystal and the STM32 microcontroller, first identify which procedure has to be followed among the two procedures described in Section 3.4: Oscillator transconductance. The decision should be made based on the oscillator specification provided in the product datasheet: • If the oscillator transconductance parameter is specified, then the first procedure should be applied. Ensure that the gain margin ratio is higher than five (x5) to make sure that the crystal is compatible with the selected STM32 microcontroller. • If Gm_Crit_max is specified instead, make sure Gm_crit for the oscillation loop is smaller than the specified Gm_Crit_max value. Step 2: Determine the capacitance value of the load capacitors CL1 and CL2 To determine the right capacitance values for CL1 and CL2 load capacitors, apply the formula specified in Section 3.3: CL load capacitance. The values obtained are approximations of the exact capacitances to be used. In a second phase, to fine tune the values of the load capacitors, a series of experimental iterations should be performed until the right capacitance values are found. During the experimental phase, use an etalon crystal. An etalon crystal is a characterized crystal which PPM drift is well known when it is loaded by the crystal nominal load capacitance (CL). This kind of crystals can be provided by the crystal manufacturer upon request. After the etalon crystal has been chosen, calculate its oscillation frequency (Fetalon) when the crystal is loaded by its nominal load capacitance. This frequency is given by the formula: 6 F etalon = F nominal × PPM etalon ⁄ 10 where: Fetalon is the etalon crystal oscillation frequency when the crystal is loaded by its nominal load capacitance. Fnominal is the oscillation nominal frequency specified in the crystal datasheet. PPMetalon is the oscillation frequency drift of the etalon crystal as it was characterized by the crystal manufacturer. DocID15287 Rev 10 23/42 41 Guidelines for selecting suitable crystal and external components AN2867 When Fetalon is computed, execute the sequence below: 1. The first experimental iteration should be made with CL1 and CL2 capacitance values determined by calculation: – 2. – If the oscillation frequency is slower than Fetalon then go to sub-step 2). – Otherwise execute sub-step 3). For this experimental iteration, decrease CL1 and CL2 capacitance values, measure again the oscillation frequency and compare it to Fetalon: – 3. If the oscillation frequency is equal to Fetalon, then CL1 and CL2 are the correct capacitances. You can therefore skip sub-steps 2) and 3). If the oscillation frequency is slower than Fetalon, execute sub-step 2). – Otherwise execute sub-step 3). – If the oscillation frequency is almost equal to Fetalon then the latter CL1 and CL2 capacitance values should be used. For this experimental iteration, increase CL1 and CL2 capacitance values, measure again the oscillation frequency and compare it to Fetalon: – If the oscillation frequency is slower than Fetalon then execute sub-step 2). – Otherwise execute sub-step 3). – If the oscillation frequency is almost equal to Fetalon then the latter CL1 and CL2 capacitance values should be used. Step 3: Check the Safety Factor of the oscillation loop The safety factor should be assessed as described in Section 3.8: Safety factor to ensure a safe oscillation of the oscillator under operating conditions. Note: Many crystal manufacturers can check microcontroller/crystal pairing compatibility upon request. If the pairing is judged valid, they can provide a report including the recommended CL1 and CL2 values as well as the oscillator negative resistance measurement. In this case steps 2 and 3 can be skipped. Step 4: Calculate the drive level and external resistor Compute the drive level (DL) (see Section 3.5: Drive level (DL) and external resistor (RExt) calculation) and check if it is greater or lower than DLcrystal: 24/42 • If DL < DLcrystal, no need for an external resistor. Congratulations you have found a suitable crystal. • If DL > DLcrystal, you should calculate RExt in order to have: DL < DLcrystal. You should then recalculate the gain margin taking RExt into account. If you find that gain margin > 5, congratulations, you have found a suitable crystal. If not, then this crystal will not work and you have to choose another. Return to step 1 to run the procedure for the new crystal. DocID15287 Rev 10 AN2867 Guidelines for selecting suitable crystal and external components Step 5 (optional): Calculate the PPM accuracy budget Finally, you can use the formula below to estimate the PPM accuracy budget for the whole application: PPM Budget = PPM crystal + Deviation ( C L ) × Pullability crystal where: PPMBudget is the estimated accuracy for the oscillation frequency. PPMcrystal is the crystal PPM accuracy specified in the datasheet. Deviation (CL) is expressed in pF. It measures the deviation of the load capacitance (CL) due to tolerances on load capacitor values and the variation of the stray capacitance (CS) due to PCB manufacturing process deviation. Pullabilty is expressed in PPM/pF (refer to Section 3.7: Crystal pullability). Note: The PPM budget calculated above does not take into account the temperature variation which may make the PPM budget bigger. DocID15287 Rev 10 25/42 41 Some recommended resonators for STM32 microcontrollers AN2867 5 Some recommended resonators for STM32 microcontrollers 5.1 STM32-compatible high-speed resonators The high-speed oscillator (HSE) embedded into all STM32 microcontrollers are compatible with almost all the resonators available on the market. They are provided by a wide range of resonator manufacturer including: • ABRACON • EPSON (refer to http://www5.epsondevice.com) • KYOCERA • MICROCRYSTAL • MURATA (refer to the Murata part-number selector tool available at http://ds.murata.com/) • NDK (refer to http://www.ndk.com) • RIVER Compatible resonators have various frequencies and technologies (ceramic resonator and quartz-crystal resonator are all compatible with the HSE oscillator embedded into STM32 microcontrollers. Table 6 summarizes the frequency ranges supported by the HSE oscillator embedded into STM32 microcontrollers. Table 6. HSE oscillators embedded in STM32 microcontrollers Frequency STM32F0/ STM32F1/T F3 STM32F2 F4_G1 and F4_G2 STM32F7 STM32L0 STM32L1 STM32L4 Unit 4-32MHz 4 - 16MHz 4-25MHz 4-26MHz 4-26MHz 1-25MHz 1-24MHz 4-48MHz gm_min 10 25 5 5 5 3,5 3,5 7,5 gm_crit_max 2 5 1 1 1 0,7 0,7 1.5 26/42 DocID15287 Rev 10 mA/V AN2867 5.2 Some recommended resonators for STM32 microcontrollers STM32-compatible low-speed resonators Table 7 lists a set of low-speed quartz-crystal resonators that are either compatible with the whole STM32 microcontroller families or with a subset. It shows the STM32 microcontrollers compatible with each resonator part-number. A set of STM32-compatible resonators with different footprints is provided to facilitate crystal selection even if there are geometric constraints for the final application. Note: The list of the STM32-compatible resonators is not exhaustive. Only the compatible resonator part-numbers checked by STMicroelectronics are listed. DocID15287 Rev 10 27/42 41 Package Manufacturer Quartz Ref/ Part number ESR Max(Ω) Frequency (Hz) C0 (pF) CL (pF) gm_crit_max (µA/V) Compatible STM32 series/lines 1.6x1.0mm RIVER TFX04 90000 32768 1 5 0,5494 F0,F1,F2,F3,F4,F7,L0,L4,L1 1.6x1.0mm EPSON FC1610AN 90000 32768 1,2 5 0,5866 F0,F1,F3,F4_G2, F7,L0,L4,L1 1.6x1.0mm KYOCERA ST1610SB32768C0 90000 32768 1,5 7 1,1026 F0,F3,F4_G2,F7,L0,L4 1.6x1.0mm RIVER TFX04 90000 32768 1 9 1,5260 F0,F3,F7,L0,L4 DocID15287 Rev 10 2.0x1.25mm EPSON FC-12M 90000 32768 1 5 0,5494 F0,F1,F2,F3,F4,F7,L0,L4,L1 2.0x1.2mm MicroCrystal CM8V-T1A 75000 32768 1,1 4 0,3308 F0,F1,F2,F3,F4,F7,L0,L4,L1 2.0x1.2mm ABRACON ABS06-107-32.768KHz-T 80000 32768 1,7 4 0,4407 F0,F1,F2,F3,F4,F7,L0,L4,L1 2.0x1.2mm KYOCERA ST2012SB32768A0 80000 32768 1,3 5 0,5384 F0,F1,F2,F3,F4,F7,L0,L4,L1 2.0x1.2mm RIVER TFX03/TFX03L 90000 32768 1 5 0,5494 F0,F1,F2,F3,F4,F7,L0,L4,L1 2.0x1.2mm MicroCrystal CM8V-T1A 75000 32768 1,1 9 1,2972 F0,F3,F4_G2,F7,L0,L4 2.0x1.2mm KYOCERA ST3215SB32768E0 80000 32768 1,3 9 1,4391 F0,F3,F4_G2,F7,L0,L4 2.0x1.2mm NDK NX2012SA - EXS00A-MU00524 80000 32768 1,3 7 0,9345 F1,F0,F3,F7,L0,L4,F4_G2 2.0x1.2mm NDK NX2012SA - EXS00A-MU00528 80000 32768 1,3 12,5 2,5833 F0,F3,F7,L0,L4 3.2x1.5mm ABRACON ABS07-120-32.768KHz-T 60000 32768 1,2 6 0,5274 F0,F1,F2,F3,F4,F7,L0,L4,L1 3.2x1.5mm EPSON FC135R 50000 32768 1,1 6 0,4274 F0,F1,F2,F3,F4,F7,L0,L4,L1 3.2x1.5mm EPSON FC135 70000 32768 1 6 0,5816 F0,F1,F2,F3,F4,F7,L0,L4,L1 3.2x1.5mm KYOCERA ST3215SB32768A0 70000 32768 0,9 5 0,4132 F0,F1,F2,F3,F4,F7,L0,L4,L1 3.2x1.5mm KYOCERA ST3215SB32768E0 70000 32768 0,9 9 1,1633 F0,F3,F4_G2,F7,L0,L4 3.2x1.5mm MicroCrystal CM7V-T1A 50000 32768 1,2 7 0,5701 F0,F1,F2,F3,F4,F7,L0,L4,L1 3.2x1.5mm NDK NX3215SA - EXS00A-MU00525 50000 32768 1 6 0,4154 F0,F1,F2,F3,F4,F7,L0,L4,L1 NDK NX3215SA - EXS00A-MU00523 50000 32768 1 7 0,5426 F0,F1,F2,F3,F4,F7,L0,L4,L1 3.2x1.5mm NDK NX3215SA - EXS00A-MU00526 70000 32768 1 12,5 2,1631 F0,F3,F7,L0,L4,L4 3.2x1.5mm RIVER TFX02 70000 32768 1 7 0,7596 F0,F1,F3,F4_G2,F7,L0,L4 8.0x3.8mm EPSON MC306 50000 32768 0,9 6 0,4036 F0,F1,F2,F3,F4,F7,L0,L4,L1 8.0x3.8mm EPSON MC306 50000 32768 0,9 12,5 1,5223 F0,F3,F7,L0,L4 8.0x3.8mm ABRACON ABS26 50000 32768 1,35 12,5 1,6263 F0,F3,F7,L0,L4 AN2867 3.2x1.5mm Some recommended resonators for STM32 microcontrollers 28/42 Table 7. Recommended crystal resonators for LSE oscillator embedded in STM32 microcontrollers AN2867 Some recommended crystals for STM8A/S microcontrollers 6 Some recommended crystals for STM8A/S microcontrollers 6.1 Part numbers of recommended crystal oscillators Table 8. KYOCERA Part number 6.2 Freq. ESR CL Drive level (DL) CX5032GA08000H0QSWZZ 8 MHz 300 Ω max 12 pF 500 µW max CX5032GA16000H0QSWZZ 16 MHz 100 Ω max 12 pF 300 µW max CX8045GA08000H0QSWZZ 8 MHz 200 Ω max 12 pF 500 µW max CX8045GA16000H0QSWZZ 16 MHz 50 Ω max 12 pF 300 µW max Part numbers of recommended ceramic resonators Table 9 and Table 10 give the references of recommended CERALOCK® ceramic resonators for the STM8A microcontrollers provided and certified by Murata. Table 9. Recommendable conditions (for consumer) Part number Freq. CL CSTCR4M00G55B-R0 4 MHz CL1 = CL2 = 39 pF CSTCE8M00G55A-R0 8 MHz CL1 = CL2 = 33 pF CSTCE16M0V53-R0 16 MHz CL1 = CL2 = 15 pF Table 10. Recommendable conditions (for CAN-BUS) Part number Freq. CL CSTCR4M00G15C**-R0 4 MHz CL1 = CL2 = 39 pF CSTCR8M00G15C**-R0 8 MHz CL1 = CL2 = 33 pF CSTCE16M0V13C**-R0 16 MHz CL1 = CL2 = 15 pF DocID15287 Rev 10 29/42 41 Tips for improving oscillator stability AN2867 7 Tips for improving oscillator stability 7.1 PCB design guidelines The 32 kHz crystal oscillator is an ultra-low-power oscillator (transconductance of a few μA/V). The low oscillator transconductance affects the output dynamics since smaller transconductance values generates a smaller oscillating current. This results in a lower peak-to-peak voltage on the oscillator outputs (from a few dozen to a few hundred mV). Keeping the signal-to-noise ratio (SNR) below acceptable limits for a perfect operation of the oscillator means more severe constraints on the oscillator PCB design in order to reduce its sensitivity to noise. Therefore, great care must be taken when designing the PCB to reduce as much as possible the SNR. A non-exhaustive list of precautions that should be taken when designing the oscillator PCB is provided below: • High values of stray capacitance and inductances should be avoided as they might lead to uncontrollable oscillation (e.g. the oscillator might resonate at overtones or harmonics frequencies). Reducing the stray capacitance also decreases startup time and improves oscillation frequency stability. • To reduce high frequency noise propagation across the board, the microcontroller should have a stable power supply source to ensure noiseless crystal oscillations. This means that well-sized decoupling capacitor should be used for powering the microcontroller. • The crystal should be mounted as close as possible to the microcontroller to keep short tracks and to reduce inductive and capacitive effects. A guard ring around these connections, connected to the ground, is essential to avoid capturing unwanted noise which might affect oscillation stability. Long tracks/paths might behave as antennas for a given frequency spectrum thus generating oscillation issues when passing EMI certification tests. Refer to Figure 11: PCB with separated GND plane and guard ring around the oscillator and Figure 13: Signals around the oscillator. 30/42 • Any path conveying high-frequency signals should be routed away from the oscillator paths and components. Refer to Figure 11: PCB with separated GND plane and guard ring around the oscillator. • The oscillator PCB should be underlined with a dedicated underneath ground plane, distinct from the application PCB ground plane. The oscillator ground plane should be connected to the nearest microcontroller ground. It prevents interferences between the oscillator components and other application components (e.g. crosstalk between paths). Note that if a crystal in a metallic package is used, it should not been connected to the oscillator ground. Refer to Figure 10: Recommended layout for an oscillator circuit, Figure 11: PCB with separated GND plane and guard ring around the oscillator and Figure 12: GND plane. • Leakage current might increase startup time and even prevent the oscillator startup. If the microcontroller is intended to operate in a severe environment (high moisture/humidity ratio) an external coating is recommended. DocID15287 Rev 10 AN2867 Tips for improving oscillator stability Figure 10. Recommended layout for66 an oscillator circuit & / *URXQGVKLHOG 0LFURFRQWUROOHU 26&B,1 4XDUW] 26&B287 5 ([ W & / /RFDOJURXQGSODQHRWKHUOD\HU DLE Warning: It is highly recommended to apply conformal coatings to the PCB area shown in Figure 10, especially for the LSE quartz, CL1, CL2, and paths to the OSC_IN and OSC_OUT pads as a protection against moisture, dust, humidity, and temperature extremes that may lead to startup problems. DocID15287 Rev 10 31/42 41 Tips for improving oscillator stability 7.2 AN2867 PCB design examples Example 1 Figure 11. PCB with separated GND plane and guard ring around the oscillator Figure 12. GND plane 32/42 Figure 13. Signals around the oscillator DocID15287 Rev 10 AN2867 Tips for improving oscillator stability Example 2 Figure 14 gives an example of PCB that does not respect the guidelines provided in Section 7.1: • No ground plans around the oscillator component • Too long paths • No symmetry between oscillator capacitances • High crosstalk/coupling between paths • Too many test points. Figure 14. Preliminary design (PCB design guidelines not respected) DocID15287 Rev 10 33/42 41 Tips for improving oscillator stability AN2867 The PCB design has been improved to respect the guidelines (see Figure 15): • Guard ring connected to the GND plane around the oscillator • Symmetry between oscillator capacitances • Less test points • No coupling between paths. Figure 15. Final design (all design guidelines have been respected) Figure 16. GND plane 34/42 DocID15287 Rev 10 Figure 17. Top layer view AN2867 Tips for improving oscillator stability Example 3 Figure 18 gives another example of PCB that does not respect the guidelines provided in Section 7.1: • No guard ring around oscillator components • Long paths • EMC tests failed. Figure 18. PCB guidelines not respected DocID15287 Rev 10 35/42 41 Tips for improving oscillator stability AN2867 The PCB design has been improved to respect the guidelines (see Figure 19): • Ground planes around the oscillator component • Short paths that link the STM32 to the oscillator • Symmetry between oscillator capacitances • EMC tests passed. Figure 19. PCB guidelines respected 7.3 Soldering guidelines In general, soldering is a very sensitive process for low-frequency crystals more than it is for high-frequency ones. Hints to reduce the impact of such process on the crystal parameters are provided below: 36/42 • Expose crystals to temperatures above their maximum ratings can damage the crystal and affect the ESR value. Refer to the crystal datasheet for the right reflow temperature curve. If it is not provided, ask the manufacturer. • PCB cleaning is recommended to obtain the maximum performance by removing flux residuals from the board after assembly (even when using “no-clean” products in ultralow-power applications). DocID15287 Rev 10 AN2867 8 Reference documents Reference documents • [1] E. Vittoz High-Performance Crystal Oscillator Circuits: Theory and Application IEEE Journal of solid State Circuits, Vol 23, No 3, June 1988 pp 774 - 783. DocID15287 Rev 10 37/42 41 FAQs 9 AN2867 FAQs Table 11. Frequently asked questions Questions Answers How can I know if my crystal is compatible with a Refer to Section 4: Guidelines for selecting given STM32 MCU? suitable crystal and external components. 38/42 Can I use a 32.768 kHz crystal that is compatible with STM32 MCU but is not mentioned in Table 7: Recommended crystal resonators for LSE oscillator embedded in STM32 microcontrollers? Yes, you can. Table 7: Recommended crystal resonators for LSE oscillator embedded in STM32 microcontrollers is not exhaustive. It is given as a reference for some selected crystal manufacturers, footprint size and crystal load capacitance. In my application, 32.768 kHz frequency verylow drift and high accuracy are mandatory to obtain an accurate clock without calibration. Which crystal load capacitance (CL) can I choose? First, you should make sure that your crystal is compatible with the selected STM32 LSE. Then, it is highly recommended to use a crystal with low pullability, that is with CL ≥ 6 pF: CL= 7 pF is a good compromise between low drift and moderate power consumption. 9 and 12.5 pF can be used in a noisy environment but will impact the power consumption. DocID15287 Rev 10 AN2867 10 Conclusion Conclusion The most important parameter is the gain margin of the oscillator, which determines if the oscillator will start up or not. This parameter has to be calculated at the beginning of the design phase to choose the suitable crystal for the application. The second parameter is the value of the external load capacitors that have to be selected in accordance with the CL specification of the crystal (provided by the crystal manufacturer). This determines the frequency accuracy of the crystal. The third parameter is the value of the external resistor that is used to limit the drive level. In the 32 kHz oscillator part, however, it is not recommended to use an external resistor. Because of the number of variables involved, in the experimentation phase you should use components that have exactly the same properties as those that will be used in production. Likewise, you should work with the same oscillator layout and in the same environment to avoid unexpected behavior and therefore save time. Recently MEMS oscillators have emerged on the market with a significant market share. They are a good alternative to resonators-based oscillators thanks to their reduced power consumption, small size (they do not require additional passive components such as external load capacitors) and their competitive cost. This kind of oscillators are compatible with the whole STM32 microcontrollers except for STM32F1 and STM32L1. When a MEMS oscillator is paired with an STM32 embedded oscillator, this latter should be configured in bypass mode. DocID15287 Rev 10 39/42 41 Revision history 11 AN2867 Revision history Table 12. Document revision history Date Revision 20-Jan-2009 1 Initial release. 10-Nov-2009 2 DL formula corrected in Section 3.5.2: Another drive level measurement method. Package column added to all tables in Section 6: Some recommended crystals for STM32 microcontrollers. Recommended part numbers updated in Section 5.1: STM32compatible high-speed resonators and Section 5.2: STM32compatible low-speed resonators. Section 5.2: STM32-compatible low-speed resonators added. Section 5.2: STM32-compatible low-speed resonators added. 27-Apr-2010 3 Added Section 7: Some recommended crystals for STM8A/S microcontrollers. 4 Updated Section 5.2: STM32-compatible low-speed resonators: removed Table 7: Recommendable condition (for consumer) and Table 8: Recommendable condition (for CAN bus); added Table 8: Recommendable conditions (for consumer); updated Murata resonator link. Updated Section 5.2: STM32-compatible low-speed resonators: removed Table 13: EPSON TOYOCOM, Table 14: JFVNY®, and Table 15: KDS; Added Table 6: Recommendable crystals NEW LANDSCAPE TABLE. Added Warning: after Figure 10. 30-Mar-2011 5 Section 5.2: STM32-compatible low-speed resonators: updated “STM32” with “STM8”. Table 16: Recommendable conditions (for consumer): replaced ceramic resonator part number “CSTSE16M0G55A-R0” by “CSTCE16M0V53-R0”. 17-Jul-2012 6 Whole document restricted to STM32 devices. 7 Changed STM32F1 into STM32 throughout the document. Added STM8AL Series in Table 1: Applicable products Replace STM8 by STM32 in Section 5.2: STM32-compatible lowspeed resonators and updated hyperlink. Added Section 7: Tips for improving oscillator stability. Remove section Some PCB hints. 25-Nov-2010 19-Sep-2014 40/42 Changes DocID15287 Rev 10 AN2867 Revision history Table 12. Document revision history (continued) Date 19-Dec-2014 19-Feb-2015 17-Aug-2015 Revision Changes 8 Updated Section 2: Oscillator theory. Updated Section 3: Pierce oscillator design. Renamed section “Gain margin of the oscillator” into Section 3.4: Oscillator transconductance and content updated. Updated Section 3.6: Startup time. Updated Section 3.7: Crystal pullability. Updated Section 4: Guidelines for selecting suitable crystal and external components. Updated Section 5: Some recommended resonators for STM32 microcontrollers. Added Section 8: Reference documents. Updated Section 10: Conclusion. 9 Updated Section 2.3: Negative-resistance oscillator principles to specify the ratio between negative resistance and crystal ESR for STM8 and STM32 microcontrollers. Added Section 3.8: Safety factor. Added Check the Safety Factor of the oscillation loop step in Section 4.2: Detailed steps to select an STM32-compatible crystal. Note moved from step 2 to 3 and updated. Renamed Table 7. 10 Updated Figure 9: Classification of low-speed crystal resonators available on the market. Added caution notes in Section 4.1: Low-speed oscillators embedded into STM32 microcontrollers. Added STM32F7, STM32F446xx, STM32F469/479xx and STM32L4 microcontrollers in Table 5: LSE oscillators embedded into STM32 microcontrollers. Added STM32F411xx, STM32F446xx, STM32F469/479xx and STM32L4xx microcontrollers in Table 6: HSE oscillators embedded in STM32 microcontrollers. Updated Table 7: Recommended crystal resonators for LSE oscillator embedded in STM32 microcontrollers. Added Section 9: FAQs. DocID15287 Rev 10 41/42 41 AN2867 IMPORTANT NOTICE – PLEASE READ CAREFULLY STMicroelectronics NV and its subsidiaries (“ST”) reserve the right to make changes, corrections, enhancements, modifications, and improvements to ST products and/or to this document at any time without notice. Purchasers should obtain the latest relevant information on ST products before placing orders. ST products are sold pursuant to ST’s terms and conditions of sale in place at the time of order acknowledgement. Purchasers are solely responsible for the choice, selection, and use of ST products and ST assumes no liability for application assistance or the design of Purchasers’ products. No license, express or implied, to any intellectual property right is granted by ST herein. Resale of ST products with provisions different from the information set forth herein shall void any warranty granted by ST for such product. ST and the ST logo are trademarks of ST. All other product or service names are the property of their respective owners. Information in this document supersedes and replaces information previously supplied in any prior versions of this document. © 2015 STMicroelectronics – All rights reserved 42/42 DocID15287 Rev 10

- Similar pages
- Product Sheet
- cd00167594
- dm00123028
- dm00073853