AN2867 Application Note - STMicroelectronics

3y ago
63 Views
3 Downloads
2.92 MB
56 Pages
Last View : 18d ago
Last Download : 18d ago
Upload by : Callan Shouse
Transcription

AN2867Application noteOscillator design guide for STM8AF/AL/S, STM32 MCUs and MPUsIntroductionMany designers know oscillators based on Pierce-Gate topology (hereinafter referred to asPierce oscillators), but not all of them really understand how they operate, and only a fewmaster their design. In practice, limited attention is paid to the oscillator design, until it isfound that it does not operate properly (usually when the product where it is embedded isalready being produced). A crystal not working as intended results in project delays if notoverall failure.The oscillator must get the proper amount of attention during the design phase, well beforemoving to manufacturing, to avoid the nightmare scenario of products being returned fromthe field.This application note introduces the Pierce oscillator basics and provides guidelines for theoscillator design. It also shows how to determine the different external components, andprovides guidelines for correct PCB design and for selecting suitable crystals and externalcomponents.To speed-up the application development the recommended crystals (HSE and LSE) for theproducts listed in Table 1 are detailed in Section 5: Recommended resonators for STM32MCUs/MPUs and Section 6: Recommended crystals for STM8AF/AL/S microcontrollers.Table 1. Applicable r 2020Product categoriesSTM8S Series, STM8AF Series and STM8AL SeriesSTM32 32-bit Arm Cortex MCUsSTM32 Arm Cortex MPUsAN2867 Rev 131/56www.st.com1

List of tablesAN2867List of tables1Quartz crystal properties and model . . . . . . . . . . . . . . . . . . . . . . . . . . . . 62Oscillator theory . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 834562/562.1Negative resistance . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 82.2Transconductance . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 92.3Negative-resistance oscillator principles . . . . . . . . . . . . . . . . . . . . . . . . . . 9Pierce oscillator design . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 113.1Introduction to Pierce oscillators . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .113.2Feedback resistor . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .113.3Load capacitance . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 123.4Oscillator transconductance . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 133.5Drive level and external resistor calculation . . . . . . . . . . . . . . . . . . . . . . . 143.5.1Calculating the drive level . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 143.5.2Another drive level measurement method . . . . . . . . . . . . . . . . . . . . . . . 153.5.3Calculating the external resistor . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 163.6Startup time . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 163.7Crystal pullability . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 173.8Safety factor . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 183.8.1Definition . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 183.8.2Measurement methodology . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 193.8.3Safety factor for STM32 and STM8 oscillators . . . . . . . . . . . . . . . . . . . 19Guidelines to select a suitable crystal and external components . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 204.1Low-speed oscillators embedded in STM32 MCUs/MPUs . . . . . . . . . . . . 204.2Detailed steps to select an STM32-compatible crystal . . . . . . . . . . . . . . . 23Recommended resonators for STM32 MCUs/MPUs . . . . . . . . . . . . . . 265.1STM32-compatible high-speed resonators . . . . . . . . . . . . . . . . . . . . . . . 265.2STM32-compatible low-speed resonators . . . . . . . . . . . . . . . . . . . . . . . . 26Recommended crystals for STM8AF/AL/S microcontrollers . . . . . . . 40AN2867 Rev 13

AN28677List of tables6.1Part numbers of recommended crystal oscillators . . . . . . . . . . . . . . . . . . 406.2Recommended ceramic resonators . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 41Tips for improving oscillator stability . . . . . . . . . . . . . . . . . . . . . . . . . . 427.1PCB design guidelines . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 427.2PCB design examples . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 447.3Soldering guidelines . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 487.4LSE sensitivity to PC13 activity . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 488Reference documents . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 509FAQs . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 5110Conclusion . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 5211Revision history . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 53AN2867 Rev 133/563

