background image

Software Design

Main Software Flowchart

DRM028 — Rev 0

Designer Reference Manual

MOTOROLA

Software Design

83

 

3.2.5 Back-EMF Sensing Circuit

.The zero crossing selection is 

provided by the multiplexer setting.

As shown in 

Figure 5-2

, the commutation and back-EMF zero crossing 

selection process is split into two actions:

Preset commutation and zero crossing selection

The preset means setting the buffered registers and RAM 
variables for commutation

Set commutation and zero crossing selection 

The setting means loading the registers with buffered variables

The implementation is described in 

Implementation Notes

 - 

5.6.2 

BLDC Commutation and Zero Crossing Selection

.

5.4  Main Software Flowchart

The main software flowchart incorporates the main routine entered from 
the reset and interrupt states. The main routine includes initializing the 
MCU and the main loop. The flowcharts are shown in 

Figure 5-4

Figure 5-5

, and 

Figure 5-6

.

MCU Initialization

 is entered only after system reset. It provides 

initialization of system registers, ports, and CPU clock. The 

MCU 

Initialization

 is provided in 

MCUInit()

 function.

After 

MCU Initialization

 the 

Application Initialization 

is executed as 

AppInit()

 function, which performs the following actions. First the zero 

current offset of the dc-bus current measurement path is calibrated. This 
offset on the ADC input should be 1.65 V at zero current. This is 
implemented in the hardware design, in order to be able to measure 
negative and positive current values. The status registers are initialized 
and PWM generator is started. Also, timer 1 is started at the right 
moment to be synchronized with the PWM generator. This way the 
current measurement is executed at the defined moment of the PWM 
signal.

 

   

  

F

re

e

sc

a

le

 S

e

m

ic

o

n

d

u

c

to

r,

 I

  

  

  

  

  

  

  

  

  

  

  

  

  

  

  

  

  

  

  

  

  

  

  

 

Freescale Semiconductor, Inc.

For More Information On This Product,

   Go to: www.freescale.com

n

c

.

..

Summary of Contents for M68HC08

Page 1: ...Microcontrollers DRM028 D Rev 0 03 2003 Sensorless BLDC Motor Control Using the MC68HC908MR32 Manual Designer Reference Freescale Semiconductor I Freescale Semiconductor Inc For More Information On This Product Go to www freescale com nc ...

Page 2: ...Freescale Semiconductor I Freescale Semiconductor Inc For More Information On This Product Go to www freescale com nc ...

Page 3: ...or Control Using the MC68HC908MR32 Designer Reference Manual Rev 0 by Libor Prokop Motorola Czech System Laboratories Roznov pod Radhostem Czech Republic Freescale Semiconductor I Freescale Semiconductor Inc For More Information On This Product Go to www freescale com nc ...

Page 4: ... information available refer to http www motorola com semiconductors The following revision history table summarizes changes contained in this document For your convenience the page number designators have been linked to the appropriate location Revision history Date Revision Level Description Page Number s February 2003 1 Initial release N A Freescale Semiconductor I Freescale Semiconductor Inc F...

Page 5: ...1 Introduction 13 Section 2 System Description 15 Section 3 BLDC Motor Control 23 Section 4 Hardware Design 57 Section 5 Software Design 75 Section 6 User Guide 109 Appendix A References 161 Appendix B Glossary 163 Freescale Semiconductor I Freescale Semiconductor Inc For More Information On This Product Go to www freescale com nc ...

Page 6: ...List of Sections Designer Reference Manual DRM028 Rev 0 6 MOTOROLA Freescale Semiconductor I Freescale Semiconductor Inc For More Information On This Product Go to www freescale com nc ...

Page 7: ...Section 3 BLDC Motor Control 3 1 Contents 23 3 2 Brushless DC Motor Control Theory 23 3 3 Used Control Technique 38 3 4 Application Control 50 Section 4 Hardware Design 4 1 Contents 57 4 2 System Configuration and Documentation 57 4 3 All HW Sets Components 64 4 4 High Voltage Hardware Set Components 66 4 5 Low Voltage Evaluation Motor Hardware Set Components 70 4 6 Low Voltage Hardware Set Compon...

Page 8: ...ate Diagram 89 5 6 Implementation Notes 103 Section 6 User Guide 6 1 Contents 109 6 2 Application Suitability Guide 109 6 3 Warning 112 6 4 Application Hardware and Software Configuration 113 6 5 Tuning for Customer Motor 126 Appendix A References Appendix B Glossary Freescale Semiconductor I Freescale Semiconductor Inc For More Information On This Product Go to www freescale com nc ...

Page 9: ...ty Coupling 36 3 12 Back EMF Sensing Circuit Diagram 37 3 13 The Zero Crossing Detection 38 3 14 Commutation Control Stages 39 3 15 Alignment 40 3 16 BLDC Commutation with Back EMF Zero Crossing Sensing Flowchart 42 3 17 BLDC Commutation Time with Zero Crossing Sensing 43 3 18 Vectors of Magnetic Fields 47 3 19 Back EMF at Start Up 48 3 20 Calculation of the Commutation Times During the Starting B...

Page 10: ... Low Voltage Evaluation Motor Hardware System Configuration 115 6 3 Low Voltage Hardware System Configuration 116 6 4 Controller Board 117 6 5 Execute Make Command 121 6 6 PC Master Software Control Window 124 6 7 Follow up for Software Customizing to Customer Motor 128 6 8 Follow up for Advanced Software Customizing 129 6 9 Follow up for Software Customizing Trouble Shouting 129 6 10 PC Master So...

Page 11: ...e API Variables 52 4 1 Electrical Characteristics of Control Board 66 4 2 Electrical Characteristics of Power Stage 68 4 3 Electrical Characteristics 69 4 4 Electrical Characteristics of the EVM Motor Board 71 4 5 Characteristics of the BLDC motor 71 4 6 Electrical Chatacteristics of the 3 Ph BLDC Low Voltage Power Stage 74 5 1 Software Variables 76 6 1 Required Software Configuration for Dedicate...

Page 12: ...List of Tables Designer Reference Manual DRM028 Rev 0 12 MOTOROLA Freescale Semiconductor I Freescale Semiconductor Inc For More Information On This Product Go to www freescale com nc ...

Page 13: ...automotive industrial and appliance fields e g compressors air conditioning units pumps or simple industrial drives The reference design incorporates both hardware and software parts of the system including hardware schematics 1 3 Benefits of the Solution The design of very low cost variable speed BLDC motor control drives has become a prime focus point for the appliance designers and semiconducto...

Page 14: ...ith the back EMF which is induced in the stator winding due to the movement of the permanent magnets on the rotor Although some BLDC drives uses sensors for position sensing there is a trend to use sensorless control The position is then evaluated from voltage or current going to the motor One of the sensorless technique is sensorless BLDC control with back EMF electromotive force zero crossing se...

Page 15: ...p down sensed voltages to a 0 3 3 V level Zero crossing detection is synchronized with the middle of center aligned PWM signals by the software in order to filter high voltage spikes produced by switching the IGBTs MOSFETs The software selects by MUX command the phase comparator output that corresponds to the current commutation step The multiplexer MUX circuit selects this signal which is then tr...

Page 16: ...nverter 3 ph BLDC Motor START STOP SPEED PWM Generator with Dead Time PC Master SCI 3 phase BLDC Power Stage Commutation Control Zero Crossing Period Position Recognition Zero Crossing Duty Cycle Required Speed 1 T Commutation Period Zero Crossing Time moment 3 BEMF Voltage Zero Crossing Comparators Digital Inputs DC Bus Voltage Current Temperature MUX MUX Command Digital Outputs DC Bus Current DC...

Page 17: ...otorola s MC68HC908MR32 MCU It also illustrates the usage of dedicated motor control on chip peripherals The system for BLDC motor control consists of hardware and software The application uses universal modular motion control development hardware boards which are provided by Motorola for customer development support For a description of these hardware boards refer to Appendix A References 3 4 5 6...

Page 18: ...er software which can be used for software parameter tuning to a customer motor Table 2 1 Software Specifications Control Algorithm 3 phase trapezoidal BLDC motor control star or delta connected Sensorless with back EMF zero crossing commutation control Speed closed loop control Motoring mode Target Processor MC68HC908MR32 Language C language with some arithmetical functions in assembler Compiler ...

Page 19: ... voltage 115 230 Vac software customizing file const_cust_hv h Low voltage evaluation motor hardware set software customizing file const_cust_evmm h Low voltage hardware set software customizing file const_cust_lv h Software Configuration and Parameters Setting Configuration to one of the three required hardware sets is provided by inclusion of dedicated software customizing files The software pac...

