The following document contains information on Cypress products. Colophon The products described in this document are designed, developed and manufactured as contemplated for general use, including without limitation, ordinary industrial use, general office use, personal use, and household use, but are not designed, developed and manufactured as contemplated (1) for any use that includes fatal risks or dangers that, unless extremely high safety is secured, could have a serious effect to the public, and could lead directly to death, personal injury, severe physical damage or other loss (i.e., nuclear reaction control in nuclear facility, aircraft flight control, air traffic control, mass transport control, medical life support system, missile launch control in weapon system), or (2) for any use where chance of failure is intolerable (i.e., submersible repeater and artificial satellite). Please note that Spansion will not be liable to you and/or any third party for any claims or damages arising in connection with above-mentioned uses of the products. Any semiconductor devices have an inherent chance of failure. You must protect against injury, damage or loss from such failures by incorporating safety design measures into your facility and equipment such as redundancy, fire protection, and prevention of over-current levels and other abnormal operating conditions. If any products described in this document represent goods or technologies subject to certain restrictions on export under the Foreign Exchange and Foreign Trade Law of Japan, the US Export Administration Regulations or the applicable laws of any other country, the prior authorization by the respective government entity will be required for export of those products. Trademarks and Notice The contents of this document are subject to change without notice. This document may contain information on a Spansion product under development by Spansion. Spansion reserves the right to change or discontinue work on any product without notice. The information in this document is provided as is without warranty or guarantee of any kind as to its accuracy, completeness, operability, fitness for particular purpose, merchantability, non-infringement of third-party rights, or any other warranty, express, implied, or statutory. Spansion assumes no liability for any damages of any kind arising out of the use of the information in this document. ® ® ® TM Copyright © 2013 Spansion Inc. All rights reserved. Spansion , the Spansion logo, MirrorBit , MirrorBit Eclipse , TM ORNAND and combinations thereof, are trademarks and registered trademarks of Spansion LLC in the United States and other countries. Other names used are for informational purposes only and may be trademarks of their respective owners. Fujitsu Semiconductor Design (Chengdu) Co. Ltd. Application Note MCU-AN-510104-E-13 32-BIT MICROCONTROLLER MB9B500 SERIES PHASE LOCK LOOP APPLICATION NOTE ARM and Cortex-M3 are the trademarks of ARM Limited in the EU and other countries. Phase Lock Loop V1.3.0 Revision History Revision History Version Date Updated by Approved by Modifications 1.0.0 2010-8-27 Glede Luo First Draft 1.1.0 2011-3-24 Calvin Tan Change the document format 1.2.0 2011-6-26 Strom Fu Redraw some picture and change the formula format 1.3.0 2.12-6-7 Mona Chen Change the document format This manual contains 16 pages. Specifications are subject to change without notice. For further information please contact each office. All Rights Reserved. The contents of this document are subject to change without notice. Customers are advised to consult with sales representatives before ordering. The information, such as descriptions of function and application circuit examples, in this document are presented solely for the purpose of reference to show examples of operations and uses of FUJITSU SEMICONDUCTOR device; FUJITSU SEMICONDUCTOR does not warrant proper operation of the device with respect to use based on such information. When you develop equipment incorporating the device based on such information, you must assume any responsibility arising out of such use of the information. FUJITSU SEMICONDUCTOR assumes no liability for any damages whatsoever arising out of the use of the information. Any information in this document, including descriptions of function and schematic diagrams, shall not be construed as license of the use or exercise of any intellectual property right, such as patent right or copyright, or any other right of FUJITSU SEMICONDUCTOR or any third party or does FUJITSU SEMICONDUCTOR warrant non-infringement of any third-party's intellectual property right or other right by using such information. FUJITSU SEMICONDUCTOR assumes no liability for any infringement of the intellectual property rights or other rights of third parties which would result from the use of information contained herein. The products described in this document are designed, developed and manufactured as contemplated for general use, including without limitation, ordinary industrial use, general office use, personal use, and household use, but are not designed, developed and manufactured as contemplated (1) for use accompanying fatal risks or dangers that, unless extremely high safety is secured, could have a serious effect to the public, and could lead directly to death, personal injury, severe physical damage or other loss (i.e., nuclear reaction control in nuclear facility, aircraft flight control, air traffic control, mass transport control, medical life support system, missile launch control in weapon system), or (2) for use requiring extremely high reliability (i.e., submersible repeater and artificial satellite). Please note that FUJITSU SEMICONDUCTOR will not be liable against you and/or any third party for any claims or damages arising in connection with above-mentioned uses of the products. Any semiconductor devices have an inherent chance of failure. You must protect against injury, damage or loss from such failures by incorporating safety design measures into your facility and equipment such as redundancy, fire protection, and prevention of over-current levels and other abnormal operating conditions. Exportation/release of any products described in this document may require necessary procedures in accordance with the regulations of the Foreign Exchange and Foreign Trade Control Law of Japan and/or US export control laws. The company names and brand names herein are the trademarks or registered trademarks of their respective owners. Copyright © 2011 Fujitsu Semiconductor Design (Chengdu) Co. Ltd. All rights reserved. MCU-AN-510104-E-13 – Page 2 Phase Lock Loop V1.3.0 Contents Contents REVISION HISTORY ............................................................................................................ 2 CONTENTS .......................................................................................................................... 3 1 INTRODUCTION .............................................................................................................. 4 1.1 Purpose ................................................................................................................... 4 1.2 Definitions, Acronyms and Abbreviations ................................................................ 4 1.3 Document Overview ................................................................................................ 4 2 PURPOSE OF PLL .......................................................................................................... 5 2.1 Overview ................................................................................................................. 5 2.2 Field Oriented Control (FOC)................................................................................... 5 2.3 Phase Lock Loop (PLL) ........................................................................................... 6 3 PLL THEORY................................................................................................................... 9 4 PLL ESTIMATE PARAMETER INTRODUCE ................................................................ 11 4.1 Speed and angle estimator block diagram ............................................................. 11 4.2 The step of the estimate module ........................................................................... 11 5 THE FLOWCHART OF ESTIMATE MODULE ............................................................... 13 6 APPLICATION ............................................................................................................... 14 6.1 Function Description .............................................................................................. 14 7 ADDITIONAL INFORMATION ....................................................................................... 15 8 APPENDIX ..................................................................................................................... 16 8.1 List of Figures and Tables ..................................................................................... 16 MCU-AN-510104-E-13 – Page 3 Phase Lock Loop V1.3.0 Chapter 1 Introduction 1 Introduction 1.1 Purpose This application note describes the phase lock loop in motor control about theory, block, function, flow, sample, parameter and so on. 1.2 Definitions, Acronyms and Abbreviations FOC Field Orient Control PLL Phase Lock Loop 1.3 Document Overview The rest of document is organized as the following: Chapter 2 explains the purpose of PLL control. Chapter 3 explains the theory of PLL. Chapter 4 explains the introduction of the PLL estimate parameter . Chapter 5 explains the flowchart of estimate module. Chapter 6 explains the PLL application in fujitsu solution. Chapter 7 explains the additional information. Chapter 8 explains the appendix. MCU-AN-510104-E-13 – Page 4 Phase Lock Loop V1.3.0 Chapter 2 Purpose of PLL 2 Purpose of PLL PLL arithmetic purpose introduces 2.1 Overview Current industry trends suggest the Permanent Magnet Synchronous Motor (PMSM) as the first preference for motor control application designers. Its strengths, such as high power density, fast dynamic response and high efficiency in comparison with other motors in its category, coupled with decreased manufacturing costs and improved magnetic properties, make the PMSM a good recommendation for large-scale product implementation. Fujitsu Semiconductor produces a wide range of Digital Signal Controllers (DSCs) for enabling efficient, robust and versatile control of all types of motors, along with reference designs of the necessary tool sets, resulting in a fast learning curve and a shortened development cycle for new products. 2.2 Field Oriented Control (FOC) In case of the PMSM, the rotor field speed must be equal to the stator (armature) field speed (i.e., synchronous). The loss of synchronization between the rotor and stator fields causes the motor to halt. Field Oriented Control (FOC) represents the method by which one of the fluxes (rotor, stator or air gap) is considered as a basis for creating a reference frame for one of the other fluxes with the purpose of decoupling the torque and flux-producing components of the stator current. The decoupling assures the ease of control for complex three-phase motors in the same manner as DC motors with separate excitation. This means the armature current is responsible for the torque generation, and the excitation current is responsible for the flux generation. In this application note, the rotor flux is considered as a reference frame for the stator and air gap flux. The control scheme for FOC is presented in Figure 2-1. This scheme was implemented and tested using the fujitsu Inverter control platform, which can drive a PMSM motor using different control techniques without requiring any additional hardware. MCU-AN-510104-E-13 – Page 5 Phase Lock Loop V1.3.0 Chapter 2 Purpose of PLL ωre + f - PI Iqref + Park-1 Vq - Idref + d,q PI PI Vd α,β Vα Vβ 3Phase Bridge SVPW M - A C Iq Id Isα d,q α,β Par k Position and speed Estimator θestim ωm Isβ Isβ Isα Vβ Vα α,β a,b,c B Ib Ic Clark e R Software Hardware Figure 2-1: Sensorless FOC for PMSM Block Diagram 2.3 Phase Lock Loop (PLL) The particularity of the FOC in the case of PMSM is that the stator’s d-axis current reference Idref(corresponding to the armature reaction flux on d-axis) is set to zero. The rotor’s magnets produce the rotor flux linkage, ΨPM, unlike ACIM, which needs a constant reference valueIdref, for the magnetizing current, thereby producing the rotor flux linkage. The air gap flux is equal to the sum of the rotor’s flux linkage, which is generated by the permanent magnets plus the armature reaction flux linkage generated by the stator current. For the constant torque mode in FOC, the d-axis air gap flux is solely equal to ΨPM, and the d-axis armature reaction flux is zero. On the contrary, in constant power operation, the flux generating component of the stator current, Id, is used for air gap field weakening to achieve higher speed. In sensorless control, where no position or speed sensors are needed, the challenge is to implement a robust speed estimator that is able to reject perturbations such as temperature, electromagnetic noise and so on. Sensorless control is usually required when applications are very cost sensitive, where moving parts are not allowed such as position sensors or when the motor is operated in an electrically hostile environment. However, requests for precision control, especially at low speeds, should not be considered a critical matter for the given application. The position and speed estimation is based on the mathematical model of the motor. Therefore, the closer the model is to the real hardware, the better the estimator will perform. The PMSM mathematical modelling depends on its topology, differentiating mainly two types: surface-mounted and interior permanent magnet. Each type has its own advantages and disadvantages with respect to the application needs. The proposed control scheme has MCU-AN-510104-E-13 – Page 6 Phase Lock Loop V1.3.0 Chapter 2 Purpose of PLL been developed around a surface-mounted permanent magnet synchronous motor (Figure 2-2), which has the advantage of low torque ripple and lower price in comparison with other types of PMSMs. The air gap flux for the motor type considered is smooth so that the stator’s inductance value, Ld= Lq (non salient PMSM), and the Back Electromagnetic Force (BEMF) is sinusoidal. Armature (Stator) Air gap Armature winding slots with Armature Rotor’s permanent magnets Rotor core Rotor shift Figure 2-2: Surface Mounted PM PMSM Transversal Section The fact that the air gap is large (it includes the surface mounted magnets, being placed between the stator teeth and the rotor core), implies a smaller inductance for this kind of PMSM with respect to the other types of motors with the same dimension and nominal power values. These motor characteristics enable some simplification of the mathematical model used in the speed and position estimator, while at the same time enabling the efficient use of FOC. The FOC maximum torque per ampere is obtained by uninterruptedly keeping the motor’s rotor flux linkage situated at 90 degrees behind the armature generated flux linkage (see Figure 2-3). β jIsX s Us Umax RsI s Is=IIq E ψPM Figure 2-3: FOC Phase Diagram (Base Speed) MCU-AN-510104-E-13 – Page 7 α Phase Lock Loop V1.3.0 Chapter 2 Purpose of PLL In Figure 2-3 and Figure 2-4 jIsXs is voltage drop in the stator inductor. RsIs is voltage drop in the stator resistance. Eis Back Electromotive Force. ψPMis rotor’s permanent magnets flux linkage. Us is stator terminal voltage. Considering the FOC constant power mode, the field weakening for the motor considered cannot be done effectively because of the large air gap space, which implies weak armature reaction flux disturbing the rotor’s permanent magnets flux linkage. Due to this, the maximum speed achieved cannot be more than double the base speed for the motor considered for testing. Figure 2-4 depicts the phase orientation in constant power – Field Weakening mode. β Umax jIsX s RsI Is s E Us I ψPM q Id LsdId Figure 2-4: FOC Phase Diagram (High Speed - FW) MCU-AN-510104-E-13 – Page 8 α Phase Lock Loop V1.3.0 Chapter 3 PLL Theory 3 PLL Theory Theory of PLL The estimator has PLL structure. Its operating principle is based on the fact that the dcomponent of the Back Electromotive Force (BEMF) must be equal to zero at a steady state functioning mode. The block diagram of the estimator is presented in Figure 3-1. Esα Par k α,β Eβ d,q Ed LP F Eq LP F Edf Sign Eqf + - Integrator θestim ωmR Figure 3-1: PLL Estimator’s Block Schematic Starting from the closed loop shown in Figure 3-2, the estimated speed (ωmR) of the rotor is integrated in order to obtain the estimated angle, as shown in Equation 1: Equation 1: (1) ∫ The estimated speed, ωmR, is obtained by dividing the q-component of the BEMF value with the voltage constant, ΚΦ, as shown in Equation 2. Equation 2: ( ) ( ) (2) Considering the initial estimation premise (the d-axis value of BEMF is zero at steady state) shown in Equation 2, the BEMF q-axis value,Eqf, is corrected using the d-axis BEMF value, Edf, depending on its sign. The BEMF d-q component’s values are filtered with a first order filter, after their calculation with the Park transform, as indicated in Equation 3. Equation 3: ( ( { ) ) ( ( ) ) (3) With the fixed stator frame, Equation 4 represents the stators circuit equations. Equation 4: { (4) MCU-AN-510104-E-13 – Page 9 Phase Lock Loop V1.3.0 Chapter 3 PLL Theory In Equation 4, the terms containing α – β were obtained from the three-phase system’s corresponding measurements through Clarke transform. Lsand Rs represent the per phase stator inductance and resistance, respectively, considering Y (star) connected stator phases. If the motor is Δ (delta) connected, the equivalent Y connection phase resistance and inductance should be calculated and used in the equations above. MCU-AN-510104-E-13 – Page 10 Phase Lock Loop V1.3.0 Chapter 4 PLL Estimate Parameter Introduce 4 PLL Estimate Parameter Introduce This section introduce the PLL estimate parameter Estimate module is the most important module in the software, it estimate the angle speed ωmRand position θestimof the rotor. 4.1 Speed and angle estimator block diagram Park Ls α,β LP F Rs Sig n Rs Ls d,q Integrator LP F Estimator Figure 4-1: Estimator Diagram Input variables for estimate block: α and β component of the current signalI α, I βfrom Clarke transform α and β component of the stator voltage signal Vα, Vβ from SVM module Output variables by estimate block: Angle speed ωmRoutput to PI regulator for speed PI loop. Estimated position θestimoutput to park and park inverse transform. 4.2 The step of the estimate module The estimator equations implemented in the application software are described as flows. step1 The BEMF voltages are calculated as shown in equation 5,6 . ( ) (5) ( ) MCU-AN-510104-E-13 – Page 11 (6) Phase Lock Loop V1.3.0 Chapter 4 PLL Estimate Parameter Introduce Where E α is α component of the BEMF. E βis β component of the BEMF. Vαn-1is α component of the stator voltage for previous cycle . Vβn-1is β component of the stator voltage for previous cycle. Rsis Winding Resistance. Lsis Winding Inductance. Is Rs Ls Vs Motor es Figure 4-2: Motor Equal Circuit Step 2 sin and cos value of the estimated rotor angle are calculated. cos(θestim) and sin(θestim) are used to express the sin and value of the estimated angle. Step 3 the calculated α-β components of the BEMF are transformed to the d-q coordinates. as shown in Equation 7,8. The transformation angle is the estimated flux angle θesti . ( ) ( ) (7) ( ) ( ) (8) Step 4 The d-q components of the BEMF Ed ,Eq should be filtered to reduce the noise. Edf,Eqfare the d-q components of the BEMF, which is filtered by LPF function. Step 5 The estimated angular speed is calculated by the BEMF on the d-axis added or subtracted depending on the sign of BEMF on the q-axis. As equation shows ( ( ) ) { (9) The estimated angular speed should be limited to augment the stability and convergence of the estimator. On the other hand, if ωmR>max value of ωmR, it should be limited to max value of ωmR Step 6 Since there is the integral relationship between rotor position and angle speed. And the estimated rotor position θestim can be calculated by integrating the angle speed. ( ) MCU-AN-510104-E-13 – Page 12 (10) Phase Lock Loop V1.3.0 Chapter 5 The flowchart of estimate module 5 The flowchart of estimate module Figure 5-1: Flowchart of Estimate Module MCU-AN-510104-E-13 – Page 13 Phase Lock Loop V1.3.0 Chapter 6 Application 6 Application PLL application achieve in system code 6.1 Function Description The following code is the example for this module. /************************************************* Function Name: RunMotorCtrlAlgo C file name: DrvMotor_MCL.C, DrvMotor_MCL.H Input: WhichMFT Format: INT8S Function interface: void RunMotorCtrlAlgo (INT8S WhichMFT) *************************************************************/ void example_RunMotorCtrlAlgo () { WhichMFT=0; RunMotorCtrlAlgo(WhichMFT); } MCU-AN-510104-E-13 – Page 14 Phase Lock Loop V1.3.0 Chapter 7 Additional Information 7 Additional Information For more Information on FUJITSU semiconductor products, visit the following websites: English version address: http://www.fujitsu.com/cn/fsp/services/mcu/32bit/fm3/an.html Chinese version address: http://www.fujitsu.com/cn/fss/services/mcu/32bit/fm3/an.html MCU-AN-510104-E-13 – Page 15 Phase Lock Loop V1.3.0 Chapter 8 Appendix 8 Appendix 8.1 List of Figures and Tables Figure 2-1: Sensorless FOC for PMSM Block Diagram ......................................................... 6 Figure 2-2: Surface Mounted PM PMSM Transversal Section ................................................ 7 Figure 2-3: FOC Phase Diagram (Base Speed) ..................................................................... 7 Figure 2-4: FOC Phase Diagram (High Speed - FW) ............................................................. 8 Figure 3-1: PLL Estimator’s Block Schematic ......................................................................... 9 Figure 4-1: Estimator Diagram ............................................................................................ 11 Figure 4-2: Motor Equal Circuit ........................................................................................... 12 Figure 5-1: Flowchart of Estimate Module ........................................................................... 13 MCU-AN-510104-E-13 – Page 16