List of tablesAN2867List of tablesTable 1.Table 2.Table 3.Table 4.Table 5.Table 6.Table 7.Table 8.Table 9.Table 10.Table 11.Table 12.4/56Applicable products . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1Example of equivalent circuit parameters . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 7Typical feedback resistor values for given frequencies . . . . . . . . . . . . . . . . . . . . . . . . . . . 12Safety factor (Sf) for STM32 and STM8 oscillators. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 19LSE oscillators embedded into STM32 MCUs/MPUs . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 22HSE oscillators embedded in STM32 MCUs/MPUs . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 26Recommended crystal/MEMS resonators for the LSE oscillator in STM32 MCUs/MPUs . 27KYOCERA compatible crystals (not exhaustive list). . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 40NDK compatible crystals (not exhaustive list). . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 40Recommended conditions (for consumer) . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 41Recommended conditions (for CAN-BUS) . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 41Document revision history . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 53AN2867 Rev 13

AN2867List of figuresList of figuresFigure 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 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 6Impedance in the frequency domain. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 6I-V curve of a dipole showing a negative trans-resistance area (in purple) . . . . . . . . . . . . . 9Block diagram of a typical oscillation loop based on a crystal resonator . . . . . . . . . . . . . . 10Pierce oscillator circuitry . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 11Inverter transfer function . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 12Current drive measurement with a current probe . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 15Negative resistance measurement methodology description . . . . . . . . . . . . . . . . . . . . . . . 19Classification of low-speed crystal resonators . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 20Recommended layout for an oscillator circuit . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 43PCB with separated GND plane and guard ring around the oscillator . . . . . . . . . . . . . . . . 44GND plane . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 44Signals around the oscillator. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 44Preliminary design (PCB design guidelines not respected) . . . . . . . . . . . . . . . . . . . . . . . . 45Final design (following guidelines) . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 46GND plane . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 46Top layer view. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 46PCB guidelines not respected . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 47PCB guidelines respected . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 48AN2867 Rev 135/565

Quartz crystal properties and model1AN2867Quartz crystal properties and modelA quartz crystal is a piezoelectric device transforming electric energy into mechanicalenergy and vice versa. The transformation occurs at the resonant frequency. The quartzcrystal can be modeled as shown in Figure 1.Figure 1. Quartz crystal modelC0QLmRmCmMS36117V1 C0: represents the shunt capacitance resulting from the capacitor formed by theelectrodes 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 lossesThe impedance of the crystal is given by the following equation (assuming that Rm isnegligible):(1)2w Lm Cm – 1jZ ---- ------------------------------------w2 C0 Cm – w Lm Cm C0Figure 2 represents the impedance in the frequency domain.Figure 2. Impedance in the frequency domainImpedanceInductive behavior:the quartz oscillatesCapacitive behavior:no oscillationArea of parallelresonance: FpFsFaFrequencyPhase (deg) 90Frequency–90ai15834b6/56AN2867 Rev 13

AN2867Quartz crystal properties and modelFs is the series resonant frequency when the impedance Z 0. Its expression can bededuced from equation (1) as follows:(2)1F s -----------------------------2 L Cm mFa is the anti-resonant frequency when impedance Z tends to infinity. Using equation (1), itis expressed as follows:(3)Fa FsCm1 --------C0The region delimited by Fs and Fa is usually called the area of parallel resonance (shadedarea in Figure 2). In this region, the crystal operates in parallel resonance and behaves asan inductance that adds an additional 180 phase to the loop. Its frequency Fp (or FL: loadfrequency) 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 byvarying CL load capacitance. This is why in their datasheets, crystal manufacturers indicatethe 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 nominalfrequency of 8 MHz.Table 2. Example of equivalent circuit parametersEquivalent componentValueRm8 Lm14.7 mHCm0.027 pFC05.57 pFUsing equations (2), (3) and (4) we can determine Fs, Fa and Fp of this crystal: Fs 7988768 Hz Fa 8008102 HzIf the load capacitance CL is equal to 10 pF the crystal oscillates at Fp 7995695 Hz.To have an oscillation frequency of exactly 8 MHz, CL must be 4.02 pF.AN2867 Rev 137/5655