Page 20: ...Brno SM40V 3 phase star connected BLDC motor Pole Number 6 Speed range 2500 rpm at 310 V Maximum electrical power 150 W Phase voltage 3 220 V Phase current 0 55 A Brake Characteristics Brake Type SG40N 3 Phase BLDC Motor Nominal Voltage 3 x 27 V Nominal Current 2 6 A Pole Number 6 Nominal Speed 1500 rpm Drive Characteristics Speed range 2500 rpm determined by motor used Maximum dc bus voltage 380 ...

Page 21: ... power stage board is dedicated for 12 V but can be simply configured to a 42 V supply described in documentation for the ECLOVACBLDC board The supplied motor is targeted for 12 V Table 2 3 Low Voltage Evaluation Hardware Set Specifications Hardware Boards Characteristics Input voltage 12 Vdc Maximum dc bus voltage 16 0 V Maximal output current 4 0 A Motor Characteristics Motor type 4 poles three ...

Page 22: ...cted BLDC motor Pole Number 6 Speed range 3000 rpm at 12 V Maximum electrical power 150 W Phase voltage 3 6 5 V Phase current 17 A Brake Characteristics Brake Type SG40N 3 Phase BLDC Motor Nominal Voltage 3 x 27 V Nominal Current 2 6 A Pole Number 6 Nominal Speed 1500 rpm Drive Characteristics Speed range 2500 rpm Input voltage 12 Vdc Maximum dc bus voltage 15 8 V Protection Over current over volt...

Page 23: ...ctronically at certain rotor positions The stator magnetic circuit is usually made from magnetic steel sheets Stator phase windings are inserted in the slots distributed winding as shown in Figure 3 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 EMF the voltage induced into the ...

Page 24: ...age System The easy to create rectangular shape of applied voltage ensures the simplicity of control and drive But 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 STATOR STATOR WINDING IN SLOTS SHAFT ROTOR AIR GAP PERMANENT MAGNETS 30 90 150 210 270 330 electrical angle Phase ...

Page 25: ...umber of waveforms Magnetic flux linkage Phase back EMF voltage Phase to phase back EMF voltage Magnetic flux linkage can be measured However in this case it was calculated by integrating the phase back EMF voltage which was measured on the non fed motor terminals of the BLDC motor As can be seen the shape of the back EMF is approximately trapezoidal and the amplitude is a function of the actual s...

Page 26: ...tages represent the natural commutation points In normal operation the commutation is performed here Some control techniques advance the commutation by a defined angle in order to control the drive above the pulse width modulator PWM voltage control Psi_A Psi_B Psi_C Ui_A Ui_B Ui_C Ui_AB Ui_BC Ui_CA Atop Btop Ctop Cbot Abot Bbot Speed reversal Natural commutation point Phase Magnetic Phase Back EM...

Page 27: ...c motor If any sensors are used to detect rotor position sensed information must be transferred to a control unit see Figure 3 4 Therefore additional connections to the motor are necessary This may not be acceptable for some applications see 1 3 Benefits of the Solution Figure 3 4 Classical System 3 2 4 Power Stage Motor System Model In order to explain and simulate the idea of back EMF sensing te...

Page 28: ...or Power for the system is provided by a voltage source Ud Six semiconductor switches SA B C t b controlled elsewhere allow the rectangular voltage waveforms see Figure 3 2 to be applied The semiconductor switches and diodes are simulated as ideal devices The natural voltage level of the whole model is put at one half of the dc bus voltage This simplifies the mathematical expressions B C A backEMF...

Page 29: ...ssed and their nature analyzed 3 2 4 2 Indirect Back EMF Sensing Let us assume a usual situation where the BLDC motor is driven in six step commutation mode using PWM technique where both top and bottom switches in the diagonal are controlled using the same signal so called hard switching PWM technique The motor phases A and B are powered and phase C is free having no current So the phase C can be...

Page 30: ...voltage level Thus back EMF voltage is obtained and the zero crossing can be recognized When Lcb Lab this general expressions can also be found EQ 3 7 There are two necessary conditions which must be met Top and bottom switches in diagonal have to be driven with the same PWM signal No current goes through the non fed phase that is used to sense the back EMF Figure 3 6 shows branch and motor phase ...

Page 31: ...between the coils which carry the phase current and the coil used for back EMF sensing causes the PWM pulses to be superimposed onto the detected back EMF voltage In fact it is produced by the high rate of change of phase current transferred to the free phase through the coupling of the mutual inductance Figure 3 7 shows the real measured branch voltage The red curves highlight the effect of the d...

Page 32: ...well in observations carried out on the five different BLDC motors These observations were made during the development of the sensorless technique NOTE The BLDC motor with stator windings distributed in the slots has technically higher mutual inductances than other types Therefore this effect is more significant On the other hand the BLDC motor with windings wounded on separate poles shows minor p...

Page 33: ...o far the mutual capacitance of the motor phase windings was neglected in the motor model since it affects neither the phase currents nor the generated torque Usually the mutual capacitance is very small Its influence is only significant during PWM switching when the system experiences very high du dt The effect of the mutual capacitance can be studied using the model shown in Figure 3 9 Freescale...

Page 34: ...sturbing voltage can be found as follows EQ 3 10 NOTE EQ 3 10 expresses the fact that only the unbalance of the mutual capacitance not the capacitance itself disturbs the back EMF sensing When both capacities are equal they are balanced the disturbances disappear This is demonstrated in Figure 3 10 and Figure 3 11 uCcb B C A RC C C C RC RC u 2 d u 2 d uCba Id0 SAt SBt SAb SBb ISb iC iCab iC uCac u...

Page 35: ...d branch voltage while the other phase channel 2 is not affected because it faces balanced mutual capacitance The unbalance was purposely made by adding a small capacitor on the motor terminals in order to better demonstrate the effect After the unbalance was removed the branch voltage is clean without any spikes Freescale Semiconductor I Freescale Semiconductor Inc For More Information On This Pr...

Page 36: ...nd wound CAUTION Failing to maintain balance in the mutual capacitance can easily disqualify such a motor from using sensorless techniques based on the back EMF sensing Usually the BLDC motors with windings wound on separate poles show minor presence of the mutual capacitance Thus the disturbance is also insignificant 3 2 5 Back EMF Sensing Circuit An example of the possible implementation of the ...

Page 37: ...istors reduce the voltage across each resistor component to an acceptable level A simple RC filter prevents the comparators from being disturbed by high voltage spikes produced by IGBT switching The multiplexer MUX selects the phase comparator output which corresponds to the current commutation stage This zero crossing detection signal is transferred to the timer input pin The comparator control a...

Page 38: ...lowing states Alignment Starting Back EMF Acquisition Running Figure 3 14 shows the transitions between the states First the rotor is aligned to a known position then the rotation is started without the position feedback When the rotor moves back EMF is acquired so the Phase Selection MUX Command Phase Comparator Output Zero crossing edge Reference Level Branch Voltage Interval of phase Back EMF z...

Page 39: ...rical time constant when the rotor position is stabilized by applying PWM signals to only two motor phases no commutation The current controller keeps current within predefined limits This state is necessary in order to create a high start up torque When the preset time out expires then this state is finished ALIGNMENT STARTING BACK EMF ACQUISITION RUNNING ALIGNMENT TIME EXPIRED START MOTOR MINIMA...

Page 40: ...der to synchronize the current measurement with PWM Current controller period n PWM frequency The BLDC motor rotor position with flux vectors during alignment is shown in Figure 3 15 Figure 3 15 Alignment 3 3 1 2 Running The commutation process is a series of states which assure The back EMF zero crossing is successfully captured The new commutation time is calculated The commutation is performed ...

Page 41: ...le Then the new commutation time T2 n is preset 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 T2 n is made based on the captured zero crossing time T_ZCros n The new commutation is performed at this new time If fo...

Page 42: ...SSING DETECTED MAKE MOTOR COMMUTATION BEMF ZERO CROSSING DETECTED BETWEEN PREVIOUS COMMUTATIONS CORRECTIVE CALCULATION 1 PRESET COMMUTATION CURRENT DECAYS TO ZERO COMMUTATION DONE NO YES YES NO NO NO YES YES NO YES BEMF ZERO CROSSING MISSED CORRECTIVE CALCULATION 2 CORRECTED SETTING OF COMMUTATION TIME SERVICE OF RECEIVED BEMF ZERO CROSSING CORRECTED SETTING OF COMMUTATION TIME HAS COMMUTATION TIM...

