Home
DRM117, 3-Phase Sensorless BLDC Motor Control Using
Contents
1. appFaultPendingFlags iDcbLimit Fault Checking Process ADC sunm e Process B US uDcb iDcb M Lc iDcbZcFilt velocityAct bldcMainFlags bidcintTimBFlags bldcStatelndex pwm3ppsSector Tal regSpeedPIparams Align Ramp Speed Regulator Process Zero Crossing Detection sey A Process A regCurrentPIparams Nh tsa periodBLDCZcFIt zcDetectStatelndex velocityRampAct coefCmtPresetHIf Sensorless Commutation Process e oe coefZcToCmt us ma A S timeBLDCCmtNext pwm3ppsSector dutyCycleU16 timeBLDCCmt coefZcOff regForcedPLLParams regSyncPLLParams PWM 3pps Driver MC33927Config Ng mc33927ModeCommands mc33927Masklnterrupts Figure 5 1 BLDC Control Data Flow Diagram 3 Phase Sensorless BLDC Motor Control Using MC9S08MP16 Rev 0 Freescale Semiconductor Software Design 5 2 3 ADC Sensing Process Is analog variables sensing process It provides DC Bus current iDcb sensing synchronized with the PWM 3pps generator and the voltage uDcb and temperature sensing the software is prepared for temperature or other variable sensing but this is not implemented in the default hardware This process also provides filtered variables with an average from a defined number of steps For example uDcbFilt uDcbSum32 adcSensing_AverageUDCBCounter The process is mainly realized in the ADC Sensing Complete Interrupt
2. 10 Freescale Semiconductor Software Design HSCMP __HSCMP N l O FTM N ZC Comparator Timer Cmt Zc Cur Recirc Done ISR FTM1 ch1 f TimerZc N P oe PR OC ISR M N ZC IC ISR E Fan Fault ISR A ZC Detection State Current recirculatio Calculate Calculate periodBLDCZcToff periodZC Time Preset CMT timeCmt timeBLDCCmt yes i Sync Forced PLL timeBLDCCmt Hi loop VA periodBLDCCmtPreset Calcul ate timeCmtPreset NG timeBLDCCmt 2 timeBLDCzcEstimated HmeBlOGzcESt Time Next CMT periodBLDCZcToCmt mated timeBLDCCmt timeBLDCzc periodBLDCZcTo ia TS Cmt C RTS THE 7 C RTS Periodically 50us at 20kHz PWM Periodically EY Pa ES 3ms Bi l RTS at default sw setting a ADC L MTIM UN ADC Sensing f TimB N Complete ISR m Overflow ISR J MC Reset Sensorless Commutation Process v Background Loop Figure 5 3 Application Flow Chart State BLDC Sensorless Run Direct Cmt Forced PLL 3 Phase Sensorless BLDC Motor Control Using MC9S08MP16 Rev 0 Freescale Semiconductor 11 Software Design 5 4 2 ADC ADC Sensing Complete ISR This interrupt subroutine is mainly utilized for Analog Sensing Process It provides the reading of two analog samples per one interrupt It starts with the read of the synchronized DC Bus current i
3. L ii La dt Eqn 16 2 4 2 4 1 Indirect Back EMF Sensing Two Bottom Switches On Conclusion However the branch voltage seems to be similar to Equation 13 there are significant differences e The reference point for the back EMF zero crossing is the DC Bus rail At the two bottom switches on the PWM phase the back EMF zero crossing of the off phase can be sensed from the branch voltage uyy which is the off phase terminal with the DC Bus rail reference Figure 2 14 The difference in the bottom switches voltage drop usually diode versus transistor brings the reference voltage error The reference voltage error might be significant mainly at low voltage applications This error can be rectified with reversing MOSFET control gate control this is used for 4 quadrant power stage operations and with some offsetting of the sensed voltage Unbalanced mutual inductance error is usually not a issue as explained in Section 2 4 2 3 1 Indirect Back EMF Sensing Top and Bottom Switches in Diagonal On Conclusion So we get the Equation 17 Uyc Upackemre 5 Moat U oppo Eqn 17 2 4 3 Back EMF Zero Crossing Synchronization with PWM The back EMF zero crossing needs to be synchronized with PWM in order to compare to a correct reference voltage as explained in Section 2 4 2 Power Stage Motor System Model Another reason for the synchronization is that the zero crossing detection window needs to be even slightly shorter t
4. This is realized by the BDM module The BDM module can be accessed using a connector on the daughter board This can be connected to a personal computer using one of two possible devices e P amp E USB Multilink device or e HCS08 Open Source BDM device Both devices use a USB connector for connection to a PC 3 Phase Sensorless BLDC Motor Control Using MC9508MP16 Rev 0 Freescale Semiconductor 7 System Concept 3 Phase Sensorless BLDC Motor Control Using MC9S08MP16 Rev 0 8 Freescale Semiconductor Chapter 4 Hardware 4 1 Hardware Implementation The BLDC sensorless application runs on Freescale s 3 phase BLDC PMSM Low Voltage Motor Control Drive board with an MC9S08MP16 controller daughter board and a LINIX 45ZWN24 40 BLDC motor The application hardware svstem configuration is shown in Figure 4 1 USB P amp E USB MULTILINK Pf BLDC Motor J1 LINIX 45ZWN24 40 pown 3 phase BLDC PMSM Low Voltage Motor Control Drive board Figure 4 1 Hardware System Configuration All system parts are supplied and documented e MC9S08MP16 Controller Daughter Board for BLDC PMSM Motor Control Drive Uses Freescale s MC9S08MP16 as the controller Described in Section 1 3 1 Bibliography e 3 Phase BLDC PMSM Low Voltage Motor Control Drive Low voltage 3 phase power board with DC input 12 50 V AC and 4 000 VA variable voltage 3 phase MOSFET bridge output Described in
5. see Section 5 4 2 ADC ADC Sensing Complete ISR 5 2 4 Fault Checking Process The fault checking process consists of the fault interrupt which is triggered by hardware over current detection see Section 5 4 7 FTM2 pwm3pps Fault ISR uDcb voltage or other variables checking see Section 5 4 1 Application Background Loop 5 2 5 Zero Crossing Detection Process Provides the back EMF zero crossing detection with the state described in Section 2 4 5 The Zero Crossing Sensing States The process state is defined by the zcDetectStateIndex variable This process is mainly realized in the interrupt subroutines Timer Cmt Zc OC ISR see Section 5 4 4 FTM1 ch0 Timer Cmt Zc OC ISR TimerZc ZC IC ISR see Section 5 4 5 FTMI ch1 TimerZc ZC IC ISR ISR and ZC Comparator Cur Recirc Done ISR see Section 5 4 6 HSCMP ZC Comparator Cur Recirc Done ISR 5 2 6 Sensorless Commutation Process The sensorless commutation process provides all the functionality for the sensorless BLDC commutation control according to the state bldcStateIndex This process is mainly realized in the interrupt subroutines Timer Cmt Zc OC ISR see Section 5 4 4 FTM1 ch0 Timer Cmt Zc OC ISR TimerZc ZC IC ISR see Section 5 4 5 FTMI chi TimerZc ZC IC ISR ISR and ZC Comparator Cur Recirc Done ISR see Section 5 4 6 HSCMP ZC Comparator Cur Recirc Done ISR 5 2 7 PWM 3pps Driver This is the 3pps PWM driver for
6. 0 Freescale Semiconductor 13 Control Theory 2 4 2 3 Indirect Back EMF Sensing Top and Bottom Switches in Diagonal On Both common PWM switching techniques bipolar and unipolar switching have a PWM switching phase where the top and bottom switches in a diagonal are switched on In this section the situation where the Top and Bottom switches are in diagonal on will be analyzed For demonstration of the back EMF sensing we show the commutation state where the motor phases A and B are powered and phase C is free having no current So the phase C can be used to sense the back EMF voltage This is described by the following conditions Says S5 s On U pabor U ontop l li an UNG Uyg us il is is i dis di di HAY i 0 di 0 Us U backEMFe Ls ilii Ly EL dt The Ugapot and Ugptop are the voltage drops over the switching devices Currents flowing through the top switch Sp and the bottom switch Sa are the same and both go through transistors or both go through the reverse diodes we can assume the difference in the voltages across the top and bottom switches can be ignored The back EMF voltages UpackEMFa and UpackEMPb Of an ideally trapezoidal BLDC motor should be as according to Equation 10 U ackEMFb TU packEMFa Eqn 10 The branch voltage uvc can be calculated using the above conditions in Equation 8 di Uy ni U packEMFc T Lses ud Ls di Eqn 11 In reality some of the BLDC motors ha
7. 2 2 2 Voltage Amplitude Controlled by PWM e Synchronize the 6 step commutation with the rotor position The rotor position must be known at certain angles in order to align the applied voltage with the back EMF voltage induced due to movement of the PM The alignment between back EMF and commutation events is very important In this condition the motor behaves as a DC motor and runs at the best working point Thus simplicity of control and good performance make this motor a natural choice for low cost and high efficiency applications When the back EMF voltage is aligned with the applied voltage the stator and rotor field relation is maintained according to Figure 2 4 Under that condition the BLDC motor is controlled with minimal torque ripple and maximal power efficiency VCC l Phase A Motor Running TVCC Motor Running P Direction Direction Phase C Phase B Phase C Phase B l l a N VCC VCC Actual flux New flux setor vector Right Before Commutation Right After Commutation Figure 2 4 6 Step Commutation Stator Field Relative to Rotor 3 Phase Sensorless BLDC Motor Control Using MC9S08MP16 Rev 0 Freescale Semiconductor Control Theory 2 2 1 3 Phase Power Stage The 3 phase 6 step voltage system see Figure 2 2 is created by a 3 phase power stage with six IGBTs MOSFET power switches controlled by the MCU on chip PWM module see Figure 2 5 When using MC9S08MP16 the PWM module is realized
8. 5 1 Application Memory Usage The Table 5 1 shows the code size without the FreeMASTER functionality 3 Phase Sensorless BLDC Motor Control Using MC9S08MP16 Rev 0 16 Freescale Semiconductor Software Design 5 9 Conclusion The design of a speed closed loop drive with a 3 phase BLDC motor was described in this Reference Design Manual It is based on Freescale s MC9S08MP16 microcontroller It illustrates the drive from a system point of view power stage hardware around the microcontroller and finally the software The described design shows simplicity and efficiency in use of the MC9S08MP16 microcontroller for motor control and introduces it as an appropriate candidate for different low cost applications in industrial appliance and automotive fields 3 Phase Sensorless BLDC Motor Control Using MC9508MP16 Rev 0 Freescale Semiconductor 17 Software Design 3 Phase Sensorless BLDC Motor Control Using MC9S08MP16 Rev 0 18 Freescale Semiconductor
9. 6 step BLDC control It serves the Section 5 2 6 Sensorless Commutation Process and Section 5 2 8 Align Ramp Speed Regulator Process processes 5 2 8 Align Ramp Speed Regulator Process Provides alignment timing open loop ramp closed loop ramp and speed controller with torque limitation The process is mainly realized inside the Time Base Interrupt see Section 5 4 3 MTIM TimB Overflow ISR 3 Phase Sensorless BLDC Motor Control Using MC9508MP16 Rev 0 Freescale Semiconductor 3 Software Design 5 2 9 MC33927Config This process provides configuration of the MC33927 3 phase power stage driver via the SPI module The driver is utilized by the 3 Phase BLDC PMSM Low Voltage Motor Control Drive hardware board The configuration is provided via SPI 5 2 10 Application Data Flow Variables adcSensingStateIndex adc sensing state index variable appControlFlags application control flags appFaultFlags application fault flags appFaultPendingFlags application fault pending flags bldcFlags bldc control process flags bldcIntTimBFlags bldc control process flags bldcMainFlags bldc control process flags bldcStateIndex bldc control process state index variable coefCmtPresetHIf coefficient 1 2 of the multiplicant for commutation period preset coefZcOff coefficient for calculation of the period where zero crossing detection sampling is off coefZcToCmt coefficient for calc
10. BLDC Sensorless Run Direct Cmt annaa 5 3 10 State BLDC Sensorless Run Synchronized PLL 5 3 11 State BLDC Sensorless Run Forced PLL Forced Cmt 5 3 12 State BLDC Fault ISR paan KGG KG We wax Kd qon ah EORR CX S DRORCR CR sade mala SINE BLDC PAN cac iod cob dor Ra d UR oC oe d i JEN al a doi boit eodd 5 4 Application Software Flowchart 12s 23 nera rdc l a cde ROC CRAT AG AA 5 4 1 Application Background Loop ianua ede ded dd AQ l 55 5 6 5 7 5 9 5 4 2 ADC ADC Sensing Complete ISR l ksib ker RR RAE sew RC RR RC KANA 12 5 4 3 MTIM Tim Overflow ISR a Rm KA KARGA e beeen bet eeb ee ese AS 12 544 FTM1 HD Timer Cmt Zo OC ISR sa ka bia bieb phd b G e l 12 545 FINIT chi Timetze ZO IC ISR ISR xda kB GG wae ku ad anes edidit 13 5 4 6 HSCMP ZC Comparator Cur Recirc Done ISR L LL 13 5 4 7 FIN PANG Fauth ISR 6 6 PAK y RR KK KK i ERE RR RF OCC Cc 13 FreeMASTER Software 4 53 wees 4A Rr d cR aab C cd o doa wd 18 5 5 1 FreeMASTER Serial Communication Driver 0000e cece eaee 14 5 5 2 FresMASTE Recorder Lsrrrsssussnzzensssssinbvibmai sjjasibjijdaa 15 55 9 FISEMASTER Control Page sidusanzzobnfu gutazjisasadosnaiene ediaz 15 Software Setting and Overview L esubatassszszjjntiebi KAKAPAL ANNE ABER KANG 15 DEI LEGIT FONDI PP PA he bE Oke eed 16 Setting the Software Parameters for a Specific Motor 16 Microcontroller Memory Usage 11 uid ea RA wae eee
11. Frac 3o e m a dede dedo d ap c ERE RL Kak 21 25 2 Op n Lo p Siar 23 aped 45085 Ro aO e aC dopo ede ded CR URO RERO CR CR Rd dico 22 2 5 3 Sensorless Run Direct Commutation Calculation 23 2 5 4 Sensorless Run Synchronized Phase Locked Loop PLL 26 2 5 5 Sensorless Run Forced Phase Locked Loop PLL Forced Cmt 27 Speed Controller with Current Torque Limitation 000 27 Chapter 3 System Concept Application DOC ug dde do oC C NCC RR CREE OL d HC CC ERO bd 1 Jal Pa APA ARA APA os diio eed de RR pO dr AA 1 3 Phase Sensorless BLDC Drive Using MC9S08MP16 s 3 3 3 1 SO8MP16 Modules implementation and H W Synchronization 4 3 3 2 Sensorless Commutation nakak dee KAGAD er devo o OR RC ROAD ag 4 3 3 3 Commutation and PWM Control 42242523 9 x bil bib E CERCA CER AKA RARE ines 4 3 3 4 Zero Crossing Period and Position Recognition 0 00 Ca ADG DEMING oap eden VS d MB Re HERA d jo 3 3 6 BLDC State Control Alignment and Speed Torque Close Loop aar MORE Diari oll cuuaus entuwiedqepbdereeecudadesduesqee beads 338 pa a xuuasaqudusdd uiraasdacind e veda a EA ad e iMd dr AN mas COPS aaubda xs edicicid nd xad e eoa dddcddipicicodad dd doe Qd dd dadab 3 3 10 On Board Programming GP PP MR dpa d e o o aede a Re a Chapter 4 Hardware 21 Hardware Implementation 25 9 9342 osc cree Ebo I Cer a C ER ead 42 Component Description
12. Section 1 3 1 Bibliography 3 Phase Sensorless BLDC Motor Control Using MC9508MP16 Rev 0 Freescale Semiconductor 1 Hardware A detailed description of each individual board can be found in the appropriate user manual or on the Freescale web site www freescale com The user manuals include a schematic of the board a description of individual function blocks and a bill of materials parts list 4 2 Component Descriptions The MC9SO8MP16 sensorless BLDC demo is based on a 3 phase BLDC PMSM Low Voltage Motor Control Drive board module which provides a broad solution for testing and developing low power drives and demos with a list of microcontrollers and DSC daughter boards see Figure 4 2 It demonstrates the abilities of the MC9S08MP16 and provides a hardware tool to help in the development of applications using the MC9S08MP 16 targeted at motor control applications A detailed description including the hardware specification of the 3 phase BLDC PMSM Low Voltage Motor Control Drive board is located in the user s manual under the number LVMCDBLDCPMSMUG The user s guide contains the schematic of the board description of individual function blocks and a bill of materials Aug IT ri ms c NG f eripe 3 E iz zz t i zu Figure 4 2 3 Phase BLDC PMSM Low Voltage Motor Control Drive Board with Daughter Board The motor used in this application is a standard production BLDC with a Hall sensor mounted on
13. Sensorless BLDC Motor Control Using MC9508MP16 Rev 0 Freescale Semiconductor 25 Control Theory 2 5 4 Sensorless Run Synchronized Phase Locked Loop PLL This mode differs from the Section 2 5 3 Sensorless Run Direct Commutation Calculation using a closed feedback loop t t stil ZCesti t zc 7 r ZC Tzcerror f estim T SUN t li 0 1 CS gt regulator LA T estim um gt t ZCestim fr estim gt estim 0 v temr t ZCestim C73CtoCMT T estim CMT Figure 2 27 Synchronized Phase Locked Loop The motor commutation period Temr T m is estimated using a closed loop The closed loop feedback is the period TZcerror between the estimated and the measured back EMF zero crossings A benefit of this feedback loop is that the back EMF zero crossing detection disturbance is filtered Finally the BLDC motor commutation is smoother and less noisy especially at a constant speed For some application ranges with high dynamics accelerations and decelerations the Section 2 5 3 Sensorless Run Direct Commutation Calculation state might be more suitable Using the Sensorless Run Synchronized Phase Locked Loop PLL technique the motor commutation is synchronized with the rotor position The motor velocity is then controlled using the estimated period feedback T stim provided to the speed regulator as described in Section 2 6
14. Zero Crossing Synchronization with PWM and Section 2 4 4 Back EMF Zero Crossing Sensing Circuit The ZC Comparator is realized by the HSCMP2 module The motor phase terminal input is selected by the register HSCMP2CRO according to the PWM Sector The Zero Crossing sampling window is realized by the Window ZC Sampling generated by the PDB2 module 3 3 4 1 1 SYNC Timer Zc ZC Comp The zero crossing comparator output COUT triggers the Timer Zc input capture The synchronization is realized by the HSCMP2 COUT output which is connected to the FTMI Trigger 2 3 3 4 1 2 Window ZC Sampling The signal Window ZC Sampling synchronizes the ZC comparator and is generated by the PDB2 module 3 3 4 1 3 SYNC Window ZC PWM Edge This signal is used to trigger the PDB2 module to generate Window ZC Sampling The signal is generated as an FTM2 Initialization trigger 3 3 5 ADC Sensing 3 3 5 1 Udcb Idcb Vphase ADC An analog to digital convertor for the analog variables conversion This is realized bv an ADC internal module The conversion is synchronized with the PWM edge SYNC ADC Delayed PWM Edge 3 3 5 1 1 SVNC ADC Delav PWM Edge This signal is used to trigger the PDBI module to an SYNC ADC Delayed PWM Edge The signal is generated as an FTM2 Initialization trigger 3 3 5 1 2 SYNC ADC Delayed PWM Edge The signal SYNC ADC Delayed PWM Edge synchronizes the ADC start and is generated by the PDB2 module 3 3 6 BLDC State Control Alignmen
15. analyzed For a demonstration of the back EMF sensing we show the commutation state where the motor phases A and B are powered and phase C is free having no current So the phase C can be used to sense the back EMF voltage This is described by the following conditions Now we have a situation where only the two bottom switches are turned on Such a case is described by Figure 2 17 3 Phase Sensorless BLDC Motor Control Using MC9508MP16 Rev 0 Freescale Semiconductor 15 Control Theory u U a backEMF aN Uic Una Unc A Usc e Figure 2 17 Power Stage Motor Topology with GND Reference The motor phases A and B are powered and phase C is free having no current So phase C can be used to sense the back EMF voltage This is described by the following conditions Sa Spg On U ouo U oppor Uy 0 U babot Uyg 0 U oppor ip Is zi dis ily di Eqn 15 is O di 0 Use UbackEMFc UnackEMFb TM backEMFa In such a case one of the switches is conducting via a transistor switch A while the second switch B is conducting via the reverse diode Therefore the voltage drops over the switching devices Up pot and Ugppo are not equal 3 Phase Sensorless BLDC Motor Control Using MC9S08MP16 Rev 0 16 Freescale Semiconductor Control Theory The branch voltage uyc can be calculated using the above conditions in Equation 8 1 di Uy UpackEMFe i 2 UpgaBor ni U ObBot
16. by six channels of its Flextimer module 3 PHASE POWER STAGE ESIN N PWM JI PWM PWM Sar N Scr POWER E SOURCE pom DC VOLTAGE P PWM A Sca NU A 3 PHASE BLDC MOTOR MOSFET IGBT DRIVERS PWM1 PWM2 PWM PWM4 PWM5 PWM6 Figure 2 5 Power Stage Motor Topology 2 2 2 Voltage Amplitude Controlled by PWM As described in the previous sections the amplitude of a 3 phase voltage system needs to be controlled The most common BLDC control topology uses the power stage from Figure 2 5 with a constant POWER SOURCE DC VOLTAGE Therefore the 3 phase average voltage amplitude is controlled by a PWM technique of the top and bottom transistors The 6 step controller uses one of two PWM techniques 1 Bipolar PWM switching 2 Unipolar PWM switching There are a few derivatives of the two PWM switching techniques According to the operating quadrants of the power stage voltage and current 1 4 quadrant power stage control 2 2 quadrant power stage control 3 Phase Sensorless BLDC Motor Control Using MC9508MP16 Rev 0 4 Freescale Semiconductor Control Theory Second Quadrant negative Speed positive torque reverse braking First Quadrant positive speed positive torque forward accelerating Current Torque Generating Motoring ML sS Motoring II IV Third Quadrant negative
17. generates a window for the comparator HSCMPI to sense the zero crossing synchronously with the FTM2 motor phase PWM e Both hardware and software triggering The HSCMP2 High speed comparator features used in the application e 3 phase back EMF voltages zero crossing detection for rotor positional feedback e Generates FIMI input capture for zero crossing time instant detection The DACX features used in the application Sets the compare level for each HSCCMPx The MTIM Modulo timer features used in the application e 8 bit modulo limit running e Sets the time base for speed control and the long periods timing loop e Overflow interrupt generation 3 Phase Sensorless BLDC Motor Control Using MC9S08MP16 Rev 0 Freescale Semiconductor 5 Introduction 1 3 Front Matter 1 3 1 Bibliography 1 MC9SO8MP16 Reference Manual Freescale Semiconductor 2009 3 Phase BLDC PMSM Low Voltage Motor Control Drive Freescale Semiconductor 2009 3 MC9S08MP16 Controller Daughter Board for BLDC PMSM Motor Control Drive LVBLDCMPI6DBUM Freescale Semiconductor 2009 4 3 phase BLDC Motor Control with Sensorless Back EMF ADC Zero Crossing Detection using DSP 56F 80x AN1913 by Prokop L Motorola 06 2001 5 Sensorless BLDC Motor Control on MC68HC908MR32 Software Description AN2355 by Prokop L Motorola 11 2002 6 Sensorless BLDC Motor Control on MC6SHC908MR32 Software Porting to Customer Motor AN2256 by Prokop L Motorola 11 2
18. products There are no express or implied copyright licenses granted hereunder to design or fabricate any integrated circuits or integrated circuits based on the information in this document Freescale Semiconductor reserves the right to make changes without further notice to any products herein Freescale Semiconductor makes no warranty representation or guarantee regarding the suitability of its products for any particular purpose nor does Freescale Semiconductor assume any liability arising out of the application or use of any product or circuit and specifically disclaims any and all liability including without limitation consequential or incidental damages Typical parameters that may be provided in Freescale Semiconductor data sheets and or specifications can and do vary in different applications and actual performance may vary over time All operating parameters including Typicals must be validated for each customer application by customer s technical experts Freescale Semiconductor does not convey any license under its patent rights nor the rights of others Freescale Semiconductor products are not designed intended or authorized for use as components in systems intended for surgical implant into the body or other applications intended to support or sustain life or for any other application in which the failure of the Freescale Semiconductor product could create a situation where personal injury or death may occur Should B
19. some applications There are at least two reasons why you might want to eliminate the position sensors e Inability to make additional connections between position sensors and the control unit e Cost of the position sensors and wiring 3 Phase Sensorless BLDC Motor Control Using MC9S08MP16 Rev 0 Freescale Semiconductor 7 Control Theory AC LINE VOLTAGE 2 POWER STAGE IM il LOAD CONTROL SIGNALS SPEED POSITION FEEDBACK SETTING CONTROL UNIT kag MOTOR DRIVE Figure 2 10 Classical System 2 4 Sensorless Technique Based on Back EMF Zero Crossing The rotor position estimation is based on the back EMF voltage induced in the stator phases due to rotor flux permanent magnet rotation The back EMF voltage phase corresponds with the rotor position relative to the stator position 2 4 1 Back EMF Zero Crossing Sensing Background A BLDC motor is controlled with a 6 step commutation The 6 step commutation specific feature is that one of the three phases is off at a time The off phase is determined bv the 6 step commutation sector After the commutation transient current recirculation the fly back diodes are conducting the decaying phase current the current of phase x Ig 0 and so Us BEMFC See Figure 2 11 Figure 2 11 6 Step Commutation Specifics 3 Phase Sensorless BLDC Motor Control Using MC9508MP16 Rev 0 8 Freescale Semi
20. velocity ThresholdOLtoRun the sensorless feedback states will be entered with the intermediate state Section 5 3 8 State BLDC Shift Vector In this state the following processes are active The ADC Sensing process measures the DC Bus current iDcb voltage uDcb possibly temperature e FreeMASTER communication with a superior PC Speed Alignment Ramp Process Speed Torque Closed Loop Controller Velocity Ramp with acceleration rampAccelOL e Application and Fault Control Process 5 3 8 State BLDC Shift Vector The stator flux vector relative to the rotor needs to change from an open loop start to the regular run position see Figure 2 4 3 Phase Sensorless BLDC Motor Control Using MC9508MP16 Rev 0 Freescale Semiconductor 7 Software Design 5 3 9 State BLDC Sensorless Run Direct Cmt The BLDC motor is controlled by the direct commutation calculation technique according to Section 2 5 3 Sensorless Run Direct Commutation Calculation In this state the following processes are active The ADC Sensing process measures the DC Bus current iDcb voltage uDcb possibly temperature e FreeMASTER communication with a superior PC Speed Alignment Ramp Process Speed Torque Closed Loop Controller Velocity Ramp with acceleration rampAccelCL e Application and Fault Control Process e ZC Detection Process e Sensorless Commutation Process Direct Cmt Mode 5 3 10 State BLDC Se
21. 002 7 Code Warrior Development Studio for Freescale Microcontrollers V6 2 Freescale Semiconductor 2008 8 PC Master Software Usage Freescale Semiconductor AN2395 2002 9 3 Phase PM Synchronous Motor Vector Control AN1931 by Prokop L Grasblum P 2005 10 Embedded Software Library for S08 User s Manual Freescale Semiconductor 2009 For a current list of documentation refer to www freescale com 1 3 2 Acronyms and Abbreviations Table 1 1 contains sample acronyms and abbreviations used in this document Table 1 1 Acronyms and Abbreviated Terms Term Meaning AC Alternating current ADC Analog to digital converter BDM Background Debug Mode back EMF Back Electro Magnetic Force In this case Voltage generated by BLDC motor rotation BLDC motor JBrushless DC motor In this article it means a synchronous electrically commuted motor with a permanent magnet and a trapezoidal BEMF shape COP Computer operating properly watchdog timer DT Dead time a short time that must be inserted between the turning off of one transistor in the inverter half bridge and the turning on of the complementary transistor due to the limited switching speed of the transistors DC Bus Direct current bus of the 3 phase power stage GPIO General parallel input output modul FTMx Flextimer module 3 Phase Sensorless BLDC Motor Control Using MC9508MP16 Rev 0 6 Freescale Semiconductor Introduc
22. 3 Phase Sensorless BLDC Motor Control Using MC9S08MP16 Design Reference Manual Devices Supported MC9S08MP16 Document Number DRM117 Rev 0 11 2009 N Pag freescale semiconductor How to Reach Us Home Page www freescale com E mail support O freescale com USA Europe or Locations Not Listed Freescale Semiconductor Technical Information Center CH370 1300 N Alma School Road Chandler Arizona 85224 1 800 521 6274 or 1 480 768 2130 support freescale com Europe Middle East and Africa Freescale Halbleiter Deutschland GmbH Technical Information Center Schatzbogen 7 81829 Muenchen Germany 44 1296 380 456 English 46 8 52200080 English 49 89 92103 559 German 33 1 69 35 48 48 French support freescale com Japan Freescale Semiconductor Japan Ltd Headquarters ARCO Tower 15F 1 8 1 Shimo Meguro Meguro ku Tokyo 153 0064 Japan 0120 191014 or 81 3 5437 9125 support japan freescale com Asia Pacific Freescale Semiconductor China Ltd Exchange Building 23F No 118 Jianguo Road Chaoyang District Beijing 100022 China 486 10 5879 8000 support asia freescale com For Literature Requests Only Freescale Semiconductor Literature Distribution Center 1 800 441 2447 or 303 675 2140 Fax 303 675 2150 LDCForFreescaleSemiconductor hibbertgroup com Information in this document is provided solely to enable system and software implementers to use Freescale Semiconductor
23. Application and Fault Control Process 5 3 4 State BLDC Stop The 3 phase power stage is off The software checks the state of the appControlFlags Bits BldcStart flag which is set by a superior system The superior system is a personal computer with a FreeMASTER communication interface 3 Phase Sensorless BLDC Motor Control Using MC9S08MP16 Rev 0 6 Freescale Semiconductor Software Design In this state the following processes are active The ADC Sensing process measures the DC Bus current iDcb and voltage uDcb possibly temperature e FreeMASTER communication with a superior PC e Application and Fault Control Process 5 3 5 State BLDC Alignment Provides a constant vector with a defined ALIGNMENT DUTY CYCLE The alignment state is timed using the MTIM Tim Base It is exited when timBExtendedCntr gt alignmentPeriodTimB In this state the following processes are active The ADC Sensing process measures the DC Bus current iDcb voltage uDcb possibly temperature e FreeMASTER communication with a superior PC e Speed Alignment Ramp Process Alignment timing e Application and Fault Control Process 5 3 6 State BLDC Start Vector The start vector is set before the open loop commutation 5 3 7 State BLDC Open Loop Start The BLDC motor is commuted with a linear open loop starting ramp of rampAccelOL acceleration as described in Section 2 4 2 Power Stage Motor System Model When velocityRampAct 5
24. BMF FEEDBACK WAS RECEIVED periodzc n CORRECTIVE CALCULATION 1 ra timeCmt n 1 ZERO CROSSING DETECTON SIGNAL periodZCO n BACK EMF FEEDBACK periodzc n 2 periodZC n 1 periodzc n perZcToCmt n RECEIVED AND EVALUATED Pt gt ca timeZC n 1 timeZC n perZCToff n timeCmt n41 14 M Y COMMUTATED WHEN BACK EMF ZERO CROSSING ZERO CROSSING IS MISSED DURING DETECTION SIGNAL E31 periodZCToff n periodZC n perZcToCmt n lt Figure 2 26 BLDC Commutation Time with Direct Commutation Calculation The periods from Figure 2 26 are calculated using the equations below paidi periodZc Cone Eqn 18 perZcToCmt periodZcFIt x coefZcToCmt Eqn 19 periodCmtPreset periodZcFlt xcoefCmtPreset Eqn 20 Where theoretically the coefZcToCmt 0 5 since the back EMF zero crossing is between the commutations see Figure 2 12 In a real application the coefficient is slightly different The coefCmtPreset is 51 and usually less or equal to 2 Using the Sensorless Run Direct Commutation Calculation technique the motor commutation is synchronized with the rotor position The motor velocity is then controlled using the zero crossing period feedback provided to the speed regulator as described in Section 2 6 Speed Controller with Current Torque Limitation The speed regulator controls the 3 phase power stage PWM 3 Phase
25. Dcb The second conversion is either the DC Bus voltage or the temperature temperature sensing is not implemented on the default hardware This second conversion is started by software and read out after the conversion is complete At the end the first conversion hardware trigger ADHWT is enabled 5 4 3 MTIM TimB Overflow ISR This is periodically called default 3 ms It is used by the following processes e Speed Alignment Ramp Process Time alignment Speed close open loop ramp Calculate velocity Act from periodBLDCZeFIt Calculate Speed Current Limitation PI controller Set PWM duty cycle e ADC Sensing Process Voltage temperature sample average calculation e FreeMASTER Recorder 5 4 4 FTM1 ch0 Timer Cmt Zc OC ISR This commutation and zero crossing timer output capture interrupt is used by the following processes When ZC Detection State Current recirculation e Zero Crossing Detection Process Set ZC Detection Sampling When ZC Detection State Current recirculation e Sensorless Commutation Process Calculate periodBLDCZcToff Calculate timeCmtPreset when in the Direct Commutation state or timeBLDCzcEstimated when in one of the Sensorless Run PLL states e PWM 3pps Driver Preset the Next Cmt Vector e Zero Crossing Detection Process Sets ZC Detection Curr Recirculation 3 Phase Sensorless BLDC Motor Control Using MC9S08MP16 Rev 0 12 Freescale Semiconductor Software Desig
26. LL Controlled acceleration and deceleration Bidirectional rotation Both motor and generator modes One of two PWM techniques possible determined in a code conditional compile unipolar PWM commutation bipolar PWM commutation PWM frequency of 20 kHz Application controlled from a Personal Computer using the FreeMASTER software tool 3 Phase Sensorless BLDC Motor Control Using MC9S08MP16 Rev 0 Freescale Semiconductor Introduction e Software over voltage and under voltage protection Hardware over current protection e Three phase low voltage 24 V power board e MCOSOSMPIG daughter controller board e FreeMASTER software control interface motor start stop speed setup e FreeMASTER software monitor FreeMASTER software graphical control page required speed actual motor speed start stop status DC Bus voltage level motor current system status FreeMASTER software speed scope 3 Phase Sensorless BLDC M oto r Co nt rol 3 3 3 phase Sensorless BLDC Drive using S08MP16 m Using MC9S08MP16 iiae E Design Reference Den ual PWM ON OFF Application Status 0 g ig Manual Control Figure 1 1 3 Phase Sensorless BLDC Motor Control Using MC9SO8MP16 Main application components available for customers are e Software written in C code using some library algorithms available for the HCSO8 Hardware based on Freescale
27. MP16 is a very good choice for such application thanks to its peripheral like the Flextimer module high speed comparators and others This reference design manual describes the basic motor theory the system design concept hardware implementation and the software design including the FreeMASTER software visualization tool 3 Phase Sensorless BLDC Motor Control Using MC9S08MP16 Rev 0 Freescale Semiconductor 3 Introduction 1 2 Freescale Controller Advantages and Features The MCOSO8MPI6 is a member of the low cost high performance HCS08 Family of 8 bit microcontroller units MCUs All MCUs in this family use the enhanced HCSO8 core and are available with a variety of modules memory sizes memory types and package types The Freescale MC9SO8MP16 microcontroller is well suited for digital motor control offering many dedicated peripherals such as Flextimer FTM modules analog to digital converters ADC timers communications peripherals SCI SPI PO and on board flash and RAM The MC9S08MP16 device provides the following features Two Flextimer modules with a total of eight channels e One analog to digital converter ADC 13 channel 12 bit resolution 2 5 us conversion time One 8 bit modulo counter with an 8 bit prescaler and overflow interrupt Interrupt Priority Controller IPC with four programmable interrupt priority levels One differential Programmable Gain Amplifier PGA with a programmable gain x1 x2
28. PWM according to Figure 2 18 3 Phase Sensorless BLDC Motor Control Using MC9508MP16 Rev 0 18 Freescale Semiconductor Control Theory Phase Selection According to PWM Sector ZC Sampling Udcb 2 Window 1 PWM Sync Figure 2 19 Back EMF Zero Crossing Sensing Circuit 2 4 5 The Zero Crossing Sensing States During the 6 step commutation there is a current recirculation transient the fly back diodes are conducting the decaying phase current before the phase current is 0 During this transient the back EMF Zero crossing cannot be measured because the phase is not off See Figure 2 20 CMT CMT Zero BLDC Crossing Commutation Detection Process Figure 2 20 Zero Crossing Sensing States The zero crossing detector also needs to cover the situation which might appear when the zero crossing sensing is a state where the 6 step commutation is executed before the back EMF zero crossing is detected This is also described in Section 2 5 3 Sensorless Run Direct Commutation Calculation 3 Phase Sensorless BLDC Motor Control Using MC9S08MP16 Rev 0 Freescale Semiconductor 19 Control Theory The zero crossing detection states are shown in Figure 2 21 BLDC Commutation Current Recirculation BLDC Commuted Current Recirculation Done periodToff timeout ZC Sensing Prepare Motor Commutation phase selection overtook ZC ZC Detection Proces Phase BEMF of ZC expect
29. Period Application Monitoring X and Control Desired speed USB to COM Convertor On Board PI Programmi Required 0T ng speed DC Bus Limitations Current Required Elo ee S08MP16 torque Figure 3 1 3 Phase Sensorless BLDC Drive Using MC9S08MP16 System Concept 3 Phase Sensorless BLDC Motor Control Using MC9S08MP16 Rev 0 Freescale Semiconductor 3 System Concept 3 3 1 S08MP16 Modules implementation and H W Synchronization One of the most valuable features of the SO8MP16 device is the hardware synchronization between internal modules Figure 3 2 shows the functional blocks and synchronization signals used for the sensorless BLDC motor control This figure also shows how the functional blocks are implemented using the SO8MPI16 internal modules and synchronization signals PWM1 PWM2 PWM3 W W PWM6 SYNC PWM3pps TimerCmt FTM2 Initialization PWM 3pps Generator aii FTM2 ae Timer Cmt ZC FTM1CHO FTM1 chO output FTM2 Trigger 2 p gt FTM1 FTM1 ch1 Trigger2 SYNC TimerZC ZCComp Window ZC SYNC Window ZC Window ZC Generator Sampling ZC Comparator PWM Edge Triggerins PDB2 HSCMP2 HSOMP2 SYNC ADC Delayed STe PWM Edge ADC Delay PWM ADC delay Udcb Idcb Vphase PWM Edge Trigger n5 PDB1 TriggerA ADHWT ADC Figure 3 2 SO8MP16 Modules and Synchronization A description of the system functional blocks sub blocks and their re
30. Rev 0 Freescale Semiconductor 1 Control Theory VOLTAGE PHASE A PHASE B PHASE C ELECTRICAL 30 90 150 210 270 330 ANGLE Figure 2 2 3 Phase Voltage System 2 2 6 Step Commutation for a 3 Phase BLDC Motor Control The easy to create rectangular shape of applied voltage ensures the simplicity of control and drive The BLDC motor rotation is controlled by a 6 step commutation technique sometimes called 60 120 degree control A simplified principle is shown in Figure 2 3 Phases voltage 101 ABC Hall Sensors Output Figure 2 3 6 Step BLDC Commutation for a 3 Phase Voltage System The 6 step technique which creates the voltage system according to Figure 2 2 with six vectors over one electronic rotation One of the most important characteristics of the 6 step BLDC motor control is that one 3 Phase Sensorless BLDC Motor Control Using MC9S08MP16 Rev 0 2 Freescale Semiconductor Control Theory of the phases is switched off at a time This is important for the rotor position sensing as will be explained below The applied voltage needs to have amplitude and phase aligned with the back EMF So the BLDC motor controller needs to Control the applied 3 phase amplitude The applied voltage can be controlled by the DC Bus voltage level regulation or with a Pulse Width Modulation PWM technique This Sensorless BLDC Control application uses the PWM technique as described in Section
31. Speed Controller with Current Torque Limitation 3 Phase Sensorless BLDC Motor Control Using MC9S08MP16 Rev 0 26 Freescale Semiconductor Control Theory 2 5 5 Sensorless Run Forced Phase Locked Loop PLL Forced Cmt The Forced PLL is similar to Section 2 5 4 Sensorless Run Synchronized Phase Locked Loop PLL But the commutation period Temp is constant and the period TzCerror between estimated and measured amplitude low GS T Czcocmr T Forced mr pwy Vee DutyCycle 13Crorced ES owe Te error 3 7C x Regulator 4 P7459 4 Motor Power Stage Detector tre dac 0 Figure 2 28 Forced Phase Locked Loop Back EMF zero crossings is maintained by the voltage amplitude of the 3 phase system applied on the motor The benefit of this feedback loop is that the commutation period Temp is constant This is required for some applications The motor noise might also be reduced using this technique This technique is only used when the motor phase current is below maximal limits Therefore for high load disturbance ripples the state is leaved Using the Sensorless Run Forced Phase Locked Loop PLL Forced Cmt technique the motor commutation determines the motor velocity 2 6 Speed Controller with Current Torque Limitation The motor velocity is then controlled using the zero crossing period feedback provided to the speed regul
32. The process is mainly realized in the main background loop and the MTIM Tim Base Overflow Interrupt see Section 5 4 3 MTIM TimB Overflow ISR 5 2 2 FreeMASTER Process The FreeMASTER process provides the communication between the BLDC control application and the superior system a personal computer The physical interface between the personal computer and MC9S08MP16 is a serial communication based on the SCI module however due to RS232 port unavailability the hardware board transfers the RS232 to USB see Section 3 3 8 FreeMASTER The FreeMASTER is used to control the application via variables such as velocityDesired and appControlFlags and also to monitor the application variables like the actual BLDC motor velocity DC Bus current and voltage It is also used for tuning application parameters rampAccelOL regSpeedPIparams and so on This process is mainly realized in the main background loop 3 Phase Sensorless BLDC Motor Control Using MC9S08MP16 Rev 0 Freescale Semiconductor 1 Software Design FreeMASTER PC Computer Superior system PH uperi y pa a eee ra ee FreeMASTER EET cui EMQUE S08MP16 rampAccelCL rampAccelOL uDdcbFilt regSpeedPlparams appControlFlags regCurrentPlparams temperatureFilt velocityDesired regForcedPLLParams regSyncPLLParams mue BLDC ee Main se Se ae SE NUES rocess appFaultFlags
33. ale Semiconductor Inc 2008 All rights reserved DRM117 Rev 0 11 2009 2 1 22 2 3 2 5 2 6 Chapter 1 Introduction MINION Dco rm 1 1 1 1 Application Features and Components eee 1 1 1 2 Overview of Sensorless BLDC Variable Speed Drives 3 Freescale Controller Advantages and Features na 4 1 2 1 Peripheral Application Usage usura acd ico ordo x ORCI RR B di 4 PIG RIIET 425p d vA ead Ke Ow 4 43 4 dC E aca dod X EO AA 6 TOR T IDEE eaa da eed oh do UR hh HERES E NIRE oO vd E ced EU SD AP 6 1 3 2 Acronyms and Abbreviations Lu se eda ax EE dS ddr dde E RE AK ELE E ron a 6 1 3 3 Glossary f uico CT PAA AA AA AA 7 Chapter 2 Control Theory ma sn BLDG MOI PAPA 1 6 Step Commutation for a 3 Phase BLDC Motor Control 4 2 2241 Phase Power Slag BG NAGA ERA ai annae DERE EDIAN 4 2 2 2 Voltage Amplitude Controlled by PWM 2 2 eee 4 Why Sensorless Control Aa 7 Sensorless Technique Based on Back EMF Zero Crossing aa 8 2 4 1 Back EMF Zero Crossing Sensing Background Lulu 8 2 4 2 Power Stage Motor System Model a 10 2 4 8 Back EMF Zero Crossing Synchronization with PWM 17 2 4 4 Back EMF Zero Crossing Sensing Circuit L 18 245 The Zero Crossing Sensing States ssssssoies endszzzzznzjonspejjtsu 19 Sensorless Commutation Control lues rr jajd kon e ever zied nia 20 Z1 PIT Hence 6h he KSLA
34. alization is in the following sections 3 3 2 Sensorless Commutation This functional block provides sensorless BLDC commutation with the functionality described in Section 2 4 Sensorless Technique Based on Back EMF Zero Crossing This functional block is provided by software and the blocks Commutation and PWM Control Zero Crossing Period and Position Recognition 3 3 3 Commutation and PWM Control This functional block provides the BLDC commutation and PWM duty cycle control It consists of e PWM 3pps Generator 3 Phase Sensorless BLDC Motor Control Using MC9508MP16 Rev 0 4 Freescale Semiconductor System Concept Timer Cmt Zc 3 3 3 1 PWM 3pps Generator This is the PWM generator for the 3 phase BLDC control It provides the 6 step commutation with unipolar or bipolar as defined in precompiler PWM switching as described in Section 2 2 2 1 3 Phase BLDC 6 Step Control with Bipolar Hard PWM Switching and Section 2 2 2 2 3 Phase BLDC 6 Step Control with Unipolar Soft PWM Switching This PWM is realized by all six channels of the Flextimer FTM2 module The FTM2 is used in FTM complementary combined mode The 6 step commutation is provided automatically using the hardware synchronization signal SYNC PWM 3pps Timer Cmt The module has hardware fault protection The fault is generated by the over current signal from the power stage driver 3 3 3 1 1 SYNC PWM 3pps Timer Cmt Synchronizes the PWM 3 phas
35. alue e velocityRequired velocity required e zcDetectStateIndex zero crossing detection state index variable 5 3 Application Software States The main application state machine with the transition between the states is shown in Figure 5 2 i xii um S appFaultFlags 0 BLDC Us FaultPin a ee EO 00 over current d appFaultPendingFlags 0 amp 7 wn Fault ISR PA appControlFlags Bits FaultClear Noo BLDC Applnit m BLDC uu e e be FIL m caer PLL Nu Forced Cmt Done SL K SYNG pLa NA ANA d bldcFlags SyncPLLModeRq 1 amp 9 5 appControlFlags BldcStart 0 a SL_TECHNIQUE_FORCED_PLL amp XC bldcFlags ForcedPLLModeRq 1 amp bldcFlags dd dk 0 bldcFlags CurLimit 0 Run BLDC Stop BLDC Sensorless vus Direct Cmt Low Speed Ramp iiefiiztazjje BldcStart 1 8 EN ins d I 0 velocityRampAct velocityThresholdRuntoOL Er oiu UR Vector BLDC Alignment ai ake 1 5 1 2 dta timBExtendedCntr aligamentPeriodTimB velocityRampAct 5 Mm PM BLDCOpen Loop Start RR Start D Done Ramp E ol 5 2 BLDC Control State Diagram The application states are described in the following sections 3 Phase Sensorless BLDC Motor Control Using MC9S08MP16 Rev 0 Freescale Semiconductor 5 Software Design 5 3 1 State Application MCU Init The application goes to this state immediately after reset In this state the software initializes all the general application modules general purpose registers initia
36. an be done in the source code main h using define for permanent change of the control routine SL TECHNIQUE SYNCHRONIZED PLL SL TECHNIQUE FORCED PLL The zero crossing detection process has two modes The current decay sampling mode detects where the current decay finishes If the mode is not set the current decay is defined by periodBLDC Toff time out The mode permanent change is defined by Zdefine ZC MODE CURRENT DECAY SAMPLING The software default switching technique is unipolar PWM The bipolar pwm is defined by 3 Phase Sensorless BLDC Motor Control Using MC9S08MP16 Rev 0 Freescale Semiconductor 15 Software Design PWM BIPOLAR SWITCHING The benefits of a structured modular software design are well perceived This is especially true for complex motor control systems with many interacting software sub blocks Due to these reasons a Freescale library set for the HCSO8 has been developed 5 6 1 Library Functions The application source code uses the new Freescale Embedded Software Library for the S08 family of microcontrollers The library consists of two packs The basic math primitives S08math and the embedded control functions ECLIB For detailed information follow 10 5 7 Setting the Software Parameters for a Specific Motor The default software parameter settings have been tuned for a default hardware setup with the motor LINIX 45ZWN24 40 and Freescale s 3 phase BLDC PMSM Low Voltage Motor Control Drive board Whe
37. ator The outer current regulator limits the motor current This provides the torque limitation in order to limit the maximal motor current The speed regulator controls the 3 phase power stage PWM This regulator controls the velocity or torque in the Sensorless Run Synchronized Phase Locked Loop PLL or Sensorless Run Direct Commutation Calculation states 3 Phase Sensorless BLDC Motor Control Using MC9508MP16 Rev 0 Freescale Semiconductor 27 Control Theory DC Bus Current Limit Actual DC Bus Current Velocity Required rpm To PWM Velocity Actual rpm Period 60 6 p T Zero Crossing Filtered Estimated Figure 2 29 Speed Control with Torque Limitation 3 Phase Sensorless BLDC Motor Control Using MC9S08MP16 Rev 0 28 Freescale Semiconductor Chapter 3 System Concept 3 1 Application Description As was already mentioned in previous sections the 3 Phase Sensorless BLDC Motor Control Using MCOSO8MP 16 application is based on the MC9S08MP16 MCU A standard system concept was chosen for the drive see Figure 3 1 The system incorporates this hardware e 3 Phase BLDC PMSM Low Voltage Motor Control Drive e MC9S08MP16 Controller Daughter Board for BLDC PMSM Motor Control Drive e 3 phase BLDC motor default configuration for LINIx 45ZWN24 40 motor The MC9S08M 16 populated on the controller daughter board executes the control algorithm In response to the user in
38. conductor Control Theory So the phase back EMF voltage can be simply measured when using the 6 step commutation Phase Selection T TADS YS ae l MUX Command 2 A A ONG a Case Comparator A l l l TNI Appropriate Phase utpu i i PO Zero crossing edge Ma HMM phi cad Comparator Output al la erem konba A gt 1 selected Branch Voltage AT i Interval of phase Back EMF zero crossing detection Reference Level 1 Zero Crossing event Chi S mv TA 5 00 V X detected Ch3 5 00v E 500mv Commutation Signal Zero Crossing Signal Figure 2 12 The Back EMF Zero Crossing Detection Figure 2 12 shows the relationship between back EMF zero crossing and an ideallv svnchronized commutation For the ideal commutation time instant shown in Figure 2 4 the phase back EMF zero crossing is in the middle of the commutations So the back EMF zero crossing is used to synchronize the 6 step commutation with the rotor position in order to get the required constant torque performance of the BLDC motor 3 Phase Sensorless BLDC Motor Control Using MC9508MP16 Rev 0 Freescale Semiconductor 9 Control Theory 2 4 2 Power Stage Motor System Model One of the issues of the phase back EMF zero crossing sensing is that the mo
39. e 2 Uy FUyp 2 NAT U qekEMEX T 2 SL Sa I Sx Eqn 8 x A d AGA 3 Phase Sensorless BLDC Motor Control Using MC9508MP16 Rev 0 12 Freescale Semiconductor Control Theory The Equation 8 can be written for any of the three motor branch and phase voltages 2 4 2 2 Switching Phases of Bipolar and Unipolar PWM Let us assume a usual situation where the BLDC motor is driven in 6 step commutation mode using a PWM technique The standard bipolar PWM switching technique see Figure 2 15 and section 2 2 2 1 has two phases e 1 4 Top and Bottom switches in diagonal on e 2 3 Top and Bottom switches in inverse diagonal on The inverse phase 2 3 is same as 1 4 but the top and bottom switches are swapped on both phases Regeneration _ Bog Cot V Q2 Q3 Regeneration Bale os v 1 4 Top Bottom 2 3 Top Bottom in diagonal on in inverse diagonal on Figure 2 15 Bipolar Hard PWM Switching Phases The unipolar PWM switching technique see Figure 2 16 and section 2 2 2 2 has other two switching phases e 1 3 Top and Bottom switches in diagonal on e 2 4 Two Bottom switches on low voltage drop 1 2 Top Borom 2 Two Bottoms on One cycle in diagonal on F in Quadrant 1 Sof One cycle 3 Top Bott i op Bottom in Quadrant 3 in diagonal on 4 Two Bottoms on inverse current Figure 2 16 Unipolar Soft PWM Switching Phases 3 Phase Sensorless BLDC Motor Control Using MC9508MP16 Rev
40. e BLDC module with the commutation period timer The next commutation vector is executed just when the synchronization signal is set The synchronization is realized by the FTM1CHO output must be previously cleared with bit FTMIOUTINIT CHOOI 0 and FTMIMODE INIT 1 connected as FTM2 Trigger2 bit SOPT2 FTM2T2S 1 3 3 3 2 Timer Cmt Zc This is a timer which serves the two functional blocks Commutation and PWM Control and Zero Crossing Period and Position Recognition This timer is realized by the Flextimer FTM1 module in TP mode ChannelO is used for the Commutation and PWM Control functional block as an output compare for the commutation timing see timeCmt in Figure 2 26 The FTMICHO output is used for SYNC PWM 3pps Timer Cmt for hardware commutation The FTMI channell is used for Zero Crossing Period and Position Recognition as input capture for the zero crossing time instant see timeZC in Figure 2 26 The hardware trigger FTMI Trigger2 triggers the input capture with the SYNC Timer Zc ZC Comp 3 3 4 Zero Crossing Period and Position Recognition This functional block provides the back EMF zero crossing detection with period and position recognition e ZC Comparator Timer Cmt Zc 3 Phase Sensorless BLDC Motor Control Using MC9508MP16 Rev 0 Freescale Semiconductor 5 System Concept 3 3 4 1 ZC Comparator Back EMF zero crossing comparator Provides zero crossing detection as described in Section 2 4 3 Back EMF
41. e active The ADC Sensing process measures the DC Bus current iDcb voltage uDcb possibly temperature e FreeMASTER communication with superior PC Speed Alignment Ramp Process Velocity Ramp with acceleration rampAccelCL e Application and Fault Control Process e ZC Detection Process e Sensorless Commutation Process Forced PLL Mode 5 3 12 State BLDC Fault ISR This fault interrupt subroutine state is initiated by a hardware pin FTM2FAULT over current which generates an FTM2 pwm3pps Fault ISR The MC9S08MP16 microcontroller provides programmable fault protection where a fault protection can disable any combination of PWM pins These faults are generated by logic one on any of the fault pins The fault pins are assigned to both Flextimer modules When the fault protection hardware disables the PWM pins the PWM generator continues to run and only the output pins are deactivated If a fault is latched in it must be cleared and the fault state is invoked prior to enabling the PWM to prevent an unexpected interrupt 5 3 13 State BLDC Fault This fault state is entered when appFaultFlags 0 The fault flags are set by the ADC Sensing Process or in the State BLDC Fault ISR initiated by a hardware pin FTM2FAULT over current which generates an FTM2 pwm3pps Fault ISR The fault state is exited when no fault is pending appFaultPendingFlags 0 and where appControlFlags Bits FaultClear 1 is set by a superior system The supe
42. ed level search Done ZC Get ZC Detected saves timeZC Figure 2 21 Zero Crossing Sensing States 2 5 Sensorless Commutation Control This section presents the sensorless BLDC motor commutation with the Back EMF Zero Crossing technique In order to start and run the BLDC motor the control algorithm has to go through the following states Alignment e Open Loop Start e Sensorless Run Direct Commutation Calculation e Sensorless Run Synchronized Phase Locked Loop PLL e Sensorless Run Forced Phase Locked Loop PLL Forced Cmt Figure 2 22 shows the transitions between the states Firstly the rotor is aligned to a known position then the rotation is started without the positional feedback When the rotor moves back EMF is acquired so the position is known and can be used to calculate the speed and processing of the commutation in the running state 3 Phase Sensorless BLDC Motor Control Using MC9508MP16 Rev 0 20 Freescale Semiconductor Control Theory C START MOTOR ALIGNMENT ALIGNMENT TIME EXPIRED YES p OPEN LOOP START velocityRampAct gt velocityOLtoRun YES SENSORLESS RUN Figure 2 22 Commutation Control Stages 2 5 1 Alignment Before the motor starts there is a short time depending on the motor s electrical time constant when the rotor position is stabilized by applying PWM signals to only two motor pha
43. han the period of the Top and Bottom Switches in Diagonal On PWM stage This is in order to stop the zero crossing sampling during dead time and during PWM transient spikes Those spikes appear on the measured phase due to power stage switches transitions and mainly due to mutual capacitance between the motor phases see Section 1 3 1 Bibliography 5 for details Figure 2 18 shows the Zero Crossing Sampling window for position sensing at the Top and Bottom switches in diagonal on 3 Phase Sensorless BLDC Motor Control Using MC9S08MP16 Rev 0 Freescale Semiconductor 17 Control Theory Top and Bottom in diagonal on Two Bottoms on iz 1 f 7 PIA SYO S YY VIN PAALIS Ahhh a NAAALAALA AALALA LAN fff I Www poo GU i M RE 7 LA mm ri i WW Zero Crossing Window A CA Figure 2 18 Zero Crossing Detection Measurement Window Unipolar Switching 2 4 4 Back EMF Zero Crossing Sensing Circuit In this Sensorless BLDC Control application the zero crossing is detected using a high speed comparator According to the previous sections the comparator topology e Phase analog multiplexer This multiplexes the sampled motor phase according to the PWM sector Reference signal Figure 2 19 shows the reference signal for top bottom in diagonal on e Comparator e Sampling Window Generator Generates the measurement window synchronized with the power stage
44. ika RR CIC BR Oe Re KNA 16 BS a APAPAP a a ITI TEN 17 Chapter 1 Introduction 1 1 Introduction This document describes the cost effective design of a sensorless 3 phase brushless DC BLDC trapezoidal motor closed loop speed control using MC9S08MP16 The design is targeted at the consumer automotive and industrial applications This cost effective solution benefits from the dedicated motor control features in the Freescale Semiconductor MC9SO8MP 16 device 1 1 1 Application Features and Components The system is designed to drive a 3 phase brushless DC BLDC motor with trapezoidal back EMF The application features Targeted at the MC9SO8MP16 8 bit microcontroller Sensorless 3 phase trapezoidal BLDC motor control with 6 step commutation 60 120 degree control Star or Delta 3 phase connected motor Back EMF zero crossing used to synchronize the 6 step commutation with rotor position MC9S08MP16 in built high speed comparator HSCMP detects the back EMF voltage Zero crossing Three sensorless synchronized commutation control algorithms incorporating Commutation instant calculated directly from the period between two back EMF Zero crossings Commutation period synchronized with the back EMF zero crossing using a closed loop according to a phase error Synchronized PLL Constant commutation period forced with the motor voltage controlled in a closed loop according to a phase error Forced P
45. ine must be called periodically from the loop in which you want to take the samples The following line must be added to the loop code FMSTR Recorder FreeMASTER recorder routine call In this application the FreeMASTER recorder is called from the MTIM Time Base Overflow interrupt which creates a 3 ms time base for the recorder function A detailed description of the Free MASTER software is provided in AN2395 PC Master Software Usage 5 5 3 FreeMASTER Control Page The FreeMASTER control page creates a graphical user interface GUI for the 3 phase sensorless BLDC control Start the FreeMASTER software window s project by clicking on the BLDC Sensorless SO8MP16 pmp file A user is able to monitor all the important quantities of the motor By clicking the speed gauge the motor is started and the desired speed is set The actual motor speed motor currents and voltages are displayed on the control page gauges Application status is displayed The following Free MASTER software control page actions are supported e Setting the required speed of the motor Switch running motor on off The FreeMASTER software control page displays e Actual and required speed e DC bus current and voltage e Application fault status 5 6 Software Setting and Overview The application supports three sensorless synchronous commutation algorithms Direct commutation calculation Synchronized PLL and Forced PLL Switching between algorithms c
46. lization e MCU clock initialization e input output registers initialization e SPI Initialization e MC33927 driver configuration 5 3 2 State BLDC MCU Init In this state the BLDC application dedicated modules are initialized the FTM2 module is initialized as pwm3pps for complementary BLDC 6 step control the FTMI timer ch0 is initialized as the zero crossing output compare Timer Cmt the FTMI timer chl is initialized as the zero crossing input capture Timer Zc the HSCMP comparator is initialized as a zero crossing comparator the PDB2 delay block is initialized to a zero crossing sampling window the ADC comparator is initialized for current sensing synchronized with the 3 phase PWM and voltage possibly temperature where supported by hardware sampling e the PDB1 delay block is initialized for 3 phase PWM synchronization with the ADC the MTIM timer is initialized for Time Base interrupts default 3 ms the App Init state is entered 5 3 3 State BLDC App Init In this state the current offset calibration is provided DC Bus current samples are added to the iDcbSum register with the adcSensing CalibrationCounter increment After a defined number of samples ADC SENSING CALIBRATION COUNT the average iDcboffset is calculated In this state the following processes are active e The ADC Sensing process measures the DC Bus current iDcb voltage uDcb possibly temperature e FreeMASTER communication with a superior PC e
47. me Alignment Figure 2 24 Open Loop Start 2 5 3 Sensorless Run Direct Commutation Calculation The commutation process is a series of states which ensure e The back EMF zero crossing is successfully captured The new commutation time is calculated The commutation is performed The following processes need to be provided e BLDC motor commutation service e Back EMF zero crossing moment capture service e Calculation of commutation time Interactions between these commutation processes From the diagrams an overview of how the commutation works can be understood After commuting the motor phases a time interval periodZcToff k is set that allows the shape of the back EMF to be stabilized after the commutations the fly back diodes are conducting the decaying phase current therefore sensing of the back EMF is not possible Then the new commutation time timeBLDCCmt k is preset according to periodC mtPreset The new commutation will be performed at this time if the back EMF zero crossing is not captured If the back EMF zero crossing is captured before the preset commutation time expires then the exact calculation of the commutation time timeCmt k is made from this based on the captured Zero crossing time timeBLDCZc k and perZcToCmt k The new commutation is performed at this new time 3 Phase Sensorless BLDC Motor Control Using MC9S08MP16 Rev 0 Freescale Semiconductor 23 Control Theory If for any reason
48. n 5 4 5 FTM1 chi TimerZc ZC IC ISR ISR This zero crossing timer input capture interrupt is used by the following processes e Zero Crossing Detection Process Set zero crossing off load the zero crossing instant load timeBLDCZc e Sensorless Commutation Process Calculate periodZC timeCmt when Direct Commutation state or Calculate the Sync Forced PLL closed loop regulator when in one of the Sensorless Run PLL states Time Next CMT time the next commutation timeBLDCCmt timeBLDCzc periodBLDCZcToCmt 5 4 6 HSCMP ZC Comparator Cur Recirc Done ISR The comparator interrupt Current recirculation Done is utilized by e Zero Crossing Detection Process Set the Zero Crossing Detection Sampling e Sensorless Commutation Process time the next commutation preset the preset commutation will be performed when no Zero crossing appears Time Preset timeBLDCCmt timeBLDCCmt periodBLDCCmtPrese when Direct Commutation state or timeBLDCCmt timeBLDCzcEstimated periodBLDCZcToCmt when one of the Sensorless Run PLL states 5 4 7 FTM2 pwm3pps Fault ISR This hardware fault interrupt subroutine is utilized by e PWM 3pps Driver Switch the 3pps off e Application and Fault Control Set the Fault 5 5 FreeMASTER Software FreeMASTER software was designed to provide a debugging diagnostic and demonstration tool for the development of algorithms and applications Moreover it s very useful for t
49. n another motor and hardware are used the software settings need to be changed according to their specific parameters All application parameters dedicated to the motor or application ratings max velocity are defined in the main h file and commented to help users modify the parameters according to their requirements Part of parameter file define ALIGNMENT PERIOD MS 1000 0 Alignment state period ms define ALIGNMENT_PERIOD_TIMB ALIGNMENT_PERIOD_MS 1000 0 TIMB_PERIOD_US Alignment state period Time Base scale ms All application parameters dedicated to the hardware boards and processor pin assignment clock rating and so on are defined in the hw_config h file and commented to help users modify the parameters according to their requirements Part of the parameter file define CPU_FREQUENCY_MHZ 40 0 CPU FREQUENCY 40 000 000 Hz define SYSTEMCLOCK FREQUENCY MHZ CPU FREQUENCY MHZ define BUSCLOCK FREQUENCY MHZ CPU FREQUENCY MHZ 2 0 5 8 Microcontroller Memory Usage Table 5 1 shows how much memory is needed to run the 3 phase BLDC Motor Control application A significant part of the microcontroller memory is still available for other tasks Memory Type Available on MC9S08MP16 Used Program Flash 16 KByte 7186 Bytes Unified Data Program RAM 1 KByte 412 Bytes Table
50. nsorless Run Synchronized PLL This state provides a better speed precision the commutation period is constant It is entered after the state State BLDC Sensorless Run Direct Cmt If the constant SL TECHNIQUE SYNCHRONIZED PLL is defined for the precompiler main h and the commutation is stabilized bldcFlags SyncPLLModeRq 1 and current limitation is not active bldcFlags CurLimit 0 then the state is entered In this state the following processes are active The ADC Sensing process measures the DC Bus current iDcb voltage uDcb possibly temperature e FreeMASTER communication with superior PC Speed Alignment Ramp Process Speed Closed Loop Controller Velocity Ramp with acceleration rampAccelCL e Application and Fault Control Process e ZC Detection Process e Sensorless Commutation Process Synchronized PLL Mode 5 3 11 State BLDC Sensorless Run Forced PLL Forced Cmt This state provides a better speed precision the commutation period is constant It is entered after the state State BLDC Sensorless Run Direct Cmt If the constant SL TECHNIQUE FORCED PLL is defined for the precompiler main h and the commutation is stabilized bldcFlags ForcedPLLModeRq 1 and current limitation is not active bldcFlags CurLimit 0 then the state is entered 3 Phase Sensorless BLDC Motor Control Using MC9508MP16 Rev 0 8 Freescale Semiconductor Software Design In this state the following processes ar
51. on memory can be protected from illegal or invalid memory accesses To include the new FreeMASTER Serial Communication Driver in the application the user has to manually include the driver files in the CodeWarrior project For the presented application the driver has already been included The FreeMASTER driver files are located in the following folders e Project sources contains freemaster cfg h freemaster h e Project jsourcestfreemaster contains platform dependent driver C source and header files All C files included in the freemaster folders are added to the project for compilation and linking see support group in the project The master header file freemaster h declares the common data types macros and prototvpes of the FreeMASTER driver API functions This should be included in your application using include directive wherever you need to call any of the FreeMASTER driver API functions Note that the FreeMASTER driver does not perform any initialization or configuration of the SCI module it uses to communicate Therefore it is the user s responsibility to configure the communication module before the FreeMASTER driver is initialized by the FMSTR_Init call The default baud rate of the SCI communication is set to 9600 baud NOTE Higher communication speeds than 9600 baud can cause communication instability mainly when the Recorder function is used FreeMASTER uses a poll driven communication mode It does not re
52. quire the setting of interrupts for SCI Both communication and protocol decoding are handled in the application background loop The polling mode requires a periodic call of the FMSTR Poll function in the application main The driver is configured using the appconfig h header file Changes to the file are preferably made through the provided Quick Start graphical configuration tool in CodeWarrior toolbar Project Configuration Tool The user has to modify this file to configure the Free MASTER driver The FreeMASTER driver C source files include the configuration file and use the macros defined there for conditional and parameter compilation 3 Phase Sensorless BLDC Motor Control Using MC9S08MP16 Rev 0 14 Freescale Semiconductor Software Design A detailed description of the FreeMASTER Serial Communication Driver is provided in AN2471 PC Master Software Communication Protocol Specification 5 5 2 FreeMASTER Recorder Part of the Free MASTER software is also a recorder which is able to sample the application variables at a specified sample rate The samples are stored in a buffer and read by the PC via an RS 232 serial port The sampled data can be displayed in a graph or the data can be stored The recorder behaves like a simple on chip oscilloscope with trigger pre trigger capabilities The size of the recorder buffer and the FreeMASTER recorder time base can be defined in the appconfig h configuration The recorder rout
53. rigger function which is used to trigger both PDBs 3 Phase Sensorless BLDC Motor Control Using MC9S08MP16 Rev 0 4 Freescale Semiconductor Introduction The FTMI Flextimer module features used in the application e Input capture mode for the tacho period signal measurement e HSCMP output connected to the FTMI input for back EMF zero crossing detection The FTM2 Flextimer module features used in the application e Generation of six PWM signals Set combine mode with complementary outputs e Dead time inserted Fault protection enabled for external over current fault trigger e Synchronized PWM register update on timer overflow event e Synchronized PWM output configuration with the FTM1 compare to generate a 6 step BLDC commutation Hardware trigger generation for ADC synchronization with the PWM signal optional feature not required for application functionality The ADC features used in the application e Hardware trigger for an ADC start generated by the PDBI Linear successive approximation algorithm with a 12 bit resolution High speed conversion e 5 MHz module clock The PDBI Program delay block features used in the application optional not required e The controllable delay from the Flextimer module s SYNC output to the sample trigger input of the programmable gain amplifiers and the ADC The PDB2 features used in the application Window mode synchronized with the FTM2 motor phase PWM e The PDB2
54. rior system is a personal computer with a FreeMASTER communication interface In this state the following processes are active The ADC Sensing process measures the DC Bus current iDcb and voltage uDcb temperature e FreeMASTER communication with a superior PC e Application and Fault Control Process 5 4 Application Software Flowchart The application software states are described in Section 5 3 Application Software States The flow chart in Figure 5 3 shows all the interrupts and main software loop and gives us information on the processes execution Due to the software complexity the software flowchart in Figure 5 3 describes the software functionality in the state BLDC Sensorless Run Direct Cmt Forced PLL sub states This state is most descriptive since most of the processes are active see Section 5 3 9 State BLDC Sensorless Run Direct Cmt 3 Phase Sensorless BLDC Motor Control Using MC9508MP16 Rev 0 Freescale Semiconductor 9 Software Design 5 4 1 Application Background Loop The endless application background provides e Application and Fault Control process with microcontroller initialization FreeMASTER polling function FMSTR Poll BLDC Process state machine Fault Control Watchdog periodic feeding The main application control tasks are executed in interrupt service routines which interrupt the background loop 3 Phase Sensorless BLDC Motor Control Using MC9S08MP16 Rev 0
55. rotational field for trapezoidal BLDC motors Sometimes also called commutation 60 120 degree control 1 3 3 Glossary of Symbols Table 1 2 shows a glossary of symbols used in this document Table 1 2 Glossary of Symbols Term Definition C7CtoCMT A constant for calculation of the period from the back EMF zero crossing to commutation f estim Commutation estimated frequencv Pp Stator pole pair number p Stator pole number periodCmtPreset Period commutation preset periodZCFit Filtered period between two consecutive back EMF zero crossing occurrence instants periodZCtoCmt Period from the back EMF zero crossing to commutation 3 Phase Sensorless BLDC Motor Control Using MC9508MP16 Rev 0 Freescale Semiconductor Introduction Table 1 2 Glossary of Symbols continued Term Definition tout timeCmt BLDC six step commutation instant tzc Back EMF zero crossing occurrence instant 17CForced Back EMF zero crossing occurrence instant U7Cestim Estimated back EMF zero crossing occurrence instant Tostim Commutation period estimated T Forced Forced back EMF zero crossing and commutation period Tzc periodZC Period between two consecutive back EMF zero crossing occurrence instants periodZCO Previous period between two consecutive back EMF zero crossing occurrence instants TzCerror Error between the estimated and real back EMF zero cro
56. s a dg wauccud eue doa aa SCA MUR WR E ROS ERA KA Chapter 5 Software Design nd BU PAPA NAK GAP NANA PK AB KAKO aai ARKA b ts 5 2 Application Software Processes and Data Flow Diagram lusus 5 2 1 BLOG Application Main Process isusu ae es de llkoll S22 FreeMASTER PIDCBBB 2 6 66 cee ee l KA 523 ADC Sensing Process nc cede ct der bata a e pi basi b b bib ibb hk RR ROR EUR hok d 5 2 4 Fault Checking Process isis icri OC WAG Lib NG ii ik AD BRRP GR cus 5 2 5 Zero Crossing Detection Process sosanna ARAWARAW entrees es 5 2 6 Sensorless Commutation Process 00 ccc cece eee ee eens nag PWM LI aua dup 4h dd BAGA bb ta b di b i ib DA PK EEE Awe OE 5 2 8 Align Ramp Speed Regulator Process 0 00 cece eee eee eee ma MAURO PAA AN i 5 2 10 Application Dala Flow Variables np dock ako y ARKA BR RR RR C ALA 5 3 Application Software States Gn AA ora ees roa e RR RERO CR d a ha 59 1 State Application MGU Mit 64 64h ie qc ORE RO EC REO CERE REC OO 5 3 2 State BLDG MOGLIE ii in E i dk Ed Slate BLOC ADDIDIT ssasn eb oji ata a fa bb Rcksex rd REA AKA UE bu dde S34 Se BLDC OD 235p d dad dd iod l 3 ee EH diua d dera d aro uaa 5 3 5 State BLDC Alignment uae ii XX Ra KR A Red d ed AGAR E RR Re rae d 5 9 6 State BLDG Start VERDE LL oid pao qa qc ae d Re o C ddr di dod CIC CR dob OLED 5 3 7 State BLDC Open Loop Start oo Zsa aee sess rd oro AG AG 5 3 8 State BLDC Shift Vector a ii biddilt 5 3 9 State
57. s can be detected Parasitic effects that negativelv influence the back EMF detection are discussed and their nature analvzed The electrical BLDC motor model then consists of a set of the following stator voltage equations Us ls Vs Eqn 1 Us Rs ts Vs l dt Us Ls V sc 3 Phase Sensorless BLDC Motor Control Using MC9508MP16 Rev 0 Freescale Semiconductor 11 Control Theory it is also evident that the stator currents sum is 0 Eqn 2 LORI tig 40 The Equation 1 can be rewritten as Usa lsa U backEMFa Los Ls Ly lsa Eqn 3 Us Rol isp Upackemro T Dep Ls Lgs di lsp Us Ls U aekEMFe Lu Ls Ls lsc In the Equation 3 we assume that the phase resistance of all phases is constant and equal For further calculation we need to introduce voltage up which is the voltage between the motor winding central point and the virtual ground Eqn 4 Uy Uy Us Uy Uyg Usp Uy Uye Us And so C d Uy Uye Upackemre 7 R ise gt Lo ls Eqn 5 x A dt The Equation 5 can be written for any motor phase and so we can get Equation 6 C C 3xu gt Uy Y U aekEMFX Ls px Sx Eqn 6 y Ax A Since the central stator winding point is not accessible we need to know the relationship between the motor phase ug voltage and the branch voltage uyy The Equation 7 Us TUY Ug 4 Uy Y U backEMFx Y Y Ls x Ti Eqn 7 y Ax A leads into the Equation 8 C 3 1 1 Hye 2 ts
58. ses no commutation The current controller keeps the current within predefined limits This state is necessary in order to create a high startup torque When the preset timeout expires then this state is finished The BLDC motor rotor position with flux vectors during alignment is shown in Figure 2 23 3 Phase Sensorless BLDC Motor Control Using MC9S08MP16 Rev 0 Freescale Semiconductor 21 Control Theory 2 5 2 VCC Alignment flux vector Phase A dk Ph B Phase C AA ud l VCC Starting flux vector Figure 2 23 Alignment Open Loop Start In the open loop start the motor commutation starts the open loop without rotor positional feedback The commutation period is controlled by a linear velocity ramp The rotor and stator flux need to be in an approximately 90 degree relation in order not to lose synchronization The torque is lower and not constant Therefore the position resonance can cause the rotor synchronization loss The open loop start needs to be a short state at a very low speed where the back EMF is too small so the zero crossing cannot be reliably detected 3 Phase Sensorless BLDC Motor Control Using MC9508MP16 Rev 0 22 Freescale Semiconductor Control Theory Velocity Open Loop Commutation velocity Ramp Acceleration OL Velocity aa a RETE Desired j I l I i l Alignment Open Loop Start Run I Velocity i i Threshold 4 S us I OLtoRun real speed 1 I ti
59. speed negative torque reverse accelerating Generating Fourth Quadrant Positiye speed AE torque forward br Figure 2 6 Quadrant of Operations The bipolar unipolar switching and the operating quadrant control is determined by all the six Sa Scb switchings The 2 quadrant operation provides a defined voltage and current of the same polarity positive voltage with positive current or negative voltage and negative current which are the operating quadrants I and III in Figure 2 6 The 4 quadrant PWM switching covers the operation of the generated voltage in all four quadrants This is provided using complementary switching of the top and bottom transistors The benefits of the 4 quadrant PWM operation are e Motoring and generating mode control possibility of braking the motor e Linear operation in all four quadrants The MCOSO8MPI6 is able to control the 3 phase power stage with unipolar and bipolar PWW with the more advanced 4 quadrant operation Therefore in the following sections we will cover the transistor control pattern for the 4 quadrant PWM technique 3 Phase Sensorless BLDC Motor Control Using MC9S08MP16 Rev 0 Freescale Semiconductor 5 Control Theory 2 2 2 1 3 Phase BLDC 6 Step Control with Bipolar Hard PWM Switching The PWM commutation pattern of the bipolar complementary 4 quadrant PWM switching technique is shown in Figure 2 7 commutation commutation commutation commutation comm
60. ssing occurrence instants Vgipc Voltage applied to the BLDC motor 3 phase voltage svstem amplitude 3 Phase Sensorless BLDC Motor Control Using MC9508MP16 Rev 0 8 Freescale Semiconductor Chapter 2 Control Theory 2 1 3 Phase BLDC Motor The brushless DC motor BLDC motor is also referred to as an electronicallv commuted motor There are no brushes on the rotor and commutation is performed electronicallv at certain rotor positions The stator magnetic circuit is usuallv made from magnetic steel sheets Stator phase windings are inserted in the slots distributed winding as shown in Figure 2 1 or it can be wound as one coil on the magnetic pole Magnetization of the permanent magnets and their displacement on the rotor are chosen in such a way that the back EME the voltage induced into the stator winding due to rotor movement shape is trapezoidal This allows a rectangular shaped 3 phase voltage system see Figure 2 2 to be used to create a rotational field with low torque ripples STATOR STATOR WINDING IN SLOTS SHAFT ROTOR AIR GAP PERMANENT MAGNETS Figure 2 1 BLDC Motor Cross Section The motor can have more than just one pole pair per phase This defines the ratio between the electrical revolution and the mechanical revolution The BLDC motor shown has three pole pairs per phase which represent three electrical revolutions per one mechanical revolution 3 Phase Sensorless BLDC Motor Control Using MC9508MP16
61. t and Speed Torque Close Loop The BLDC state control process provides application state control as described in Section 2 5 Sensorless Commutation Control and Chapter 5 Software Design Section 2 6 Speed Controller with Current Torque Limitation 3 Phase Sensorless BLDC Motor Control Using MC9508MP16 Rev 0 6 Freescale Semiconductor System Concept 3 3 6 1 MTIM Time Base TimB A time base of a long period is used for speed control alignment timing and other functionality in the BLDC control process state machine with long period default setting 3 ms It is realized by the MTIM module 3 3 7 MC33927 Driver Config The 3 Phase BLDC PMSM Low Voltage Motor Control Drive board utilizes a MOSFET MC33927 predriver This device is configured via the SPI protocol The S08MP16 SPI module provides the communication 3 3 8 FreeMASTER This is a tool for communication with a superior system for application monitoring and control The superior system is a personal computer running the FreeMASTER protocol The physical layer of the FreeMASTER can be a BDM module or a serial port In this application we use the serial communication using the SCI module Today personal computers usually do not have the COM port Therefore the MC9S08MP16 Controller Daughter Board for BLDC PMSM Motor Control Drive is equipped with a USB to COM converter 3 3 9 O Ports Are realized by the GPIO module 3 3 10 On Board Programming
62. terface and feedback signals it generates PWM signals for the board called the 3 Phase BLDC PMSM Low Voltage Motor Control Drive Voltage waveforms generated by the 3 phase inverter are applied to the motor Input voltage is 24 V DC 3 2 Control Process The speed control is calculated according to the state of the control signals Start Stop Desired Speed from FreeMASTER Then the speed command is processed by means of the speed ramp algorithm Depending on the enabled control algorithm utilizing the commutation period is set according to the velocity ramp This is for the open loop starting state or the Forced PLL control technique The comparison between the actual ramp velocity obtained from the ramp algorithm output and the measured speed obtained from 1 estimated period generates a speed error The speed error is processed by the speed PI controller that generates a new corrected motor voltage amplitude The PWM 3pps generation process provides a 6 step BLDC commutation of a 3 phase voltage system of required amplitude PWM includes dead time and finally the 3 phase PWM motor control signals are generated The DC Bus voltage and the DC Bus current optional informative value are measured during the control process They are used for over voltage under voltage protection DC Bus voltage and torque limitation DC Bus current of the drive The voltage protection is performed by software The over current fault signal utilizes a fault inp
63. the back EMF feedback is lost within one commutation period corrective actions are taken in order to return to the regular states The flowchart explaining the principle of BLDC commutation control with back EMF zero crossing sensing is shown in Figure 2 25 Commutation Done ra commutation overtook zero crossing No Corrective Calculation 1 with timeZC k 1 timeCmt k 1 BEMF Zero Crossing detected between previous commutations Yes y lt Service of Commutation preset new pwm sector Wait for periodZCToff until phase current decays to zero Y Preset commutation time Yes Service of received BEMF Zero Crossing Calculation and corrected commutation time setting BEMF Zero Crossing Detected No has commutation time expired has commutation time expired No Yes Yes y Make motor Commutation Figure 2 25 Flow Chart BLDC Commutation with Direct Commutation Calculation 3 Phase Sensorless BLDC Motor Control Using MC9S08MP16 Rev 0 24 Freescale Semiconductor Control Theory Commutation time calculation is shown in Figure 2 27 timeCmt n 2 timeCmt n 1 timeCmt n T2 n 3 T2 n 2 T2 n 1 T2 n n 2 n 1 n V periodcmtPreset n 1 Y y la PS COMMUTATION IS PRESET NEN JUN m COMMUTATED AT PRESET TIME NO DETECTION SIGNAL BACK
64. the shaft though not used in the control The motor has the following specifications 3 Phase Sensorless BLDC Motor Control Using MC9S08MP16 Rev 0 2 Freescale Semiconductor Table 4 1 Specifications of the Motor Motor Specification Motor Type LINIX 45ZWN24 40 BLDC Motor Nominal voltage line to line 24 V RMS Nominal speed 4000 RPM Nominal current phase 2 94 A Nominal torque 0 0924 Nm 3 Phase Sensorless BLDC Motor Control Using MC9S08MP16 Rev 0 Hardware Freescale Semiconductor Hardware 3 Phase Sensorless BLDC Motor Control Using MC9S08MP16 Rev 0 4 Freescale Semiconductor Chapter 5 Software Design 5 1 Introduction This section describes the design of the software blocks of the drive The software will be described in terms of e Application Software Processes and Data Flow Diagram e Application Software States e Application Software Flowchart e FreeMASTER Software Software Setting and Overview e Application Parameters see 5 7 5 16 5 2 Application Software Processes and Data Flow Diagram The application data flow diagram with the main processes and variables is shown in Figure 5 1 The individual processes of the control routines are described in the following sections The variables are described at the end of this section 5 2 1 BLDC Application Main Process Provides the main state machine control The state is defined by the bldcStateIndex variable
65. tic emission of the motor This is because the PWM ripple is twice that of the DC Bus voltage On the other hand this switching is better for sensorless rotor position sensing This switching can be implemented using MC9SO8MP16 2 2 2 2 3 Phase BLDC 6 Step Control with Unipolar Soft PWM Switching There are more modifications to the unipolar PWM switching One of the most common 6 step commutation with unipolar complementary 4 quadrant PWM switching techniques is shown in Figure 2 9 commutation commutation commutation commutation commutation commutation commutation commutation I 3phase OB Brushless DC motor OA BG N Figure 2 9 Unipolar PWM Switching The unipolar PWM switching can control the BLDC motor with an almost identical voltage and current performance The only difference is that the PWM duty cycle 0 creates an average voltage of 0 The main advance of the unipolar PWM switching is better EMC compatibility due to half of the voltage ripple compared to the bipolar switching This switching is implemented as default for this application using the MC9S08MP16 2 3 Why Sensorless Control As explained in the previous section rotor position must be known in order to drive a brushless DC motor If any sensors are used to detect the rotor position the sensed information must be transferred to a control unit see Figure 2 10 Therefore additional connections to the motor are necessary This may not be acceptable for
66. tion Table 1 1 Acronyms and Abbreviated Terms continued Term Meaning GPIO General purpose input output module HSCMP2 High speed comparator module 2 1 0 Input output interfaces between a computer system and the external world a CPU reads an input to sense the level of an external signal and writes to an output to change the level of an external signal LED Light emitting diode MC9S08MP16 JA Freescale HCS08 family member dedicated to motor control MTIM Modulo timer module PDBx Programmable Delay Block module x 1 or 2 PLL Phase locked loop a clock generator circuit in which a voltage controlled oscillator produces an oscillation that is synchronized to a reference signal Synchronized Synchronized phase closed loop A closed loop where the commutation period is synchronized with the rotor PLL position according to a phase error Forced PLL Forced commutation phase locked loop A closed loop where the amplitude of the 3 phase voltage system is controlled according to a phase error PM Permanent Magnet PM synchronous Permanent Magnet Synchronous Motor In this article it means a synchronous motor with a sinusoidal BEMF motor shape PWM Pulse width modulation RPM Revolutions per minute SCI Serial communication interface module a module that supports asynchronous communication SPI Serial peripheral module six step Commutation technique used to create
67. tor stator phases central point is usually not accessible This section describes how to get the right zero crossing comparator reference signal Inverter Stage dcbus Figure 2 13 Stator Phase Central Point Not Accessible In order to explain and simulate the idea of back EMF sensing techniques a simplified mathematical model based on the basic circuit topology has been created See Figure 2 14 or Figure 2 17 3 Phase Sensorless BLDC Motor Control Using MC9508MP16 Rev 0 10 Freescale Semiconductor Control Theory u U a backEMF aN Uic Una Unc A Usc e Figure 2 14 Power Stage Motor Topologv with a DC Bus Voltage 2 Reference The motor drive model consists of a normal 3 phase power stage plus a brushless DC motor Power for the system is provided by a voltage source Uq Six semiconductor switches S A B C tw controlled elsewhere allow the rectangular voltage waveforms see Figure 2 2 to be applied The natural voltage level of the whole model is put at one half of the DC Bus voltage This simplifies the mathematical expressions 2 4 2 1 Stator Winding Equations The BLDC motor is usually very symmetrical All phase resistances phase and mutual inductances flux linkages can be thought of as equal to or as a function of the position q with a 120 displacement The task of this section is to explain the background of the back EMF sensing and to demonstrate how the zero crossing event
68. ulation of the period from zero crossing to commutation FTM2SYNC TRIG2 hardware trigger used for synchronizing the PWM 3pps Sync Timer Cmt iDcb DC Bus current sample iDcbLimit DC Bus current limit desired value for the current torque regulator iDcbZcFilt DC Bus current at zero crossing point filtered mc33927ModeCommands MC33927 mode setting commands mc33927MasklInterrupts MC33927 mask interrupts determines which event generates the MC33297 interrupt the interrupt pin is connected to MC9SO8MP16 fault input periodBLDCZcFlt period between back EMF zero crossings filtered average or PLL loop pwm3ppsSector sector of the PWM 3pps determines the 6 step vector rampAccelCL acceleration ramp closed loop rampAccelOL acceleration ramp open loop regCurrentPIparams current regulator parameters regForcedPLLParams regulator parameters for Forced PLL control regSpeedPIparams speed regulator parameters regSyncPLLParams regulator parameters for Synchronized PLL control temperature measured temperature NOT APPLICABLE FOR DEFAULT HARDWARE temperatureFilt temperature filtered NOT APPLICABLE FOR DEFAULT HARDWARE uDdcb DC Bus voltage sampled uDdcbFilt DC Bus voltage filtered velocityDesired velocity desired 3 Phase Sensorless BLDC Motor Control Using MC9S08MP16 Rev 0 Freescale Semiconductor Software Design e velocityRampAct velocity ramp actual v
69. uning the application for different power stages and motors because almost all the application parameters can be changed via the FreeMASTER interface This consists of a component running on a PC and another part running on the target MCU connected via an RS 232 serial port A small program is resident in the MCU that communicates with the FreeMASTER software to parse commands return status information to the PC 3 Phase Sensorless BLDC Motor Control Using MC9508MP16 Rev 0 Freescale Semiconductor 13 Software Design and process control information from the PC FreeMASTER software executing on the PC uses Microsoft Internet Explorer as the user interface 5 5 1 FreeMASTER Serial Communication Driver The presented application includes the Free MASTER Serial Communication Driver The Free MASTER Serial Communication Driver fully replaces the former PC Master driver The new FreeMASTER driver remains fully compatible with the communication interface provided by the old PC Master drivers It brings however many useful enhancements and optimizations The main advantage of the new driver is a unification across all supported Freescale processor products as well as several new features that were added One of the key features implemented in the new driver is target side addressing TSA which enables an embedded application to describe the memory objects it grants the host access to By enabling the so called TSA Safety option the applicati
70. universal motor control hardware modules Documentation this document 3 Phase Sensorless BLDC Motor Control Using MC9S08MP16 Rev 0 2 Freescale Semiconductor Introduction 1 1 2 Overview of Sensorless BLDC Variable Speed Drives Replacing standard brushed DC motors or variable speed universal motors with maintenance free brush less motors are a trend The design of cost effective variable speed 3 phase motor control drives has become a prime focal point for the appliance designers and semiconductor suppliers The big push in this direction is driven by several factors low power consumption the flexibility that can be achieved by using electronic commutation e the maturity level and affordable price trend of power devices the system efficiency optimization that microprocessor controlled drives can provide e the size weight and dissipated power reduction of the motors for a given mechanical power An advantageous solution for the brushless drives is the synchronous motor with permanent magnet rotor Those motors achieve high efficiency by generating the rotor magnetic flux with rotor magnets Therefore they are used in applications which require high reliability power and size efficiency These may be refrigerators washing machines dishwashers pumps fans electrical power steering and many others in the appliance and automotive applications The 3 phase synchronous motors with permanent magnets come in two ver
71. ut of the microcontroller If any of the above mentioned faults occur the motor control PWM outputs are disabled in order to protect the drive and the fault state of the system is displayed The rotor positional estimation with back EMF zero crossig detection is based on the HSCMP comparator The application can be controlled via the Free MASTER control page from a host PC The FreeMASTER communicates via a serial interface which is converted into USB on the MC9SO8MP16 daughter board 3 Phase Sensorless BLDC Motor Control Using MC9508MP16 Rev 0 Freescale Semiconductor 1 System Concept The application state machine of the drive manages the operating states of the drive FAULT INIT INIT and RUN with sub states The actual operating state is indicated by the Free MASTER control page In the case of over voltage under voltage or over current the signals for the 3 phase inverter are disabled and the fault state is displayed 3 Phase Sensorless BLDC Motor Control Using MC9S08MP16 Rev 0 2 Freescale Semiconductor System Concept 3 3 3 Phase Sensorless BLDC Drive Using MC9S08MP16 Figure 3 1shows the system functional blocks and their sub blocks Most of the sub blocks are implemented with the MC9S08MP16 modules 3 Phase BLDC PMSM Low Voltage oun Control Drive 3 Phase Inverter DC Bus EM amp Current EM 3PH ase BLDC Motor Vdcb Idcb Over current y o Ports Superior Zero crossing System
72. utation commutation commutation commutation Li 1 ILI ILI HI Sat N A Sap l l l A Off anon A Off Spt l l ise Off A BH MAL B Off ss PANA nia 1 s idi p IL 7 1 Brushless Sc a E m NIS Off l i DC motor GA tbc N Figure 2 7 Bipolar PWM Switching Dead Dead Dead Dead Dead Dead Time Time Time Time Time Time S umm Sab gi ERE UI 01 i bg ni gg Dead Dead Swap Dead Dead Time Time Time Time Figure 2 8 Bipolar PWM Switching Detail Details of the technique are shown in Figure 2 8 From Figure 2 8 we can see the characteristic of the bipolar 4 quadrant complementary switching The bipolar switching requires that the top and bottom switch PWM signals need to be swapped Another important detail is the introduction of dead time insertion in the complementary top and bottom signals This dead time insertion is typical for all 4 quadrant power stage operations The 4 quadrant operation is enabled by the complementary operation of the top and bottom switches the bottom switch of one phase is almost the negative of the top switch 3 Phase Sensorless BLDC Motor Control Using MC9S08MP16 Rev 0 6 Freescale Semiconductor Control Theory This requires the insertion of a dead time since the switching transient will cause a DC Bus short circuit with fatal power stage damage The bipolar PWM switching is not as popular as the unipolar switching due to a worse electromagne
73. uyer purchase or use Freescale Semiconductor products for any such unintended or unauthorized application Buyer shall indemnify and hold Freescale Semiconductor and its officers employees subsidiaries affiliates and distributors harmless against all claims costs damages and expenses and reasonable attorney fees arising out of directly or indirectly any claim of personal injury or death associated with such unintended or unauthorized use even if such claim alleges that Freescale Semiconductor was negligent regarding the design or manufacture of the part 2 freescale semiconductor Freescale and the Freescale logo are trademarks of Freescale Semiconductor Inc The ARM POWERED logo is a registered trademark of ARM Limited ARM7TDMI S is a trademark of ARM Limited Java and all other Java based marks are trademarks or registered trademarks of Sun Microsystems Inc in the U S and other countries The PowerPC name is a trademark of IBM Corp and is used under license The described product contains a PowerPC processor core The PowerPC name is atrademark of IBM Corp and used under license The described product is a PowerPC microprocessor The PowerPC name is a trademark of IBM Corp and is used under license The described product is a PowerPC microprocessor core The PowerPC name is a trademark of IBM Corp and is used under license All other product or service names are the property of their respective owners Freesc
74. ve the back EMF voltage close to sinusoidal The back EMF voltage sum of an ideal 3 phase symetrical sinusoidal motor is C bi oet 0 Eqn 12 x A and the branch voltage uvc will then be 3 Phase Sensorless BLDC Motor Control Using MC9508MP16 Rev 0 14 Freescale Semiconductor Control Theory 3 Uy 2 backEMPC La EE Eqn 13 dt In a real BLDC motor the relationship between the branch uyc and BEMF voltages is somewhat between the equation Equation 11 and Equation 11 For the back EMF zero crossing detection the scale does not matter 2 4 2 3 1 Indirect Back EMF Sensing Top and Bottom Switches in Diagonal On Conclusion e With top and bottom switches in diagonal on the back EMF zero crossing of the off phase can be sensed from the branch voltage uyy which is the off phase terminal with the half DC Bus voltage ug 2 reference shown in Figure 2 14 e Unbalanced mutual inductance brings error to this indirect back EMF sensing method Fortunately close to the back EMF zero crossing of any phase the L and Lop are balanced Loa Lep so we get the Equation 14 Uyc Upackemre Eqn 14 2 4 2 4 Indirect Back EMF Sensing Two Bottom Switches On Low Drop The unipolar PWM switching technique has the second PWM switching phase besides the previous one where the two bottom switches are switched on see Figure 2 16 and section 2 2 2 2 In this section the situation where the two bottom switches are on will be
75. x4 x8 x16 or x32 e Three fast analog comparators HSCMP1 HSCMP2 and HSCMP3 with both positive and negative inputs e Three 5 bit digital to analog converters DAC used as a 32 tap voltage reference Two programmable delay blocks PDB PDB1 synchronizes the PWM with the samples from the ADC PDB2 synchronizes the PWM with comparison window of the analog comparators PWM output synchronizes with the FTM PWM output One serial peripheral interface SPI e One serial communications interface SCI with LIN slave functionality One inter integrated circuit PC port e On board 3 3 V to 2 5 V voltage regulator for powering internal logic and memories Integrated power on reset and a low voltage interrupt module e Multiplexing of all pins with the general purpose input output GPIO pins Computer operating properly COP watchdog timer e External reset input pin for hardware reset e Single wire background debug interface BDM e Internal Clock Source ICS Containing a frequency locked loop FLL controlled by an internal or external reference 1 2 1 Peripheral Application Usage The sensorless BLDC benefits greatly from the flexible PWM module high speed comparators HSCMP a fast ADC program delay block PDB and the modulo timer MTIM The Flextimer offers flexibility in its configuration enabling efficient 3 phase motor control and BLDC motor 3 phase commutation Each FTM module supports an initialization t
76. y popular variants The Sinusoidal PM synchronous motor and the trapezoidal BLDC motor The sinusoidal PM synchronous motor is very similar to the trapezoidal BLDC Electronically Commuted motor There are two main differences e Motor construction the shape of the BEMF inducted voltage sinusoidal PM synchronous motor versus trapezoidal BLDC motor Control the shape of the control voltage 3 phase sinusoidal all three phases connected at one time versus rectangular 6 step commutation one phase is non conducting at any time The drive system cost is a very sensitive parameter for any mass production application The trapezoidal BLDC motor is a good candidate for the cost effective drives thanks to its simple 6 step commutation and rotor position detection This enables the use of a cost effective 8 bit microcontrollers The BLDC motor control system requires the detection of the rotor position in order to create synchronous commutation The rotor position can be detected with Hall sensors or by using a sensorless technique Sensorless position detection saves on the system cost It displaces the Hall sensors cables and connectors which leads to a lower system cost a higher reliability and less bushings important for example for compressors One well tried method is to use the back EMF zero crossing of the non conductive motor phase Such a method can be easily implemented on 8 bit microcontrollers The HCSO8
Download Pdf Manuals
Related Search
Related Contents
User Manual - Fast Forward Video Operating Instructions - VEGAWAVE 63 - - two-wire es fr de gb it cuocipasta pasta cooker nudelkocher cuiseur à pâtes operating instructions nha linhas j linhas j - Dubrasil: Máquinas e Equipamentos para Itech BlueBand Sport Istruzioni per l`uso TOP 722 TOP 812 Istruzioni per l`uso SelfCooking Center® 809/2008 2 - yodobashi.com Casio 2952 Watch User Manual Copyright © All rights reserved.
Failed to retrieve file