Oscillator theory2AN2867Oscillator theoryOscillators are among the backbone components of modern digital ICs. They can beclassified into different sub-families depending on their topology and operating principles. Toeach oscillator sub-family corresponds a suitable mathematical model that can be used tostudy the oscillator behavior and theoretically determine its performance.This section deals only with harmonic oscillators (relaxation oscillators are not within thescope of this application note) with a particular focus (see Section 3) on Pierce-oscillatortopology. This is because all the oscillators that require external passive components(external resonator, load capacitors, etc.) covered by this document are of the previouslymentioned 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 concerns the output waveform.They deliver an oscillating waveform at the desired frequency. This waveform is typicallycomposed of a fundamental sine wave of the desired frequency plus a sum of overtoneharmonics (at frequencies multiple of the fundamental one) due to the nonlinearity of somecomponents of the oscillation loop.These two sub-families differ in their operating principles. This difference also implies adifferent mathematical model to describe and analyze each sub-family.Positive-feedback oscillators are generally modeled using the Barkhausen model where anoscillator must fulfill the Barkhausen criterion to maintain a stable oscillation at the desiredfrequency.The Barkhausen model is not fully adequate to describe negative-resistance oscillators, themost suitable approach to analyze is to use the negative-resistance model described in [1].STM32 microcontrollers and microprocessors (based on Arm (a) cores) feature low-speedexternal (LSE) and high-speed external (HSE) oscillators designed following the negativeresistance principle, hence this section focuses on the presentation of this model.2.1Negative resistanceTheoretically speaking, a negative resistance is a dipole that absorbs heat and converts theenergy into an electrical current proportional to the applied voltage but flowing in theopposite direction (exactly the opposite mechanism of an electrical resistance). In the realworld such a dipole does not exist.a. Arm is a registered trademark of Arm Limited (or its subsidiaries) in the US and/or elsewhere.8/56AN2867 Rev 13

AN2867Oscillator theoryThe term “negative resistance” is actually a misnomer of the “negative trans-resistance”,defined by the ratio between a given voltage variation ( V) and the induced current variation( I). Unlike the resistance, always positive, the trans-resistance (also known as differentialresistance) can be either positive or negative. Figure 3 gives the current-voltage curve for adipole that shows a negative trans-resistance region. It is obvious that the V/I ratio is alwayspositive, this is not the case for the V / I ratio.The portion of the I-V curve represented in purple shows a negative trans-resistance: VV D – V C -------- --------------------------------- 0 II D – I C while the portions in blue shows a positive trans-resistance: VV B – V A -------- -------------------------------- 0 II B – I A Figure 3. I-V curve of a dipole showing a negative trans-resistance area (in purple)2.2TransconductanceSimilarly to the conductance, defined as the inverse of the resistance, the transconductanceis defined as the inverse of the trans-resistance. Transconductance can also be defined asthe differential conductance, expressed as V / I.2.3Negative-resistance oscillator principlesAn oscillation loop is made of two branches (see Figure 4): The active branch, composed by the oscillator itself, provides the energy to make theoscillation start and build up until it reaches a stable phase. When a stable oscillation isreached, this branch provides the energy to compensate for the losses of the passiveAN2867 Rev 139/5655

Oscillator theoryAN2867branch. The passive branch is mainly composed by the resonator, the two load capacitors andall the parasitic capacitances.Figure 4. Block diagram of a typical oscillation loop based on a crystal resonatorPassive branchActive branchXtalSTM32CMSv36188V1According to the small signals theory and when the active branch (oscillator part) is correctlybiased, the latter must have its transconductance equal to the passive branch conductanceto maintain a stable oscillation around the oscillator biasing voltage.However, at startup, the oscillator transconductance must be higher than (multiple of) theconductance of the passive part of the oscillation loop to maximize the possibility to build upthe oscillation from inherent noise of the oscillation loop. Note that an excessive oscillatortransconductance compared to the oscillation loop passive branch conductance may alsosaturate the oscillation loop and cause a startup failure.To ensure the oscillator ability to startup successfully and maintain stable oscillation, a ratiobetween the negative resistance of the oscillation loop and the crystal maximal equivalentseries resistance (ESR) is specified for STM32 and STM8 products. It is recommended tohave a ratio higher than 5 for the HSE oscillators, and higher than 3 for the LSE oscillators.10/56AN2867 Rev 13