Page 43: ..._ZCrosFlt n 1 2 Per_ZCros n 1 2 Per_ZCros0 HlfCmt n 1 2 Per_ZCrosFlt n Advance_angle 1 2 Per_ZCrosFlt n C_CMT_ADVANCE Per_ZCrosFlt n Coef_HlfCmt Per_ZCrosFlt n 2 Per_ZCrosFlt n 1 T_ZCros n n 2 n 1 n T_Cmt n 2 T_Cmt n 1 T_Cmt n T_Cmt n 1 COMMUTATION IS PRESET T_Cmt n 1 Per_HlfCmt n Per_HlfCmt n Per_ZCros n Per_ZCros n 1 Per_ZCros n 2 Per_Toff n Per_ZCros n T_ZCros n 1 Per_ZCros0 n Per_ZCros n T2 n ...

Page 44: ...state Per_Toff n 1 Per_ZCrosFlt Coef_Toff and Per_Dis minimum Per_ZCros0 Per_ZCros n T_ZCros0 T_ZCros n If back EMF zero crossing is missed then Corrective Calculation 2 is made T_ZCros n CmtT n Toff n Per_ZCros n T_ZCros n T_ZCros n 1 T_ZCros n T_ZCros0 Per_ZCrosFlt n 1 2 T_ZCros n 1 2 T_ZCros0 HlfCmt n 1 2 Per_ZCrosFlt n Advance_angle Coef_HlfCmt Per_ZCrosFlt n The best commutation was get with ...

Page 45: ... fluxes It implies for BLDC motors the following 1 The level of phase current must be high enough 2 The angle between the stator and rotor magnetic fields must be 90 30 The first condition is satisfied during the alignment state by maintaining dc bus current at a level sufficient to start the motor In the starting back EMF acquisition state the same value of PWM duty cycle is used as the one which...

Page 46: ...uccessive back EMF zero crossing events are not missed After several successive back EMF zero crossings Exact commutation time can be calculated Commutation process is adjusted Control flow continues to the Running state The BLDC motor is then running with regular feedback and the speed controller can be used to control the motor speed by changing the PWM duty cycle value Freescale Semiconductor I...

Page 47: ...te an angular difference of the stator magnetic field and rotor magnetic field The back EMF feedback is tested When the back EMF zero crossing is recognized the time of new commutation is evaluated Until at least two successive back EMF zero crossings are received the exact commutation time can not be calculated Therefore the commutation is done in advance in order to assure that successive back E...

Page 48: ...the starting back EMF acquisition state The commutation times T2 1 and T2 2 are calculated without any influence of back EMF feedback The commutation time calculations are explained in the following section RUNNING ALIGN BACK EMF ZERO CROSSINGS IDEAL COMMUTATION PATTERN WHEN POSITION IS KNOWN REAL COMMUTATION PATTERN WHEN POSITION IS ESTIMATED PHASE BACK EMFS PHASE A PHASE C PHASE B CTOP CBOT ATOP...

Page 49: ...n but the following computation coefficients are different coefficient Coef_HlfCmt 0 125 with advanced angle Advance_angle 60Deg 3 8 22 5Deg at Starting state Per_CmtStart 2 Per_CmtStart Per_Toff n T_ZCros 0 T_ZCros n n 1 n 2 n 3 T_Cmt 1 T_Cmt 2 T_Cmt 3 T2 1 T2 2 T2 n T2 n COMMUTATION IS PRESET T2 n Per_HlfCmt n Per_HlfCmt n 2 Per_ZCrosFlt n 1 ZERO CROSSING DETECTION SIGNAL ZERO CROSSING DETECTION...

Page 50: ...led in two basic modes Manual mode PC master software mode In manual mode it is controlled by an on board start stop switch and speed potentiometer In PC master mode it is controlled from a computer using PC master software In both modes the individual variables can be observed using the PC master software 3 4 1 PC Master Software PC master software was designed to provide the debugging diagnostic...

Page 51: ...a application interface variables 3 4 1 2 PC Master Software BLDC Control MCU Software API Communication Commands Commands defined for the BLDC control MCU software are listed in Table 3 1 The commands are very simple If the software executes the command it responds with OK byte 00 If it is unable to execute the command it responds with failed code 55 The commands Set PC master software mode Set m...

Page 52: ...scriptio n Table 3 2 PC Master Software API Variables Name Type I O Representing Range Description Sys3 Sys3_Def I O 8flags System variable 3 Motor_Ctrl Motor_Ctrl_Def I 8flags Motor control variable Motor_Status Motor_Status_D ef O 8flags Motor status variable Failure Failure_Def O 8flags Failure variable Sp_Input U8 I 0 255 Speed input variable used for required speed calculation Speed_Range_Max...

Page 53: ... unsigned int BIT5 1 BIT5 RESERVED unsigned int BIT6 1 BIT6 RESERVED unsigned int Alignment 1 BIT7 Alignment state Proceeding B Alignment PCMode EVMm LV HV char R Sys3_Def System register 3 Definition typedef union struct unsigned int StartCtrl 1 Switch Start set to START Flag unsigned int BIT1 1 BIT1 RESERVED unsigned int BIT2 1 BIT2 RESERVED unsigned int BIT3 1 BIT5 RESERVED unsigned int BIT4 1 ...

Page 54: ...g unsigned int VoltageFailure 1 BIT2 Over Voltage unsigned int BIT3 1 BIT5 RESERVED unsigned int BIT4 1 BIT4 RESERVED unsigned int BIT5 1 BIT6 RESERVED unsigned int BoardIdFail 1 BIT6 pcb Identification Failure unsigned int ErrCmt 1 BIT7 error Commutation B ErrCmt VoltageFailure OverHeating OverCurrent char R Failure_Def Failure Flags register Definition Table 3 2 declares if the variable is used ...

Page 55: ... motor set by the BLDC control MCU software The variable Speed_Range_Max_RPM determines scaling of the speed variables The actual speed of the motor can be calculated from Per_Speed_MAX_Range and zero crossing period Per_ZCrosFlt_T2 Actual speed rpm Speed_Range_Max_RPM Per_Speed_MAX_Range Per_ZCrosFlt_T2 The variable Commut_Rev can be used for calculation of the BLDC motor commutation period Commu...

Page 56: ...DC Motor Control Designer Reference Manual DRM028 Rev 0 56 BLDC Motor Control MOTOROLA Freescale Semiconductor I Freescale Semiconductor Inc For More Information On This Product Go to www freescale com nc ...

Page 57: ...on The application is designed to drive the 3 phase BLDC motor The HW is a modular system composed from board and motor There are three possible hardware options High Voltage Hardware Set Configuration Low Voltage Evaluation Motor Hardware Set Configuration Low Voltage Hardware Set Configuration The following subsection shows the system configurations They systems consists of the following modules...

Page 58: ...he evaluation board is connected to the controller board ECCTRMR32 via an emulator connector This solution is recommended for software evaluation 2 Programmed MCU MC68HC908MR32 Where a daughter board module with MC68HC908MR32 processor is plugged into the controller board ECCTRMR32 instead of the emulator cable the processor must be programmed in an external programmer This solution is recommended...

Page 59: ...DS08MR32 Described in Manual supplied with kit U1 Controller Board for MC68HC908MR32 Supplied as ECCTR908MR32 ECOPTHIVACBLDC U1 U2 U3 EVM1 MB1 3ph AC BLDC High Voltage Power Stage PC Computer RS232 PC Master 100 240VAC ECCTR908MR32 J13 1 J13 2 J13 3 Red Black 49 61 Hz J5 SM40V PC Computer RS232 emulator White SG40N 40w flat ribbon cable L J11 1 J11 2 N J14 J1 Black KITMMDS08MR32 Not Connected PE J...

Page 60: ... document order number MEMCOBUM D see References 5 NOTE It is strongly recommended to use opto isolation optocouplers and optoisolation amplifiers during development time to avoid any damage to the development equipment MB1 Motor Brake SM40V SG40N Supplied as ECMTRHIVBLDC The individual modules are described in some sections below More detailed descriptions of the boards can be found in comprehens...

Page 61: ...lied and documented according to the following references EVM1 Modular Development System with EM08MR32 Daughter Board Supplied as KITMMDS08MR32 Described in Manual supplied with kit U1 Controller Board for MC68HC908MR32 Supplied as ECCTR908MR32 Motor KITMMDS08MR32 J3 ECCTR908MR32 IB23810 U1 HC908MR32 ECMTREVAL J2 J5 Evaluation Motor Board 40w flat ribbon cable M1 Controller Board EVM1 PC Computer...

