![]() |
|
If you can't view the Datasheet, Please click here to try to view without PDF Reader . |
|
Datasheet File OCR Text: |
motorola.com/semiconductors m68hc08 microcontrollers DRM028/d rev. 0, 03/2003 sensorless bldc motor control using the mc68hc908mr32 manual designer reference f r e e s c a l e s e m i c o n d u c t o r , i freescale semiconductor, inc. f o r m o r e i n f o r m a t i o n o n t h i s p r o d u c t , g o t o : w w w . f r e e s c a l e . c o m n c . . .
f r e e s c a l e s e m i c o n d u c t o r , i freescale semiconductor, inc. f o r m o r e i n f o r m a t i o n o n t h i s p r o d u c t , g o t o : w w w . f r e e s c a l e . c o m n c . . . DRM028 ? rev 0 designer reference manual motorola 3 sensorless bldc motor control using the mc68hc908mr32 designer reference manual ? rev 0 by: libor prokop motorola czech s ystem laboratories roznov pod radhostem, czech republic f r e e s c a l e s e m i c o n d u c t o r , i freescale semiconductor, inc. f o r m o r e i n f o r m a t i o n o n t h i s p r o d u c t , g o t o : w w w . f r e e s c a l e . c o m n c . . . revision history designer reference manual DRM028 ? rev 0 4 motorola to provide the most up-to-date info rmation, the re vision of our documents on the world wide web will be the most current. your printed copy may be an earlier revision. to veri fy you have the latest information available, refer to: http://www.motorol a.com/semiconductors the following revision history table summarizes cha nges contained in this document. for your conven ience, 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 f r e e s c a l e s e m i c o n d u c t o r , i freescale semiconductor, inc. f o r m o r e i n f o r m a t i o n o n t h i s p r o d u c t , g o t o : w w w . f r e e s c a l e . c o m n c . . . DRM028 ? rev 0 designer reference manual motorola 5 designer reference manual ? sensorless bldc motor control list of sections section 1. introduction . . . . . . . . . . . . . . . . . . . . . . . . . . . 13 section 2. system description. . . . . . . . . . . . . . . . . . . . . 15 section 3. bldc motor co ntrol . . . . . . . . . . . . . . . . . . . . 23 section 4. hardware design. . . . . . . . . . . . . . . . . . . . . . . 57 section 5. software design . . . . . . . . . . . . . . . . . . . . . . . 75 section 6. user guide . . . . . . . . . . . . . . . . . . . . . . . . . . . 109 appendix a. references. . . . . . . . . . . . . . . . . . . . . . . . . 161 appendix b. glossary. . . . . . . . . . . . . . . . . . . . . . . . . . . 163 f r e e s c a l e s e m i c o n d u c t o r , i freescale semiconductor, inc. f o r m o r e i n f o r m a t i o n o n t h i s p r o d u c t , g o t o : w w w . f r e e s c a l e . c o m n c . . . list of sections designer reference manual DRM028 ? rev 0 6 motorola f r e e s c a l e s e m i c o n d u c t o r , i freescale semiconductor, inc. f o r m o r e i n f o r m a t i o n o n t h i s p r o d u c t , g o t o : w w w . f r e e s c a l e . c o m n c . . . DRM028 ? rev 0 designer reference manual motorola 7 designer reference manual ? sensorless bldc motor control table of contents section 1. introduction 1.1 contents . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .13 1.2 application functionality . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 13 1.3 benefits of the solu tion. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 13 section 2. system description 2.1 contents . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .15 2.2 system concept . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 15 2.3 system specification . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 17 section 3. bldc motor control 3.1 contents . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .23 3.2 brushless dc motor con trol 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 an d 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 se t components . . . . . . . . . . . . . . . . . 72 f r e e s c a l e s e m i c o n d u c t o r , i freescale semiconductor, inc. f o r m o r e i n f o r m a t i o n o n t h i s p r o d u c t , g o t o : w w w . f r e e s c a l e . c o m n c . . . table of contents designer reference manual DRM028 ? rev 0 8 motorola section 5. software design 5.1 contents . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .75 5.2 introduction . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 75 5.3 data flow . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 75 5.4 main software flowchart . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 83 5.5 state 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 f r e e s c a l e s e m i c o n d u c t o r , i freescale semiconductor, inc. f o r m o r e i n f o r m a t i o n o n t h i s p r o d u c t , g o t o : w w w . f r e e s c a l e . c o m n c . . . DRM028 ? rev 0 designer reference manual motorola 9 designer reference manual ? sensorless bldc motor control list of figures figure title page 2-1 system concept . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 16 3-1 bldc motor cross section. . . . . . . . . . . . . . . . . . . . . . . . . . . .24 3-2 3-phase voltage system . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 24 3-3 bldc motor back emf and magnetic flux . . . . . . . . . . . . . . . 26 3-4 classical system . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 27 3-5 power stage ? motor topology . . . . . . . . . . . . . . . . . . . . . . . . 28 3-6 phase voltage waveform . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 31 3-7 mutual inductance effect . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 32 3-8 detail of mutual inductanc e effect . . . . . . . . . . . . . . . . . . . . . . 33 3-9 mutual capacitance model . . . . . . . . . . . . . . . . . . . . . . . . . . . .34 3-10 distributed back-emf by unbalanced capacity coupling. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .35 3-11 balanced capacity coupling . . . . . . . . . . . . . . . . . . . . . . . . . . . 36 3-12 back-emf sensing circui t 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 flowch art. . . . . . . . . . . . . . . . . . . . . . . 42 3-17 bldc commutation time with zer o crossing sensing . . . . . . 43 3-18 vectors of magnetic fields . . . . . . . . . . . . . . . . . . . . . . . . . . . .47 3-19 back-emf at start up. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 48 3-20 calculation of the commut ation times during the starting (back-emf acquisition) stat e. . . . . . . . . . . . . . . . . . . . . . . . . . 49 4-1 high-voltage hardware system config uration . . . . . . . . . . . . . 59 4-2 low-voltage evalua tion motor hardware system configuration . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 61 4-3 low-voltage hardware s ystem configuration . . . . . . . . . . . . . 63 4-4 mc68hc908mr32 control b oard . . . . . . . . . . . . . . . . . . . . . . 65 f r e e s c a l e s e m i c o n d u c t o r , i freescale semiconductor, inc. f o r m o r e i n f o r m a t i o n o n t h i s p r o d u c t , g o t o : w w w . f r e e s c a l e . c o m n c . . . list of figures designer reference manual DRM028 ? rev 0 10 motorola 4-5 3-phase ac high voltage power stage . . . . . . . . . . . . . . . . . . 67 4-6 block diagram . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 73 5-1 main data flow ? part1. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 78 5-2 main data flow ? part 2: alignment, starting, running control . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 80 5-3 closed loop control system . . . . . . . . . . . . . . . . . . . . . . . . . . 81 5-4 main software flowchart . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 84 5-5 main software flowchart ? main software loop. . . . . . . . . . . 86 5-6 software flowchart ? interrupts . . . . . . . . . . . . . . . . . . . . . . . 89 5-7 application state transitions . . . . . . . . . . . . . . . . . . . . . . . . . . 90 5-8 stand-by state . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 93 5-9 align state . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 94 5-10 back-emf acquisition. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 97 5-11 running state . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 101 5-12 stop state. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 102 5-13 fault state . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 103 6-1 high-voltage hardware system conf iguration . . . . . . . . . . . . 114 6-2 low-voltage evalua tion 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 cust omer motor . . . . 128 6-8 follow-up for advanced software customizing . . . . . . . . . . . 129 6-9 follow-up for softwa re customizing trouble shouting. . . . . . 129 6-10 pc master software paramete rs tuning control window . . . 130 6-11 pc master software paramete rs tuning control window . . . 131 6-12 pc master software current parameters tuning window . . . 141 6-13 pc master software start pa rameters tuning wi ndow . . . . . 149 6-14 pc master software speed parameters tuning window. . . . 154 f r e e s c a l e s e m i c o n d u c t o r , i freescale semiconductor, inc. f o r m o r e i n f o r m a t i o n o n t h i s p r o d u c t , g o t o : w w w . f r e e s c a l e . c o m n c . . . DRM028 ? rev 0 designer reference manual motorola 11 designer reference manual ? sensorless bldc motor control list of tables table title page 2-1 software specifications . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 18 2-2 high voltage hardware se t specifications . . . . . . . . . . . . . . . . 20 2-3 low voltage eval uation hardware set specif ications . . . . . . . 21 2-4 low voltage hardware se t specifications . . . . . . . . . . . . . . . . 22 3-1 pc master software communicat ion commands . . . . . . . . . . 51 3-2 pc master software api variables. . . . . . . . . . . . . . . . . . . . . . 52 4-1 electrical characteristi cs of control board . . . . . . . . . . . . . . . . 66 4-2 electrical characteristi cs of power stage. . . . . . . . . . . . . . . . . 68 4-3 electrical characteristics . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 69 4-4 electrical characterist ics of the evm motor boar d. . . . . . . . . . 71 4-5 characteristics of the bl dc motor . . . . . . . . . . . . . . . . . . . . . . 71 4-6 electrical chatacteri stics of the 3-ph bldc low voltage power stage . . . . . . . . . . . . . . . . . . . . . . . . . . . . 74 5-1 software variables . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 76 6-1 required softwa re configuration for dedicated hardware platform . . . . . . . . . . . . . . . . . . . . . . 118 6-2 start-up period . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 146 6-3 pwm frequency setting. . . . . . . . . . . . . . . . . . . . . . . . . . . . . 157 f r e e s c a l e s e m i c o n d u c t o r , i freescale semiconductor, inc. f o r m o r e i n f o r m a t i o n o n t h i s p r o d u c t , g o t o : w w w . f r e e s c a l e . c o m n c . . . list of tables designer reference manual DRM028 ? rev 0 12 motorola f r e e s c a l e s e m i c o n d u c t o r , i freescale semiconductor, inc. f o r m o r e i n f o r m a t i o n o n t h i s p r o d u c t , g o t o : w w w . f r e e s c a l e . c o m n c . . . DRM028 ? rev 0 designer reference manual motorola introduction 13 designer reference manual ? sensorless bldc motor control section 1. introduction 1.1 contents 1.2 application functionality . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 13 1.3 benefits of the solu tion. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 13 1.2 application functionality this reference design de scribes the design of a low-cost sensorless 3-phase brushless dc (bldc) motor control with back-emf (electromotive force) zero-crossing sensing. it is based on motorola?s mc68hc908mr32 microcontro ller which is dedicat ed for motor control applications. the system is desi gned as a motor drive system for medium power three phase bldc motors and is targeted for applications in automotive, indust rial and applianc e fields (e.g. compressors, air conditioning units, pu mps or simple in dustrial drives). the reference design incorporates bot h hardware and software parts of the system including hardware schematics. 1.3 benefits of the solution the design of very low co st variable speed bldc motor control drives has become a prime focus point for the applianc e designers and semiconductor suppliers. today more and more vari able speed drives are put in appliance or automotive products to increase t he whole system efficiency and the product performance. using of the control systems based on semiconductor components and mcus is mandatory to satisfy requirements for hi gh efficiency, performanc e and cost of the system. f r e e s c a l e s e m i c o n d u c t o r , i freescale semiconductor, inc. f o r m o r e i n f o r m a t i o n o n t h i s p r o d u c t , g o t o : w w w . f r e e s c a l e . c o m n c . . . introduction designer reference manual DRM028 ? rev 0 14 introduction motorola once using the semiconductor com ponents, it is opened to replace classical universal and dc-motors with maintenance-free electrically commutated bldc motors . this brings many advantages of bldc motors when the system costs c ould be maintained equivalent. the advantages of bldc mo tor versus universal and dc-motors are: high efficiency reliability (no brushes) low noise easy to drive features to control the bldc motor, the rotor position must be known at certain angles in order to align the applied voltage with the ba ck-emf, which is induced in the stator winding due to the movement of the permanent magnets on the rotor. although some bldc drives uses sens ors 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 ba ck-emf (electromotive force) zero-crossing sensing. the advantages of this control are: save cost of the pos ition sensors & wiring can be used where there is impo ssibility or expansive to make additional connections between position sens ors and the control unit low cost system (medium demand for control mcu power) f r e e s c a l e s e m i c o n d u c t o r , i freescale semiconductor, inc. f o r m o r e i n f o r m a t i o n o n t h i s p r o d u c t , g o t o : w w w . f r e e s c a l e . c o m n c . . . DRM028 ? rev 0 designer reference manual motorola system description 15 designer reference manual ? sensorless bldc motor control section 2. system description 2.1 contents 2.2 system concept . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 15 2.3 system specification . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 17 2.2 system concept the application block diagram is shown in figure 2-1 . the sensorless rotor position technique detects t he zero crossing points of back-emf induced in the motor windings. th e phase back-emf zero crossing points are sensed while one of the thre e phase windings is not powered. the information obtained is processe d in order to commutate the energized phase pair and control the phase volt age, using pulse width modulation. the back-emf zero crossing detecti on enables position recognition. the resistor network is used to step dow n sensed voltages to a 0?3.3 v level. zero crossing detection is synchronized with the mi ddle of center aligned pwm signals by the software, in or der to filter hi gh voltage spikes produced by switching the igbts (mos fets). 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 transferred to the mcu input. the voltage drop resistor is used to m easure the dc-bus current which is chopped by the pulse-wid th modulator (pwm). the signal obtained is rectified and amplified (0?3.3 v with 1.65 v offset). the internal mcu analog-to-digital (a/d) converter and zero crossing detection are synchronized with the pwm signal. thi s synchronization avoids spikes when the igbts (or mosf ets) are switched and si mplifies the electric circuit. f r e e s c a l e s e m i c o n d u c t o r , i freescale semiconductor, inc. f o r m o r e i n f o r m a t i o n o n t h i s p r o d u c t , g o t o : w w w . f r e e s c a l e . c o m n c . . . system description designer reference manual DRM028 ? rev 0 16 system description motorola figure 2-1system concept during the rotor alignment state, the dc-bus curr ent is controlled by the current pi regulator. in the other states (motor running), the phase voltage (pwm duty cycle) is contro lled by the speed pi regulator. adc speed pi regulator hc08mr32 power line actual speed pwm bemf zero crossing signal three-phase inverter 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 bus voltage sensing current pi regulator (for alignment) required alignment current actual current f r e e s c a l e s e m i c o n d u c t o r , i freescale semiconductor, inc. f o r m o r e i n f o r m a t i o n o n t h i s p r o d u c t , g o t o : w w w . f r e e s c a l e . c o m n c . . . system description system specification DRM028 ? rev 0 designer reference manual motorola system description 17 the a/d converter is also used to sense the dc -bus voltage and the drive temperature. the dc-bus voltage is stepped down to a 3.3-v signal level by a resistor network. the six igbts (copack wi th built-in fly back di ode), or mosfets, and gate drivers create a compact power stage. the drivers provide the level shifting that is requir ed to drive the high side switch. the pwm technique is used to control motor phase voltage. 2.3 system specification the concept of the application is that of a speed-closed loop drive using back-emf zero crossing technique for position detection. it serves as an example of a sensorless bldc moto r control system using motorola?s mc68hc908mr32 mcu. it also illustrat es the usage of dedicated motor control on-chip peripherals. the system for bldc motor control co nsists of hardwar e and software. the application uses universal modul ar motion control development hardware boards, which are provi ded by motorola for customer development support. for a description of these hardware boards refer to appendix a. references 3. , 4. , 5. , 6. , 7. , and the world wide web at: http://www.motorola.com there are three board and motor hard ware sets for the application: 1. high-voltage hardware set ? for variable lin e voltage 115?230 vac and medium power ( phase current < 2.93 a) 2. low-voltage evaluati on motor hardware set ? for automotive voltage (12 v) and very low po wer (phase current < 4 a) 3. low-voltage hardware set ? for automotive volt age (12 v or possibly 42 v) and medium po wer (phase current < 50 a) f r e e s c a l e s e m i c o n d u c t o r , i freescale semiconductor, inc. f o r m o r e i n f o r m a t i o n o n t h i s p r o d u c t , g o t o : w w w . f r e e s c a l e . c o m n c . . . system description designer reference manual DRM028 ? rev 0 18 system description motorola 2.3.1 software specification the application software is practically the same for all three hardware platforms. the only modification needed is to include one of three constants that customize the hardw are and motor parameter settings. the software (written in c language) specificat ions are listed in table 2-1 . a useful feature of the software is serial communication with pc master software protocol via rs2 32. the pc master software is pc computer software which allows r eading and setting of all the system variables, and can also ru n html script pages to control the application from the pc. another feature of the bldc cont rol software, is on-line parameter modification wi th pc master software, which can be used for software parameter tuni ng 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 metrowerks ansi-c/cc++ compiler for hc08 application control manual interface (start/stop switch, speed potentiometer control, led indication) pc master software (remote) interface (via rs232 using pc computer) mcu oscillator frequency 4 mhz (with default software setting) mcu bus frequency 8 mhz (with default software setting) minimal bldc motor commutation period (without pc master software communication) 333 s (with default software setting and coef_hlfcmt = 0.450) f r e e s c a l e s e m i c o n d u c t o r , i freescale semiconductor, inc. f o r m o r e i n f o r m a t i o n o n t h i s p r o d u c t , g o t o : w w w . f r e e s c a l e . c o m n c . . . system description system specification DRM028 ? rev 0 designer reference manual motorola system description 19 2.3.2 hardware and drive specifications the other system specifications ar e determined by hardware boards and motor characteristics. the boards and their connections are shown in section 4. hardware design . and section 6. user guide , 6.4.1 hardware configuration . the hardware set s pecifications are discussed in the following subsections. 2.3.2.1 high-voltage hard ware set specification this hardware set is dedicated for medium power (phase current < 2.93 a) and main voltage. the specifications fo r a high-voltage hardware minimal bldc motor commutation period (with pc master software control) 520 s (with default software setting and coef_hlfcmt = 0.450) targeted hardware software is prepared to run on three optional board and motor hardware sets: high-voltage hardware set at variable line 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 pack contains the files const_cust_hv.h, const_cust_lv.h, and const_cust_evm.h with predefined parameter settings for running on one of the optional board and motor hardware sets. the required hardware must be selected in code_fun.c file by one of these files #include. where software is configuration for different customer motors, the software configuration for any motor is provided in the dedicated customizing file, according to the hardware board used. pwm frequency 15.626 khz with default software setting, possibly changeable in const.h file table 2-1. software specifications f r e e s c a l e s e m i c o n d u c t o r , i freescale semiconductor, inc. f o r m o r e i n f o r m a t i o n o n t h i s p r o d u c t , g o t o : w w w . f r e e s c a l e . c o m n c . . . system description designer reference manual DRM028 ? rev 0 20 system description motorola and motor set are listed in table 2-2 . the hardware operates on both 230 vac and 115 vac mains. table 2-2. high voltage ha rdware set specifications hardware boards characteristics input voltage: 230 vac or 115 vac maximum dc-bus voltage: 407 v maximal output current: 2.93a motor -brake set manufactured em brno, czech republic motor characteristics motor type: em 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 v optoisolation: required protection: over-current, over-voltage, and under-voltage fault protection load characteristic type: varying f r e e s c a l e s e m i c o n d u c t o r , i freescale semiconductor, inc. f o r m o r e i n f o r m a t i o n o n t h i s p r o d u c t , g o t o : w w w . f r e e s c a l e . c o m n c . . . system description system specification DRM028 ? rev 0 designer reference manual motorola system description 21 2.3.2.2 low-voltage evaluation hardware set specification this hardware set is dedicated fo r 12 v voltage and very low power (phase current < 4 a). th e specifications for a low-voltage evaluation hardware and motor set are listed in table 2-3 . it is targeted first of all to software evaluation with small motors. 2.3.2.3 low-voltage hard ware set specification this hardware set is dedicated for medium po wer (phase current < 50 a) and automotive voltage. the specificat ions for a low-voltage hardware and motor set are listed in table 2-4 . the hardware power stage board is dedicated for 12 v, but can be si mply configured to a 42 v supply (described in documentation fo r the eclovacbldc board). the supplied motor is targeted for 12 v. table 2-3. low voltage evalua tion 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 phase, star connected, bldc motor speed range: < 5000 rpm (at 60 v) maximal line voltage: 60 v phase current: 2 a output torque: 0.140 nm (at 2 a) drive characteristics speed range: < 1400 rpm input voltage: 12 vdc maximum dc-bus voltage: 15.8 v protection: over-current, over-voltage, and under-voltage fault protection load characteristic type: varying f r e e s c a l e s e m i c o n d u c t o r , i freescale semiconductor, inc. f o r m o r e i n f o r m a t i o n o n t h i s p r o d u c t , g o t o : w w w . f r e e s c a l e . c o m n c . . . system description designer reference manual DRM028 ? rev 0 22 system description motorola table 2-4. low voltage ha rdware set specifications hardware boards characteristics input voltage: 12 vdc or 42 v maximum dc-bus voltage: 16.0 v or 55.0 v maximal output current: 50.0 a motor -brake set manufactured em brno, czech republic motor characteristics motor type: em brno sm40n 3 phase, star connected 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-voltage, and under-voltage fault protection load characteristic type: varying f r e e s c a l e s e m i c o n d u c t o r , i freescale semiconductor, inc. f o r m o r e i n f o r m a t i o n o n t h i s p r o d u c t , g o t o : w w w . f r e e s c a l e . c o m n c . . . DRM028 ? rev 0 designer reference manual motorola bldc motor control 23 designer reference manual ? sensorless bldc motor control section 3. bldc motor control 3.1 contents 3.2 brushless dc motor con trol theory. . . . . . . . . . . . . . . . . . . . .23 3.3 used control technique . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 38 3.4 application control . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 50 3.2 brushless dc motor control theory 3.2.1 bldc motor target ed by this application the brushless dc motor (bldc moto r) is also referred to as an electronically commutated motor. ther e are no brushes on the rotor, and commutation is performed electronically 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 stator winding due to rotor movement) shape is trapezoidal. this allows a rectangul ar shaped 3-phase voltage system (see figure 3-2 ) to be used to create a rotati onal field with low torque ripples. f r e e s c a l e s e m i c o n d u c t o r , i freescale semiconductor, inc. f o r m o r e i n f o r m a t i o n o n t h i s p r o d u c t , g o t o : w w w . f r e e s c a l e . c o m n c . . . bldc motor control designer reference manual DRM028 ? rev 0 24 bldc motor control motorola figure 3-1. bldc motor cross section the motor can have more than just one pole-pair per phase. this defines the ratio between the elec trical revolution and the mechanical revolution. the bldc motor shown has three pole- pairs per phase, which represent three electrical re volutions per one mechanical revolution. figure 3-2. 3-phase voltage system the easy to create rectangular sh ape of applied voltage ensures the simplicity of control and drive. but, the rotor po sition must be known at certain angles in order to alig n 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 a phase b phase c 120 voltage voltage phase a phase b phase c 120 electrical angle 30 90 150 210 270 330 f r e e s c a l e s e m i c o n d u c t o r , i freescale semiconductor, inc. f o r m o r e i n f o r m a t i o n o n t h i s p r o d u c t , g o t o : w w w . f r e e s c a l e . c o m n c . . . bldc motor control brushless dc motor control theory DRM028 ? rev 0 designer reference manual motorola bldc motor control 25 back-emf and commutation events is ve ry important. in this condition, the motor behaves as a dc motor and runs at the best working point. thus, simplicity of control and go od performance make this motor a natural choice for low-cost an d high-efficiency applications. figure 3-3 shows a number 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 integrat ing the phase back-emf voltage (which was measured on the n on-fed motor terminals of the bldc motor). as can be seen, the shape of the back-em f is approximately trapezoidal and the amplitude is a functi on of the actual speed. during speed reversal, the amplitude changes its sign and the phase sequence changes. f r e e s c a l e s e m i c o n d u c t o r , i freescale semiconductor, inc. f o r m o r e i n f o r m a t i o n o n t h i s p r o d u c t , g o t o : w w w . f r e e s c a l e . c o m n c . . . bldc motor control designer reference manual DRM028 ? rev 0 26 bldc motor control motorola figure 3-3. bl dc motor back emf and magnetic flux the filled areas in the tops of the phase back-emf voltage waveforms indicate the intervals where the particular phase power stage commutations occur. the power switches are cyclically commutated through the six steps; t herefore, this technique is sometimes called six step commutation control. the cr ossing points of the phase back-emf voltages represent the natural comm utation points. in normal operation the commutation is performed here. some control te chniques advance the commutation by a defined angle in order to control the drive above the pulse-width modulato r (pwm) voltage control. ps i_ a ps i_ b ps i_ c ui_a ui_b ui_c ui_a b ui_bc ui_ca atop btop ctop cbot abot bbot speed reversal ?natural? commutation point phase magnetic phase back emf phase-phase flux linkage b?c c?a a?b ph. a ph. b ph. c back emf ph. a ph. b ph. c ?natural? commutation point speed reversal acting power switch in the power stage f r e e s c a l e s e m i c o n d u c t o r , i freescale semiconductor, inc. f o r m o r e i n f o r m a t i o n o n t h i s p r o d u c t , g o t o : w w w . f r e e s c a l e . c o m n c . . . bldc motor control brushless dc motor control theory DRM028 ? rev 0 designer reference manual motorola bldc motor control 27 3.2.2 3-phase bl dc power stage the voltage for 3-phase bl dc motor is provi ded by a 3-phase power stage controlled by digita l signals. its topology is the one as for the ac induction motor (refer to figure 3-5 ). the power stage is usually controlled by a dedicated microcon troller with on-chip pwm module. 3.2.3 why sensorless control? as explained in the previous sectio n, rotor position must be known in order to drive a brushless dc motor. if any sensors are used to detect rotor position, sensed information must be transferred to a control unit (see figure 3-4 ). therefore, addi tional connections to the motor are necessary. this may not be accept able 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 techniques a simplified ma thematical model bas ed on the basic circuit topology has been created. see figure 3-5 . ac line voltage ? = power stage position sensors load control unit control signals position feedback speed setting m motor drive f r e e s c a l e s e m i c o n d u c t o r , i freescale semiconductor, inc. f o r m o r e i n f o r m a t i o n o n t h i s p r o d u c t , g o t o : w w w . f r e e s c a l e . c o m n c . . . bldc motor control designer reference manual DRM028 ? rev 0 28 bldc motor control motorola figure 3-5. power st age ? motor topology the second goal of the model is to find how the motor characteristics depend on the swit ching angle. the switching angle is the angular difference between a real switching event and an ideal one (at the point where the phase-to-phase back-emf crosses zero). the motor-drive model consists of a normal 3-phase power stage plus a brushless dc motor. power for t he system is provided by a voltage source (u d ). six semiconductor switches (s a/b/c t/b ), controlled elsewhere, allow the rectan gular voltage waveforms (see figure 3-2 ) to be applied. the semiconductor switches and diodes are simulated as ideal devices. the natural voltage leve l of the whole model is put at one half of the dc-bus voltage. this simplifies the ma thematical expressions. b c a backemf b backemf c backemf a rb ra rc lb lc u u uu u u u la u u u /2 d = + - u /2 d = + - u ab i sa i d0 s at s bt s ct s ab s bb s cb i sb i sc u bc u ca u sb u sc u sa u 0 u vc u vb u va o f r e e s c a l e s e m i c o n d u c t o r , i freescale semiconductor, inc. f o r m o r e i n f o r m a t i o n o n t h i s p r o d u c t , g o t o : w w w . f r e e s c a l e . c o m n c . . . bldc motor control brushless dc motor control theory DRM028 ? rev 0 designer reference manual motorola bldc motor control 29 3.2.4.1 stator winding equations the bldc motor is usually very sym metrical. all phase resistances, phase and mutual inductanc es, flux-linkages can be thought of as equal to, or as a functi on of the position with a 120 displacement. the electrical bldc motor model then c onsists of a set of the following stator voltage equations (eq 3-1.) . (eq 3-1.) the task of this section is to ex plain the backgroun d of the back-emf sensing and to demonstrate how the zero crossi ng events can be detected. parasitic effects that negatively influence the back-emf detection are discussed 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 m ode using pwm techniq ue, where both top and bottom switches in the diagonal are controlled us ing the same signal (so called ?hard switching pwm? technique). the moto r 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. thi s is described by the following conditions: (eq 3-2.) the branch voltage u vc can be calculated usi ng the above conditions, (eq 3-3.) u sa u sb u sc r s i sa i sb i sc t d d sa sb sc + = s ab s bt , pwm u va 1 2 -- -u d + ? =u vb 1 2 -- - u d = , i sa i sb ?i ==i sa di sb d ?i d == , i sc 0 =i sc d0 = , u backemf a u backemf b u backemf c ++ 0 = u vc u sc 1 3 -- -u backemf x xa = c l ac l bc ? () i d t d ---- u vc ? + ? = f r e e s c a l e s e m i c o n d u c t o r , i freescale semiconductor, inc. f o r m o r e i n f o r m a t i o n o n t h i s p r o d u c t , g o t o : w w w . f r e e s c a l e . c o m n c . . . bldc motor control designer reference manual DRM028 ? rev 0 30 bldc motor control motorola after evaluation the expre ssion of the branch voltage u vc is as follows: (eq 3-4.) the same expressions can al so be found fo r phase a and b: (eq 3-5.) (eq 3-6.) the first member in the equation (eq 3-6.) demonstrates the possibility to indirectly sense t he back-emf between the fr ee (not powered) phase terminal and the zero point, defined at half of the dc -bus voltage (see figure 3-5.). simple co mparison of these two levels can provide the required zero crossing detection. as shown in figure 3-5 , the branch voltage of phase b can be sensed between the power stage out put b and the zero voltage level. thus, back-emf voltage is obtained and the zero crossing can be recognized. when l cb = l ab , this general expressi ons can also be found: (eq 3-7.) there are two necessary cond itions 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-f ed phase that is used to sense the back-emf figure 3-6 shows branch and motor phase winding voltages during a 0?360 electrical interval . shaded rectangles desi gnate the validity of the equation (eq 3-7.) . in other words, the back-emf voltage can be sensed during designated intervals. u vc 3 2 -- -u backemf c 1 2 -- -l ac l bc ? () i d t d ---- ? = u va 3 2 -- -u backemf a 1 2 -- -l ba l ca ? () i d t d ---- ? = u vb 3 2 -- -u backemf b 1 2 -- -l cb l ab ? () i d t d ---- ? = u vx 3 2 -- -u backemfx where x a b c , , = = f r e e s c a l e s e m i c o n d u c t o r , i freescale semiconductor, inc. f o r m o r e i n f o r m a t i o n o n t h i s p r o d u c t , g o t o : w w w . f r e e s c a l e . c o m n c . . . bldc motor control brushless dc motor control theory DRM028 ? rev 0 designer reference manual motorola bldc motor control 31 figure 3-6. phase voltage waveform however simple this solution looks, in reality it is more difficult, because the sensed ?branch? voltage also contains some ripples. 3.2.4.3 effect of mutual inductance as shown in previous equations (eq 3-4.) through (eq 3-6.) , the mutual inductances play an im portant role here. the di fference of the mutual inductances between the coils whic h 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 phas e current, transferred to the free phase through the coupling of the mutual inductance. figure 3-7 shows the real measured ?br anch? voltage. the red curves highlight the effect of the differ ence in the mutual inductances. this difference is not constant. 0 30 60 90 120 150 180 210 240 270 300 330 360 390 uva usa - back-emf can be sensed f r e e s c a l e s e m i c o n d u c t o r , i freescale semiconductor, inc. f o r m o r e i n f o r m a t i o n o n t h i s p r o d u c t , g o t o : w w w . f r e e s c a l e . c o m n c . . . bldc motor control designer reference manual DRM028 ? rev 0 32 bldc motor control motorola figure 3-7. mut ual inductance effect due to the construction of the bldc motor, both mutual inductances vary. they are equal at the position that corr esponds to the back-emf zero crossing detection. the branch waveform detail is shown in figure 3-8 . channel 1 in figure 3-8 shows the disturbed ?branch? voltage. the superimposed ripples clearly match the width of the pwm pulses, and thus prove the conclusions from the theoretical analysis. the effect of the mutual inductanc e corresponds 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 windi ngs 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 separat e poles, shows minor presence of the effect of mut ual inductance. caution: however noticeable this effect, it does not degrade t he back-emf zero crossing detection because it is canc elled at the zero crossing point. simple additional filtering he lps to reduce ripples further. 0 v f r e e s c a l e s e m i c o n d u c t o r , i freescale semiconductor, inc. f o r m o r e i n f o r m a t i o n o n t h i s p r o d u c t , g o t o : w w w . f r e e s c a l e . c o m n c . . . bldc motor control brushless dc motor control theory DRM028 ? rev 0 designer reference manual motorola bldc motor control 33 figure 3-8. detail of mutual inductance effect 3.2.4.4 effect of mu tual phase capacitance the negative effect of mut ual inductance is not t he only one to disturb the back-emf sensing. so far, the mutual capacitance of the motor phase windings was neglect ed in the motor model, since it affects neither the phase currents nor the gen erated torque. usual ly the mutual capacitance is very small. its infl uence is only signif icant during pwm switching, when the system experiences very high du/dt . the effect of the mutual capacit ance can be studied using the model shown in figure 3-9 . f r e e s c a l e s e m i c o n d u c t o r , i freescale semiconductor, inc. f o r m o r e i n f o r m a t i o n o n t h i s p r o d u c t , g o t o : w w w . f r e e s c a l e . c o m n c . . . bldc motor control designer reference manual DRM028 ? rev 0 34 bldc motor control motorola figure 3-9. mutual capacitance model let us focus on the si tuation when the motor phas e a is switched from negative dc-bus rail to positive, and the phase b is switched from positive to negative. this is described by t hese conditions (eq 3-8.) : (eq 3-8.) the voltage that disturbs the back-emf sensing, ut ilizing the free (not powered) motor phase c, can be calculated based the equation: (eq 3-9.) the final expression fo r disturbing voltage can be found as follows: (eq 3-10.) note: (eq 3-10.) expresses the fact that only the unbal ance of the mutual capacitance (not the capacitance itself ) disturbs the back-emf sensing. when both capacities ar e equal (they are balanc ed), the disturbances disappear. this is demonstrated in figure 3-10 and figure 3-11 . u ccb b c a r c c c c r c r c u /2 d = + - u /2 d = + - u cba i d0 s at s bt s ab s bb i sb i c i cab i c u cac u vc cap u vb u va s ab s bt , pwm u va 1 2 -- -u d ? 1 2 -- -u d =u vb 1 2 -- -u d 1 2 -- -u d ? = , i cac i ccb i c == u vc cap 1 2 -- -u ccb u cac 2r c ++ () u ccb r c + () ? 1 2 -- -u cac u ccb ? () == u vc cap 1 2 -- - 1 c ac ------- - 1 c cb -------- ? ?? ?? i c t d 1 2 -- - c cb c ac ? c cb c ac ? ---------------------- ?? ?? i c t d == f r e e s c a l e s e m i c o n d u c t o r , i freescale semiconductor, inc. f o r m o r e i n f o r m a t i o n o n t h i s p r o d u c t , g o t o : w w w . f r e e s c a l e . c o m n c . . . bldc motor control brushless dc motor control theory DRM028 ? rev 0 designer reference manual motorola bldc motor control 35 figure 3-10. distributed back-emf by unbalanced capacity coupling channel 1 in figure 3-11 shows the disturbed ?b ranch? voltage, while the other phase (c hannel 2) is not affected because it faces balanced mutual capacitance. the unbalance wa s purposely made by adding a small capacitor on the motor terminal s, in order to better demonstrate the effect. after the unbalance was removed the ?branch? voltage is clean, without any spikes. f r e e s c a l e s e m i c o n d u c t o r , i freescale semiconductor, inc. f o r m o r e i n f o r m a t i o n o n t h i s p r o d u c t , g o t o : w w w . f r e e s c a l e . c o m n c . . . bldc motor control designer reference manual DRM028 ? rev 0 36 bldc motor control motorola figure 3-11. balan ced capacity coupling note: the configuration of the phase win dings end-turns has significant impact; therefore, it needs to be properly m anaged to preserve the balance in the mutual capacity. this is important, especially for prototype motors that are usually hand-wound. caution: failing to maintain balance in t he mutual capacitance can easily disqualify such a motor from us ing sensorless techniques based on the back-emf sensing. usually, the bl dc motors with windings wound on separate poles show minor presence of the mutual capacitance. thus, the disturbance is al so insignificant. 3.2.5 back-emf sensing circuit an example of the possi ble implementation of the back-emf sensing circuit is shown in figure 3-12 . f r e e s c a l e s e m i c o n d u c t o r , i freescale semiconductor, inc. f o r m o r e i n f o r m a t i o n o n t h i s p r o d u c t , g o t o : w w w . f r e e s c a l e . c o m n c . . . bldc motor control brushless dc motor control theory DRM028 ? rev 0 designer reference manual motorola bldc motor control 37 figure 3-12. back-emf se nsing circuit diagram as explained in the theor etical part of this des igner reference manual, the phase zero crossing event can be detected at the mo ment when the branch voltage (of a free phase) crosses the half dc-bus voltage level. the resistor network is used to step down sensed voltages down to a 0?15 v voltage level. the comparators sense the zero voltage difference in the input signal. the multiple resi stors reduce the vo ltage across each resistor component to an acceptable level. a si mple rc filter prevents the comparators from bei ng disturbed by high vo ltage spikes produced by igbt switching. the multiplexer (mux) selects the phase comparator output, which corresponds to the curr ent commutation stage. this zero crossing detection signal is transferred to the timer input pin. the comparator control and zero crossing signal s plus the voltage waveforms are shown in figure 3-13 . ? + ? + ? + mux command zero crossing detection signal 560k 1n 2x27k mux 560k 560k 560k 560k 560k 560k 560k 560k 1n 1n 1n 2x27k 2x27k 2x27k +dc_bus phase a phase b phase c f r e e s c a l e s e m i c o n d u c t o r , i freescale semiconductor, inc. f o r m o r e i n f o r m a t i o n o n t h i s p r o d u c t , g o t o : w w w . f r e e s c a l e . c o m n c . . . bldc motor control designer reference manual DRM028 ? rev 0 38 bldc motor control motorola figure 3-13. the zero cr ossing detection 3.3 used control technique 3.3.1 sensorless co mmutation control this section concentrates on sens orless bldc motor commutation with back-emf zero crossing technique. in order to start and run the bldc motor, the cont rol algorithm has to go through the following states: alignment starting (back-em f acquisition) running figure 3-14 shows the transitions between the states. first the rotor is aligned to a known positi on; then the rotation is started without the position feedback. wh en 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 zero crossing detection) commutation signal zero crossing signal 90 f r e e s c a l e s e m i c o n d u c t o r , i freescale semiconductor, inc. f o r m o r e i n f o r m a t i o n o n t h i s p r o d u c t , g o t o : w w w . f r e e s c a l e . c o m n c . . . bldc motor control used control technique DRM028 ? rev 0 designer reference manual motorola bldc motor control 39 position is known, and can be used to calculate the speed and processing of the commutat ion in the running state. figure 3-14. commut ation control stages 3.3.1.1 alignment be fore the motor starts, there is a short time (dependi ng on the motor?s electrical time constant) when the ro tor position is stab ilized by applying pwm signals to only two motor phas es (no commutation). the current controller keeps current within prede fined limits. this st ate is necessary in order to create a hi gh 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 minimal correct commutations done? no yes yes no f r e e s c a l e s e m i c o n d u c t o r , i freescale semiconductor, inc. f o r m o r e i n f o r m a t i o n o n t h i s p r o d u c t , g o t o : w w w . f r e e s c a l e . c o m n c . . . bldc motor control designer reference manual DRM028 ? rev 0 40 bldc motor control motorola the current controller subr outine, with pi regulator, is called to control dc-bus current. it sets the correct pwm ratio for the r equired current. the current pi controller works with cons tant execution (s ampling) period. this period should be a multiple of the pwm period, in order 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 seri es of states which assure: 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: f r e e s c a l e s e m i c o n d u c t o r , i freescale semiconductor, inc. f o r m o r e i n f o r m a t i o n o n t h i s p r o d u c t , g o t o : w w w . f r e e s c a l e . c o m n c . . . bldc motor control used control technique DRM028 ? rev 0 designer reference manual motorola bldc motor control 41 bldc motor commutation service back-emf zero crossing moment capture service calculation of commutation time interactions between thes e commutation processes from diagrams an overview of how the commutation works can be understood. after commuting the motor phases, there is a time interval (per_toff[n]) when the shape of back-emf must stabilized (after the commutation the fly-back diodes ar e conducting the decaying phase current; therefore, sensing of the back-emf is not possible). then the new commutation time (t2[n]) is preset. the new commutation will be performed at this time if the back-emf zero crossi ng is not captured. if the back-emf zero crossing is captur ed before the pres et commutation time expires, then the ex act calculation of the co mmutation time (t2*[n]) is made, based on the captured zero crossing time (t_zcros[n]). the new commutation is perform ed at this new time. if for any reason the back-emf feedba ck is lost within one commutation period, corrective actions are taken in order to return to the regular states. the flowchart explaining t he principle of bldc co mmutation control with back-emf zero crossing sensing is shown in figure 3-16 . f r e e s c a l e s e m i c o n d u c t o r , i freescale semiconductor, inc. f o r m o r e i n f o r m a t i o n o n t h i s p r o d u c t , g o t o : w w w . f r e e s c a l e . c o m n c . . . bldc motor control designer reference manual DRM028 ? rev 0 42 bldc motor control motorola figure 3-16. bldc comm utation with back-emf zero crossing sensing flowchart 3.3.1.3 running ? commut ation time calculation commutation time calc ulation is shown in figure 3-17 . service of commutation: bemf zero crossing wait for per_toff until phase missed? bemf zero crossing 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 time expired? has commutation time expired? f r e e s c a l e s e m i c o n d u c t o r , i freescale semiconductor, inc. f o r m o r e i n f o r m a t i o n o n t h i s p r o d u c t , g o t o : w w w . f r e e s c a l e . c o m n c . . . bldc motor control used control technique DRM028 ? rev 0 designer reference manual motorola bldc motor control 43 figure 3-17. bldc comm utation time with zero crossing sensing the following calculations are made to calculate the commutation time (t2[n] ) during the running state : service of commutation ? the commutation time (t2 [n]) is predicted: t2[n] = t_cmt[n] + 2*per_zcrosflt[n-1] if 2*per_zcrosflt>per_cmt_max then result is limited at per_cmt_max service of received back-emf zero crossing ? the commutation time (t2 *[n]) is evaluated from the captured back-emf zero crossing time (t_zcros[n]): per_zcros[n] = t_zcros[n] - t_zcros[n-1] = t_zcros[n] - t_zcros0 per_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-3] t2[n-2] t2[n-1] t2[n] zero crossing detection signal zero crossing detection signal zero crossing detection signal commutated at preset time no back-bmf feedback was received corrective calculation 1. back-emf feedback received and evaluated commutated when back-emf zero crossing is missed correction calculation 2. f r e e s c a l e s e m i c o n d u c t o r , i freescale semiconductor, inc. f o r m o r e i n f o r m a t i o n o n t h i s p r o d u c t , g o t o : w w w . f r e e s c a l e . c o m n c . . . bldc motor control designer reference manual DRM028 ? rev 0 44 bldc motor control motorola the best commutation was get with advance_angle: 60deg*1/8 = 7.5deg which means coef_hlfcmt = 0.375 at running state with default s/w setting per_toff[n+1] = per_zcrosflt*coef_toff and per_dis minimum coef_toff = 0.375 at running state, per_dis = 150 with default s/w setting per_zcros0 <-- per_zcros[n] t_zcros0 <-- t_zcros[n] t2*[n] = t_zcros[n] + hlfcmt[n] if no back-emf zero crossing was captured during preset commutation period (t2p[n] then corrective calculation 1. is made: t_zcros[n] <-- cmtt[n+1] per_zcros[n] = t_zcros[n] - t_zcros[n-1] = t_zcros[n] - t_zcros0 per_zcrosflt[n] = (1/2*per_zcros[n]+1/2*per_zcros0) hlfcmt[n] = 1/2*per_zcrosflt[n]-advance_angle = coef_hlfcmt*per_zcrosflt[n] the best commutation was get with advance_angle: 60deg*1/8 = 7.5deg which means coef_hlfcmt = 0.375 at running 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 cro ssing 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 advance_angle: 60deg*1/8 = 7.5deg which means coef_hlfcmt = 0.375 at running state! per_zcros0 <-- per_zcros[n] t_zcros0 <-- t_zcros[n] where: t_cmt = time of the last commutation t2 = time of the timer 2 event (for timer setting) t_zcros = time of the last zero crossing t_zcros0 = time of the previous zero crossing per_toff = period of the zero crossing off per_zcros = period between zero crossings (estimates required commutation period) per_zcros0 = pervious period between zero crossings per_zcrosflt = estimated period of commutation filtered f r e e s c a l e s e m i c o n d u c t o r , i freescale semiconductor, inc. f o r m o r e i n f o r m a t i o n o n t h i s p r o d u c t , g o t o : w w w . f r e e s c a l e . c o m n c . . . bldc motor control used control technique DRM028 ? rev 0 designer reference manual motorola bldc motor control 45 per_hlfcmt = period from zero crossing to commutation (half commutation) the required commutation ti ming is provided by setting commutation constants coef_hlfcmt, coef_toff . 3.3.1.4 starting (b ack-emf acquisition) the back-emf sensing technique enables a sensorless detection of the rotor position; however, the drive must be firs t started without this feedback. this is due to t he fact that the amplitude of the induced voltage is proportional to t he motor speed. hence, the back-emf cannot be sensed at a very low speed and a special start- up algorithm must be performed. in order to start the bldc motor, the adequate torque must be generated. the motor torque is proportional to t he multiplication of the stator magnetic flux, the rotor magnet ic flux, and the si ne of the angle between these magnetic fluxes. it implies (for bldc motors) the following: 1. the level of phase curr ent must be high enough. 2. the angle between the stator and ro tor magnetic fields must be 90 30 . the first condition is satisfied during the alignment stat e by maintaining dc-bus current at a leve l sufficient to start t he motor. in the starting (back-emf acquisition) st ate, the same value of pwm duty cycle is used as the one which ha s stabilized the dc -bus current duri ng the align state. the second condition is mo re difficult to fulf ill without any position feedback information. after the alignment state, t he stator and the rotor magnetic fields are aligned (0 angle). therefore, two fast commutations (faster than the rotor can follow) mu st be applied to cr eate an angular difference in the magnetic fields (see figure 3-18 ). the commutation time is defined by the start comm utation period ( per_cmtstart ) . this allows starting the motor such that minimal speed (defined by state when back-emf can be sensed) and is achieved f r e e s c a l e s e m i c o n d u c t o r , i freescale semiconductor, inc. f o r m o r e i n f o r m a t i o n o n t h i s p r o d u c t , g o t o : w w w . f r e e s c a l e . c o m n c . . . bldc motor control designer reference manual DRM028 ? rev 0 46 bldc motor control motorola during several commutations, while producing the requir ed torque. until the back-emf feedback is locked, t he commutation process (explained in running ) assures that commutations are done in advance, so that successive back-emf zero cro ssing events are not missed. after several successive back-emf zero crossings: exact commutation ti me can be calculated commutation process is adjusted control flow continues to the running state the bldc motor is then running wit h regular feedback and the speed controller can be used to control th e motor speed by changing the pwm duty cycle value. f r e e s c a l e s e m i c o n d u c t o r , i freescale semiconductor, inc. f o r m o r e i n f o r m a t i o n o n t h i s p r o d u c t , g o t o : w w w . f r e e s c a l e . c o m n c . . . bldc motor control used control technique DRM028 ? rev 0 designer reference manual motorola bldc motor control 47 figure 3-18. vectors of magnetic fields border of stator pole stator magnetic field rotor magnetic phase winding rotor movement field (created by pm) direction of phase current during one commutation zero crossing edge indicator motor is running motor is starting alignment state starting (back-emf acquisition) running the rotor position is stabilized by applying pwm signals to only two motor phases the two fast (faster then the rotor can move) commutations are applied to create 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 eval uated. 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-emf zero crossing events would not be missed. after several back-emf zero crossing events the exact commutation time is calculated. the commutation process is adjusted. motor is running with regular back-emf feedback. at steady-state condition with regular back-emf feedback f r e e s c a l e s e m i c o n d u c t o r , i freescale semiconductor, inc. f o r m o r e i n f o r m a t i o n o n t h i s p r o d u c t , g o t o : w w w . f r e e s c a l e . c o m n c . . . bldc motor control designer reference manual DRM028 ? rev 0 48 bldc motor control motorola figure 3-19 demonstrates the back-em f during the start up. the amplitude of the back-emf varies acco rding to the roto r speed. during the starting (back-emf acquisition) state the commutation is done in advance. in the running state the commutation is done at the right moments. figure 3-19. back- emf at start up figure 3-20 illustrates the sequence of the commutations during the starting (back-emf acquisition) st ate. the commutation times t2[1] and t2[2] are calculated without any in fluence of back-em f 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 ................. c top c bot a top b top c top b top a bot b bot c bot a bot c top c bot a top b top b top a bot b bot c bot a bot c top starting (back-emf acquisition) first second third fourth f r e e s c a l e s e m i c o n d u c t o r , i freescale semiconductor, inc. f o r m o r e i n f o r m a t i o n o n t h i s p r o d u c t , g o t o : w w w . f r e e s c a l e . c o m n c . . . bldc motor control used control technique DRM028 ? rev 0 designer reference manual motorola bldc motor control 49 figure 3-20. calculation of the commutation tim es during the starting (back-emf acquisi tion) state 3.3.1.5 starting ? commutation ti me calculation even the sub-states of the commutation proc ess in the starting (back-emf acquisition) state remain the same as in the running state. the required commutatio n timing depends on applicat ion state (starting state, running state). so the commutat ion time calculation is the same as that described in running ? commutatio n time calculation , but the following computation coeffici ents 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 signal zero crossing detection signal commutated at present time no back-emf feedback was received corrective calculation 1 commuted when correct back-emf feedback received and evaluated commutated when back-emf zero crossing is missed corrective calculation 2. f r e e s c a l e s e m i c o n d u c t o r , i freescale semiconductor, inc. f o r m o r e i n f o r m a t i o n o n t h i s p r o d u c t , g o t o : w w w . f r e e s c a l e . c o m n c . . . bldc motor control designer reference manual DRM028 ? rev 0 50 bldc motor control motorola coef_toff = 0.5 at running state, per_dis = 150 with default s/w setting 3.3.2 speed control the speed close loop control is provi ded by a well know n pi regulator. the required speed is calculated from speed input variable, as explained in process desired speed setting . the actual speed is calculated from the average of two back-emf zero crossing periods (t ime intervals), received from the sens orless commutation co ntrol block. the speed regulator output is a pwm duty cycle. the speed controller works with the constant execution (sampling) period per_t3_run_us . a detailed explanation is provided in processs speed control . 3.4 application control the application can be contro lled 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 softwa re. in both modes, the individual variables can be observed usi ng the pc master software. 3.4.1 pc master software pc master software was designed to provide the debugging, diagnostic, and demonstration tools for developing algorithms and a pplications. it consists of components running on pcs and parts running on the target mcu, connected by an rs232 serial po rt. a small program is resident in the mcu that communica tes with the pc master software to parse commands, return status informati on, and process control information from the pc. the pc master software uses microsoft 1 internet explorer as a user interface on the pc. f r e e s c a l e s e m i c o n d u c t o r , i freescale semiconductor, inc. f o r m o r e i n f o r m a t i o n o n t h i s p r o d u c t , g o t o : w w w . f r e e s c a l e . c o m n c . . . bldc motor control application control DRM028 ? rev 0 designer reference manual motorola bldc motor control 51 3.4.1.1 communication with pc master software specifications sci communication protoc ol with a default of 9.6 kbaud, is used for communication as described in user?s manual for pc master software , motorola 2000, found on the world wide web at: http://e-www.motorola.com pc master software controls and s enses the status of the application with: pc master software ? bl dc demonstration suitcase communication commands pc master software ? bl dc demonstration suitcase communication bytes after reset, the bldc control mcu soft ware is in manual mode. in order to control the system from pc master software, it is necessary to set pc master software mode, a nd then to provide the mcu software control from pc master software via application interface variables. 3.4.1.2 pc master software, bldc control mcu software api, communication commands commands defined for the bldc control mcu soft ware 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 faile d code 55. the co mmands ?set pc master software mode?, ?set manual mode? can only be executed when the start/stop switch on the demonstration suitca se is set to stop and the motor is stop ped. otherwise, a failed response is sent. 1. microsoft is a registered tra demark of microsoft corporation in the united states and/or other countries. table 3-1. pc master so ftware communi cation commands command comman d code data byte s demo suitcase action respon s byte response descriptio n set pc master software mode 01 none setting of pc master software mode 00 55 ok failed f r e e s c a l e s e m i c o n d u c t o r , i freescale semiconductor, inc. f o r m o r e i n f o r m a t i o n o n t h i s p r o d u c t , g o t o : w w w . f r e e s c a l e . c o m n c . . . bldc motor control designer reference manual DRM028 ? rev 0 52 bldc motor control motorola 3.4.1.3 pc master software, bldc control mcu software api, communication variables the application interface, data variabl es used for the exchange between the bldc control mcu software and pc master software, are shown in table 3-2 . these variables are used for st atus sensing and control. pc master software accesses these bytes directly from their physical memory addresses. set manual mode 02 none setting of manual mode 00 55 ok failed table 3-1. pc master so ftware communi cation commands command comman d code data byte s demo suitcase action respon s byte response descriptio 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_rp m u16 o < 0; 65535> [rpm] speed range maximum speed_max_rpm u16 o < 0; 65535> [rpm] maximal speed limit speed_min_rpm u16 o < 0; 65535> [rpm] minimal speed limit commut_rev u8 o < 0; 255> commutations per motor revolution curr s8 o <-curr_range_max_c a; curr_range_max_ca) dc-bus current curr_range_max_ca s16 o <-32768;32767> [a*10^-2] current range maximum [a*10^-2] f r e e s c a l e s e m i c o n d u c t o r , i freescale semiconductor, inc. f o r m o r e i n f o r m a t i o n o n t h i s p r o d u c t , g o t o : w w w . f r e e s c a l e . c o m n c . . . bldc motor control application control DRM028 ? rev 0 designer reference manual motorola bldc motor control 53 type: s8- signed 8 bit, u8- unsigned 8 bit,s16- signed 16bit, u16- unsigned 16bit the system registers sys3, motor_ctrl, mo tor_status, failure flags are described by definitions of sys3_def, motor_ctrl_def, motor_status_def, failure_def: typedef union { struct { unsigned int hv : 1; /* bit0 high voltage board flag */ unsigned int lv : 1; /* bit1 low voltage board */ unsigned int evmm : 1; /* bit2 evmm board */ unsigned int bit3 : 1; /* bit3 reserved */ unsigned int pcmode : 1;/* bit4 pcmaster/manual mode flag */ 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; /* bit4 reserved */ unsigned int bit5 : 1; /* bit6 reserved */ unsigned int bit6 : 1; /* bit6 reserved */ unsigned int clearfail : 1; /* bit7 clear failure status */ } b; /* |clearfail|***|***|***|***|***|***|startctrl| */ char r; } motor_ctrl_def; /* pc master software motor control flags definition */ typedef union { struct { f r e e s c a l e s e m i c o n d u c t o r , i freescale semiconductor, inc. f o r m o r e i n f o r m a t i o n o n t h i s p r o d u c t , g o t o : w w w . f r e e s c a l e . c o m n c . . . bldc motor control designer reference manual DRM028 ? rev 0 54 bldc motor control motorola unsigned int switch_start : 1; /* bit0 switch start/stop set to start flag */ unsigned int running : 1;/* bit1 motor is running (alignment, start or running state) */ unsigned int bit2 : 1; /* bit2 reserved */ unsigned int v120 : 1; /* bit3 120 v dc-bus detected (only for hv dc-bus) */ unsigned int bit4 : 1; /* bit4 reserved */ unsigned int bit5 : 1; /* bit5 reserved */ unsigned int bit6 : 1; /* bit6 reserved */ unsigned int bit7 : 1; /* bit7 reserved */ } b; /* |***|***|***|***|v120|***|running|switch_start| */ char r; } motor_status_def; /* pc master software motor status flags register definition */ typedef union { struct { unsigned int overcurrent : 1; /* bit0 over-current failure */ unsigned int overheating : 1; /* bit1 over-heating */ 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 variabl e is used as an outpu t or input from the bldc control mcu softwa re side. the variable is described and the unit defined. when pc master software mode is se t, the system start and stop is controlled by startctrl flag in motor_ctrl variable. when the application enters the fault st ate, the variable failure displays the fault reason. setting the clearfail flag in motor_ctrl will exit t he fault state. f r e e s c a l e s e m i c o n d u c t o r , i freescale semiconductor, inc. f o r m o r e i n f o r m a t i o n o n t h i s p r o d u c t , g o t o : w w w . f r e e s c a l e . c o m n c . . . bldc motor control application control DRM028 ? rev 0 designer reference manual motorola bldc motor control 55 the sp_input variable is used for speed contro l. in pc master software mode, it can be m odified from pc master softwa re (otherwise, it is set according to speed potentiometer value). desired speed [rpm] = sp_input/255*( speed_max_rpm-speed_min_rpm) + speed_min_rpm so, the required motor commutati on period is determined by the speed_max_rpm and speed_min_rpm variables. these are chosen according to which optional board and 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 moto r 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 calc ulation of the bldc motor commutation period: commutation period [s] = 60 / actual speed [rpm] / commut_rev the variable curr_range_max_ca determines scaling of the current variables. so, the actual dc-bus current is: dc-bus current [a] = curr / 256* curr_range_max_ca / 100 f r e e s c a l e s e m i c o n d u c t o r , i freescale semiconductor, inc. f o r m o r e i n f o r m a t i o n o n t h i s p r o d u c t , g o t o : w w w . f r e e s c a l e . c o m n c . . . bldc motor control designer reference manual DRM028 ? rev 0 56 bldc motor control motorola f r e e s c a l e s e m i c o n d u c t o r , i freescale semiconductor, inc. f o r m o r e i n f o r m a t i o n o n t h i s p r o d u c t , g o t o : w w w . f r e e s c a l e . c o m n c . . . DRM028 ? rev 0 designer reference manual motorola hardware design 57 designer reference manual ? sensorless bldc motor control section 4. hardware design 4.1 contents 4.2 system configuration an d documentation . . . . . . . . . . . . . . . . 57 4.3 all hw sets components . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 64 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 se t components . . . . . . . . . . . . . . . . . 72 4.2 system configuration and documentation the application is designed to drive the 3-phase bldc motor. the hw is a modular system composed fro m board and motor. there are three possible hardware options: high-voltage hardware set configuration low-voltage evaluatio n motor hardware set configuration low-voltage hardware set configuration the following subsection shows the system configurations. they systems consists of the fo llowing modules (see also figure 4-1 , figure 4-2 , figure 4-3 ): for all hardware options: mc68hc908mr32 control board for high-voltage hardwa re set cofiguration: f r e e s c a l e s e m i c o n d u c t o r , i freescale semiconductor, inc. f o r m o r e i n f o r m a t i o n o n t h i s p r o d u c t , g o t o : w w w . f r e e s c a l e . c o m n c . . . hardware design designer reference manual DRM028 ? rev 0 58 hardware design motorola 3-phase ac/bldc high voltage power stage optoisolation board 3-phase bldc high voltage motor with motor brake for low-voltage evaluation motor hardware set configuration: evm motor board 3-phase low voltage ev m bldc motor low-voltage hardware set configuration: 3-ph ac/bldc low voltage power stage 3-phase bldc low voltage mo tor with motor brake the supplied controller boards for mc68hc908mr 32 (ecctrmr32) allows two possibilities for software execution: 1. mmds evaluation bo ard (kitmmdsmr32) using a real-time debugger (s upplied with the metrowerks compiler) the evaluation board is connected to the controller board (ecctrmr32) vi a an emulator connec tor. this solution is recommended for software evaluation. 2. programmed mcu (mc68hc908mr32) where a daughter board m odule, with mc68hc908mr32 processor, is plugged into the controller board (ecctrmr32) instead of the emulator cable, the processo r must be programmed in an external programmer. this solution is recommended for final tests. figure 4-1 , figure 4-2 and figure 4-3 show the conf iguration with mmds evaluation board. the sections 4.3 all hw sets components , 4.4 high-voltage hardware set components , 4.5 low-voltage evaluation motor hardware set components and 4.6 low-voltage hardware set components will describe the individual boards. f r e e s c a l e s e m i c o n d u c t o r , i freescale semiconductor, inc. f o r m o r e i n f o r m a t i o n o n t h i s p r o d u c t , g o t o : w w w . f r e e s c a l e . c o m n c . . . hardware design system configuration and documentation DRM028 ? rev 0 designer reference manual motorola hardware design 59 4.2.1 high-voltage hard ware set configuration the system configuration fo r a high-voltage hardwa re set is shown in figure 4-1 . figure 4-1. high-voltage hardwa re system c onfiguration all the system parts are suppli ed 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 b oard 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 j5 not connected +12vdc j2 ecopt hc908mr32 gnd optoisolation board white controller board 40w flat ribbon cable jp1.1 jp1.2 ecmtrhivbldc motor-brake red f r e e s c a l e s e m i c o n d u c t o r , i freescale semiconductor, inc. f o r m o r e i n f o r m a t i o n o n t h i s p r o d u c t , g o t o : w w w . f r e e s c a l e . c o m n c . . . hardware design designer reference manual DRM028 ? rev 0 60 hardware design motorola ? described in: mc68hc908mr32 control board ? user?s manual (motorola document order number memcmr32cbum/d ), see references 3 u2 ? 3-phase ac/bldc hi gh voltage power stage: ? supplied in kit with optoisolation board as: ecopthivacbldc ? described in: 3-phase ac brushless dc high voltage power stage user?s manual (motorola docume nt order number memc3pbldcpsum /d), see references 4 . u3 ? optoisolation board ? supplied with 3-ph ase ac/bldc high voltage power stage as: ecopthivacbldc ? or, supplied alone as: ecop t?ecopt optoisolation board ? described in: optoisolation board user?s manual (motorola document order number memcobum/d), see references 5 note: it is strongly recommended to us e opto-isolation (optocouplers and optoisolation amplifiers) during develop ment 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 f ound in comprehensive user?s manuals belongi ng to each board ( references 3 , 4 , 5 ). 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 functi on blocks and a bill of materi als. an individual board can be ordered from motoro la as a standard product. f r e e s c a l e s e m i c o n d u c t o r , i freescale semiconductor, inc. f o r m o r e i n f o r m a t i o n o n t h i s p r o d u c t , g o t o : w w w . f r e e s c a l e . c o m n c . . . hardware design system configuration and documentation DRM028 ? rev 0 designer reference manual motorola hardware design 61 4.2.2 low-voltage eval uation motor hardware set configuration the system configuration for a low-voltage eval uation motor hardware set is shown in figure 4-2 . figure 4-2. low-voltage evaluation motor hardware system configuration all the system parts are suppli ed 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 b oard 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 rs232 - emulator 12vdc +12 gnd pc computer rs232 - pc master j1 u2 f r e e s c a l e s e m i c o n d u c t o r , i freescale semiconductor, inc. f o r m o r e i n f o r m a t i o n o n t h i s p r o d u c t , g o t o : w w w . f r e e s c a l e . c o m n c . . . hardware design designer reference manual DRM028 ? rev 0 62 hardware design motorola ? described in: mc68hc908mr32 control board ? user?s manual (motorola document order number memcmr32cbum/d ), see references 3 m1 ? ib23810 motor ? supplied in kit with ib23810 motor as: ecmtreval ? evaluation motor board kit u2 ? 3-phase ac/bldc low voltage power stage: ? supplied in kit with ib23810 motor as: ecmtreval ? evaluation motor board kit ? described in: motorola embedded motion control evaluation motor board user?s manual (motorola document order number memcevmbum/d) see references 6 the individual modules are described in some sections below. more detailed descriptions of the boards can be f ound in comprehensive user?s manuals belongi ng 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 functi on blocks and a bill of materi als. an individual board can be ordered from motoro la as a standard product. 4.2.3 low-voltage hardwa re set configuration the system configuration for low-voltage hardware set is shown in figure 4-3 . f r e e s c a l e s e m i c o n d u c t o r , i freescale semiconductor, inc. f o r m o r e i n f o r m a t i o n o n t h i s p r o d u c t , g o t o : w w w . f r e e s c a l e . c o m n c . . . hardware design system configuration and documentation DRM028 ? rev 0 designer reference manual motorola hardware design 63 figure 4-3. low-voltage hardwa re system configuration all the system parts are suppli ed 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 b oard for mc68hc908mr32: ? supplied as: ecctr908mr32 ? 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 j18 sm40n not connected mb1 pc computer rs232 - pc master white ecctr908mr32 hc908mr32 3ph ac/bldc low voltage power stage 12vdc f r e e s c a l e s e m i c o n d u c t o r , i freescale semiconductor, inc. f o r m o r e i n f o r m a t i o n o n t h i s p r o d u c t , g o t o : w w w . f r e e s c a l e . c o m n c . . . hardware design designer reference manual DRM028 ? rev 0 64 hardware design motorola ? described in: motorola embedded motion control 3-phase bldc low-voltage powe r stage user?s manual (motorola document order number me mc3pbldclvum/d3), see references 7 mb1 ? motor-brake sm40n + sg40n ? supplied as: ecmtrlovbldc the individual modules are described in some sections below. more detailed descriptions of the boards can be f ound in comprehensive user?s manuals belongi ng to each board ( references 3 , 7 ). 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 functi on blocks and a bill of materi als. an individual board can be ordered from motoro la as a standard product. 4.3 all hw sets components 4.3.1 mc68hc908mr 32 control board motorola?s embedded motion control se ries mr32 motor control board is designed to provide control signals for 3-phase ac induction, 3-phase brushless dc (bldc), and 3-phase swit ched reluctance (sr) motors. in combination with one of the embedded motion control series power stages, and an optoisolatio n board, it provides a software development platform that allows algorithms to be written and test ed without the need to design and build hard ware. with software supplied on the cd-rom, the control board s upports a wide variety of algor ithms for ac induction, sr, and bldc motors. user cont rol inputs are accepted from start/stop, fwd/rev switc hes, and a speed potentiometer located on the control board. alte rnately, motor commands can be entered via a pc and transmitted over a serial cable to db-9 connector. output connections and power st age feedback signals are grouped together on 40-pin ribbon cable connector. moto r feedback signals can be connected to hall sensor/enco der connector. power is supplied f r e e s c a l e s e m i c o n d u c t o r , i freescale semiconductor, inc. f o r m o r e i n f o r m a t i o n o n t h i s p r o d u c t , g o t o : w w w . f r e e s c a l e . c o m n c . . . hardware design all hw sets components DRM028 ? rev 0 designer reference manual motorola hardware design 65 through the 40-pin ri bbon cable from the optoisolation board or low-voltage power stage. the control board is designed to run in two configurat ions. it can be connected to an m68em08mr32 emulator via an m68cbl08a impedance matched ribbon cable, or it can operate us ing the daughter board. the m68em08mr32 emulator board may be used in either an mmds05/08 or mmevs05/ 08 emulation system. figure 4-4 shows a block diagram of the board?s circuitry. figure 4-4. mc68hc908 mr32 control board 4.3.1.1 electrical c haracteristics of the mc68hc908mr 32 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/ overvoltage inputs pwm (6) outputs current/temp sense inputs misc. power and control i/o opto/power driver i/o connector back emf inputs config. jumpers 40-pin ribbon connector input tachometer hall effect inputs (3) i/f f r e e s c a l e s e m i c o n d u c t o r , i freescale semiconductor, inc. f o r m o r e i n f o r m a t i o n o n t h i s p r o d u c t , g o t o : w w w . f r e e s c a l e . c o m n c . . . hardware design designer reference manual DRM028 ? rev 0 66 hardware design motorola 4.4 high-voltage ha rdware set components 4.4.1 3-phase ac/bldc hi gh voltage power stage motorola?s embedded motion control seri es high-voltage (hv) ac power stage is a 180-watt (one-fourth hors epower), 3-phase power stage that will operate off of dc i nput voltages from 140 to 230 volts and ac line voltages from 100 to 240 volts. in co mbination with on e of the embedded motion control series control boar ds and an optoisolat ion board, it provides a software development plat form that allows algorithms to be written and tested withou t the need to design and build a power stage. it supports a wide variety of algorithm s for both ac induction and brushless dc (bldc) motors. input connections are made via 40-pin ri bbon 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 requir ements are met with a single external 140- to table 4-1. electrical charact eristics of control board characteristic symbol min typ max units dc power supply voltage (1) 1. when operated and powered separately fr om other embedded motion control tool set products vdc 10.8 12 16.5 v quiescent current i cc ?80? ma min logic 1 input voltage (mr32) v ih 2.0 ? ? v max logic 0 input voltage (mr32) v il ??0.8 v propagation delay (hall sensor/encoder input) t dly ??500 ns analog input range v in 0?5.0 v rs-232 connection speed ? ? 9600 baud pwm sink current i pk ??20 ma f r e e s c a l e s e m i c o n d u c t o r , i freescale semiconductor, inc. f o r m o r e i n f o r m a t i o n o n t h i s p r o d u c t , g o t o : w w w . f r e e s c a l e . c o m n c . . . hardware design high-voltage hardware set components DRM028 ? rev 0 designer reference manual motorola hardware design 67 230-volt dc power supply or an ac li ne voltage. either input is supplied through connector j11. current measuring circuitry is set up for 2.93 amps full scale. both bus and phas e leg currents are measured. a cycle-by-cycle over-current trip point is set at 2.69 amps. the high-voltage ac power stage has bot h a printed circuit board and a power substrate. the printed circui t board contains igbt gate drive circuits, analog signal conditioning, low-voltage power supplies, power factor control circuitry, and so me of the large, passive, power components. all of the power electronics whic h need to dissipate heat are mounted on the power substrate. this substra te includes the power igbts, brake resistors, current s ensing resistors, a power factor correction mosfet, and temp erature sensing diodes. figure 4-5 shows a block diagram. figure 4-5. 3-phase ac hi gh voltage power stage 4.4.1.1 electrical charac teristics of the 3- phase ac/bldc high voltage power stage the electrical characteristics in table 4-2 apply to operation at 25 c with a 160-vdc power supply voltage. hv power input switch mode power supply pfc control dc bus brake 3-phase igbt gate phase current phase voltage bus current bus voltage monitor zero cross back-emf sense board id block 3-phase ac signals to/from control board power module drivers motor to f r e e s c a l e s e m i c o n d u c t o r , i freescale semiconductor, inc. f o r m o r e i n f o r m a t i o n o n t h i s p r o d u c t , g o t o : w w w . f r e e s c a l e . c o m n c . . . hardware design designer reference manual DRM028 ? rev 0 68 hardware design motorola 4.4.2 optoisolation board motorola?s embedded motion control series optoisolation board links signals from a controller to a high-voltage power stage. the board isolates the controller , and peripherals that ma y be attached to the controller, from dangerou s voltages that are pres ent on the power stage. the optoisolation board?s ga lvanic isolation barrier also isolates control signals from high noise in the power stage and pr ovides a noise-robust systems architecture. signal translation is virtually one- for-one. gate drive signals are passed from controller to pow er stage via high-speed, high dv/dt, digital optocouplers. analog feedback signals are passed back through hcnr201 high-linearity analog optocouplers. dela y times are typically table 4-2. electrical char acteristics 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 i cc ?70 ?ma min logic 1 input voltage v ih 2.0 ? ? v max logic 0 input voltage v il ??0.8 v input resistance r in ?10 k ? ? analog output range v out 0?3.3v bus current sense voltage i sense ?563 ?mv/a bus voltage sense voltage v bus ?8.09 ?mv/v peak output current i pk ??2.8 a brake resistor dissipation (continuous) p bk ??50 w brake resistor dissipation (15 sec pk) p bk(pk) ??100w total power dissipation p diss ??85 w f r e e s c a l e s e m i c o n d u c t o r , i freescale semiconductor, inc. f o r m o r e i n f o r m a t i o n o n t h i s p r o d u c t , g o t o : w w w . f r e e s c a l e . c o m n c . . . hardware design high-voltage hardware set components DRM028 ? rev 0 designer reference manual motorola hardware design 69 250 ns for digital signals, and 2 s for analog signals. grounds are separated by the optocouplers? galvanic isolation barrier. both input and output connections are made via 40-pin ribbon cable connectors. the pin assignments for bo th connectors are the same. for example, signal pwm_at appears on pin 1 of th e input connector and also on pin 1 of the output connecto r. in addition to the usual motor control signals, an mc68 hc705jj7cdw serves as a serial link, which allows controller software to identify the power board. power requirements for controller side circuitry are met with a single external 12-vdc power supply. powe r for power stage side circuitry is supplied from the power stage through the 40-pi n output connector. 4.4.2.1 electrical characteristics of t he 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. electri cal characteristics characteristic symbol min typ max units notes power supply voltage vdc 10 12 30 v quiescent current i cc 70 (1) 200 (2) 500 (3) ma dc/dc converter min logic 1 input voltage v ih 2.0 ? ? v hct logic max logic 0 input voltage v il ? ? 0.8 v hct logic analog input range v in 0?3.3v input resistance r in ?10?k ? analog output range v out 0?3.3v digital delay time t ddly ?0.25? s analog delay time t adly ?2? s 1. power supply powers optoisolation board only. 2. current consumption of optoisolation board plus dsp emv board (powered from this power supply) 3. maximum current handled by dc/dc converters f r e e s c a l e s e m i c o n d u c t o r , i freescale semiconductor, inc. f o r m o r e i n f o r m a t i o n o n t h i s p r o d u c t , g o t o : w w w . f r e e s c a l e . c o m n c . . . hardware design designer reference manual DRM028 ? rev 0 70 hardware design motorola 4.4.3 3-phase bldc high volt age motor with motor brake the high voltage bldc motor-brake set incorporates a 3-phase high voltage bldc motor and attached bldc motor brake. the bldcmotor has six poles. the incremental positi on encoder is coupled to the motor shaft, and position hall sensors are mounted bet ween motor and brake. they allow sensing of the position if required by the control algorithm. detailed motor-brake specif ications are listed in table 2-2 , section 2. 4.5 low-voltage evaluation motor hardware set components 4.5.1 evm motor board motorola?s embedded motion control series evm motor board is a 12-volt, 4-amp, surface- mount power stage that is shipped with an mcg ib23810-h1 brushless dc motor. in combination with one of the embedded motion control series control boards, it provides a software development platform that allows algorithms to be written and tested without the need to des ign and build a power stage. it supports algorithms that use hall sensor s, encoder feedba ck, and back emf (electromotive force) sig nals 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 impeda nce motor is used. with the motor that is supplied in the kit, t he power output stage will withstand a full-stall condition without the need for overcurrent protec tion. current measuring circuitry is set up for 4 amps full scale. in a 25 c ambient operation at up to 6 amps continuous rm s output current is wi thin the board?s thermal limits. input connections are m ade via 40-pin ribbon cable connector j1. power connections to the motor are made on output connecto r j2. phase a, phase b, and phase c are labeled on the board. po wer requirements are met with a single exter nal 12-vdc, 4-amp power supply. two connectors, labeled j3 and j4, are provided for th e 12-volt power supply. j3 and j4 are located on the front edge of the board. powe r is supplied to one or the other, but not both. f r e e s c a l e s e m i c o n d u c t o r , i freescale semiconductor, inc. f o r m o r e i n f o r m a t i o n o n t h i s p r o d u c t , g o t o : w w w . f r e e s c a l e . c o m n c . . . hardware design low-voltage evaluation motor hardware set components DRM028 ? rev 0 designer reference manual motorola hardware design 71 4.5.1.1 electrical characteri stics of the evm motor board the electrical characteristics in table 4-4 apply to operation at 25 c and a 12-vdc power supply voltage. 4.5.2 3-phase low vo ltage evm bldc motor the evm motor board is shipped wit h an mcg ib23810-h1 brushless dc motor. motor-brake specifications are listed in table 2-3 , section 2. other detailed motor ch aracteristics are in table 4-5 this section. they apply to operation 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 i cc ?50? ma min logic 1 input voltage v ih 2.4 ? ? v max logic 0 input voltage v il ??0.8 v input resistance r in ?10? k ? analog output range v out 0?3.3 v bus current sense voltage i sense ?412?mv/a bus voltage sense voltage v bus ?206?mv/v power mosfet on resistance r ds(on) ?3240m ? rms output current i m ?? 6 a total power dissipation p diss ?? 5 w table 4-5. characterist ics of the bldc motor characteristic symbol min typ max units terminal voltage v t ?? 60 v speed @ v t ? 5000 ? rpm torque constant k t ? 0.08 ? nm/a f r e e s c a l e s e m i c o n d u c t o r , i freescale semiconductor, inc. f o r m o r e i n f o r m a t i o n o n t h i s p r o d u c t , g o t o : w w w . f r e e s c a l e . c o m n c . . . hardware design designer reference manual DRM028 ? rev 0 72 hardware design motorola 4.6 low-voltage hardware set components 4.6.1 3-ph ac/bldc low voltage power stage motorola?s embedded motion control se ries low-voltage (lv) brushless dc (bldc) power stage is de signed to run 3-ph. bldc and pm synchronous motors. it operates from a nominal 12-volt motor supply, and delivers up to 30 amps of rms moto r current from a dc bus that can deliver peak currents up to 46 amps. in comb ination with one of motorola?s embedded motion control seri es control boards, it provides a software development platform that allows algorithms to be written and tested, without the need to design and build a po wer stage. it supports a wide variety of algorithms for co ntrolling bldc motors and pm synchronous motors. input connections are made via 40-pin ri bbon cable connector j13. power connections to the motor are made with fast-on co nnectors j16, j17, and j18. they ar e located along the ba ck edge of the board, and are labeled phase a, ph ase b, and phase c. po wer 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 located on th e back edge of the board. j20 is labeled 0v and is located along t he front edge. cu rrent measuring circuitry is set up for 50 amps full scale. both bus and phase leg currents are measured. a cycle by cycle overcurrent trip po int is set at 46 amps. voltage constant k e ? 8.4 ? v/krpm winding resistance r t ?2.8 ? ? winding inductance l ? 8.6 ? mh continuous current i cs ?? 2 a peak current i ps ?? 5.9 a inertia j m ? 0.075 ? kgcm 2 thermal resistance ? ? 3.6 c/w table 4-5. characterist ics of the bldc motor f r e e s c a l e s e m i c o n d u c t o r , i freescale semiconductor, inc. f o r m o r e i n f o r m a t i o n o n t h i s p r o d u c t , g o t o : w w w . f r e e s c a l e . c o m n c . . . hardware design low-voltage hardware set components DRM028 ? rev 0 designer reference manual motorola hardware design 73 the lv bldc power stage has both a pr inted circuit board and a power substrate. the printed circuit b oard contains mo sfet gate drive circuits, analog signal conditioning, low-voltage power supplies, and some of the large pa ssive power components. this board also has a 68hc705jj7 microcontroller us ed for board conf iguration and identification. all of t he power electronics that need to dissipate heat are mounted on the power substrate. this substr ate includes the power mosfets, brake resistors, current-s ensing resistors, bus capacitors, and temperature sensing diodes. figure 4-5 shows a block diagram. figure 4-6. block diagram 4.6.1.1 electrical char acteristics 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. power input bias power brake mosfet gate phase current phase voltage bus current bus voltage monitor zero cross back-emf sense board id block signals to/from control board power module drivers motor to f r e e s c a l e s e m i c o n d u c t o r , i freescale semiconductor, inc. f o r m o r e i n f o r m a t i o n o n t h i s p r o d u c t , g o t o : w w w . f r e e s c a l e . c o m n c . . . hardware design designer reference manual DRM028 ? rev 0 74 hardware design motorola 4.6.2 3-phase bldc low volt age motor with motor brake the low voltage bldc mo tor-brake set incorpor ates a 3-phase low voltage bldc motor em brno sm40n and attached bldc motor brake sg40n. the bldcmotor has six poles. the incremental position encoder is coupled to t he motor shaft, and posit ion hall sensors are mounted between motor and brake. they allow sensing of the position if required by the control algorithm, whic h is not required in this sensorless application. detailed motor-brake specifications are listed in table 2-4 , section 2. table 4-6. electrical chat acteristics 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 i cc ?175 ? ma min logic 1 input voltage v ih 2.0 ? ? v max logic 0 input voltage v il ??0.8 v analog output range v out 0?3.3v bus current sense voltage i sense ?33 ?mv/a bus voltage sense voltage v bus ?60 ?mv/v peak output current (300 ms) i pk ??46 a continuous output current i rms ??30 a brake resistor dissipation (continuous) p bk ??50 w brake resistor dissipation (15 sec pk) p bk(pk) ??100w total power dissipation p diss ??85 w f r e e s c a l e s e m i c o n d u c t o r , i freescale semiconductor, inc. f o r m o r e i n f o r m a t i o n o n t h i s p r o d u c t , g o t o : w w w . f r e e s c a l e . c o m n c . . . DRM028 ? rev 0 designer reference manual motorola software design 75 designer reference manual ? sensorless bldc motor control section 5. software design 5.1 contents 5.2 introduction . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 75 5.3 data flow . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 75 5.4 main software flowchart . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 83 5.5 state diagram. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 89 5.6 implementation notes. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 103 5.2 introduction this section describe s the design of the software blocks of the drive. the software will be descr ibed in terms of: data flow main software flowchart state diagram for more information on t he control technique used see 3.3 used control technique . 5.3 data flow the control algorithm obtains valu es from the user interface and sensors, processes them and genera tes 3-phase pwm signals for motor control, as can be seen on t he data flow analysis shown in figure 5-1 and figure 5-2 . f r e e s c a l e s e m i c o n d u c t o r , i freescale semiconductor, inc. f o r m o r e i n f o r m a t i o n o n t h i s p r o d u c t , g o t o : w w w . f r e e s c a l e . c o m n c . . . software design designer reference manual DRM028 ? rev 0 76 software design motorola 5.3.1 software vari ables and defined constants important system vari ables are listed in table 5-1 . table 5-1. software variables name type representing range description sys1 sys1_def 8flags system variable #1 speed_min_u8 u8 < 0; speed_range_max_rpm) minimal speed [system units] sp_input u8 < 0; 255> speed input variable used for required speed calculation coef_speed_inp u8 coeficient sp_inp to speed_desired calculation speed_desired u8 < 0; speed_range_max_rpm) desired speed piparamsscl_u8_spe ed structure speed pi regulator parameters per_speed_max_ran ge u16 [unit_period_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 current curr_align s8 <-curr_range_max_ca; curr_range_max_ca) required current during alignment state piparamsscl_s8_currr structure current pi regulator parameters volt u8 <-volt_range_max; volt_range_max) dc-bus voltage v_tasc2 u8 back-emf zero crossing expecting edge v_mux u8 preset value of back-emf zero crossing phase multiplexer f r e e s c a l e s e m i c o n d u c t o r , i freescale semiconductor, inc. f o r m o r e i n f o r m a t i o n o n t h i s p r o d u c t , g o t o : w w w . f r e e s c a l e . c o m n c . . . software design data flow DRM028 ? rev 0 designer reference manual motorola software design 77 type: s8- signed 8 bit, u8 - unsigned 8 bit, s16- signed 16bit, u16- unsigned 16bit, (union)- 16 bi ts access or 2*8bit access the system registers sys1 flags are described by definitions of sys3_def: typedef union { struct { unsigned int pc_f : 1; /* bit0 phase commutation flag */ unsigned int off_f : 1; /* bit1 offset timeout flag - offset timeout can be measured */ unsigned int icr_f : 1; /* bit2 input capture was succesfuly received - flag */ unsigned int rmp_f : 1; /* bit3 speed ramp flag - motor ramping */ unsigned int stop_f : 1; /* bit4 motor is going or is stopped */ unsigned int strt_f : 1; /* bit5 start phase flag */ unsigned int run_f : 1; /* 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 measured inputs are: dc -bus current, dc-bus vo ltage, and speed input. the measurement is prov ided by the measurem ent handler. the state diagram is explained in state diagram . 5.3.3 start/stop switch reading and start/stop decision the process reads the start stop swit ch and provides st art condition and clear failure decisions, as explained in stand-by and fault state . f r e e s c a l e s e m i c o n d u c t o r , i freescale semiconductor, inc. f o r m o r e i n f o r m a t i o n o n t h i s p r o d u c t , g o t o : w w w . f r e e s c a l e . c o m n c . . . software design designer reference manual DRM028 ? rev 0 78 software design motorola figure 5-1. main data flow ? part1 5.3.4 process fault co ntrol fault stop the process provides f ault control and fault stop as described in fault state , stand-by , align state , 5.5.5 back-emf acquisition state , and running state . the processes alignment, starting, and running cont rol are displayed in figure 5-2 . the processes are described in the following subsections. 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 reading and start/stop decision process speed input, dc-bus voltage and dc-bus current measurement process fault control fault stop f r e e s c a l e s e m i c o n d u c t o r , i freescale semiconductor, inc. f o r m o r e i n f o r m a t i o n o n t h i s p r o d u c t , g o t o : w w w . f r e e s c a l e . c o m n c . . . software design data flow DRM028 ? rev 0 designer reference manual 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 . f r e e s c a l e s e m i c o n d u c t o r , i freescale semiconductor, inc. f o r m o r e i n f o r m a t i o n o n t h i s p r o d u c t , g o t o : w w w . f r e e s c a l e . c o m n c . . . software design designer reference manual DRM028 ? rev 0 80 software design motorola figure 5-2. main data flow ? part 2: ali gnment, starting, running control sp_input v_tasc2 v_mux t_zcros speed_desired t_cmt t2 per_zcrosflt pc_f per_speed_max_range t_cmt pc_f v_tasc2 timer 2 pwm module timer1 virtual back-emf icr_f fok_f curr_align curr coef_speed_inp speed_min_u8 piparamsscl_s8_curr piparamsscl_u8_speed commutation has been process desired 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 performed ? flag timer 3 init timer2 timeout, actual time zero crossing multiplexer timer 2 actual time back-emf zero crossing input f r e e s c a l e s e m i c o n d u c t o r , i freescale semiconductor, inc. f o r m o r e i n f o r m a t i o n o n t h i s p r o d u c t , g o t o : w w w . f r e e s c a l e . c o m n c . . . software design data flow DRM028 ? rev 0 designer reference manual motorola software design 81 5.3.6 process commutation time calculati on, corrective calculation 1, corrective calculation 2 these processes provide calculations of commutation time intervals (periods) ( per_zcros , per_zcrosflt ), from captured time ( t_cmt , t_zcros , t_zcros0 ), and sets time r 2 with variable t2 . these calculations are described in 3.3.1.5 starting ? commutation time calculation and 3.3.1.3 running ? commuta tion time calculation . 5.3.7 process desir ed speed setting the desired speed, held in register speed_desired , is calculated from the following formula: speed_desired = sp_input * coef_speed_inp /255 + speed_min_u8 5.3.8 processs sp eed control the general principle of the speed pi control l oop is illustrated in figure 5-3 . figure 5-3. closed loop control system the speed closed loop control is char acterized by the feedback of the actual motor speed. the actual motor speed is calcul ated from zero crossing period: actual motor speed = 256* per_speed_max_range / per_zcrosflt_t2 ( outreg_u8 ) (256* per_speed_max_range / per_zcrosflt_t2 ) - reference speed (speed_desired) speed error pi controller pwm duty cycle controlled system actual motor speed f r e e s c a l e s e m i c o n d u c t o r , i freescale semiconductor, inc. f o r m o r e i n f o r m a t i o n o n t h i s p r o d u c t , g o t o : w w w . f r e e s c a l e . c o m n c . . . software design designer reference manual DRM028 ? rev 0 82 software design motorola this information is com pared with the reference se t point and the error signal is generated. the magnitude and polarity of the error signal corresponds to the difference between the actual and desired speeds. based on the speed error, the pi c ontroller generates the corrected motor voltage in order to compensate for the error. the speed regulator parameters (gain...), inte rnal, and input/output vari ables are located in the structure piparamsscl_u8_speed . the speed controller works with a cons tant execution (s ampling) period. the period is timed by time r 3, with the constant per_t3_run_us . pwm duty cycle is set for all six pw m channels according to regulator output, outreg_u8 . the maximum duty cycle is at outreg_u8 = 255. the implementation is described in implementation notes ? 5.6.3 bldc speed control and calculation . 5.3.9 process alignment control the process alignment cont rol controls the current , curr, using the pi regulator during al ignment state (see 5.5 state diagram ). the dc-bus current is regulated to required value curr_align. the current regulator parameters (gain...), inte rnal, and input/output vari ables are located in the structure piparamsscl_s8_curr . the current controller works with a constant execution (sampling) period. the period is timed by timer1, with the constant per_cs_t1_us . 5.3.10 processes co mmutation and zero cr ossing preset and set the processes commutati on and zero crossing preset and set provides the bldc commutation and zero crossing select ion. here the bldc commutation means gener ation of the six step commutation which creates the voltage system shown in figure 3-2 . the required bldc motor voltage system and commut ation is provided using the mc68hc08mr32 pwm block. the zero crossing selection means th e selection of the required zero crossing phase as described in 3.2.4.2 indirect back emf sensing and f r e e s c a l e s e m i c o n d u c t o r , i freescale semiconductor, inc. f o r m o r e i n f o r m a t i o n o n t h i s p r o d u c t , g o t o : w w w . f r e e s c a l e . c o m n c . . . software design main software flowchart DRM028 ? rev 0 designer reference manual motorola software design 83 3.2.5 back-emf sensing circuit .the zero crossi ng selection is provided by the multiplexer setting. as shown in figure 5-2 , the commutation and ba ck-emf zero crossing selection process is split into two actions: preset commutation and ze ro crossing selection the preset means se tting the buffered registers and ram variables for commutation set commutatio n and zero crossing selection the setting means load ing the registers with buffered variables the implementation is described in implementation notes - 5.6.2 bldc commutation and ze ro crossing selection . 5.4 main software flowchart the main software flowchart incorporat es the main routine entered from the reset and interrupt states. the main routine includes initializing the mcu and the main loop. the fl owcharts are shown in figure 5-4 , figure 5-5 , and figure 5-6 . mcu initialization is entered only after syst em reset. it provides initialization of system regist ers, ports, and cpu clock. the mcu initialization is provided in mcuinit() function. after mcu initialization the application initialization is executed as appinit() function, which perfo rms the following acti ons. 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 hardwar e design, in order to be able to measure negative and positive current values. the status regi sters 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 r e e s c a l e s e m i c o n d u c t o r , i freescale semiconductor, inc. f o r m o r e i n f o r m a t i o n o n t h i s p r o d u c t , g o t o : w w w . f r e e s c a l e . c o m n c . . . software design designer reference manual DRM028 ? rev 0 84 software design motorola figure 5-4. main software flowchart in the stand-by state function, the start/st op switch is checked using stswreadstart () function. the decidestasto () function is called to decide if the application should start. th e start condition differs if manual or pc master software mode is set. when in manual mode ( pcmode = 0), the start condition is the switch in the start position. when pc master software mode ( pcmode = 1), the start condition is a start request from pc master software ( startctrl = 1). in both modes, stop_f is cleared when the software evaluate s the start condition. when stop_f is cleared, the software checks t he 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 du ring the start and running state is described in 3.3.1 sensorless commutation control . during the starting (ba ck-emf acquisition) state, the commutation time reset mcu initialization: ? system registers initialization ? ports initialization ? pll ? cpu clock initialization ? pc master software (port) initialization application initialization: ? current offset calibration ? system registers initialization ? pwm initialization ? timer 1 current sensing to pwm synchronization ? adc measurement initialization main s/w loop: ? see figure 5-5 f r e e s c a l e s e m i c o n d u c t o r , i freescale semiconductor, inc. f o r m o r e i n f o r m a t i o n o n t h i s p r o d u c t , g o t o : w w w . f r e e s c a l e . c o m n c . . . software design main software flowchart DRM028 ? rev 0 designer reference manual motorola software design 85 preset calculations are prepared in the strtcmtpreset() function, and commutation time set calcul ations are provided by the strtcmtset() function. f r e e s c a l e s e m i c o n d u c t o r , i freescale semiconductor, inc. f o r m o r e i n f o r m a t i o n o n t h i s p r o d u c t , g o t o : w w w . f r e e s c a l e . c o m n c . . . software design designer reference manual DRM028 ? rev 0 86 software design motorola figure 5-5. main software fl owchart ? main software loop stand-by ? check start stop switch ? if pc master s/w mode: check startctrl flag ? if run conditions: set stop_f flag alignment state: ? time alignment (timer3) ? apply voltage ? current control loop ? if stop or fault condition: stop motor exit running state starting (acquisition) state: ? pwm increment of ? startincroutregs8 ? set speed regulator integral portion according to cur- rent regulator ? first commutation step ? second commutation step ? acquisition state motor commutation loop ?if i_cntr_fok 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 commutation control loop ? motor speed control loop ? if stop or fault condition: stop motor exit running state stop_f flag or failure stop_f flag or failure fault state: ? stop motor ? wait until fault clear ? set failure.b.voltagefailure stop_f flag or failure failure yes no yes no no yes yes no state: f r e e s c a l e s e m i c o n d u c t o r , i freescale semiconductor, inc. f o r m o r e i n f o r m a t i o n o n t h i s p r o d u c t , g o t o : w w w . f r e e s c a l e . c o m n c . . . software design main software flowchart DRM028 ? rev 0 designer reference manual motorola software design 87 when the start is successf ully completed, the running () function is called from main() . during the running state, the commutation time preset calculations are provided by the cmtpreset() function, and commutation time set calcul ations are provided by the cmtset() function. during the running , start or alignment states, the decidestop () function is called to check driv e stop conditions and can set the stop_f flag. when the stop flag is set the motorstop () function is called to stop the motor, and running, st art, or alignment state is left. the software enters stand-by state. also, the commutation error ( cntr_err >= max_zc_err ) and over-current ( overcurrent flag = 1) fault are checked in errhndl () and ovcurrent () functions during the running , start or alignment states. if any error is det ected, the function motorstop () function is called. then the software enters fault state through the fault() function. this is only left when the failure s are cleared (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 mast er 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, t here are three interrupts: timer 1, timer 2, and pwm reload interrupts. they are described in figure 5-6 . interrupt timer 1 is periodically called with period per_cs_t1 . the interrupt function provides dc-bus cu rrent measurement and virtual timer 3 service, where timer 1 is prov iding the timer 3 time base. when over-current is discovered, the ovc_f flag is set. finally , the adc is set according to the nxt_chnl variable to prepare speed potentiometer or temperature sensing. this inte rrupt is provided by the timach1_int() function. interrupt timer 2 sets commutation actions. if commutation is enabled ( cmte_f flag is set), the foll owing actions are done: pwm commutation step synchronization of timer 1, fo r current measur ement with pwm f r e e s c a l e s e m i c o n d u c t o r , i freescale semiconductor, inc. f o r m o r e i n f o r m a t i o n o n t h i s p r o d u c t , g o t o : w w w . f r e e s c a l e . c o m n c . . . software design designer reference manual DRM028 ? rev 0 88 software design motorola phase commutated flag pc_f is set actual time (from timer counter register) = commutation time is recorded in t_cmt . this interrupt is provided by the timach3_int() function. interrupt pwm reload provides back-emf zero crossing sensing. the zero crossing input is sampled 2 or 3 times. the back -emf state value is compared with expecting (rising/fall ing) edge. if the value corresponds with expecting edge, the ze ro crossing get flag icr_f is set, and the actual time (from timer counter regist er) = zero crossing time is recorded in t_zcros . this interrupt is provided by pwmmc_int() function in code_isr.c . f r e e s c a l e s e m i c o n d u c t o r , i freescale semiconductor, inc. f o r m o r e i n f o r m a t i o n o n t h i s p r o d u c t , g o t o : w w w . f r e e s c a l e . c o m n c . . . software design state diagram DRM028 ? rev 0 designer reference manual motorola software design 89 figure 5-6. software flowchart ? interrupts 5.5 state diagram the motor control application can be in one of the eight states shown in figure 5-7 . each of these states is described in the subsections following the figure. interrupt pwm reload bemf zero crossing rti interrupt timer 1 (tim a ch1) current measurement isr: rti sense zero crossing input: ? take 3 zc input samples ? 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 commutation step timer 1 current sensing to pwm synchronization set pc_f (phase commutated) t_cmt = timer 2 actual time ? zero crossing selection sensing isr: f r e e s c a l e s e m i c o n d u c t o r , i freescale semiconductor, inc. f o r m o r e i n f o r m a t i o n o n t h i s p r o d u c t , g o t o : w w w . f r e e s c a l e . c o m n c . . . software design designer reference manual DRM028 ? rev 0 90 software design motorola figure 5-7. applicat ion state transitions reset stand-by state running state stop state pwm disabled over voltage (stop_f = 0) (stop_f = 1) pwm disabled align state pwm enabled back-emf acquisition state commutation + pwm enabled 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) f r e e s c a l e s e m i c o n d u c t o r , i freescale semiconductor, inc. f o r m o r e i n f o r m a t i o n o n t h i s p r o d u c t , g o t o : w w w . f r e e s c a l e . c o m n c . . . software design state diagram DRM028 ? rev 0 designer reference manual motorola software design 91 5.5.1 initialize mcu this state is entered afte r the mcu is reset, a nd performs the following actions: mcu ports are confi gured for the application some application (system) va riables are initialized mcu clock pll is locked hardware boards used are identi fied, and parameters initialized pc master communication softwar e is initialized with sci port adc is initialized and the state is exited. 5.5.2 initialize application 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 cali brated and checked for error some application (system) variables initialized some mcu peripherals are confi gured (timer, oc function, pwm) pwm outputs for motor control are turned off timer 1 (tim a ch1) is syn chronized with the pwm cycle speed input, dc-bus voltage a nd temperature measurement is initialized ready led is turned on and the state is exited. 5.5.3 stand-by state diagram for this software is shown in figure 5-8 . f r e e s c a l e s e m i c o n d u c t o r , i freescale semiconductor, inc. f o r m o r e i n f o r m a t i o n o n t h i s p r o d u c t , g o t o : w w w . f r e e s c a l e . c o m n c . . . software design designer reference manual DRM028 ? rev 0 92 software design motorola current measurement and current calibrat ion when pwm is off before testing of the start switch , dc-bus current is measured when pwm is off. this way the dc-bus current measurement path is calibrated. the calibrated value offset0_curr is used for the final current calculation. this offset on t he adc input should ideally be 1. 65 v at 0 dc-bus current. if the sensed value exceeds the lim it (offset_max_curr) when pwm is off, this indicates some har dware error, and the control flow enters into the fault state: start condition test the start condition is tested. if in manual mode (p cmode = 0), the start condition is a movement in the switch from stop to start. in pc master software mode (p cmode = 1), the start c ondition in switch start position and startctrl = 1. if start condition valid then strt_f is set, stop_f is cleared, an d the next state entered. f r e e s c a l e s e m i c o n d u c t o r , i freescale semiconductor, inc. f o r m o r e i n f o r m a t i o n o n t h i s p r o d u c t , g o t o : w w w . f r e e s c a l e . c o m n c . . . software design state diagram DRM028 ? rev 0 designer reference manual motorola software design 93 figure 5-8. stand-by state speed input and dc-bus voltage measurements the dc-bus voltage is measured afte r the start switch is turned on. this prevents the measur ement being disturbed by the power turn on. where that dc-bus voltage 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 ctrl) f r e e s c a l e s e m i c o n d u c t o r , i freescale semiconductor, inc. f o r m o r e i n f o r m a t i o n o n t h i s p r o d u c t , g o t o : w w w . f r e e s c a l e . c o m n c . . . software design designer reference manual DRM028 ? rev 0 94 software design motorola 5.5.4 align state in the align state the rotor position is stabili zed by applying pwm signals to only two motor phas es (no commutation). when preset time-out expires, then this st ate is finished. see figure 5-9 . figure 5-9. align state scheduler the scheduler handles the state transit ions in the align state. the dc-bus current measurement is done in oc interrupt service routine, in order to keep synchronization wi th pwm cycle. after measurement is made, the scheduler allows calcul ation 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 current measurement is done current measurement is done (cmd_f = 1) run condition (stop_f = 0) f r e e s c a l e s e m i c o n d u c t o r , i freescale semiconductor, inc. f o r m o r e i n f o r m a t i o n o n t h i s p r o d u c t , g o t o : w w w . f r e e s c a l e . c o m n c . . . software design state diagram DRM028 ? rev 0 designer reference manual motorola software design 95 the over-current detection. the cm d_f (current measurement done) flag indicates that the new value of dc-bus cu rrent is ready to be processed by the current controller. the time-out (software timer 3) of th is state is defined in the software by the constants: per_t_align and per_base_t3_align . current controller the current controller subr outine is called every per_cs_t1_us s (128 s with default software setting) after a new value of the dc-bus current has been obtained ( cmd_f =1). it sets all si x pvalx register pairs to get the ri ght pwm ratio for the required current. timer 1 interrupt once the synchronization of oc function with the pwm cycle has been achieved, it must be ma intained because the current measurement is initiated here. over-current detection the dc-bus current is periodicall y sensed and the over-current condition is evaluated. afte r 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 provi des the functionality described in 3.3.1.4 starting (back-emf acquisition) and 3.3.1.5 starting ? commutation time calculation . figure 5-10 shows the state transitions for the state. first commutation after the align state ti me out expires, voltage is applied to another phase pair. the first commutation is made and the pwm duty cycle is constant. this value has been defined by the current controller during the aalign state. the calculation of the commutat ion time is explained in 3.3.1.5 starting ? commutati on time calculation . f r e e s c a l e s e m i c o n d u c t o r , i freescale semiconductor, inc. f o r m o r e i n f o r m a t i o n o n t h i s p r o d u c t , g o t o : w w w . f r e e s c a l e . c o m n c . . . software design designer reference manual DRM028 ? rev 0 96 software design motorola second commutation the commutation time (t2) is ca lculated from the previous commutation time and the start comm utation period ( per_cmtstart ). this time is set to timer 2. then, the new pwm multiplexer logic data is readied for when the commut ation interrupt performs the next commutation. the calculation of the commutat ion time is explained in 3.3.1.5 starting ? commutati on 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-curre nt, the control enters the fault state (see fault state ). the voltage and t he speed commands ar e scanned too. when this state is finished, the values of dc-bus current, dc -bus voltage, and speed command are updated. f r e e s c a l e s e m i c o n d u c t o r , i freescale semiconductor, inc. f o r m o r e i n f o r m a t i o n o n t h i s p r o d u c t , g o t o : w w w . f r e e s c a l e . c o m n c . . . software design state diagram DRM028 ? rev 0 designer reference manual motorola software design 97 figure 5-10. back- emf acquisition pwm (reload) interrupt (pwm center) bemf zero crossing sensing isr done (icr_f=1) commutation isr timer2 (tim a ch3) interrupt (pc_f=1) current measurement isr timer1 (tim a ch1) interrupt done scheduler first commutation service of commutation done (cmd_f = 1) service of received back-emf zero crossing done done error handler irrecoverable 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 measurement is done (cmd_f = 1) received the zero crossing event (icr_f = 1) phase has been commutated current measurement is done (cmd_f = 1) f r e e s c a l e s e m i c o n d u c t o r , i freescale semiconductor, inc. f o r m o r e i n f o r m a t i o n o n t h i s p r o d u c t , g o t o : w w w . f r e e s c a l e . c o m n c . . . software design designer reference manual DRM028 ? rev 0 98 software design motorola service of commutation as already explained, the motor p hase commutation is performed in the oc interrupt service rout ine. the phase commutated flag ( pc_f =1) indicates this action to the scheduler, which allows the performed commutation to be servic ed. detailed explanation of this state is in processes commutation and zer o crossing preset and set . service of received back-emf zero crossing the back-emf zero crossing is de tected by pwm middle function block. then the appropriate flag (c aptured received the zero crossing event - icr_f) is set by pwm cent re interrupt serv ice routine. this indicates to the scheduler that the zero crossing event must be served. the following actions are taken: 1. commutation parameters are reca lculated more precisely based on the received feedback 2. commutation time is preset to t he output compare register of timer 2 for a better underst anding of how the commut ation process works, see 3.3.1 sensorless commutation control , (see 3.3.1.5 starting ? commutation ti me calculation ). bemf zero crossing sensing interrupt service routine this isr is used to ev aluate the back-emf zero crossing. back-emf is evaluated here in order to synch ronize zero crossing capture with the middle of central- aligned pwm. this tec hnique rejects the noise caused by pwm from the back-emf signa l. when this isr is initiated, then three samples of the zero crossing input ( bemf_in ) are taken and the state is evaluated. based on the expected edge ( v_tasc2, els2a_els2b) and the ev aluated state of the bemf_in pin, the zero crossing event is verified. if it is accepted, then the captured time is stored in variable ( t_zcros ) and the pwm isr is finished. the appropriate flag (captured rece ived the zero cr ossing event ? icr_f ) is set. current measurement inte rrupt service routine f r e e s c a l e s e m i c o n d u c t o r , i freescale semiconductor, inc. f o r m o r e i n f o r m a t i o n o n t h i s p r o d u c t , g o t o : w w w . f r e e s c a l e . c o m n c . . . software design state diagram DRM028 ? rev 0 designer reference manual motorola software design 99 the output compare function is used to synchronize initiating the dc-bus current sampling with t he pwm cycle, and also for the commutation timing. error handler if the bldc motor is controlled properly, commutation events must be locked to the back-emf zero cr ossing feedback. when that feedback is lost, commutation time is der ived from previo us commutation events. if feedback d oes not recover duri ng a defined number of commutations (constant ? c_maxerr ), then the situation is evaluated as irrecoverable commutation error, and the fault state is entered. measurement handler the measurement handler assures th at the measurement process is done in the right order. the dc-b us voltage, speed command, and temperature are scanned sequentially. after the state has run three times, all the values for dc-bus cu rrent, dc-bus vo ltage, speed input, and temperature are updat ed. dc-bus current is scanned with a constant time period in the cu rrent measurement isr, but the over-current condition is evaluated in the main software loop. after a defined number (i_ovc_c nt) of successive over -current events, the control flow enters in to the fault state. 5.5.6 running state the bldc motor is run with regular feedback. the speed controller is used to control the mo tor speed by changing t he value of pwm duty cycle. figure 5-11 shows the state transitions. measurements handler explained in 5.5.5 back-emf acquisition state . service of commutation explained in 5.5.5 back-emf acquisition state . service of received back-emf zero crossing f r e e s c a l e s e m i c o n d u c t o r , i freescale semiconductor, inc. f o r m o r e i n f o r m a t i o n o n t h i s p r o d u c t , g o t o : w w w . f r e e s c a l e . c o m n c . . . software design designer reference manual DRM028 ? rev 0 100 software design motorola explained in 5.5.5 back-emf acquisition state . the difference is that the commutation parameters are recalcul ated with different constants (see 3.3.1.3 running ? commuta tion time calculation ) bemf zero crossing inte rrupt service routine explained in 5.5.5 back-emf acquisition state . current measurement inte rrupt 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 . f r e e s c a l e s e m i c o n d u c t o r , i freescale semiconductor, inc. f o r m o r e i n f o r m a t i o n o n t h i s p r o d u c t , g o t o : w w w . f r e e s c a l e . c o m n c . . . software design state diagram DRM028 ? rev 0 designer reference manual motorola software design 101 figure 5-11. running state done scheduler measurements service of commutation done (cmd_f=1) phase has been service of received back-emf zero crossing done (icr_f = 1) the zero crossing event received done error handler speed control done t3 time-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 measurement is done (cmd_f = 1) f r e e s c a l e s e m i c o n d u c t o r , i freescale semiconductor, inc. f o r m o r e i n f o r m a t i o n o n t h i s p r o d u c t , g o t o : w w w . f r e e s c a l e . c o m n c . . . software design designer reference manual DRM028 ? rev 0 102 software design motorola 5.5.7 stop state when motor stop is required, the pwm signals are disabled and the power switches are swit ched off. the state diag ram for this state is shown in figure 5-12 . figure 5-12. stop state 5.5.8 fault state if over-voltage, over-current, or commutation fault occurs, the motor control pwm?s are disabled and contro l enters the fault state, where it remains until reset or clear fail ure (start switch set off or pcmode&clearfail). the fault state is indicated by t he 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 required pwm is off f r e e s c a l e s e m i c o n d u c t o r , i freescale semiconductor, inc. f o r m o r e i n f o r m a t i o n o n t h i s p r o d u c t , g o t o : w w w . f r e e s c a l e . c o m n c . . . software design implementation notes DRM028 ? rev 0 designer reference manual motorola software design 103 the failure (failure = 0) is test ed. in manual mode (pcmode = 0), the switch in the stop position clears th e failure. in pc master software mode (pcmode = 1), the failure is cleared by clearfai l flag or the switch in the stop positio n. if start condition is valid strt_f is set, stop_f is cleared, and the next state entered. see figure 5-13 . figure 5-13. fault state 5.6 implementation notes 5.6.1 software files the software files and structur e 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 or reset clear failure (start switch set off or pcmode&clearfail) (failure = 0) or reset f r e e s c a l e s e m i c o n d u c t o r , i freescale semiconductor, inc. f o r m o r e i n f o r m a t i o n o n t h i s p r o d u c t , g o t o : w w w . f r e e s c a l e . c o m n c . . . software design designer reference manual DRM028 ? rev 0 104 software design motorola 5.6.2 bldc commutati on and zero crossing selection the required bldc motor voltage syst em commutation is provided using the mc68hc08mr32 pwm block. the zero crossing selection is pr ovided by setting port f pins ptf1?ptf3 connected to the multiplexer. as shown in data flow , the commutation and back-emf zero-crossing selection process is split into two actions: 1. preset bldc commutation and bemf zero-crossing selection 2. set bldc commutation and bemf zero-crossing selection 5.6.2.1 preset bldc commutation and bemf ze ro crossing selection in each phase of the 6-step commutation tw o pwm channels (bottom and top switch) are active and the ot her four pwm channels are logical 0. the commutation pres et is accomplished by setting the buffered registers pval1h, pval1l through pv al6h, pval6l. to preset the active pwm channel, the msb bits of the dedicated pvalxh registers are set to 0.to preset the pwm channel to the logical 0, the msb bits of the dedicated pvalxh registers ar e 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] () calls one of shft_pwm0..5() functions according to p_step_cmt value, so the pvalxh registers are set as required. this will not effect the pwm signals until ldok bit is set. also, the back-emf zero crossing selection preset is provided in this function, by setting v_mux variable according to p_step_cmt value. 5.6.2.2 set bldc commutation and bemf zero crossing selection the commutation set is provided in timer 2 interrupt function timach3_int() in the code_isr.c file. the pwmen is toggled and ldok bit set, in order to immediately restart the pwm generator and reload the pwm with t he buffered pval1h, pva l1l through pval6h, f r e e s c a l e s e m i c o n d u c t o r , i freescale semiconductor, inc. f o r m o r e i n f o r m a t i o n o n t h i s p r o d u c t , g o t o : w w w . f r e e s c a l e . c o m n c . . . software design implementation notes DRM028 ? rev 0 designer reference manual motorola software design 105 pval6l registers. then the back-emf zero crossing selection set is provided by setting portf according to v_mux variable. 5.6.3 bldc speed c ontrol and calculation desired speed calculation and pwm dut y cycle setting is quite simple, but there are some c language syntax tricks. al so, the scaling aspect needs to be taken in to consideration. 5.6.3.1 desired speed calculation the 8 bit value speed_desired is calculated using 8- bit multiplication of two 8-bit variables, sp_input and coef_speed_inp . the syntax is: (unsigned char)(( sp_input * coef_speed_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 pw m 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 pw m modulus register pmod = mcpwm_modulus constant (100% duty cycle is when pvalx = pmod ). the pwm_val_max variable is: pwm_val_max = duty_pwm_max * mcpwm_modulus this variable is used for scali ng of the regul ator output outreg_u8 . the registers pval1h, pva l1l through pval6h, pval6l are loaded with pwm_val calculated from outreg_u8 : pwm_val = pwm_val_max * outreg_u8/256 this calculation is provided with macro umul_16x8_macro . f r e e s c a l e s e m i c o n d u c t o r , i freescale semiconductor, inc. f o r m o r e i n f o r m a t i o n o n t h i s p r o d u c t , g o t o : w w w . f r e e s c a l e . c o m n c . . . software design designer reference manual DRM028 ? rev 0 106 software design motorola 5.6.4 timers timer 1 and timer 2 are implement ed using mc68hc08mr32 timers. timer 3 is a software virtual timer using time base of timer 1. 5.6.4.1 timer 1 timer 1 is provided by timer a chan nel 1 set in output compare mode. in this mode the regist ers tach1h and tach1l are used for setting the output compare value, t1. tacnth and tacntl form a 16- bit timer a counter with an infinite counting 16-bit roll over. the timer a channel 1 interrupt is called whenever tach1h = tacnth and tach1l = tacntl. with each interrupt, the registers tach1h and tach1l are loaded with the new value, t1 = t1+per_cs_t1 , where t1+per_cs_t1 is a 16-bit addition with no saturation. so, the constant interrupt period per_cs_t1 of the timer t1 in terrupts is generated. the timer unit unit_period_t1_us of timer a is determined by the mcu bus frequency (8 mhz wi th 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 chan nel 3 set in output compare mode. in this mode, the regist ers tach3h and tach3l are used for setting the output compare value, t2. tacnth and tacntl form a 16-bit ti mer a counter, with infinite counting 16-bit roll over. the actual time is sens ed from tacnth and tacntl base (e.g., time of the commutation, t_cmt ). the timer a channel 3 (t imer 2) interrupt is called whenever tach3h = tacnth and tach3l = tacntl. so, the registers tach3h and tach3l are loaded wi th the t2 variable value. f r e e s c a l e s e m i c o n d u c t o r , i freescale semiconductor, inc. f o r m o r e i n f o r m a t i o n o n t h i s p r o d u c t , g o t o : w w w . f r e e s c a l e . c o m n c . . . software design implementation notes DRM028 ? rev 0 designer reference manual motorola software design 107 the value t2 (e.g., t2 = t_cmt + per_hlfcmt ) is calculated using a 16-bit addition with no saturation. so, the time duration up to 65,536 unit_period_t2_us from actual time (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 wit h 4-mhz oscillator and default software setting) and timer presca ler set in tasc . so, the default software value is 2 s. the timer 2 interrupt function is provided by function timach3_int() . f r e e s c a l e s e m i c o n d u c t o r , i freescale semiconductor, inc. f o r m o r e i n f o r m a t i o n o n t h i s p r o d u c t , g o t o : w w w . f r e e s c a l e . c o m n c . . . software design designer reference manual DRM028 ? rev 0 108 software design motorola f r e e s c a l e s e m i c o n d u c t o r , i freescale semiconductor, inc. f o r m o r e i n f o r m a t i o n o n t h i s p r o d u c t , g o t o : w w w . f r e e s c a l e . c o m n c . . . DRM028 ? rev 0 designer reference manual motorola user guide 109 designer reference manual ? sensorless bldc motor control section 6. user guide 6.1 contents 6.2 application suitability guide . . . . . . . . . . . . . . . . . . . . . . . . . . 109 6.3 warning . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 112 6.4 application hardware and software configuration . . . . . . . . . 113 6.5 software parameters setting and tuning for customer motor. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 126 6.2 application suitability guide this application suitabili ty guide deals with i ssues which may be encountered when tailori ng application using customer motor. 6.2.1 minimal application speed as it is known, the back-emf vo ltage is proportion ally dependent on motor speed. 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 fact ors of the motor and hardware design, and differs for any applicat ion. this is because the back-emf zero crossing is disturbed and effected by the zero crossing comparator threshold as explained be low and in the sections 6.2.4.2 effect of mutual inductance and 6.2.4.1 effect of mu tual phase capacitance . note: usually, the minimal speed for reliable operation is from 7% to 20% of the motor?s nominal speed. f r e e s c a l e s e m i c o n d u c t o r , i freescale semiconductor, inc. f o r m o r e i n f o r m a t i o n o n t h i s p r o d u c t , g o t o : w w w . f r e e s c a l e . c o m n c . . . user guide designer reference manual DRM028 ? rev 0 110 user guide motorola 6.2.2 maximal application speed the maximal motor speed is limited by the minimal commutation period: (eq 6-1.) commut_rev ? commutations per motor revolution, must be set according to rotor poles: (eq 6-2.) where: p = rotor poles the minimal commutation period is deter mined by execution time of the software. with default software se ttings and coef_h lfcmt = 0.450 it is 333 s, as shown in table 2-1 . so for example, th e 4 pole (3-phase) motor can be controlled up to t he maximal speed of 15,015 rpm. note: using pc master software in t he application increases the minimal commutation time. this is due to the executio n of pc master software routine. in this case, the minimal execution ti me is 520 ms. the minimal commutation period could be decr eased 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 ac hievable for most of bldc motors with a trapezoidal back-emf. howeve r, for some bldc motors the back-emf zero crossing sensing can be problematic since it is affected by unbalanced mutual phase capaci tance and induct ance. it can disqualify some motors from usin g sensorless techniques based on the back-emf sensing. maximal speed[rpm] 60 10 6 () min. commutation period [us]*commut_rev -------------------------------------------------------------------------------------------------------------------------- = commut_rev 6p 2 ------ - = f r e e s c a l e s e m i c o n d u c t o r , i freescale semiconductor, inc. f o r m o r e i n f o r m a t i o n o n t h i s p r o d u c t , g o t o : w w w . f r e e s c a l e . c o m n c . . . user guide application suitability guide DRM028 ? rev 0 designer reference manual motorola user guide 111 6.2.4.1 effect of mu tual phase capacitance the effect of the mutual phase capacit ances can play an important role in the back-emf sensing. usually the mutual capacitance is very small. its influence is only significant during the pwm switching when the system experiences very high du/dt .the effect of mu tual capacitance is described in section 3.2.4.4 effect of mu tual phase capacitance . note: note that the configur ation of the end-turns of the phase windings has a significant impact. therefore, it mu st be properly managed to preserve the balance of the mut ual capacity. this is especially important for prototype motors that are usually hand-wound. caution: failing to maintain balance of t he mutual capacita nce can easily disqualify such motors from us ing sensorless techniques based on the back-emf sensing. usually the bldc motors with win dings wound on separate poles show minor presence 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 unbalanc ed mutual capacitance. however, it can be noticed on the sensed phase. the differ ence of the mutual inductances between the coils which carry the phas e current and the coil used for back-emf sensing, causes the pwm pulses to be superimposed onto the detected back-emf voltage. the effect of mutual inductanc e is described in section 3.2.4.3 effect of mutual inductance . note: the bldc motor with stator windi ngs 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 wound on separate poles, show s minor presence of the effect of mutual inductance. caution: however noticeable this effect, it does not degrade t he back-emf zero crossing detection, because it is cancelled at th e zero crossing point. additional simple filtering helps to reduce ripples further. f r e e s c a l e s e m i c o n d u c t o r , i freescale semiconductor, inc. f o r m o r e i n f o r m a t i o n o n t h i s p r o d u c t , g o t o : w w w . f r e e s c a l e . c o m n c . . . user guide designer reference manual DRM028 ? rev 0 112 user guide motorola 6.3 warning this application operates in an en vironment that includes dangerous voltages and rotating machinery. be aware that the ap plication power stage and optoisolation board are not electrically isol ated from the main s voltage - they ar e live with risk of electric shock when touched. an isolation transformer should be used when operating off an ac power line. if an isolation transformer is not used, power stage grounds and oscilloscope grounds are at differen t potentials, unless the oscilloscope is floating. note that probe grounds and, therefore, the case of a floated oscilloscope are subjec ted to dangerous voltages. the user should be aware that: before moving scope probes, maki ng connections, etc., it is generally advisable to power down the high- voltage supply. to avoid inadvertently touching li ve parts, use plastic covers. when high voltage is applied, us ing only one hand for operating the test setup minimizes the po ssibility of el ectrical shock. operation in lab setups that have grounded tables and/or chairs should be avoided. wearing safety glasses, avoiding ties and jewelry, using shields, and operation by personnel trained in high-voltage lab techniques are also advisable. power transistors, the pfc coil, and the motor can reach temperatures hot e nough to cause burns. when powering down; due to storage in the bus capacitors, dangerous voltages are present until the power-on led is off. f r e e s c a l e s e m i c o n d u c t o r , i freescale semiconductor, inc. f o r m o r e i n f o r m a t i o n o n t h i s p r o d u c t , g o t o : w w w . f r e e s c a l e . c o m n c . . . user guide application hardware and software configuration DRM028 ? rev 0 designer reference manual motorola user guide 113 6.4 application hardware and software configuration 6.4.1 hardware configuration as mentioned, the software can be conf igured to run on one of the three hardware and motor platforms: high-voltage hardware set configuration low-voltage evaluatio n motor hardware set configuration low-voltage hardware set configuration the hardware setups are shown in figure 6-1 , figure 6-2 , and figure 6-3 . these setups are described in followi ng subsections (see hardware and drive specifications for each platform characteristics). the supplied controller boards for mc68hc908mr 32 (ecctrmr32) allows two possibilities for software execution: 1. mmds evaluation bo ard (kitmmdsmr32) using a real-time debugger (s upplied with the metrowerks compiler) the evaluation board is connected to the controller board (ecctrmr32) vi a an emulator connec tor. this solution is recommended for software evaluation. 2. programmed mcu (mc68hc908mr32) where a daughter board m odule, with mc68hc908mr32 processor, is plugged into the controller board (ecctrmr32) instead of the emulator cable, the processo r must be programmed in an external programmer. this solution is recommended for final tests. figure 6-1 , figure 6-2 , and figure 6-3 show the conf iguration with mmds evaluation board. note: all the system parts are described in section 4. hardware design . they can be ordered as a standard pro ducts. for the the supply and in detail document references see section 4. hardware design . f r e e s c a l e s e m i c o n d u c t o r , i freescale semiconductor, inc. f o r m o r e i n f o r m a t i o n o n t h i s p r o d u c t , g o t o : w w w . f r e e s c a l e . c o m n c . . . user guide designer reference manual DRM028 ? rev 0 114 user guide motorola 6.4.1.1 high-voltage hard ware set configuration the system configuration fo r a high-voltage hardwa re set is shown in figure 6-1 figure 6-1. high-voltage hardwa re system c onfiguration note: it is strongly recommended to us e opto-isolation (optocouplers and optoisolation amplifiers) during develop ment time to avoid any damage to the development equipment. note: all the system parts are described in section 4. hardware design . they can be ordered as a standard pro ducts. for the the supply and in detail document referenc es shown see section 4.2.1 high-voltage hardware set configuration . 6.4.1.2 low-voltage ev aluation motor hardware set configuration the system configuration for a low-voltage eval uation 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 computer rs232 - emulator white sg40n 40w flat ribbon cable l j11.1 j11.2 n j14 j1 black kitmmds08mr32 not connected pe j5 not connected +12vdc j2 ecopt hc908mr32 gnd optoisolation board white controller board 40w flat ribbon cable jp1.1 jp1.2 ecmtrhivbldc motor-brake red f r e e s c a l e s e m i c o n d u c t o r , i freescale semiconductor, inc. f o r m o r e i n f o r m a t i o n o n t h i s p r o d u c t , g o t o : w w w . f r e e s c a l e . c o m n c . . . user guide application hardware and software configuration DRM028 ? rev 0 designer reference manual motorola user guide 115 figure 6-2. low-voltage evaluation motor hardware system configuration note: all the system parts are described in section section 4. hardware design . they can be ordered as a standar d products. for the the supply and in detail document refe rences shown see section 4.2.2 low-voltage evaluatio n motor hardware set configuration . 6.4.1.3 low-voltage hard ware 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 pc computer rs232 - pc master j1 u2 f r e e s c a l e s e m i c o n d u c t o r , i freescale semiconductor, inc. f o r m o r e i n f o r m a t i o n o n t h i s p r o d u c t , g o t o : w w w . f r e e s c a l e . c o m n c . . . user guide designer reference manual DRM028 ? rev 0 116 user guide motorola figure 6-3. low-voltage hardwa re system configuration note: all the system parts are described in section section 4. hardware design . they can be ordered as a standar d products. for the the supply and in detail document refe rences shown see section 4.2.3 low-voltage hardware set configuration . 6.4.1.4 controll er board settings controller board settings are the same for all hardware platforms. jumpers jp3 and jp7 mu st 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 rs232 - pc master white ecctr908mr32 hc908mr32 3ph ac/bldc low voltage power stage 12vdc f r e e s c a l e s e m i c o n d u c t o r , i freescale semiconductor, inc. f o r m o r e i n f o r m a t i o n o n t h i s p r o d u c t , g o t o : w w w . f r e e s c a l e . c o m n c . . . user guide application hardware and software configuration DRM028 ? rev 0 designer reference manual motorola user guide 117 figure 6-4. controller board 6.4.1.5 evm board settings evm board settings are the same for all hardware platforms. caution: remember, the mmds mcu clock mu st be set to 4 mhz. change the crystal oscillator, or set oscillator w1 to mmds, and set for 4 mhz in the debugger! 6.4.2 software setup in order to run the s ensorless bldc application th e 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 rs232 to evaluation board f r e e s c a l e s e m i c o n d u c t o r , i freescale semiconductor, inc. f o r m o r e i n f o r m a t i o n o n t h i s p r o d u c t , g o t o : w w w . f r e e s c a l e . c o m n c . . . user guide designer reference manual DRM028 ? rev 0 118 user guide motorola for application pc master software (remote) contro l, the following software is needed: pc master software for pc ? installed on your pc computer sensorless bldc application pc master so ftware control files (located in bldc_zerocros 08mr32\pc_master directory) both the hc08 and pc master software control files for the sensorless bldc application are del ivered together in the bldc_zerocros08mr32 directory. it consists of files listed in application hc08 software files . 6.4.2.1 applicati on hc08 software files the application hc08 so ftware files are: ...\bldc_zerocros08mr 32\bldc_zerocross.mcp , application project file ...\bldc_zerocros08mr 32\sources\const_cust_hv.h , definitions for software customiz ing for high volt age (230/115 vac) power board ...\bldc_zerocros08mr 32\sources\const_cust_evm.h , definitions for software custom izing for evm motor board (12 v low power) ...\bldc_zerocros08mr 32\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 const_cust_hv.h, const_cust_evmm.h, or const_cust_lv. h files according to the hardware platform used! see table 6-1 . table 6-1. required software configuration for dedicated hardware platform hardware platform dedicated customizing file required software configuration high-voltage hardware const_cust_hv.h #include const_cust_hv.h into code.fun.c (done with default software setting) f r e e s c a l e s e m i c o n d u c t o r , i freescale semiconductor, inc. f o r m o r e i n f o r m a t i o n o n t h i s p r o d u c t , g o t o : w w w . f r e e s c a l e . c o m n c . . . user guide application hardware and software configuration DRM028 ? rev 0 designer reference manual motorola user guide 119 ...\bldc_zerocros08m r32\sources\code_fun.c , program c language functions ...\bldc_zerocros08m r32\sources\code_fun.h , program c language functions header ...\bldc_zerocros08m r32\sources\const.h , main program definitions ...\bldc_zerocros08mr 32\sources\mr32io.h , mc68hc908mr32 register s definitions file ...\bldc_zerocros08mr 32\sources\mr32_bit.h , mchc908mr32 register bi ts definitions file ...\bldc_zerocros08mr 32\sources\bldc08.c , main program ...\bldc_zerocros08mr 32\sources\code_start.c , motor alignment and starting (back-em f acquisition) state functions ...\bldc_zerocros08mr 32\sources\code_start.h , motor alignment and starting (back-em f acquisition) state function header ...\bldc_zerocros08m r32\sources\code_run.c , motor running state function ...\bldc_zerocros08m r32\sources\code_run.h , motor running state function header ...\bldc_zerocros08m r32\sources\code_isr.c , program interrupt functions ...\bldc_zerocros08m r32\sources\code_isr.h , program interrupt functions header low-voltage evaluation motor hardware const_cust_evmm. h #include const_cust_evmm.h into code.fun.c low-voltage hardware const_cust_lv.h #include const_cust_lv.h into code.fun.c table 6-1. required software configuration for dedicated hardware platform hardware platform dedicated customizing file required software configuration f r e e s c a l e s e m i c o n d u c t o r , i freescale semiconductor, inc. f o r m o r e i n f o r m a t i o n o n t h i s p r o d u c t , g o t o : w w w . f r e e s c a l e . c o m n c . . . user guide designer reference manual DRM028 ? rev 0 120 user guide motorola ...\bldc_zerocros08m r32\sources\ram.c , general ram definitions ...\bldc_zerocros08m r32\sources\ram.h , general ram declarations header ...\bldc_zerocros08mr 32\sources\ram_bit.h , general ram bits definitions header ...\bldc_zerocros08mr32\s ources\ram_cust_param.c , ram variables for software customizing definitions ...\bldc_zerocros08mr32\s ources\ram_cust_param.h , ram variables for software cu stomizing header declarations ...\bldc_zerocros08mr 32\sources\tab_cust.c , constants/tables definitions ...\bldc_zerocros08mr 32\sources\tab_cust.h , constants/tables definitions header ...\bldc_zerocros08mr 32\sources\pcmaster.c , pc master software communication subroutines ...\bldc_zerocros08mr 32\sources\pcmaster.h , pc master software communicati on subroutines header ...\bldc_zerocros08mr 32\sources\code_asm.asm , program assembler functions ...\bldc_zerocros08m r32\sources\code_asm.h , program assembler functions header ...\bldc_zerocros08mr 32\prms\default.prm , linker command file 6.4.2.2 application pc mast er software control files the application pc master so ftware control files are: ...\bldc_zerocros08mr32\ pc_master\bldc.pmp , pc master software project file ...\bldc_zerocros08mr 32\pc_master\source , directory with pc master software control page files f r e e s c a l e s e m i c o n d u c t o r , i freescale semiconductor, inc. f o r m o r e i n f o r m a t i o n o n t h i s p r o d u c t , g o t o : w w w . f r e e s c a l e . c o m n c . . . user guide application hardware and software configuration DRM028 ? rev 0 designer reference manual motorola user guide 121 6.4.3 software execution 6.4.3.1 build to build the bldc sensorless wi th the back-emf zero crossing application, open the bldc_zerocross.mcp project file and execute the make command, as shown in figure 6-5 . this will build and link the application and all needed metrowerks libraries. figure 6-5. execute make command 6.4.3.2 execute fr om evaluation board to execute the application fr om mmds evaluation board (kitmmdsmr32), choose the project/debug command in the code warrior ide. this will start real-time d ebugger, load firmware, and application software to evaluation board mmds. the application should then be start ed from the real-time debugger ide by the run/start command. for more help with these commands, refer to the codewarrior tutorial docume ntation located in the codewarrior installation directory. f r e e s c a l e s e m i c o n d u c t o r , i freescale semiconductor, inc. f o r m o r e i n f o r m a t i o n o n t h i s p r o d u c t , g o t o : w w w . f r e e s c a l e . c o m n c . . . user guide designer reference manual DRM028 ? rev 0 122 user guide motorola note: remember, the mmds mcu clock mu st be set to 4 mhz. change the crystal oscillator, or set oscillato r w1 to mmds, and set 4 mhz in the real-time debugger ? mmds050 8/target signals/4 mhz! once the applicat ion is running, move the ru n/stop switch to the run position and set the r equired speed with the s peed potentiometer. if successful, the bldc motor will be spinning. note: if the run/stop switch is set to t he run position when the application starts, toggle the run/stop s witch between the stop and run positions to enable motor spinning. this is a pr otection feature that prevents the motor from starting when the applicat ion is executed from 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 fo r programming of mc68hc908mr32 mcu devices. an external programmer (e.g., motorola m68hc08 serial programmer) must be used to program the device! the programmed mcu, with mc 68hc908mr32 daughter board module, can then be plug ged into the controller board (ecctrmr32) instead of the emulator cable. 6.4.4 application control this bldc sensorless motor contro l application can operate in two modes: 1. manual operating mode 2. pc master software (r emote) operating mode f r e e s c a l e s e m i c o n d u c t o r , i freescale semiconductor, inc. f o r m o r e i n f o r m a t i o n o n t h i s p r o d u c t , g o t o : w w w . f r e e s c a l e . c o m n c . . . user guide application hardware and software configuration DRM028 ? rev 0 designer reference manual motorola user guide 123 6.4.4.1 manual operating mode in the manual operating m ode, the drive is contro lled by the run/stop switch and the required speed is se t by the speed potentiometer. the run/stop switch enables/disables mo tor spinning. the yellow led will light whenever the applicat ion software corr ectly executes (s o, it will also light when motor spinning is di sabled or at a fault state). when motor spinning is enabled and st arts spinning (alignment or starting/back-emf acquisition state) , only the yellow led lights. when motor rotation is enabled and the motor runs with speed closed loop (running st ate), the green led lights (yellow led also lights). if an over-current or over-voltage fault occurs, the internal fault logic is asserted and the application enters a fault state indicated 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 softwar e (remote) operating mode in the pc master softw are (remote) operating mode, the drive is controlled remotely from a pc through the serial communication interface (sci) channel of the mcu device via an rs-232 physical interface. the drive is enabled by th e run/stop switch, which can be used to safely stop the application at any time. for the pc master software (remote) control it is necessary to have pc master software installe d on your pc computer! start the pc master software application: ...\bldc_zerocros08mr32\pc_master\bldc.pmp after you start the pc ma ster software, press ?cont rol page? to make the control window visible! figure 6-6 illustrates the pc master software control window. f r e e s c a l e s e m i c o n d u c t o r , i freescale semiconductor, inc. f o r m o r e i n f o r m a t i o n o n t h i s p r o d u c t , g o t o : w w w . f r e e s c a l e . c o m n c . . . user guide designer reference manual DRM028 ? rev 0 124 user guide motorola note: after you start the pc master software, the al gorithm block description window appears instead of the pc mast er control window; therefore, press ?control page?. if the pc master softw are project ( ..pmp file) is unable to control the applic ation, it is possible that the wrong load map ( ..\bin\bldc_zerocros08mr32_mmds.map file) has been selected. pc master software uses the load map to determi ne addresses for global variables being monitored. once the pc master project has been launched, this option may be select ed in the pc mast er window under project/select other map filereload. figure 6-6. pc master software control window the following control ac tions are supported: setting pc master software/m anual control mode (pc master mode radio button) click here to display control page f r e e s c a l e s e m i c o n d u c t o r , i freescale semiconductor, inc. f o r m o r e i n f o r m a t i o n o n t h i s p r o d u c t , g o t o : w w w . f r e e s c a l e . c o m n c . . . user guide application hardware and software configuration DRM028 ? rev 0 designer reference manual motorola user guide 125 note: application control from pc master software requires that pc master software control mode must be set. before changing pc master software/manual control mode (by pc master mo de radio button) the controller board start/stop switch must be set to stop. this is a protection feature t hat prevents the motor from unexpected starts! start the motor (s tart motor button) note: to start the motor with pc master software con trol mode, two conditions must be fulfilled. start/stop switch on the controll er board must be set to start and start motor but ton on pc master software control page must be ?pressed down?. stop the motor (stop motor button) set the required speed of the motor (via bar graph) clear failures (clear failures button) pc master software displa ys 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-volta ge, 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 master software control window displays power stage board, optoisolation bo ard: not recognized. if the fault status is different from the no fa ults (when over-current, over-voltage, or under-vol tage fault), the red le d blinks and the motor is stopped. this state can be exited by application reset or clear failures button on t he pc master soft ware control page. note: it is strongly recommended that you inspect the entire application to locate the source of faul t before star ting it again. f r e e s c a l e s e m i c o n d u c t o r , i freescale semiconductor, inc. f o r m o r e i n f o r m a t i o n o n t h i s p r o d u c t , g o t o : w w w . f r e e s c a l e . c o m n c . . . user guide designer reference manual DRM028 ? rev 0 126 user guide motorola 6.5 tuning for customer motor this section describes how to modify the software parameters for any bldc motor and some hardware ada ptations. the software parameters can be evaluated from a pc computer using pc master software, so the first subsection describes tuning the pc master software project file. a follow-up for softwa re customizing to a cu stomer motor is shown in figure 6-7 . before starting the soft ware modification for a customer motor and application, it is recommended th at you check the application and motor suitability. this is explained in the section 6.2 application suitability guide . the parameters file selection must be made according to hardware configuration used. if a modified hardware power stage is used, the appropriate constants in const_cust _x.h file must be set as described in the section 6.5.3.1 software cust omizing to power stage . if a low-voltage board with a modi fication 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 cust omer motor and application, a setting must be made as explained in: ? 6.5.4 software customiz ing to motor ? voltage and current settings ? 6.5.4.3 alignment current and current regulator setting ? 6.5.5 software customizing to motor ? commutation and start-up control setting ? 6.5.6 software customizi ng to motor ? speed control setting . accomplishing the above steps s hould be sufficient for most applications. however, in some ca ses there may be a need for advanced software customizing (see figure 6-8.) with changes to motor pwm f r e e s c a l e s e m i c o n d u c t o r , i freescale semiconductor, inc. f o r m o r e i n f o r m a t i o n o n t h i s p r o d u c t , g o t o : w w w . f r e e s c a l e . c o m n c . . . user guide tuning for customer motor DRM028 ? rev 0 designer reference manual motorola user guide 127 frequency or to the curr ent regulator sampling per iod as explained in the section 6.5.7 pwm frequency 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. f r e e s c a l e s e m i c o n d u c t o r , i freescale semiconductor, inc. f o r m o r e i n f o r m a t i o n o n t h i s p r o d u c t , g o t o : w w w . f r e e s c a l e . c o m n c . . . user guide designer reference manual DRM028 ? rev 0 128 user guide motorola figure 6-7. follow-up for software customizing to customer motor include appropriate: ? const_cust_x.h ? into code_fun.c file include: ? const_cust_lv.h ? into code_fun.c file include: ? const_cust_evmm.h ? into code_fun.c file include: ? const_cust_hv.h ? into code_fun.c file ? set duty_pwm_max ? set volt_hw_max ? set volt_max_fault_v ? set curr_hw_max_a ? set curr_hw_min_a ? set curr_max_fault_a ? set alignment state current - curr_align_a ? set current regulator: curr_pireg_p_gainscaleleft, curr_pireg_p_gain, curr_pireg_i_gainscaleleft, curr_pireg_i_gain ? set coil discharge period per_dis_us ? set commutation (advancing) coefficient coef_hlfcmt -set commutation start period per_cmt_start_us! and maximal per_cmt_max_us -set alignment to start increment start_incr_ooutreg -set number of successive bemf zero crossings to 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 speed decision on the application suitability selection of the power stage hv evm lv modified h/w lv for 42v ? modify r207, r522, r523, r524 ? set volt_hw_max ? set volt_max_fault_v in const_cust_lv.h file ? set maximal fault voltage volt_max_fault_v ? set minimal fault voltage volt_min_fault_v ? set volt_120_threshold_v (only for hv) ? set maximal fault current curr_max_fault_a ? set number of current faults i_cntr_ovc voltage and current settings alignment current an d regulator settings start-up control settings speed control settings ok ok ok ok ok f r e e s c a l e s e m i c o n d u c t o r , i freescale semiconductor, inc. f o r m o r e i n f o r m a t i o n o n t h i s p r o d u c t , g o t o : w w w . f r e e s c a l e . c o m n c . . . user guide tuning for customer motor DRM028 ? rev 0 designer reference manual motorola user guide 129 figure 6-8. follow-up for ad vanced software customizing figure 6-9. follow-up for softwa re customizing trouble shouting 6.5.1 software parameters tuning wit h pc master software project file sensorless bldc software is prov ided with a pc master software project file for on-line soft ware parameters tuning (see figure 6-10 ). this file supports: remote application control key software paramet ers modification for: ? current parameters tuning ? start-up parameters tuning ? speed parameters tuning pc master software ?oscillo scope? windows with required variables the remote application control uses the same control page as described in pc master software (r emote) operating mode . moreover, the tuning file incor porates 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 setting ? measure free phase back-emf voltage for the motor mutual capacitance effect ? measure free phase back-emf voltage for the motor inductance capacitance effect decision on the motor suitability ? check minimal application speed ? check maximal motor speed decision on the application suitability f r e e s c a l e s e m i c o n d u c t o r , i freescale semiconductor, inc. f o r m o r e i n f o r m a t i o n o n t h i s p r o d u c t , g o t o : w w w . f r e e s c a l e . c o m n c . . . user guide designer reference manual DRM028 ? rev 0 130 user guide motorola setting, and pc master software ?oscilloscope? window s for watching dedicated parameters (variables). note: for software parameter tuning with pc master software, it is necessary to have pc master 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 f r e e s c a l e s e m i c o n d u c t o r , i freescale semiconductor, inc. f o r m o r e i n f o r m a t i o n o n t h i s p r o d u c t , g o t o : w w w . f r e e s c a l e . c o m n c . . . user guide tuning for customer motor DRM028 ? rev 0 designer reference manual motorola user guide 131 ...\bldc_zerocros08mr32\ pc_master\tuning_bldc.pmp after you start the pc master software, you can choose which parameters you are going to tune (c urrent, start-up, speed parameters ? see figure 6-10 ). then you can press ?cont rol page? to make the control window visible ( and provide control in the same way as in pc master software (rem ote) operating mode ). or, you can display the oscilloscope window (see figure 6-11 ). you can then modify the variable values in th e variable window ( figure 6-11 ), which is visible for both control page or oscilloscope pag e turned on. the variables can be modified according to their defined limits. figure 6-11. pc master software parameters tuning control window click here to display oscilloscope modify values here f r e e s c a l e s e m i c o n d u c t o r , i freescale semiconductor, inc. f o r m o r e i n f o r m a t i o n o n t h i s p r o d u c t , g o t o : w w w . f r e e s c a l e . c o m n c . . . user guide designer reference manual DRM028 ? rev 0 132 user guide motorola note: the software parameters can be te mporarily modified and evaluated using the pc master softwar e tuning file. but, the parameter settings are not stored in the non-vola tile memory (after re set the software loads parameters from const_cust_x.h file ). when you finish the software parameters evaluation, y ou must open one of the const_cust_hv.h , const_cust_evmm.h , and const_cust_lv.h files and manually modify the parameters according to t he final variable values evaluated (otherwise, you will get default setting a fter the mcu reset!). 6.5.2 software parameters setting follow-up the software is provided with three parameters sets (files const_cust_hv.h, const_cust_evmm.h , and const_cust_l v.h) configured for three hardware and motor kits (hv, lv, and evm), as was described before. but, the software can be c onfigured for other 3- phase trapezoidal bldc motors (or possibly other hardware board parameters). the motor control drive usual ly needs setting/tuning for: current/voltage parameters dynamic parameters the parameter configurations must be set in source code before compilation. however, some param eters can also be temporarily changed using pc master software (e xperimental setting). finally, when an appropriate parameter va lue is found, it can be set in the source code. the software parameters settings ar e described in the subsections below and in the softwa re code by comments. you should proceed with some st eps to customize the software according to your motor (or hardwa re) characteristics. the source code is commented with descriptive l abels to simplify the process. 6.5.2.1 labels in the files const_cust_h v.h, const_cust_evm. h, const_cust_lv.h most of the software pa rameter settings are pr ovided in one of these files: const_cust_hv.h, const_cust _evmm.h or const_ cust_lv.h. the required steps are marked: f r e e s c a l e s e m i c o n d u c t o r , i freescale semiconductor, inc. f o r m o r e i n f o r m a t i o n o n t h i s p r o d u c t , g o t o : w w w . f r e e s c a l e . c o m n c . . . user guide tuning for customer motor DRM028 ? rev 0 designer reference manual motorola user guide 133 /* must_change_nn: */ label for changes which must be set (changed) when adapting software for a motor /* must_change _nn_exper: */ label for changes which must be set (changed) when adapting software for a motor ? the se tting can be done experimentally /* must_if_hw_change_nn */ label for changes which must be set (changed) when a power stage board different from high voltage power board is used /* can_change_nn */ label for changes which can be set (changed) when adapting software for a motor, but us ually the 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 cons t.h. the required steps are marked: /* can_change_fpwm_n */ label for definitions which shou ld be modified, when changing pwm frequency /* can_change_ percursamp_n */ llabel for definitio ns which should be co rrected, when changing current sampling period let?s follow the next sections, or the labels in the source code to customize the software. f r e e s c a l e s e m i c o n d u c t o r , i freescale semiconductor, inc. f o r m o r e i n f o r m a t i o n o n t h i s p r o d u c t , g o t o : w w w . f r e e s c a l e . c o m n c . . . user guide designer reference manual DRM028 ? rev 0 134 user guide motorola 6.5.3 parameters file selection as explained before (see software setup ) one of the following files is used for most of software parameters configuration: ...\bldc_zerocros08mr 32\sources\const_cust_hv.h , definitions for software customiz ing, for high-voltage (230/115 vac ) power board ...\bldc_zerocros08mr 32\sources\const_cust_evm.h , definitions for software customizing for evm motor board (12 v low power) ...\bldc_zerocros08mr 32\sources\const_cust_lv.h , definitions for software customizing for lo w-voltage (12 vdc) power board according to hardware used, the designated file (see table 6-1 ) must be selected by including: ...\bldc_zerocros08m r32\sources\code_fun.c , program 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 cust omizing to power stage the hardware boards parameters cu stomizing is provided in the const_cust_x.h file. note: skip this section, when standard modular motion control development hardware boards are used without any changes. when low-voltage power stage eclovacbldc is configured for 42 v, some const_cust_x.h changes are needed. for setting, follow the labels must_if_hw_change_nn in file const_cust_x.h from nn = 1. detailed de scription starts here. an example of software customiz ing to power stage is shown in example of software customizing to hardware . 6.5.3.2 maximal pwm duty cycle maximal pwm duty cycle [-]: f r e e s c a l e s e m i c o n d u c t o r , i freescale semiconductor, inc. f o r m o r e i n f o r m a t i o n o n t h i s p r o d u c t , g o t o : w w w . f r e e s c a l e . c o m n c . . . user guide tuning for customer motor DRM028 ? rev 0 designer reference manual motorola user guide 135 /* must_if_hw_change_1: */ #define duty_pwm_max 0.96 range: <0,1> proportional value of maximal pw m duty cycle is determined by power stage boards used. duty_pwm_max must be set for any hardw are customizing. some hardware boards need maximal duty cycl e<1, in order to charge high side drivers for power inverters. 6.5.3.3 voltage setting hardware customizing maximal measurable volt age determined by hard ware voltage sensing [v]: /* must_if_hw_change_2: */ # define volt_hw_max 407.0 range: <0,infinity) volt_hw_max must be changed when volt age sensing range 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. therefore, setting this constant is also mentioned in maximal and minimal voltage limits setting under a different label ( can_change_1 ). 6.5.3.4 current settin g hardware customizing maximal measurable curr ent determined by hardw are current sensing [a]: /* must_if_hw_change_4: */ #define curr_hw_max_a 2.93 range: <0,infinity) f r e e s c a l e s e m i c o n d u c t o r , i freescale semiconductor, inc. f o r m o r e i n f o r m a t i o n o n t h i s p r o d u c t , g o t o : w w w . f r e e s c a l e . c o m n c . . . user guide designer reference manual DRM028 ? rev 0 136 user guide motorola minimal measurable cu rrent determined by har dware current sensing [a]: /* must_if_hw_change_5: */ #define curr_hw_min_a (-2.93) range: (-infinity,0> curr_hw_max_a and curr_hw_min_a must be changed when current sensing range is di fferent from default hardware. maximal limit of dc-bus curren t allowable for the hardware [a]: /* must_if_hw_change_6: */ #define curr_max_fault_a 1.5 range: <0,current_range_max_a> curr_max_fault_a determines the maxima l current when the drive fault state should be entered. so , it must be set to the maximum current allowed for the power stage or the motor (see also maximal and minimal current limits setting ) 6.5.3.5 example of softwa re customizing to hardware let?s have low-voltage power sta ge eclovacbldc m odified to 42 v (from 12 v) as described in its do cumentation. so, software must be customized for hardwar e changes. because of low-voltage set, the const_cust_lv.h must be modified 1. maximal pwm duty cycl e remains the same: #define duty_pwm_max 0.942 2. modified maximal m easurable voltage is 55 v, so set: #define volt_hw_max 55.0 3. maximum limit of dc- bus voltage should be set according to motor or application r equirements, but volt_max_fault_v > 42v #define volt_max_fault_v 63.0 4. board modified to 42 v has maximal measurable current unchanged #define curr_hw_max_a 2.93 #define curr_hw_min_a (-2.93) 5. maximum limit of dc-bus curr ent should remain unchanged or set according to motor or application requirements: #define curr_max_fault_a 45.0 f r e e s c a l e s e m i c o n d u c t o r , i freescale semiconductor, inc. f o r m o r e i n f o r m a t i o n o n t h i s p r o d u c t , g o t o : w w w . f r e e s c a l e . c o m n c . . . user guide tuning for customer motor DRM028 ? rev 0 designer reference manual motorola user guide 137 when the software parameters are set for the hardware, you should follow the settings in software customizing to motor ? voltage and current settings . 6.5.4 software custom izing to motor ? voltag e and current settings the software parameter settings a ccording to customer motor are described in this section. note: first of all, voltage a nd current settings need to be done. for settings which must be done, follow the labels must_change_nn and must_change_exper_nn in file const_cust_x.h where nn = 1. for changes which can be done (but usually are not necessary), follow the labels can_change_nn and can_change_exper_nn in file const_cust_x.h detailed description starts here. 6.5.4.1 maximal and minima l voltage limits setting most of voltage limit settings do not nece ssarily 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 according to maximal voltage limit of the motor or t he power stage, using the lo wer value. therefore, the setting of this consta nts is also mentioned in voltage setting hardware customizing under a different label must_if_hw_change_3 . it should be changed when there are problems with over-voltage. minimal limit of dc -bus voltage [v]: /* can_change_2_exper: */ #define volt_min_fault_v 100.0 range: <0,volt_range_max> f r e e s c a l e s e m i c o n d u c t o r , i freescale semiconductor, inc. f o r m o r e i n f o r m a t i o n o n t h i s p r o d u c t , g o t o : w w w . f r e e s c a l e . c o m n c . . . user guide designer reference manual DRM028 ? rev 0 138 user guide motorola volt_min_fault_v determines the mini mal voltage when the drive fault state should be entered. so the constants volt_min_fault_v must be set accordi ng to minimal voltage limits of the motor appl ication. it should be changed when there are problems with under-voltage. dc-bus voltage threshol d mains 120v/230v [v]: /* can_change_10: */ #define volt_120_threshold_v 150 range: <0,volt_range_max> 120 v voltage threshold setting s hould only be used for high-voltage hardware. it determines if 120 or 230 v mains voltage will be detected by software. but the volt_120_threshold_ v detection has no importance for the software func tionality! for lo w-voltage hardware the volt_120_threshold_v should be set to 0. 6.5.4.2 maximal and minima l current limits setting most of current limits settings do not necessarily need to be done. current offset limit for fault duri ng calibration (initi alization) [v]: /* can_change_4: */ #define offset_max_curr_v (1.65+0.225) range: <0,5> when pwm is off, the def ault hardware determined offset should be 1.65 v.the actual offset is checked during cu rrent calibration. the fault offset limit should be: offset_max_curr_v = default h/w offset + minimal allowed of fset error (eq 6-3.) offset_max_curr_v should only be changed if there are over-current problems during current offset calibration (at mcu initialization). maximal limit of dc-bus current [a]: /* can_change_3: */ #define curr_max_fault_a 1.5 range: <0,current_range_max_a> f r e e s c a l e s e m i c o n d u c t o r , i freescale semiconductor, inc. f o r m o r e i n f o r m a t i o n o n t h i s p r o d u c t , g o t o : w w w . f r e e s c a l e . c o m n c . . . user guide tuning for customer motor DRM028 ? rev 0 designer reference manual motorola user guide 139 curr_max_fault_a should be changed for a motor with maximal allowable current lower than the board. initial value for over -current counter [-]: /* can_change_5: */ #define i_cntr_ovc 0x04 range: <0,255> i_cntr_ovc determines the number of cu rrent samples with current value > curr_max_fault_a needed before enter ing the drive fault state. the current sampling period is per_cs_t1_us = 128 s at default software and pwm frequency setting. i_cntr_ovc should normally not be changed. lower value of i_cntr_ovc secures a fast, safer over-current switch-off. high value of i_cntr_ovc secures an unexpected over-current switch-off. 6.5.4.3 alignment current and current regulator setting the current during alignment st ate (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 no t able to deliver the r equired current, it is necessary to set a lower valu e then nominal motor current. note: curr_align_a can be evaluated with pc master software tuning file tuning_bldc.pmp. it might also be necessary to set the current pi r egulator constants: /* must_change_2_exper: */ #define curr_pireg_p_gainscaleleft 0 range: <0,8> /* must_change_3_exper: */ #define curr_pireg_p_gain 128 range: <0,255> where the current regulat or proportional gain is: kp = cur_pireg_p_gain*2 curr_oureg_p_gainscaleleft (eq 6-4.) /* must_change_4_exper: */ f r e e s c a l e s e m i c o n d u c t o r , i freescale semiconductor, inc. f o r m o r e i n f o r m a t i o n o n t h i s p r o d u c t , g o t o : w w w . f r e e s c a l e . c o m n c . . . user guide designer reference manual DRM028 ? rev 0 140 user guide motorola #define curr_pireg_i_gainscaleleft 0 range: <0,8> /* must_change_5_exper: */ #define curr_pireg_i_gain 64 range: <0,255> where the current regulat or integral gain is: kp = cur_pireg_i_gain*2 curr_pireg_i_gainscaleleft (eq 6-5.) these constants can be calculated a ccording to regulators theory. the current sampling (regulator execution) period is per_cs_t1_us = 128 s, at the default softwa re setting. normally it does not need to be changed (if change is required see pwm frequency and current sampling period setting ). another recomme nded solution is an experimental setting. note: curr_pireg_p_gainscaleleft, curr_pireg_p_gain, curr_pireg_i_gainscaleleft, curr_pireg_i_gain can be evaluated with pc master softwa re tuning file tuning_bldc.pmp. we suggest using pc mast er software with tuni ng file tuning_bldc.pmp for regulator parameters evaluatio n. 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 a lign (it will cause infinite time for alignment state, where the current is tuned) 3. build and run the code (see software execution , build , execute from evaluation board ) 4. start the pc master software tuning project 5. select current paramete rs tuning subproject (see software parameters tuning with pc ma ster software project file ) in order to be able to modi fy the curr ent regulator 6. you can see the actual current (and required alignment current) f r e e s c a l e s e m i c o n d u c t o r , i freescale semiconductor, inc. f o r m o r e i n f o r m a t i o n o n t h i s p r o d u c t , g o t o : w w w . f r e e s c a l e . c o m n c . . . user guide tuning for customer motor DRM028 ? rev 0 designer reference manual motorola user guide 141 on the current parameters tuni ng\new scope, or measure the powered motor coil curr ent on real oscilloscope 7. set pc master software contro l mode, and start the motor (see application control and pc master software (remote) operating mode ) figure 6-12. pc master software current parame ters tuning window 8. increase, step by st ep, the proportional gain curr_pireg_p_gain with pc ma ster 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 f r e e s c a l e s e m i c o n d u c t o r , i freescale semiconductor, inc. f o r m o r e i n f o r m a t i o n o n t h i s p r o d u c t , g o t o : w w w . f r e e s c a l e . c o m n c . . . user guide designer reference manual DRM028 ? rev 0 142 user guide motorola 9. if curr_pireg_p_ga in is set to 128, do further proportional gain increase curr_pireg_p _gainscaleleft with pc master software, steps 0, 1, 2...8, otherwise leave curr_pireg_p_gainscaleleft as 0 10. increase, step by step, the in tegral gain curr_pireg_i_gain with pc master software, up to cu rrent oscillation or noise, or up to 128 11. if curr_pireg_i_gain is set to 128, do further integral gain increases to curr_pireg_i_ga inscaleleft with pc master software, steps 0, 1, 2... 8; otherwise, leave curr_pireg_i_gainscaleleft as 0 12. you can further evaluate the setti ng of the regulator parameters in order to get a smoother current waveform, or until the regulation seems to be performing well 13. open const_cust_x.h and modify the regul ator parameters with the final variable va lues evaluated with pc master software 14. change the software back to norma l: in code_star t.c file, label tuning_1 remove goto (modify as comment): /* goto align */ (it will allow finishing alignment stat e when alignment period ends) 15. build the code (see software execution , build ) 16. you can also tune regulator dynam ic characteristics of current transients (steps 17. to 26. ) or finish the regulators tuning 17. run the code (see software execution and execute from evaluation board ) 18. start the pc master software tuning project 19. select current paramete rs tuning subproject (see software parameters tuning with pc ma ster software project file ) in order to be able to modi fy the curr ent regulator 20. you can see the actual current (and required alignment current) on the current parameters tuni ng\new scope, or measure the powered motor coil curr ent on real oscilloscope 21. set pc master software con trol mode and start motor (see application control and pc master software (remote) operating mode ) f r e e s c a l e s e m i c o n d u c t o r , i freescale semiconductor, inc. f o r m o r e i n f o r m a t i o n o n t h i s p r o d u c t , g o t o : w w w . f r e e s c a l e . c o m n c . . . user guide tuning for customer motor DRM028 ? rev 0 designer reference manual motorola user guide 143 22. observe the current tr ansient at alignment st art, then stop motor (or reset software) 23. then modify the regulator parameter s with pc master software as in steps 8. , 9. , 10. , and 11. 24. repeat steps 21. to 23. until regulation is improved 25. open const_cust_x.h and modify the regul ator parameters with the final variable va lues evaluated with pc master software 26. build the code (see software execution and build ) the last alignment settin g constant is alignm ent time period [ms]: /* must_change_6_exper: */ #define per_t_align_ms 1000.0 range: <0,per_bas e_t3_align_us/1000/255> this period can be set experimental ly. this constant can also be evaluated using pc master software tuning file. this period must be high enough to let the rotor stabilize during alignment state. it is recommended that you begin with large values su ch as 20,000 ms, then it can be lowered. the period should be set to ensure that the rotor (and, therefore, also t he current) is stabilized at the end of alignment state. 6.5.5 software customizin g to motor ? commutation and start-up control setting when all voltage and curr ent settings are done, the motor commutation and start-up parameters need to be set. for settings which must be done, follow the labels must_change_nn , must_change_exper_nn in file const_cust_x.h . for changes, which can be done (but us ually are not necessary), follow the labels can_change_nn , can_change_exper_nn in file const_cust_x.h note: thanks to the motorola patented start-up technique, the start parameters setting is quite simple and reliable. however, in order to reliably start the motor, the comm utation control constants must be properly set. detailed description starts here. f r e e s c a l e s e m i c o n d u c t o r , i freescale semiconductor, inc. f o r m o r e i n f o r m a t i o n o n t h i s p r o d u c t , g o t o : w w w . f r e e s c a l e . c o m n c . . . user guide designer reference manual DRM028 ? rev 0 144 user guide motorola 6.5.5.1 commutation parameters commutation time period to discharge coil current [ s] /* must_change_7: */ #define per_dis_us 300.0 range: <0,minimal commu tation period*coef_toff> it is the maximal allo wed current decay period, determined by motor winding and ma ximal current. must be: per_dis_us < minimal motor commutation period[ s] * coef_toff where: coef_toff is commutation toff per iod coefficient from const.h file explai ned in the section 3.3 used control technique . note: if per_dis_us is too high, it can cause commutation errors at high speed half commutation (advancing) coefficient [-]: /* can_change_9: */ #define coef_hlfcmt 0.375 range: <0,1> coef_hlfcmt , multiplied by commutatio n period, determines the time from back-emf zero crossing to motor commutation. so, it sets the electrical angle from ba ck-emf zero crossing to motor commutation step. the software cont rols bldc moto r with a 6-step commutation (six commutations per one electrical rotation), which means 60 between commutations . for ideal comm utation with no advancing (no field weakening), the back-emf zero crossing should be just in the middle between comm utations, which means that the electrical angle (zc-c mt angle), between back-emf zero crossing and commutation, is 30. (eq 6-6.) zc-cmt angle = 15 fo r coef_hlfcmt = 0.25 zc-cmt angle = 22.5 fo r coef_hlfcmt = 0.375 zc-cmt angle = 30 fo r coef_hlfcmt = 0.5 coef_hlfcmt zc-cmt angle 60 - - - - - - - - - - - - - - - - - - - - - - - = f r e e s c a l e s e m i c o n d u c t o r , i freescale semiconductor, inc. f o r m o r e i n f o r m a t i o n o n t h i s p r o d u c t , g o t o : w w w . f r e e s c a l e . c o m n c . . . user guide tuning for customer motor DRM028 ? rev 0 designer reference manual motorola user guide 145 in the real system, the zc-cmt angle is a little bit greater than the theoretical calculat ion. this is due to the re sponse time of the hardware back-emf zero crossing s ensing. therefore, the default software setting is coef_hlfcmt =0.375 normally, coef_hlfcmt should only be ch anged if you need a different commutation angle (time from back-emf ze ro crossing to commutation). for example, for motor field weakening. the relation between coef_hlfcmt and the commutat ion can also be defined by advance_angle, wh ich is the electrical angle shift from ideal commutation. (eq 6-7.) (eq 6-8.) advance_angle = 15 for coef_hlfcmt = 0.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 c onstants 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: */ #define per_cmt_start_us 4000.0 range: <0,per_cmt_max_us/2> per_cmt_start_us is the period used to ca lculate the first (start) commutation period. per_cmt_start_us period must be ch anged for any motor accommodation. it can be set exper imentally. if the motor displays errors during starting (back-emf acquisition) st ate, beginning advance_angle 30 deg zc-cmt angle ? = coef_hlfcmt 1 2 - advance_angle 60 - - - - - - - - - - - - - - - - - - - - - - - - - ? = f r e e s c a l e s e m i c o n d u c t o r , i freescale semiconductor, inc. f o r m o r e i n f o r m a t i o n o n t h i s p r o d u c t , g o t o : w w w . f r e e s c a l e . c o m n c . . . user guide designer reference manual DRM028 ? rev 0 146 user guide motorola running state, or has a low start- up torque, do decrease or increase the per_cmt_start_us value. table 6-2 shows typical setting examples. must be: per_cmt_start_us<=per_cmt_max_us/2 note: setting this constant is an empirical process. it is difficult to use a precise formula, because there ar e many factors involved which are difficult to obtain in the case of a real drive (motor and lo ad mechanical inertia, motor electromechanical constants, and sometimes also the motor load). so they need to be set with a specific motor. per_cmt_start_us can be evaluated with 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 peri od at start-up is to long. alignment to start increment of the regulators output [-]: /* can_change_7_exper: */ #define start_incr_ooutreg 20.0 range: <-128,127> table 6-2. start-up period motor size typical per_cmt_start_ us first-to-seco nd commutation step period second-to-thi rd commutation step period slow motor/high load and motor mechanical inertia 8000.0 s 8 ms 8?16 ms fast motor/high load and motor mechanical inertia 2000.0 s 2 ms 2?4 ms f r e e s c a l e s e m i c o n d u c t o r , i freescale semiconductor, inc. f o r m o r e i n f o r m a t i o n o n t h i s p r o d u c t , g o t o : w w w . f r e e s c a l e . c o m n c . . . user guide tuning for customer motor DRM028 ? rev 0 designer reference manual motorola user guide 147 start_incr_ooutreg should not necessari ly be changed for a motor accommodation. it can be set experimentally. if the motor has a low torque, increase the value. if the motor starts with a high speed, then slows down by regula tor, decrease the value. note: start_incr_ooutreg can be evaluated with pc master software tuning file tuning_bldc.pmp. number of successive feedbacks neces sary to enter th e running state [-]: /* can_change_8_exper: */ #define i_cntr_fok 0x03 range: <0,255> the motor starts spinning with sta rting (back-emf acquisition) state. the software enters regular running state with speed regulation after i_cntr_fok back-emf successive comm utation steps are done. usually it is not recommended to change i_cntr_fok , but it can be evaluated when there are pr oblems with motor start up. note: i_cntr_fok can be evaluated with pc mast er software tuning file uning_bldc.pmp. we suggest using pc mast er software with tuni ng file tuning_bldc.pmp for start-up parameters evaluatio n. you can use this procedure: 1. ensure that the alignment current and regulator were properly set ( alignment current and curr ent regulator setting ) 6.5.4.3 in const_cust_x.h 2. ensure that per_dis_us and coef_hlfcmt are properly set in const_cust_x.h 3. set #define per_cmt_start_us in const_cust_x.h according to table 6-2 . 4. ensure per_cmt_start_us <= per_cmt_max_us /2 5. set #define start_incr_ooutreg 20.0 in const_cust_x.h 6. in order to dis able speed regulator, temporarily change the software by clearing speed regulator parameters: 7. #define speed_pireg_p _gain 0 /* 64 */ f r e e s c a l e s e m i c o n d u c t o r , i freescale semiconductor, inc. f o r m o r e i n f o r m a t i o n o n t h i s p r o d u c t , g o t o : w w w . f r e e s c a l e . c o m n c . . . user guide designer reference manual DRM028 ? rev 0 148 user guide motorola #define speed_pireg_i_gain 0 8. in const_cust_x.h file 9. build and run the code (see software execution , build , and execute from evaluation board ) 10. start the pc master software tuning project 11. select start parameters tuning subproject (see software parameters tuning with pc ma ster software project file ) in order to be able to modi fy the start parameters 12. you can see the actual zero-c rossing (commutation) period on the start parameters tuning\new sco pe, or measure the phase a, b, and c voltages on a real oscilloscope f r e e s c a l e s e m i c o n d u c t o r , i freescale semiconductor, inc. f o r m o r e i n f o r m a t i o n o n t h i s p r o d u c t , g o t o : w w w . f r e e s c a l e . c o m n c . . . user guide tuning for customer motor DRM028 ? rev 0 designer reference manual motorola user guide 149 figure 6-13. pc master software start parameters tuning window 13. set pc master softwa re control mode (see application control and pc master software (r emote) operating mode ) 14. start motor (see application control and pc master software (remote) operating 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 we ll. if the motor starts against a high start-up tor que, or if alignment state current is low, click here for start parameters tuning click here to display oscilloscope modify values here click here to display control page f r e e s c a l e s e m i c o n d u c t o r , i freescale semiconductor, inc. f o r m o r e i n f o r m a t i o n o n t h i s p r o d u c t , g o t o : w w w . f r e e s c a l e . c o m n c . . . user guide designer reference manual DRM028 ? rev 0 150 user guide motorola it is recommended to change start_incr_ooutreg by pc master software. (if it is a problem to start the motor, then i_cntr_fok can also be changed from default 0x03, but not recommended!) 17. if the motor starts and conti nues running, after you repeatedly start/stop, the start-up parameters are set properly 18. open const_cust_x.h and modify paramet ers with the final variable values per_cmt_start_us, start_incr_ooutreg , evaluated with pc master software. 19. change the software back to normal, set speed regulator parameters to: 20. #define speed_pireg_p_gain 64 #define speed_pireg_i_gain 0 21. in const_cust_x.h file to enabl e speed regulation 22. build the code (see software execution and build ) 6.5.6 software cust omizing to motor ? s peed control setting when the motor commutation se tting is done, the speed control parameters need to be set. for settings which must be done, follow the labels must_change_nn , must_change_exper_nn in file const_cust_x.h . for changes which can be done (but usually are not necessary), follow the labels can_change_nn , can_change_exper_nn in file const_cust_x.h number of commutations per motor revolution: /* must_change_9: */ #define commut_rev 18.0 range: <0,255> f r e e s c a l e s e m i c o n d u c t o r , i freescale semiconductor, inc. f o r m o r e i n f o r m a t i o n o n t h i s p r o d u c t , g o t o : w w w . f r e e s c a l e . c o m n c . . . user guide tuning for customer motor DRM028 ? rev 0 designer reference manual motorola user guide 151 commut_rev period must be changed for any motor accommodation. set the number of commutations a ccording to the number of rotor poles (there are six commutations for one electrical angle revolution). therefore: (eq 6-9.) maximal speed range [rpm]: /* must_change_10: */ #define speed_range_max_rpm 3000.0 range: <0,infinity> determines scaling of speed variables. speed_range_max_rpm must be changed for any motor accommodation as the software calculates the internal speed variables using this cons tant. for proper speed control it is important to 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 in ternal speed variables using speed_range_max_rpm constant. for proper speed control it is important that speed_max_rpm and speed_range_max_rpm constants relation must be set according to the following equation: (eq 6-10.) minimal speed of the drive [rpm]: /* must_change_12_exper: */ #define speed_min_rpm 500.0 range: <0,speed_range_max_rpm> commut_rev 6*motor poles 2 - - - - - - - - - - - - - - - - - - - - - - - - - - = speed_max_rpm speed_range_max_rpm < f r e e s c a l e s e m i c o n d u c t o r , i freescale semiconductor, inc. f o r m o r e i n f o r m a t i o n o n t h i s p r o d u c t , g o t o : w w w . f r e e s c a l e . c o m n c . . . user guide designer reference manual DRM028 ? rev 0 152 user guide motorola speed_min_rpm determines the minimal des ired speed. it must be changed for any motor accommodati on. the minimal speed is also determined by the back-emf zero crossing technique. usually: (eq 6-11.) therefore, for low speed r equirements minimal speed speed_min_rpm must be evaluated experimentally. note: speed_min_rpm can be evaluated with pc ma ster software tuning file tuning_bldc.pmp. minimal pwm duty cycle limit [-]: /* can_change_11: */ #define duty_pwm_min 0.250 range: <0,1> duty_pwm_min determines minimal pwm duty cycle limit, and in this way it restricts mini mal voltage on the motor. therefore, duty_pwm_min must be changed if its default setting creates a higher voltage than is phys ically 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 regulat or constants: /* must_change_13_exper: */ #define speed_pireg_p_gainscaleleft 0 range: <0,8> /* must_change_14_exper: */ #define speed_pireg_p_gain 128 range: <0,255> where the current regulat or proportional gain is: (eq 6-12.) /* must_change_15_exper: */ #define speed_pireg_i_gainscaleright 0 range: <0,8> /* must_change_16_exper: */ #define speed_pireg_i_gain 64 speed_min_rpm (0.07 to 0.5)speed_max_rpm = kp speed_pireg_p_gain*2 speed_pireg_p_gainscaleleft = f r e e s c a l e s e m i c o n d u c t o r , i freescale semiconductor, inc. f o r m o r e i n f o r m a t i o n o n t h i s p r o d u c t , g o t o : w w w . f r e e s c a l e . c o m n c . . . user guide tuning for customer motor DRM028 ? rev 0 designer reference manual motorola user guide 153 range: <0,255> where the current regulat or integral gain is: (eq 6-13.) these constants can be calculated a ccording to regulators theory. the speed sampling (regulator execution) period is per_t3_run_us = 2.560 ms at default software setti ng. another recommended solution is experimental setting. note: speed_pireg_p_gainscalele ft, speed_pireg_p_gain, speed_pireg_i_gainscaleright , speed_pireg_i_gain can be evaluated with pc master soft ware tuning file tuning_bldc.pmp. we suggest using pc mast er software with tuni ng file tuning_bldc.pmp for regulator parameters evaluatio n. 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_g ainscaleright 7 speed_pireg_i_gain 0 3. ensure that commut_rev , speed_range_max_rpm , speed_max_rpm are set properly in const_cust_x.h 4. set speed_min_rpm as required (should be speed_min_rpm > speed_max_rpm/5 for reliable commutation at low speed) ki speed_pireg_i_gain*2 speed_pireg_i_gainscaleright ? () = f r e e s c a l e s e m i c o n d u c t o r , i freescale semiconductor, inc. f o r m o r e i n f o r m a t i o n o n t h i s p r o d u c t , g o t o : w w w . f r e e s c a l e . c o m n c . . . user guide designer reference manual DRM028 ? rev 0 154 user guide motorola figure 6-14. pc master softwa re speed paramete rs tuning window 5. build and run the code (see software execution , build , and execute from evaluation board ) 6. start the pc master software tuning project 7. select speed parameters tuning subproject (see software parameters tuning with pc ma ster software project file ) in order to be able to modi fy the curr ent 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 f r e e s c a l e s e m i c o n d u c t o r , i freescale semiconductor, inc. f o r m o r e i n f o r m a t i o n o n t h i s p r o d u c t , g o t o : w w w . f r e e s c a l e . c o m n c . . . user guide tuning for customer motor DRM028 ? rev 0 designer reference manual motorola user guide 155 9. set pc master software con trol mode and start motor (see application control and pc master software (remote) operating mode ) 10. set the speed to the middle of minimal and maximal speed 11. increase, step by st ep, the proportional gain speed_pireg_p_gain with pc master softw are, until speed noise or oscillation appears, or up to 128 12. if speed_pireg_p_gain is set to 128, increase proportional gains in speed_pireg_p_ga inscaleleft further with pc master software, steps 0, 1, 2 ... 8 otherwise leave speed_pireg_p_gai nscaleleft as 0 13. increase, step by step, the in tegral gain spee d_pireg_i_gain with pc master software, up to cu rrent oscillation or noise, or up to 128 14. if speed_pireg_i_gain is set to 128, do furthe r integral gain increases to speed_pireg_i _gainscaleleft with pc master software, steps 6, 5, 4...0; otherwise, leave speed_pireg_i_gai nscaleleft as 7 15. you can further evaluate the setti ng of the regulator parameters in order to get a smoother curren t waveform until the regulation seems to be performing well 16. open const_cust_x.h and modify the regul ator parameters with the final variable va lues evaluated with pc master software 17. start motor (see application control and pc master software (remote) operating mode ) 18. set minimal desired speed 19. if the displayed real speed is not able to go down to the desired minimal speed, it is necessary to decrease minimal pwm duty cycle duty_pwm_min in const_cust_x.h ! 20. then, you can tune dynamic char acteristics of speed regulators (steps 22. to 29. ) or finish tuni ng the regulators 21. start motor (see application control and pc master software (remote) operating mode ) f r e e s c a l e s e m i c o n d u c t o r , i freescale semiconductor, inc. f o r m o r e i n f o r m a t i o n o n t h i s p r o d u c t , g o t o : w w w . f r e e s c a l e . c o m n c . . . user guide designer reference manual DRM028 ? rev 0 156 user guide motorola 22. set minimal speed 23. set maximal speed and obs erve the speed transient 24. set minimal speed and obs erve the speed transient 25. then, modify the regul ator parameters with pc master software as in steps 11. to 14. 26. change speed_min_rpm if problems occur at low speed 27. repeat steps 21. to 25. until regulation is improved 28. open const_cust_x.h and modify the regul ator parameters with the final variable va lues evaluated with pc master software 29. build the code (see software execution and build ) most important software settings ar e described in previous sections, but for some applications, pw m frequency must be modifi ed. it is described in pwm frequency and current sampling period setting . once you set the speed c ontrol and the motor is running in all start, speed up, and slow down conditions, t he software parameters are set for the motor. remember that all parameters are set in const_cust_x.h . then, it is possible to program th e flash memory of the mc68hc908mr32 device. 6.5.7 pwm frequency and current sampling period setting pwm frequency and current sampling peri od settings are not usually needed. the pwm frequency also affect s the current sa mpling period. consequently, the current regulation setting should be done, while understanding thei r mutual dependency. theref ore, the pwm frequency setting is provided in the file const.h , instead of const_cust_x.h . 6.5.7.1 pwm frequency for the pwm frequency sett ing, follow the label can_change_fpwm_n in const.h file. the pwm frequency setting is provided by: /* can_change_fpwm_1: */ #define set_per_pwm 32.0 f r e e s c a l e s e m i c o n d u c t o r , i freescale semiconductor, inc. f o r m o r e i n f o r m a t i o n o n t h i s p r o d u c t , g o t o : w w w . f r e e s c a l e . c o m n c . . . user guide tuning for customer motor DRM028 ? rev 0 designer reference manual motorola user guide 157 range: <1,255> the final pwm period is defined by setting set_per_pwm . the pwm period [ s] is: pwm period = period_pwm_us = set_per_pwm*2 (eq 6-14.) with default software setti ng (oscillator clock, etc.). the final pwm frequency [hz] is: (eq 6-15.) with default software setting. settings for some important pwm frequencies ar e listed in table 6-3 . caution: current measurement sampling peri od is synchronized with pwm. therefore, changing pw m frequency automatically changes the current sampling period. this, apart from other things, effects the current regulator. therefore, after chang ing pwm frequency, changing (or checking) current sampling per iod is strongly recommended. 6.5.7.2 current sampling period current sampling period should usually be cha nged 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 period of 128 s, the current regulato r may not work properly. table 6-3. pwm frequency setting set_per_pwm pwm frequency (frequency_pwm) pwm period (period_pwm_us) 16.0 31.250 hz 32 s 25.0 20.000 hz 50 s 32.0 (default) 15.625 hz 64 s 128.0 3.90625 hz 256 s pwmfrequency 10 6 2set_per_pwm ------------------------------------------------ - = f r e e s c a l e s e m i c o n d u c t o r , i freescale semiconductor, inc. f o r m o r e i n f o r m a t i o n o n t h i s p r o d u c t , g o t o : w w w . f r e e s c a l e . c o m n c . . . user guide designer reference manual DRM028 ? rev 0 158 user guide motorola for current sampling peri od setting follow the label can_change_p ercursamp_n in const.h file. current sampling period setting is provided by: /* can_change_fpwm_n: */ /* can_change_percursamp_n: */ #define set_per_cs 2.0 range: <1,-> the final current sa mpling period [ s] is: (eq 6-16.) current sampling period = pwm period * set_per_cs [ s] per_cs_t1_us = period_pwm_us * set_per_cs [ s] 6.5.7.3 current sampling instant time period from a pwm reload event (middle of central aligned pwm) to current sampling (time shift of a/d conversion with pwm) [ s]: /* can_change_percursamp_n: */ #define per_pwm_cs_us 5.0 range: <-period_pwm_u s/2,period_pwm_us/2> usually it is not recommended to change per_pwm_cs_us , but it can be evaluated when ther e are problems with ba ck-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 done, the software should be customized to customer motor. if the software customizing of your motor was not successful, it is recommended that you read application suitability guide , since the current sampling period pwm period*set_per_cs = period_pwm_us 2 ---------------------------------------------------- ? per_pwm_cs_us period_pwm_us 2 ---------------------------------------------------- << f r e e s c a l e s e m i c o n d u c t o r , i freescale semiconductor, inc. f o r m o r e i n f o r m a t i o n o n t h i s p r o d u c t , g o t o : w w w . f r e e s c a l e . c o m n c . . . user guide tuning for customer motor DRM028 ? rev 0 designer reference manual motorola user guide 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. f r e e s c a l e s e m i c o n d u c t o r , i freescale semiconductor, inc. f o r m o r e i n f o r m a t i o n o n t h i s p r o d u c t , g o t o : w w w . f r e e s c a l e . c o m n c . . . user guide designer reference manual DRM028 ? rev 0 160 user guide motorola f r e e s c a l e s e m i c o n d u c t o r , i freescale semiconductor, inc. f o r m o r e i n f o r m a t i o n o n t h i s p r o d u c t , g o t o : w w w . f r e e s c a l e . c o m n c . . . DRM028 ? rev 0 designer reference manual motorola references 161 designer reference manual ? sensorless bldc motor control appendix a. references 1. sensorless bldc motor control on mc68hc908mr32 - software porting to customer motor (document order number an2356/d), motorola 2002 2. motion control development tools found on the world wide web at: http://e-www.motorola.com 3. motorola embedded motion con trol mc68hc908mr32 control board user?s manual , (document order number memcmr32cbum/d), motorola 2000 4. motorola embedded motion control 3-phase ac bldc high-voltage power stage user?s manual (document order number memc3pbldcpsum /d), motorola 2000 5. motorola embedded motion con trol optoisolation board (document order number me mcobum/d), motorola 2000 6. motorola embedded motion con trol evaluation motor board user?s manual (document order num ber memcevmbum/d), motorola 2000 7. motorola embedded motion cont rol 3-phase bldc low-voltage power stage user?s manual (document order number memc3pbldclvum/d), motorola 2000 8. user?s manual for pc master software, mo torola 2000, found on the world wide web at: http://e-www.motorola.com 9. 68hc908mr32, 68hc908mr16 advance information (document order number mc68hc908mr32/d), motorola 10. low cost high efficiency sensor less drive for brushless dc f r e e s c a l e s e m i c o n d u c t o r , i freescale semiconductor, inc. f o r m o r e i n f o r m a t i o n o n t h i s p r o d u c t , g o t o : w w w . f r e e s c a l e . c o m n c . . . references designer reference manual DRM028 ? rev 0 162 references motorola motor using mc68hc(7)05mc4 (document order number an1627), motorola f r e e s c a l e s e m i c o n d u c t o r , i freescale semiconductor, inc. f o r m o r e i n f o r m a t i o n o n t h i s p r o d u c t , g o t o : w w w . f r e e s c a l e . c o m n c . . . DRM028 ? rev 0 designer reference manual motorola glossary 163 designer reference manual ? sensorless bldc motor control appendix b. glossary ac ? alternative current. acim ? ac induction motor. a/d converter ? analog to digital converter. adc ? analog to digital converte r - see ?a/d converter? back-emf ? back electro-motive force (i n this document it means the voltage inducted into motor winding due to rotor movement) bldc ? brushless dc motor. cw ? codewarrior - compille rs produced by metrowerks dc ? direct current. dc-bus ? part of power converter with direct current dc-motor ? direct current motor, if not mentioned di fferently, 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 invert er half bridge and tu rning on of the complementary transistor due to t he limited switching speed of the transistors. duty cycle ? a ratio of the amount of time the signal is on versus the time it is off. duty cycle is us ually represented by a percentage. eclovacbldc ? 3-ph ac/bldc low vo ltage power stage ecmtrlovbldc ? 3-ph bldc low voltage motor-brake sm40n + sg40n f r e e s c a l e s e m i c o n d u c t o r , i freescale semiconductor, inc. f o r m o r e i n f o r m a t i o n o n t h i s p r o d u c t , g o t o : w w w . f r e e s c a l e . c o m n c . . . glossary designer reference manual DRM028 ? rev 0 164 glossary motorola ecmtreval ? evaluation motor board ki t (supplied in kit with trapezoidal bldc ib23810) ecopthivacbldc ? 3-ph ac/bldc high voltage power stage + optoisolation board ecmtrhivbldc ? 3-ph bldc high voltage motor-brake sm40v + sg40n ecoptinl ? optoisolation between hos t computer and mcu board evaluation or customer tar get cards (optoisolation board) ecopt ? optoisolation between power stage and processor evaluation or controller cards (i n line optoisolator) ecctr908mr32 ? motor control bo ard for hc908mr32 ide ? integrated devel opement environment interrupt ? a temporary break in the sequential exec ution of a program to respond to signals fro m peripheral devices by executing a subroutine. input/output (i/o) ? input/output interfac es between a computer system and the external world. a cpu reads an input to sense the level of an external signal an d writes to an output to change the level on an external signal. kitmmds08mr32 ? mmds 68hc908mr32/16 developement kit logic 1 ? a voltage level approximately equal to the inpu t power voltage (v dd ). logic 0 ? a voltage level approximatel y equal to t he ground voltage (v ss ). m68hc8 ? a motorola family of 8-bit mcus. mc ? motor control mcu ? microcontroller unit. a comp lete computer system, including a cpu, memory, a clock oscillator, and input/output (i/o) on a single integrated circuit. mw ? metrowerks corporation f r e e s c a l e s e m i c o n d u c t o r , i freescale semiconductor, inc. f o r m o r e i n f o r m a t i o n o n t h i s p r o d u c t , g o t o : w w w . f r e e s c a l e . c o m n c . . . glossary DRM028 ? rev 0 designer reference manual motorola glossary 165 pcm ? pc master software for comm unication between pc computer and system phase-locked loop (pll) ? a clock generator circuit in which a voltage controlled oscillator produces an osci llation which is synchronized to a reference signal. pmp ? pc master soft ware project file pval ? pwm value register of mo tor control pwm module of mc68hc908mr32 microcon troller. it defines the duty cycle of generated pwm signal. pwm ? pulse width modulation reset ? to force a device to a known condition. sci ? see "serial communication interface module (sci)." serial communications inte rface module (sci) ? a module that supports asynchronous communication. serial peripheral inte rface 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 an interrupt and its associated vector fetch. spi ? see "serial peripheral interface module (spi)." sr ? switched reluctance motor. timer ? a module used to relate events in a system to a point in time. f r e e s c a l e s e m i c o n d u c t o r , i freescale semiconductor, inc. f o r m o r e i n f o r m a t i o n o n t h i s p r o d u c t , g o t o : w w w . f r e e s c a l e . c o m n c . . . glossary designer reference manual DRM028 ? rev 0 166 glossary motorola f r e e s c a l e s e m i c o n d u c t o r , i freescale semiconductor, inc. f o r m o r e i n f o r m a t i o n o n t h i s p r o d u c t , g o t o : w w w . f r e e s c a l e . c o m n c . . . f r e e s c a l e s e m i c o n d u c t o r , i freescale semiconductor, inc. f o r m o r e i n f o r m a t i o n o n t h i s p r o d u c t , g o t o : w w w . f r e e s c a l e . c o m n c . . . how to reach us: usa/europe/locations not listed: motorola literature distribution; p.o. box 5405, denver, colorado 80217 1-303-675-2140 or 1-800-441-2447 japan: motorola japan ltd.; sps, technical information center, 3-20-1, minami-azabu minato-ku, tokyo 106-8573 japan 81-3-3440-3569 asia/pacific: motorola semiconductors h.k. ltd.; silicon harbour centre, 2 dai king street, tai po industrial estate, tai po, n.t., hong kong 852-26668334 technical information center: 1-800-521-6274 home page: http://motorola.com/semiconductors information in this document is provided solely to enable system and software implementers to use motorola 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. motorola reserves the right to make changes without further notice to any products herein. motorola makes no warranty, representation or guarantee regarding the suitability of its products for any partic ular purpose, nor does motorola assume any liability arising out of the app lication or use of any product or circuit, and specifically disclaims any and all liability, including withou t limitation consequential or incidental damages. ?typical? parameters which may be provided in motorola 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. motorola does not convey any license under its patent rights nor the rights of others. motorola products are not desig ned, 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 motorola product could create a situation where personal injury or death may occur. should buyer purchase or use motorola products for any such unintended or unauthorized application, buyer shall indemnify and hold motorola 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 motorola was negligent regarding the design or manufacture of the part. motorola and the stylized m logo are registered in the u.s. patent and trademark office. digital dna is a trademark of motorola, inc. all other product or service names are the property of their respective owners. motorola, inc. is an equal opportunity/affirmative action employer. ? motorola, inc. 2003 DRM028/d f r e e s c a l e s e m i c o n d u c t o r , i freescale semiconductor, inc. f o r m o r e i n f o r m a t i o n o n t h i s p r o d u c t , g o t o : w w w . f r e e s c a l e . c o m n c . . . |
Price & Availability of DRM028
![]() |
|
|
All Rights Reserved © IC-ON-LINE 2003 - 2022 |
[Add Bookmark] [Contact Us] [Link exchange] [Privacy policy] |
Mirror Sites : [www.datasheet.hk]
[www.maxim4u.com] [www.ic-on-line.cn]
[www.ic-on-line.com] [www.ic-on-line.net]
[www.alldatasheet.com.cn]
[www.gdcy.com]
[www.gdcy.net] |