AN28673Pierce oscillator designPierce oscillator designThis section describes the different parameters and how to determine their values in orderto be compliant with the Pierce oscillator design.3.1Introduction to Pierce oscillatorsPierce oscillators are variants of Colpitts oscillators, widely used in conjunction with crystalresonators. A Pierce oscillator (see Figure 5) requires a reduced set of externalcomponents, this results in a lower final design cost. In addition, the Pierce oscillator isknown for its stable oscillation frequency when paired with a crystal resonator, in particular aquartz-crystal resonator.Figure 5. Pierce oscillator circuitryMicrocontrollerRFIn vOSC INOSC OUTR ExtQC L1CsC L2ai15836b3.2 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 sum of the device pin capacitance (OSC IN andOSC OUT) and the PCB (a parasitic) capacitance.Feedback resistorIn most STMicroelectronics MCUs/MPUs, RF is embedded in the oscillator circuitry, its roleis to make the inverter act as an amplifier. The feedback resistor is connected between Vinand Vout to bias the amplifier at Vout Vin, and force it to operate in the linear region (shadedAN2867 Rev 1311/5655

Pierce oscillator designAN2867area in Figure 6). The amplifier amplifies the noise (for example, the thermal noise of thecrystal) within the range of serial to parallel frequency (Fa, Fp), this noise causes theoscillation to start.Figure 6. Inverter transfer functionLinear area: the inverter acts as an amplifierVoutVDDSaturationregionSaturationregion VDD/2V DDVinai15837bTable 3 provides typical values of RF.Table 3. Typical feedback resistor values for given frequencies3.3FrequencyFeedback resistor range32.768 kHz10 to 25 MΩ1 MHz5 to 10 MΩ10 MHz1 to 5 MΩ20 MHz470 kΩ to 5 MΩLoad capacitanceThe load capacitance is the terminal capacitance of the circuit connected to the crystaloscillator. This value is determined by the external capacitors CL1 and CL2 and the straycapacitance of the printed circuit board and connections (Cs). The CL value is specified bythe crystal manufacturer. For the frequency to be accurate, the oscillator circuit has to showthe same load capacitance to the crystal as the one the crystal was

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.

Related Documents:

STM32CubeIDE quick start guide - User manual Author: STMICROELECTRONICS Subject: STM32CubeIDE is STMicroelectronics integrated development environment for STM32 microcontrollers and microprocessors. Keywords: STM32, IDE, Eclipse , QSG Created Date: 11/2/2020 4:57:17 PM

[2]. Ben Jordan, Amit Bahl Rigid - Flex PCB Design a guide book for design, Sierra Proto express, 2013 [3]. STMicroelectronics. STM32 embedded graphic objects/ touchscreen library, 2011. [4]. STMicroelectronics. STM32F10xxx ı2c optimized examples, 2010. [5]. STMicroelectronics. Migratin

How a designer can make the most of STMicroelectronics serial EEPROMs Introduction Electrically Erasable and PROgrammable Memory (EEPROM) devices are standard products used for the non-volatile storage of data parameters, with a fine-granularity. This application note describes most of the internal architecture and related functionality of

the oscillators embedded in STM32 microcontrollers covered by this document that require external passive

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-fam

– Electrostatic discharge protection Application Reverse battery protection of an electronic control unit Description The VN5R003H-E is a device made using STMicroelectronics VIPower technology. It is intended for providing reverse battery protection to an electronic module. This devic

Application note SPC560Pxx/SPC56APxx HW design guideline Introduction This application note is intended for hardware designers. It gives hardware design references on SPC560Pxx/SPC56APxx microcontroller. Four topics are covered: Voltage Regulator (VREG) Main oscillator Supply pins Reference Reset circuit www.st.com

During the American Revolution both the American Continental Army and the British Army had spies to keep track of their enemy. You have been hired by the British to recruit a spy in the colonies. You must choose your spy from one of the colonists you have identified. When making your decisions use the following criteria: 1. The Spy cannot be someone who the Patriots mistrust. The spy should be .