Page 62: ...MEMCEVMBUM D see References 6 The individual modules are described in some sections below More detailed descriptions of the boards can be found in comprehensive User s Manuals belonging to each board References 3 6 These manuals are available on on the World Wide Web at http www motorola com The User s Manual incorporates the schematic of the board description of individual function blocks and a b...

Page 63: ...908MR32 Described in MC68HC908MR32 Control Board User s Manual Motorola document order number MEMCMR32CBUM D see References 3 U2 3 Phase AC BLDC Low Voltage Power Stage Supplied as ECLOVACBLDC 12 White Black SG40N J13 GND J5 ECMTRLOVBLDC ECLOVACBLDC Red Controller Board U2 EVM1 J5 Red Not Connected 40w flat ribbon cable J20 PC Computer RS232 emulator Black U1 Motor Brake J19 KITMMDS08MR32 J16 J17 ...

Page 64: ...32 motor control board is designed to provide control signals for 3 phase ac induction 3 phase brushless dc BLDC and 3 phase switched reluctance SR motors In combination with one of the embedded motion control series power stages and an optoisolation board it provides a software development platform that allows algorithms to be written and tested without the need to design and build hardware With ...

Page 65: ...rd s circuitry Figure 4 4 MC68HC908MR32 Control Board 4 3 1 1 Electrical Characteristics of the MC68HC908MR32 Control Board The electrical characteristics in Table 4 1 apply to operation at 25 C OPTOISOLATED RS 232 I F TERMINAL dc POWER 12 Vdc REGULATED POWER SUPPLY PWM LEDs 6 FORWARD REVERSE SWITCH START STOP SWITCH SPEED POT EMULATOR PROCESSOR CONNECTOR RESET SWITCH 2 OPTION SWITCHES OVERCURRENT...

Page 66: ...ac induction and brushless dc BLDC motors Input connections are made via 40 pin ribbon cable connector J14 Power connections to the motor are made on output connector J13 Phase A phase B and phase C are labeled PH_A Ph_B and Ph_C on the board Power requirements are met with a single external 140 to Table 4 1 Electrical Characteristics of Control Board Characteristic Symbol Min Typ Max Units dc pow...

Page 67: ...e power electronics which need to dissipate heat are mounted on the power substrate This substrate includes the power IGBTs brake resistors current sensing resistors a power factor correction MOSFET and temperature sensing diodes Figure 4 5 shows a block diagram Figure 4 5 3 Phase AC High Voltage Power Stage 4 4 1 1 Electrical Characteristics of the 3 Phase AC BLDC High Voltage Power Stage The ele...

Page 68: ...age via high speed high dv dt digital optocouplers Analog feedback signals are passed back through HCNR201 high linearity analog optocouplers Delay times are typically Table 4 2 Electrical Characteristics of Power Stage Characteristic Symbol Min Typ Max Units dc input voltage Vdc 140 160 230 V ac input voltage Vac 100 208 240 V Quiescent current ICC 70 mA Min logic 1 input voltage VIH 2 0 V Max lo...

Page 69: ...itry is supplied from the power stage through the 40 pin output connector 4 4 2 1 Electrical Characteristics of the Optoisolation Board The electrical characteristics in Table 4 3 apply to operation at 25 C and a 12 Vdc power supply voltage Table 4 3 Electrical Characteristics Characteristic Symbol Min Typ Max Units Notes Power Supply Voltage Vdc 10 12 30 V Quiescent Current ICC 70 1 200 2 500 3 m...

Page 70: ...ld a power stage It supports algorithms that use Hall sensors encoder feedback and back EMF electromotive force signals for sensorless control The EVM motor board does not have overcurrent protection that is independent of the control board so some care in its setup and use is required if a lower impedance motor is used With the motor that is supplied in the kit the power output stage will withsta...

Page 71: ...n at 25 C Table 4 4 Electrical Characteristics of the EVM Motor Board Characteristic Symbol Min Typ Max Units Power Supply Voltage Vdc 10 12 16 V Quiescent Current ICC 50 mA Min Logic 1 Input Voltage VIH 2 4 V Max Logic 0 Input Voltage VIL 0 8 V Input Resistance RIn 10 kΩ Analog Output Range VOut 0 3 3 V Bus Current Sense Voltage ISense 412 mV A Bus Voltage Sense Voltage VBus 206 mV V Power MOSFET...

Page 72: ... are made via 40 pin ribbon cable connector J13 Power connections to the motor are made with fast on connectors J16 J17 and J18 They are located along the back edge of the board and are labeled Phase A Phase B and Phase C Power requirements are met with a 12 volt power supply that has a 10 to 16 volt tolerance Fast on connectors J19 and J20 are used for the power supply J19 is labeled 12V and is l...

Page 73: ...re mounted on the power substrate This substrate includes the power MOSFETs brake resistors current sensing resistors bus capacitors and temperature sensing diodes Figure 4 5 shows a block diagram Figure 4 6 Block Diagram 4 6 1 1 Electrical Characteristics of the 3 Ph BLDC Low Voltage Power Stage The electrical characteristics in Table 4 6 apply to operation at 25 C with a 12 Vdc supply voltage PO...

Page 74: ...led motor brake specifications are listed in Table 2 4 Section 2 Table 4 6 Electrical Chatacteristics of the 3 Ph BLDC Low Voltage Power Stage Characteristic Symbol Min Typ Max Units Motor Supply Voltage Vac 10 12 16 V Quiescent current ICC 175 mA Min logic 1 input voltage VIH 2 0 V Max logic 0 input voltage VIL 0 8 V Analog output range VOut 0 3 3 V Bus current sense voltage ISense 33 mV A Bus vo...

Page 75: ...are blocks of the drive The software will be described in terms of Data Flow Main Software Flowchart State Diagram For more information on the control technique used see 3 3 Used Control Technique 5 3 Data Flow The control algorithm obtains values from the user interface and sensors processes them and generates 3 phase PWM signals for motor control as can be seen on the data flow analysis shown in...

Page 76: ...IOD_T2_US Minimal commutation period of the speed range at Speed_Range_Max_RPM Per_ZCrosFlt U16 UNIT_PERIOD_T2_US Zero crossing period filtered T2 U16 union UNIT_PERIOD_T2_US Timer 2 variable T_ZCros U16 UNIT_PERIOD_T2_US Zero crossing time n T_ZCros0 U16 union UNIT_PERIOD_T2_US Zero crossing time n 1 T_Cmt U16 UNIT_PERIOD_T2_US Commutation time Curr S8 Curr_Range_Max_cA Curr_Range_Max_cA dc bus c...

Page 77: ...BIT6 Motor Running with back EMF feedback Flag unsigned int FOK_F 1 BIT7 Feedback within the righ time Flag B FOK_F Run_F Strt_F Stop_F Rmp_F ICR_F Off_F PC_F char R Sys1_Def System register 1 Definition Main data flow is displayed in Figure 5 1 The processes are described in the following subsections 5 3 2 Process Measurement The process provides measurement of analog values using ADC The measure...

Page 78: ... 5 3 5 Process Back EMF Zero Crossing Sensing Back EMF zero crossing process provides Back EMF zero crossing sampling in synchronization with PWM START STOP PC Mode Start Ctrl Switch_Start Running SWITCH A D CONVERTERS Sp_Input TIMER 1 VOLTAGE Curr_Max_Fault Volt_Max_Fault CURRENT PC MASTER SOFTWARE Stop_F PCM COMMAND FFLAG1 FFLAG2 PROCESS ALIGNMENT STARTING RUNNING CONTROL START STOP SWITCH READI...

Page 79: ...al MOTOROLA Software Design 79 Evaluates the zero crossing Records its time in T_ZCros Further explanation is provided in Data Flow and Figure 5 6 Freescale Semiconductor I Freescale Semiconductor Inc For More Information On This Product Go to www freescale com nc ...

Page 80: ... SPEED SETTING PROCESS BACK EMF ZERO CROSSING SENSING CORRECTIVE CALCULATION 1 OF COMMUTATION PARAMTERS CORRECTIVE CALCULATION 2 OF COMMUTATION PARAMETERS ACCELERATION PROCESS COMUTATION TIMES CALCULATION PROCESS SPEED CONTROL PROCESS PRESET COMMUTATION AND ZERO CROSSING PROCESS ALIGNMENT CONTROL PROCESS SET COMMUTATION AND ZERO CROSSING SELECTION Only when regular feedback can not be used PERFORM...

Page 81: ... register Speed_Desired is calculated from the following formula Speed_Desired Sp_Input Coef_Speed_Inp 255 Speed_Min_U8 5 3 8 Processs Speed Control The general principle of the speed PI control loop is illustrated in Figure 5 3 Figure 5 3 Closed Loop Control System The speed closed loop control is characterized by the feedback of the actual motor speed The actual motor speed is calculated from ze...

Page 82: ...ent Control The process alignment control controls the current Curr using the PI regulator during alignment state see 5 5 State Diagram The dc bus current is regulated to required value Curr_Align The current regulator parameters gain internal and input output variables are located in the structure PIParamsScl_S8_Curr The current controller works with a constant execution sampling period The perio...

Page 83: ... initializing the MCU and the main loop The flowcharts are shown in Figure 5 4 Figure 5 5 and Figure 5 6 MCU Initialization is entered only after system reset It provides initialization of system registers ports and CPU clock The MCU Initialization is provided in MCUInit function After MCU Initialization the Application Initialization is executed as AppInit function which performs the following ac...

Page 84: ...are checks the over voltage condition and the application starts The system Alignment and Starting Back EMF Acquisition states are provided by Alignment and Start functions in the code_start c file both are called from main The functionality during the start and running state is described in 3 3 1 Sensorless Commutation Control During the starting back EMF acquisition state the commutation time RE...

Page 85: ...OROLA Software Design 85 preset calculations are prepared in the StrtCmtPreset function and commutation time set calculations are provided by the StrtCmtSet function Freescale Semiconductor I Freescale Semiconductor Inc For More Information On This Product Go to www freescale com nc ...

Page 86: ...K SUCCESSIVE CORRECT COMMUTATIONS EXIT STARTING AQ STATE IF STOP OR FAULT CONDITION STOP MOTOR EXIT RUNNING STATE APPLICATION INITIALIZATION CURRENT OFFSET CALIBRATION SYSTEM REGISTERS INITIALIZATION PWM INITIALIZATION TIMER 1 CURRENT SENSING TO PWM SYNCHRONIZATION ADC MEASUREMENT INIT Stop_F Flag DC Bus over voltage YES NO YES NO RUNNING SET TIMER PERIOD FOR SPEED REGULATOR VIRTUAL TIMER3 MOTOR C...

Page 87: ...ared variable Failure 0 This decision is provided DecideCleSto function called from ErrorStop In manual control the failures are cleared by setting the Start Stop switch to Stop In case of PC master software control the failures are cleared by the ClearFail flag from the software When the failures are cleared the software enters Application Initialization Besides the main loop there are three inte...

Page 88: ...o crossing sensing The zero crossing input is sampled 2 or 3 times The back EMF state value is compared with expecting rising falling edge If the value corresponds with expecting edge the zero crossing get flag ICR_F is set and the actual time from timer counter register zero crossing time is recorded in T_ZCros This interrupt is provided by PWMMC_Int function in code_isr c Freescale Semiconductor...

Page 89: ...PLES BEMF STATE S1 S2 S2 S3 BEMF state 0 1 V_TASC ris edge YES NO V_TASC fal edge YES NO SET ZERO CROSSING GET SET ICR_F ZERO CROS GET T_ZCROS TIMER2 TIME START ADC DC BUS CURRENT CHANNEL SERVE VIRTUAL TIMER3 CURR VALUE FROM ADC IF CURR CURR_MAX_FAULT SET OVC_F OVERCUR FLAG SET NEXT ADC CHANNEL NXT_CHNL INTERRUPT TIMER 2 TIM A CH3 COMMUTATION ISR RTI IF CMTE_F COMMUTATION ENABLED DO MOTOR COMMUTAT...

Page 90: ... ALIGN TIMEOUT EXPIRED OVER CURRENT COMMUTATION IS LOCKED WITH BACK EMF FEEDBACK APPLICATION INITIALIZE DONE IRRECOVERABLE COMMUTATION ERROR COMMUTATION PWM ENABLED MOTOR STOP IS REQUIRED MCU INITIALIZE RUN CONDITION START SWITCH IS ON AND PCMode 0 OR PCMode AND StartCtrl AND SWITCH IS ON FAULT STATE PWM DISABLED CLEAR FAILURE START SWITCH SET OFF OR PCMode AND CLEAR FAIL FAILURE 0 Freescale Semic...

Page 91: ...ation This state is used as an application reset called following a return from fault or stop states In this state the following actions are done Current measurement path calibrated and checked for error Some application system variables initialized Some MCU peripherals are configured timer OC function PWM PWM outputs for motor control are turned OFF Timer 1 Tim A Ch1 is synchronized with the PWM ...

Page 92: ...dc bus current If the sensed value exceeds the limit Offset_Max_Curr when PWM is OFF this indicates some hardware error and the control flow enters into the fault state Start condition test The start condition is tested If in manual mode PCMode 0 the start condition is a movement in the switch from stop to start In PC master software mode PCMode 1 the start condition in switch start position and S...

Page 93: ...oltage is not within the limits the control flow enters into the fault state CURRENT IS HIGHER THAN LIMIT ENTER EXIT START CONDITION TEST FAULT STATE SPEED INPUT AND DC BUS VOLTAGE MEASUREMENTS ERROR IN HARDWARE OVER VOLTAGE OR UNDER VOLTAGE DONE DONE CURRENT MEASUREMENT AND CURRENT CALIBRATION WHEN PWM IS OFF START CONDITION START SWITCH CHANGED FROM STOP TO START OR START AND PC MODE AND START C...

Page 94: ...measurement is done in OC interrupt service routine in order to keep synchronization with PWM cycle After measurement is made the scheduler allows calculation by the current controller and CMD_F 1 IRRECOVERABLE OVER CURRENT ENTER EXIT SCHEDULER ALIGN TIME OUT EXPIRED ISR DONE TIMER1 TIM A CH1 INTERRUPT FAULT STATE ALIGN TIME OUT CURRENT CONTROLLER CMD_F 0 CURRENT MEASUREMENT OVER CURRENT DETECTION...

Page 95: ...d because the current measurement is initiated here Over Current Detection The dc bus current is periodically sensed and the over current condition is evaluated After a defined number successive over current events I_CNTR_OVC the control flow enters into the fault state 5 5 5 Back EMF Acquisition State The back EMF acquisition state provides the functionality described in 3 3 1 4 Starting Back EMF...

Page 96: ...of the commutation time is explained in 3 3 1 5 Starting Commutation Time Calculation Measurements Handler As explained in Scheduler and Over Current Detection the dc bus current is scanned and over current condition is evaluated Where there is an over current the control enters the fault state see Fault State The voltage and the speed commands are scanned too When this state is finished the value...

Page 97: ...RECOVERABLE COMMUTATION ERROR IRRECOVERABLE OVER CURRENT DONE ENTER EXIT CURRENT MEASUREMENT IS DONE FEEDBACK MEASUREMENTS MEASUREMENTS SECOND COMMUTATION DONE DONE DONE FAULT STATE PHASE HAS BEEN COMMUTATED PC_F 1 HANDLER HANDLER OVER CURRENT PWM DUTY CYCLE IS LEFT AT VALIE FOUND BY THE CURRENT CONTROLLER DURING THE ALIGN STATE COMMUTATIONS ARE LOCKED TO THE BACK BMF FEEDBACK START_F 0 CURRENT ME...

Page 98: ...reset to the output compare register of timer 2 For a better understanding of how the commutation process works see 3 3 1 Sensorless Commutation Control see 3 3 1 5 Starting Commutation Time Calculation BEMF Zero Crossing Sensing Interrupt Service Routine This ISR is used to evaluate the back EMF zero crossing Back EMF is evaluated here in order to synchronize zero crossing capture with the middle...

Page 99: ...c bus voltage speed command and temperature are scanned sequentially After the state has run three times all the values for dc bus current dc bus voltage speed input and temperature are updated dc bus current is scanned with a constant time period in the current measurement ISR but the over current condition is evaluated in the main software loop After a defined number I_OVC_Cnt of successive over...

Page 100: ...mmutation Time Calculation BEMF Zero Crossing Interrupt Service Routine Explained in 5 5 5 Back EMF Acquisition State Current Measurement Interrupt Service Routine Explained in 5 5 5 Back EMF Acquisition State Error Handler Explained in 5 5 5 Back EMF Acquisition State Over Current Explained in 5 5 5 Back EMF Acquisition State Freescale Semiconductor I Freescale Semiconductor Inc For More Informat...

Page 101: ...E OUT T3_F 1 IRRECOVERABLE COMMUTATION ERROR OVER CURRENT DONE ENTER EXIT STOP_F 1 CURRENT MEASUREMENT IS DONE MOTOR STOP IS REQUIRED FEEDBACK PWM RELOAD INTERRUPT PWM CENTER DONE FAULT STATE COMMUTATED PC_F 1 ICR_F 1 HANDLER TIMER2 TIM A CH3 INTERRUPT PHASE HAS BEEN COMMUTATED PC_F 1 TIMER1 TIM A CH1 INTERRUPT COMMUTATION ISR CURRENT MEASUREMENT ISR BEMF ZERO CROSSING SENSING ISR CURRENT MEASUREM...

Page 102: ...utation fault occurs the motor control PWM s are disabled and control enters the fault state where it remains until RESET or clear failure start switch set OFF or PCMode ClearFail The fault state is indicated by the Red LED diode blinking Clear Failure Test CURRENT MEASUREMENT ISR TIMER1 TIM A CH1 INTERRUPT CMD_F 1 CURRENT MEASUREMENT IS DONE ENTER EXIT MOTOR IS STOPPED STOP_F 1 MOTOR STOP IS REQU...

Page 103: ...ate entered See Figure 5 13 Figure 5 13 Fault State 5 6 Implementation Notes 5 6 1 Software Files The software files and structure are described in section 6 4 2 1 Application HC08 Software Files TIMER1 TIM A CH1 INTERRUPT ENTER DONE CURRENT MEASUREMENT ISR CURRENT MEASUREMENT IS DONE CMD_F 1 MOTOR IS STOPPED PWM IS OFF CLEAR FAILURE TEST ERROR INDICATION RED LED IS BLINKING WAIT FOR CLEAR FAILURE...

Page 104: ...d PVALxH registers are set to 0 To preset the PWM channel to the logical 0 the MSB bits of the dedicated PVALxH registers are set to 1 This is due to the signature bit functionality as described in 68HC908MR32 68HC9908MR16 Advance Information Motorola document order number MC68HC908MR32 D This commutation preset is provided by the function Commut In Commut the function field Set_PWM P_Step_Cmt cal...

Page 105: ...peed_Inp 8 This syntax is used to generate optimal code using the MUL instruction 5 6 3 2 PWM Duty Cycle PWM duty cycle is set for all six PWM channels according to regulators output OutReg_U8 The maximal duty cycle is at OutReg_U8 255 The registers PVAL1H PVAL1L through PVAL6H PVAL6L are set proportionally to the PWM modulus register PMOD MCPWM_MODULUS constant 100 duty cycle is when PVALx PMOD T...

Page 106: ...ER_CS_T1 of the timer T1 interrupts is generated The timer unit UNIT_PERIOD_T1_US of timer A is determined by the MCU bus frequency 8 MHz with a 4 MHz oscillator and default software setting and timer prescaler set in TASC So the default software value is 2 µs The timer 1 interrupt function is provided by the TIMACh1_Int function 5 6 4 2 Timer 2 Timer 2 is provided by timer A channel 3 set in outp...

Page 107: ...me TACNTH TACNTL can be timed at any TACNTH TACNTL timer A counter value The timer unit UNIT_PERIOD_T2_US of timer A is determined by the MCU bus frequency 8 MHz with 4 MHz oscillator and default software setting and timer prescaler set in TASC So the default software value is 2 µs The timer 2 interrupt function is provided by function TIMACh3_Int Freescale Semiconductor I Freescale Semiconductor ...

Page 108: ...Software Design Designer Reference Manual DRM028 Rev 0 108 Software Design MOTOROLA Freescale Semiconductor I Freescale Semiconductor Inc For More Information On This Product Go to www freescale com nc ...

Page 109: ...peed Since the sensorless back EMF zero crossing sensing technique is based on back EMF voltage it has some minimal speed limitations The motor start up is solved by starting back EMF acquisition state but minimal operation speed is limited The minimal speed depends on many factors of the motor and hardware design and differs for any application This is because the back EMF zero crossing is distur...

Page 110: ... this case the minimal execution time is 520 ms The minimal commutation period could be decreased using pure assembler code instead of C coding 6 2 3 Voltage Closed Loop As shown in Application Hardware and Software Configuration the speed control is based on voltage closed loop control This should be sufficient for most applications 6 2 4 Motor Suitability Back EMF zero crossing sensing is achiev...

Page 111: ...esence of the mutual capacitance Thus the disturbance is insignificant 6 2 4 2 Effect of Mutual Inductance The negative effect on back EMF sensing of mutual inductance is not to such a degree as unbalanced mutual capacitance However it can be noticed on the sensed phase The difference of the mutual inductances between the coils which carry the phase current and the coil used for back EMF sensing c...

Page 112: ...ges The user should be aware that Before moving scope probes making connections etc it is generally advisable to power down the high voltage supply To avoid inadvertently touching live parts use plastic covers When high voltage is applied using only one hand for operating the test setup minimizes the possibility of electrical shock Operation in lab setups that have grounded tables and or chairs sh...

Page 113: ... execution 1 MMDS Evaluation Board KITMMDSMR32 Using a real time debugger supplied with the Metrowerks compiler the evaluation board is connected to the controller board ECCTRMR32 via an emulator connector This solution is recommended for software evaluation 2 Programmed MCU MC68HC908MR32 Where a daughter board module with MC68HC908MR32 processor is plugged into the controller board ECCTRMR32 inst...

Page 114: ...nces shown see section 4 2 1 High Voltage Hardware Set Configuration 6 4 1 2 Low Voltage Evaluation Motor Hardware Set Configuration The system configuration for a low voltage evaluation motor hardware set is shown in Figure 6 2 ECOPTHIVACBLDC U1 U2 U3 EVM1 MB1 3ph AC BLDC High Voltage Power Stage PC Computer RS232 PC Master 100 240VAC ECCTR908MR32 J13 1 J13 2 J13 3 Red Black 49 61 Hz J5 SM40V PC ...

Page 115: ...nt references shown see section 4 2 2 Low Voltage Evaluation Motor Hardware Set Configuration 6 4 1 3 Low Voltage Hardware Set Configuration The system configuration for low voltage hardware set is shown in Figure 6 3 Motor KITMMDS08MR32 J3 ECCTR908MR32 IB23810 U1 HC908MR32 ECMTREVAL J2 J5 Evaluation Motor Board 40w flat ribbon cable M1 Controller Board EVM1 PC Computer RS232 emulator 12VDC 12 GND...

Page 116: ...roller board settings are the same for all hardware platforms Jumpers JP3 and JP7 must be connected with the other jumpers disconnected See Figure 6 4 12 White Black SG40N J13 GND J5 ECMTRLOVBLDC ECLOVACBLDC Red Controller Board U2 EVM1 J5 Red Not Connected 40w flat ribbon cable J20 PC Computer RS232 emulator Black U1 Motor Brake J19 KITMMDS08MR32 J16 J17 J18 SM40N Not Connected MB1 PC Computer RS...

Page 117: ... W1 to MMDS and set for 4 MHz in the debugger 6 4 2 Software Setup In order to run the sensorless BLDC application the following software is needed Metrowerks compiler for HC08 installed on your PC computer Sensorless BLDC application HC08 software files located in bldc_zerocros08MR32 directory indication LEDs to power stage board START STOP switch SPEED potentiometer connect JP13 PC Master S W RS...

Page 118: ...08MR32 sources const_cust_hv h definitions for software customizing for high voltage 230 115 Vac power board bldc_zerocros08MR32 sources const_cust_evm h definitions for software customizing for EVM motor board 12 V low power bldc_zerocros08MR32 sources const_cust_lv h definitions for software customizing for low voltage 12 Vdc power board NOTE Change the code_fun c file to include include one of ...

Page 119: ...s bldc_zerocros08MR32 sources code_start h motor alignment and starting back EMF acquisition state function header bldc_zerocros08MR32 sources code_run c motor running state function bldc_zerocros08MR32 sources code_run h motor running state function header bldc_zerocros08MR32 sources code_isr c program interrupt functions bldc_zerocros08MR32 sources code_isr h program interrupt functions header L...

Page 120: ...ts tables definitions header bldc_zerocros08MR32 sources pcmaster c PC master software communication subroutines bldc_zerocros08MR32 sources pcmaster h PC master software communication subroutines header bldc_zerocros08MR32 sources code_asm asm program assembler functions bldc_zerocros08MR32 sources code_asm h program assembler functions header bldc_zerocros08MR32 prms default prm linker command f...

Page 121: ...te Make Command 6 4 3 2 Execute from Evaluation Board To execute the application from MMDS evaluation board KITMMDSMR32 choose the Project Debug command in the Code Warrior IDE This will start real time debugger load firmware and application software to evaluation board MMDS The application should then be started from the real time debugger IDE by the Run Start command For more help with these com...

Page 122: ...om CodeWarrior 6 4 3 3 Execute from Pre programmed MCU When the software is built the S record file bldc_zerocros08mr32_MMDS sx is generated in bldc_zerocros08MR32 bin bldc_zerocros08mr32_MMDS sx NOTE The software must be built see Build to generate by linker the bldc_zerocros08mr32_MMDS sx file last update This S record file can be used for programming of MC68HC908MR32 MCU devices An external pro...

Page 123: ...cated by a red LED blinking yellow LED lights This state can be exited only by an application RESET or setting RUN STOP switch to STOP NOTE It is strongly recommended that you inspect the entire application to locate the source of the fault before starting again 6 4 4 2 PC Master Software Remote Operating Mode In the PC master software remote operating mode the drive is controlled remotely from a ...

Page 124: ...S map file has been selected PC master software uses the load map to determine addresses for global variables being monitored Once the PC master project has been launched this option may be selected in the PC master window under Project Select Other Map FileReload Figure 6 6 PC Master Software Control Window The following control actions are supported Setting PC master software manual control mode...

Page 125: ...ia bar graph Clear failures Clear Failures button PC master software displays the following information Required speed of the motor Actual speed of the motor dc bus current Temperature of the power stage Fault status no fault over voltage under voltage or over current in dc bus Motor status running stopped NOTE Hardware board identification is not implemented in the software Therefore the PC maste...

Page 126: ...riate constants in const_cust_x h file must be set as described in the section 6 5 3 1 Software Customizing to Power Stage If a low voltage board with a modification for 42 V is used the constants VOLT_HW_MAX and VOLT_MAX_FAULT_V must be changed If one of the three standard power stages is used the software customizing to power stage is not needed For software customizing to customer motor and app...

Page 127: ...uency and Current Sampling Period Setting If there s still a problem running the motor check if the motor is suitable for sensorless control with back EMF zero crossing see Figure 6 9 as described in the section 6 2 4 Motor Suitability Then again check the application suitability Freescale Semiconductor I Freescale Semiconductor Inc For More Information On This Product Go to www freescale com nc ...

Page 128: ...O ENTER RUNNING STATE I_CNTR_FOK SET COMMUTATIONS PER ROTOR MECHANICAL REVOLUTION COMMUT_REV SET MAXIMAL SPEED VARIABLES RANGE SPEED_RANGE_MAX_RPM SET MAXIMAL REQUIRED SPEED SPEED_MAX_RPM SET MINIMAL REQUIRED SPEED SPEED_MIN_RPM SET SPEED REGULATOR CONSTANTS CURR_PIREG_P_GAINSCALELEFT CURR_PIREG_P_GAIN CURR_PIREG_I_GAINSCALELEFT CURR_PIREG_I_GAIN CHECK MINIMAL APPLICATION SPEED CHECK MAXIMAL MOTOR...

Page 129: ...e windows with required variables The remote application control uses the same control page as described in PC Master Software Remote Operating Mode Moreover the tuning file incorporates subprojects for a dedicated system variables SET PWM FREQUENCY SET_PER_PWM SET CURRENT SAMPLING PERIOD SET_PER_CS SET PERIOD FROM PWM RELOAD TO CURRENT SAMPLING SET_PER_CS PWM Frequency and Current Sampling Period...

Page 130: ...ster software installed on your PC computer Figure 6 10 PC Master Software Parameters Tuning Control Window Start the PC master software parameters tuning application click here to display click here for Current Parameters Tuning click here for Start Parameters Tuning click here for Speed Parameters Tuning modify variables here control page Freescale Semiconductor I Freescale Semiconductor Inc For...

Page 131: ...ntrol in the same way as in PC Master Software Remote Operating Mode Or you can display the oscilloscope window see Figure 6 11 You can then modify the variable values in the variable window Figure 6 11 which is visible for both control page or oscilloscope page turned on The variables can be modified according to their defined limits Figure 6 11 PC Master Software Parameters Tuning Control Window...

Page 132: ...hase trapezoidal BLDC motors or possibly other hardware board parameters The motor control drive usually needs setting tuning for Current voltage parameters Dynamic parameters The parameter configurations must be set in source code before compilation However some parameters can also be temporarily changed using PC master software experimental setting Finally when an appropriate parameter value is ...

Page 133: ... setting is not needed CAN_CHANGE_nn_EXPER Label for changes which can be set changed when adapting software for a motor but usually the setting is not needed the setting can be done experimentally 6 5 2 2 Labels in the File const h The other parameters like motor PWM frequency and current sampling period can be set in the file const h The required steps are marked CAN_CHANGE_FPWM_n Label for defi...

Page 134: ...am c language functions NOTE The following parameter settings will be provided in the selected file Therefore it will be referred to as const_cost_x h in the following sections 6 5 3 1 Software Customizing to Power Stage The hardware boards parameters customizing is provided in the const_cust_x h file NOTE Skip this section when standard modular motion control development hardware boards are used ...

Page 135: ...nge is different from default hardware Maximum limit of dc bus voltage allowable for the hardware V MUST_IF_HW_CHANGE_3 define VOLT_MAX_FAULT_V 380 0 Range 0 VOLT_RANGE_MAX VOLT_MAX_FAULT_V determines the maximal voltage when the drive fault state should be entered So the constant VOLT_MAX_FAULT_V must be set according to maximal voltage limit of the power stage or the motor using the lower value ...

Page 136: ...mizing to Hardware Let s have low voltage power stage ECLOVACBLDC modified to 42 V from 12 V as described in its documentation So software must be customized for hardware changes Because of low voltage set the const_cust_lv h must be modified 1 Maximal PWM duty cycle remains the same define DUTY_PWM_MAX 0 942 2 Modified maximal measurable voltage is 55 V so set define VOLT_HW_MAX 55 0 3 Maximum li...

Page 137: ...st_cust_x h Detailed description starts here 6 5 4 1 Maximal and Minimal Voltage Limits Setting Most of voltage limit settings do not necessarily need to be done Maximal limit of dc bus voltage V CAN_CHANGE_1 define VOLT_MAX_FAULT_V 380 0 Range 0 VOLT_RANGE_MAX VOLT_MAX_FAULT_V determines the maximal voltage when the drive fault state should be entered So the constants VOLT_MAX_FAULT_V must be set...

Page 138: ...low voltage hardware the VOLT_120_THRESHOLD_V should be set to 0 6 5 4 2 Maximal and Minimal Current Limits Setting Most of current limits settings do not necessarily need to be done Current offset limit for fault during calibration initialization V CAN_CHANGE_4 define OFFSET_MAX_CURR_V 1 65 0 225 Range 0 5 When PWM is off the default hardware determined offset should be 1 65 V The actual offset i...

Page 139: ... 5 4 3 Alignment Current and Current Regulator Setting The current during alignment state before motor starts Α MUST_CHANGE_1_EXPER define CURR_ALIGN_A 0 55 Range 0 CURRENT_RANGE_MAX_A It is recommended that nominal motor current value be set Sometimes when power source is not able to deliver the required current it is necessary to set a lower value then nominal motor current NOTE CURR_ALIGN_A can...

Page 140: ...PC master software tuning file tuning_bldc pmp We suggest using PC master software with tuning file tuning_bldc pmp for regulator parameters evaluation You can use this procedure 1 Set const_cust_x h CURR_PIREG_P_GAINSCALELEFT 0 CURR_PIREG_P_GAIN 0 CURR_PIREG_I_GAINSCALELEFT 0 CURR_PIREG_I_GAIN 0 2 Temporarily change the software in code_start c file label TUNING_1 enable goto Align it will cause ...

Page 141: ...C Master Software Remote Operating Mode Figure 6 12 PC Master Software Current Parameters Tuning Window 8 Increase step by step the proportional gain CURR_PIREG_P_GAIN with PC master software until current noise or oscillation appears or up to 128 Click here for Current Parameters Tuning click here to display oscilloscope modify values here click here to display control page Freescale Semiconducto...

Page 142: ...r software 14 Change the software back to normal in code_start c file label TUNING_1 remove goto modify as comment goto Align it will allow finishing Alignment state when alignment period ends 15 Build the code see Software Execution Build 16 You can also tune regulator dynamic characteristics of current transients steps 17 to 26 or finish the regulators tuning 17 Run the code see Software Executi...

Page 143: ...ing Alignment state It is recommended that you begin with large values such as 20 000 ms then it can be lowered The period should be set to ensure that the rotor and therefore also the current is stabilized at the end of Alignment state 6 5 5 Software Customizing to Motor Commutation and Start up Control Setting When all voltage and current settings are done the motor commutation and start up para...

Page 144: ...HLFCMT 0 375 Range 0 1 COEF_HLFCMT multiplied by commutation period determines the time from back EMF zero crossing to motor commutation So it sets the electrical angle from back EMF zero crossing to motor commutation step The software controls BLDC motor with a 6 step commutation six commutations per one electrical rotation which means 60 between commutations For ideal commutation with no advanci...

Page 145: ...25 Advance_angle 7 5 for COEF_HLFCMT 0 375 Advance_angle 0 for COEF_HLFCMT 0 5 The relation between back EMF zero crossing and the commutation is explained in the section 3 3 1 3 Running Commutation Time Calculation 6 5 5 2 Start up Constants and Maximal Commutation Period Constants defining start up need to be changed according to the drive dynamics Start Commutation Period µs MUST_CHANGE_8_EXPER...

Page 146: ...th PC master software tuning file tuning_bldc pmp Maximal commutation period limit µs CAN_CHANGE_6_EXPER define PER_CMT_MAX_US 65536 0 Range 0 65535 UNIT_PERIOD_T2_US Usually it is not recommended to change PER_CMT_MAX_US The change is only necessary if the commutation period at start up is to long Alignment to Start Increment of the regulators output CAN_CHANGE_7_EXPER define START_INCR_OOUTREG 2...

Page 147: ... not recommended to change I_CNTR_FOK but it can be evaluated when there are problems with motor start up NOTE I_CNTR_FOK can be evaluated with PC master software tuning file uning_bldc pmp We suggest using PC master software with tuning file tuning_bldc pmp for start up parameters evaluation You can use this procedure 1 Ensure that the Alignment current and regulator were properly set Alignment C...

Page 148: ...g project 11 Select Start Parameters Tuning subproject see Software Parameters Tuning with PC Master Software Project File in order to be able to modify the start parameters 12 You can see the actual zero crossing commutation period on the Start Parameters Tuning New Scope or measure the phase a b and c voltages on a real oscilloscope Freescale Semiconductor I Freescale Semiconductor Inc For More ...

Page 149: ...Mode 15 If the software signalizes errors usually commutation error clear the errors stop the motor and change PER_CMT_START_US increase or decrease by PC master software 16 Repeat step 15 until the motor starts well If the motor starts against a high start up torque or if Alignment state current is low Click here for Start Parameters Tuning click here to display oscilloscope modify values here cl...

Page 150: ... parameters to 20 define SPEED_PIREG_P_GAIN 64 define SPEED_PIREG_I_GAIN 0 21 in const_cust_x h file to enable speed regulation 22 Build the code see Software Execution and Build 6 5 6 Software Customizing to Motor Speed Control Setting When the motor commutation setting is done the speed control parameters need to be set For settings which must be done follow the labels MUST_CHANGE_nn MUST_CHANGE...

Page 151: ... set SPEED_RANGE_MAX_RPM higher then maximal actual motor speed even during speed transient Maximal speed of the drive rpm MUST_CHANGE_11 define SPEED_MAX_RPM 2500 0 Range 0 SPEED_RANGE_MAX_RPM SPEED_MAX_RPM determines the maximal desired speed It must be changed for any motor accommodation The software calculates the internal speed variables using SPEED_RANGE_MAX_RPM constant For proper speed con...

Page 152: ...on the motor Therefore DUTY_PWM_MIN must be changed if its default setting creates a higher voltage than is physically necessary to run with a speed close to SPEED_MIN_RPM CAUTION If the motor is unable to run down to the speed set in SPEED_MIN_RPM then decrease DUTY_PWM_MIN constant Speed PI regulator constants MUST_CHANGE_13_EXPER define SPEED_PIREG_P_GAINSCALELEFT 0 Range 0 8 MUST_CHANGE_14_EXP...

Page 153: ...sing PC master software with tuning file tuning_bldc pmp for regulator parameters evaluation You can use this procedure 1 Ensure that the start up and commutation parameters were set properly Start up Constants and Maximal Commutation Period 6 5 4 3 in const_cust_x h 2 Set const_cust_x h SPEED_PIREG_P_GAINSCALELEFT 0 SPEED_PIREG_P_GAIN 0 SPEED_PIREG_I_GAINSCALERIGHT 7 SPEED_PIREG_I_GAIN 0 3 Ensure...

Page 154: ...t see Software Parameters Tuning with PC Master Software Project File in order to be able to modify the current regulator 8 You can see the actual speed and desired speed on the Speed Parameters Tuning New Scope or measure the phase voltage period on real oscilloscope Click here for Speed Parameters Tuning click here to display oscilloscope modify values here click here to display control page Fre...

Page 155: ...al gain increases to SPEED_PIREG_I_GAINSCALELEFT with PC master software steps 6 5 4 0 otherwise leave SPEED_PIREG_I_GAINSCALELEFT as 7 15 You can further evaluate the setting of the regulator parameters in order to get a smoother current waveform until the regulation seems to be performing well 16 Open const_cust_x h and modify the regulator parameters with the final variable values evaluated wit...

Page 156: ...ce you set the speed control and the motor is running in all start speed up and slow down conditions the software parameters are set for the motor Remember that all parameters are set in const_cust_x h Then it is possible to program the FLASH memory of the MC68HC908MR32 device 6 5 7 PWM Frequency and Current Sampling Period Setting PWM frequency and current sampling period settings are not usually...

Page 157: ...r things effects the current regulator Therefore after changing PWM frequency changing or checking current sampling period is strongly recommended 6 5 7 2 Current Sampling Period Current sampling period should usually be changed in two cases 1 When PWM frequency is changed 2 Motors with externally low electrical constant If the motor electrical constant is lower than default current sampling perio...

Page 158: ...PERCURSAMP_n define PER_PWM_CS_US 5 0 Range PERIOD_PWM_US 2 PERIOD_PWM_US 2 Usually it is not recommended to change PER_PWM_CS_US but it can be evaluated when there are problems with back EMF zero crossing noise It is necessary to set SET_PER_CS according to the following equation EQ 6 17 6 5 8 Conclusion Software Parameters Setting and Tuning If all the points in Tuning for Customer Motor are don...

Page 159: ...ide 159 software may not be suitable for some applications Some important recommendations can also be found under the Caution and Note labels in this designer reference manual Freescale Semiconductor I Freescale Semiconductor Inc For More Information On This Product Go to www freescale com nc ...

Page 160: ...User Guide Designer Reference Manual DRM028 Rev 0 160 User Guide MOTOROLA Freescale Semiconductor I Freescale Semiconductor Inc For More Information On This Product Go to www freescale com nc ...

Page 161: ... order number MEMC3PBLDCPSUM D Motorola 2000 5 Motorola Embedded Motion Control Optoisolation Board document order number MEMCOBUM D Motorola 2000 6 Motorola Embedded Motion Control Evaluation Motor Board User s Manual document order number MEMCEVMBUM D Motorola 2000 7 Motorola Embedded Motion Control 3 Phase BLDC Low Voltage Power Stage User s Manual document order number MEMC3PBLDCLVUM D Motorol...

Page 162: ...ce Manual DRM028 Rev 0 162 References MOTOROLA Motor using MC68HC 7 05MC4 document order number AN1627 Motorola Freescale Semiconductor I Freescale Semiconductor Inc For More Information On This Product Go to www freescale com nc ...

Page 163: ...nverter with direct current DC motor Direct Current motor if not mentioned differently it means the motor with brushes DT see Dead Time DT Dead Time DT short time that must be inserted between the turning off of one transistor in the inverter half bridge and turning on of the complementary transistor due to the limited switching speed of the transistors duty cycle A ratio of the amount of time the...

Page 164: ...ion of a program to respond to signals from peripheral devices by executing a subroutine input output I O 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 on an external signal KITMMDS08MR32 MMDS 68HC908MR32 16 developement kit logic 1 A voltage level approximately equa...

Page 165: ...To force a device to a known condition SCI See serial communication interface module SCI serial communications interface module SCI A module that supports asynchronous communication serial peripheral interface module SPI A module that supports synchronous communication software Instructions and data that control the operation of a microcontroller software interrupt SWI An instruction that causes a...

Page 166: ...Glossary Designer Reference Manual DRM028 Rev 0 166 Glossary MOTOROLA Freescale Semiconductor I Freescale Semiconductor Inc For More Information On This Product Go to www freescale com nc ...

Page 167: ...Freescale Semiconductor I Freescale Semiconductor Inc For More Information On This Product Go to www freescale com nc ...

Page 168: ...erent 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 Motorola does not convey any license under its patent rights nor the rights of others Motorola products are not designed intended or authorized for use as components in systems intended for surgical implant into the...

Reviews: