The Datasheet Archive - 100 Million Datasheets from 7500 Manufacturers.    


Datasheet Search Engine   
 
Part # or Description: • 5V RS232 Driver • 2SC5066* • "Real Time Clock" • "USB connector" • "blue led" 5mm • 10 watt zener diode • 2N3055* motorola
 
Search Tip: Try entering the part number only. Include a wildcard (eg. lm317* or 1n4148*)

 

 

3-Phase Switched Reluctance Motor Control with Encoder Using DSP56F80x


Datasheet Thumbnail

  

Download PDF



Top Searches for this datasheet



Order AN1937/D (Motorola Order Number) Rev. 9/02
3-Phase Switched Reluctance Motor Control with Encoder Using DSP56F80x
Design Motor Control Application Based Motorola Software Development
Peter Balazovic, Radim Visinka
Contents
Introduction Motorola DSP, Advantages Features Target Motor Theory.
Switched Reluctance Motor Mathematical Description Motor Digital Control Motor Voltage Current Control Motors.10
Switched Reluctance Motor Control Techniques with Encoder Position Sensor
Encoder Sensor Commutation Angle Calculation Commutation Strategy Current Controller.16
Introduction
This Application Note describes design advanced 3-Phase Switched Reluctance (SR) motor drive. based Motorola's DSP56F80x family dedicated motor control devices. software design takes advantage (Software Development Kit) developed Motorola. motors gaining wider popularity among variable speed drives. This their simple low-cost construction characterized absence magnets rotor winding, high level performance over wide range speeds, fault-tolerant power stage design. numerous applications, availability moderate cost necessary electronic components make drives viable alternative other commonly used motors like BLDC, Synchronous universal motors. concept this application advance speed closed loop drive with encoder position sensor. inner current loop with controller included. encoder position sensor provides accurate measurement actual rotor position necessary proper commutation. This application serves example advanced motor control. entire system designed using Motorola with support. also illustrates usage dedicated motor control libraries that included SDK. application helps start development advanced drive dedicated targeted application.
System Design
System Outline Application Description
Hardware Implementation
Hardware Setup.30 Motor-Brake Specifications
Software Design
Data Flow State Diagram.38 Software Design
Implementation Notes
Scaling Quantities Velocity Calculation
Implementation
Drivers Library Function.49 Appconfig.h File Initialization Drivers Interrupts Master Software
Usage References
Motorola, Inc., 2002. rights reserved.
More Information This Product, www.freescale.com
3-Phase Motor Control with Encoder
Motorola DSP, Advantages Features
This Application Note includes description Motorola features, basic motor theory, system design concept, hardware implementation, software design including software visualization tool.
Motorola DSP, Advantages Features
Motorola DSP56F80x family well suited digital motor control, combining DSP's computational ability with MCU's controller features single chip. These DSPs offer many dedicated peripherals like Pulse Width Modulation (PWM) unit, Analog-to-Digital Converter (ADC), timers, communications peripherals (SCI, SPI, CAN), on-board Flash RAM. Generally, family members well-suited Switched Reluctance motor control. typical member family, DSP56F805, provides following peripheral blocks: Pulse Width Modulator modules (PWMA PWMB), each with outputs, three Current Sense inputs, four Fault inputs; fault tolerant design with deadtime insertion; supports both Center- Edge- aligned modes Twelve bit, Analog Digital Converters (ADCs), supporting simultaneous conversions with dual 4-pin multiplexed inputs; synchronized Quadrature Decoders (Quad Dec0 Quad Dec1), each with four inputs, additional Quad Timers dedicated General Purpose Quad Timers totaling pins: Timer with pins Timer with pins Module with 2-pin ports used transmit receive Serial Communication Interfaces (SCI0 SCI1), each with pins, four additional GPIO lines Serial Peripheral Interface (SPI), with configurable 4-pin port, four additional GPIO lines Computer Operating Properly (COP) Watchdog Timer dedicated external interrupt pins Fourteen dedicated General Purpose (GPIO) pins, multiplexed GPIO pins External reset hardware reset JTAG/On-Chip Emulation (OnCE) Software-programmable, Phase Lock Loop-based frequency synthesizer core clock Table 2-1. Memory Configuration
DSP56F801 Program Flash Data Flash Program Data Boot Flash 8188 16-bit 16-bit 16-bit 16-bit 16-bit DSP56F803 32252 16-bit 16-bit 16-bit 16-bit 16-bit DSP56F805 32252 16-bit 16-bit 16-bit 16-bit 16-bit DSP56F807 61436 16-bit 16-bit 16-bit 16-bit 16-bit
3-Phase Motor Control with Encoder More Information This Product, www.freescale.com
MOTOROLA
Motorola DSP, Advantages Features
most interesting peripherals, from switched reluctance motor control point view, fast Analog-to-Digital Converter (ADC) Pulse-Width-Modulation (PWM) on-chip modules. They offer extensive freedom configuration, enabling efficient control motors. module incorporates generator, enabling generation control signals motor power stage. module following features: Three complementary signal pairs, independent signals Complementary channel operation Deadtime insertion Separate bottom pulse width correction current status inputs software Separate bottom polarity control Edge-aligned center-aligned signals bits resolution Half-cycle reload capability Integral reload rates from Individual software-controlled output Programmable fault protection Polarity control 20mA current sink capability pins Write-protectable registers
motor control application utilizes module independent mode, permitting fully independent generation control signals switches power stage. addition generators, outputs controlled separately software, allowing setting control signal logical Thus, state control signals changed instantly given rotor position (phase commutation) without changing contents value registers. This change made asynchronously with duty cycle update. Analog-to-Digital Converter (ADC) consists digital control module analog sample hold (S/H) circuits. following features: 12-bit resolution Maximum clock frequency 5MHz with 200ns period Single conversion time clock cycles (8.5 1.7µs) Additional conversion time clock cycles 1.2µs) Eight conversions 26.5 clock cycles (26.5 5.3µs) using simultaneous mode synchronized sync signal Simultaneous sequential sampling Internal multiplexer select eight inputs Ability sequentially scan store eight measurements Ability simultaneously sample hold inputs Optional interrupts scan zero crossing out-of-range limit exceeded Optional sample correction subtracting pre-programmed offset value Signed unsigned result Single ended differential inputs
MOTOROLA
3-Phase Motor Control with Encoder More Information This Product, www.freescale.com
Target Motor Theory
application utilizes on-chip module simultaneous mode sequential scan. sampling synchronized with pulses precise sampling reconstruction phase currents. Such configuration allows instant conversion desired analog values phase currents, voltages temperatures.
Target Motor Theory
Switched Reluctance Motor
Switched Reluctance (SR) motor rotating electric machine where both stator rotor have salient poles. stator winding comprised coils, each which wound pole. rotor created from lamination order minimize eddy-current losses.
motors differ number phases wound stator. Each them certain number suitable combinations stator rotor poles. Figure illustrates typical 3-Phase motor with (stator/rotor) pole configuration.
Phase Phase Phase Stator poles)
Stator Winding
Rotor poles)
Aligned position Phase
Figure 3-1. 3-Phase Motor motor excited sequence current pulses applied each phase. individual phases consequently excited, forcing motor rotate. current pulses need applied respective phase exact rotor position relative excited phase. When pair rotor poles exactly line with stator poles selected phase, phase said aligned position, i.e., rotor position maximal stator inductance (see Figure 3-1). interpolar axis rotor in-line with stator poles selected phase, phase said unaligned position rotor position minimal stator inductance. inductance profile motors triangular shaped, with maximum inductance when aligned position minimum inductance when unaligned. Figure illustrates idealized triangular-like inductance profile three phases motor with phase highlighted. individual Phases shifted electrically 120o relative each other. interval, when respective phase powered, called dwell angle dwell. defined turn-on turn-off angle.
3-Phase Motor Control with Encoder More Information This Product, www.freescale.com
MOTOROLA
Target Motor Theory
When voltage applied stator phase, motor creates torque direction increasing inductance. When phase energized minimum inductance position, rotor moves forthcoming position maximal inductance. movement defined magnetization characteristics motor. typical current profile constant phase voltage shown Figure 3-2. constant phase voltage phase current maximum position when inductance starts increase. This corresponds position when rotor stator poles start overlap. When phase turned off, phase current falls zero. phase current present region decreasing inductance generates negative torque. torque generated motor controlled applied phase voltage appropriate definition switching turn-on turn-off angles. more details, [3]. apparent from description, motor requires position feedback motor phase commutation. many cases, this requirement addressed using position sensors, like encoders, Hall sensors, etc. result that implementation mechanical sensors increases costs decreases system reliability. Traditionally, developers motion control products have attempted lower system costs reducing number sensors. variety algorithms sensorless control have been developed, most which involve evaluation variation magnetic circuit parameters that dependent rotor position [2], [5].
6WDWRU 3KDVH 5RWRU
$OLJQHG
8QDOLJQHG
$OLJQHG
LSK$
SRVLWLRQ WLPH
SKDVH HQHUJL]LQJ
GZHOO RQBSK$ RIIBSK$
SRVLWLRQ WLPH
Figure 3-2. Phase Energizing motor itself cost machine simple construction. High-speed operation possible, thus motor suitable high speed applications, like vacuum cleaners, fans, white goods, etc. discussed above, disadvantage motor need shaft-position information proper switching individual phases. Also, motor structure causes noise torque ripple. greater number poles, smoother torque ripple, motor construction control electronics become more expensive. Torque ripple also reduced advanced control techniques, such phase current profiling.
MOTOROLA
3-Phase Motor Control with Encoder More Information This Product, www.freescale.com
Target Motor Theory
Mathematical Description Motor
motor highly non-linear system, non-linear theory describing behavior motor developed. Based this theory, mathematical model created. hand enables simulation motor systems other hand, makes development implementation sophisticated algorithms controlling motor easier. electromagnetic circuit motor characterized non-linear magnetization. Figure illustrates magnetization characteristic specific motor [1]. function between magnetic flux phase current motor position influence phase current mostly apparent aligned position, where saturation effects observed. magnetization characteristic curve defines non-linearity motor. torque generated motor phase function magnetic flux, therefore phase torque constant constant phase current different motor positions. This creates torque ripple noise motor.
Figure 3-3. Magnetization Characteristics Motor mathematical model motor developed. model based electrical diagram motor, incorporating phase resistance phase inductance [1]. diagram phase illustrated Figure 3-4.
3-Phase Motor Control with Encoder More Information This Product, www.freescale.com
MOTOROLA
Target Motor Theory
Figure 3-4. Electrical Diagram Motor Phase According Figure 3-4, voltage applied phase motor described voltage drops phase resistance induced voltages phase inductance:
where: uLph voltage applied phase phase resistance phase current induced voltages over phase inductance.
3-1.)
equation 3-1.) supposes that phases independent have mutual influence. induced voltage uLph defined magnetic flux linkage that function phase current rotor position induced voltage expressed
Then phase voltage expressed
3-2.)
3-3.)
where:
3-4.)
angular speed motor.
MOTOROLA
3-Phase Motor Control with Encoder More Information This Product, www.freescale.com
Target Motor Theory
torque generated phase expressed
3-5.)
mathematical model motor then represented system equations, describing conversion electromechanical energy. 3-Phase motors equation 3-4.) expanded follows:
3-6.)
where index individual phases.
3-7.)
3-8.)
stated above equations, mutual effect between individual phases considered.
Digital Control Motor
motor driven voltage strokes coupled with given rotor position. profile phase current together with magnetization characteristics define generated torque thus speed motor. this fact, motor requires electronic control operation. Several power stage topologies being implemented, according number motor phases desired control algorithm. particular structure power stage structure defines freedom control individual phase. power stage with independent power switches motor phase most used topology. Such power stage 3-Phase motors illustrated Figure 3-5. permits control individual phases fully independent each other thus permits widest freedom control. Other power stage topologies share some power devices several phases, thus saving power stage cost, with these phases cannot controlled fully independently. Note that this particular topology power stage fault tolerant, contrast power stages induction motors, because eliminates possibility rail-to-rail short circuit. During normal operation, electromagnetic flux motor constant must built every stroke. motoring period, these strokes correspond rotor position when rotor poles approaching corresponding stator pole excited phase. case Phase shown Figure 3-1, stroke established activating switches low-speed operation Pulse Width Modulation (PWM), applied corresponding switches, modulates voltage level. basic switching techniques applied: Soft switching where transistor left turned during whole commutation period applied other Hard switching where applied both transistors simultaneously
3-Phase Motor Control with Encoder More Information This Product, www.freescale.com
MOTOROLA
Target Motor Theory
Voltage
PWM_Q1
PWM_Q3
PWM_Q5
Phase
Phase
Phase
PWM_Q2
PWM_Q4
PWM_Q6
Figure 3-5. 3-Phase Power Stage Figure illustrates both soft hard switching techniques. control signals upper lower switches above-described power stage define phase voltage thus phase current. soft switching technique generates lower current ripple compared hard switching technique. Also, produces lower acoustic noise less EMI. Therefore, soft switching techniques often preferred motoring operation. more details, [3].
Vhyvtrq 6yvtrq Vhyvtrq 6yvtrq
Dqphpr
Figure 3-6. Soft Switching Hard Switching
MOTOROLA 3-Phase Motor Control with Encoder More Information This Product, www.freescale.com
Target Motor Theory
Voltage Current Control Motors
number control techniques motors exist. They differ structure control algorithm position evaluation. basic techniques controlling motors distinguished, according motor variables that being controlled: Voltage control where phase voltage controlled variable Current control where phase current controlled variable
3.4.1 Voltage Control Motor
voltage control techniques, voltage applied motor phases constant during complete sampling period speed control loop. commutation phases linked position rotor.
voltage applied phase directly controlled speed controller. speed controller processes speed error, difference between desired speed actual speed, generates desired phase voltage. phase voltage defined duty cycle implemented DC-Bus voltage inverter. phase voltage constant during complete dwell angle. technique illustrated Figure 3-7. current voltage profiles seen Figure 3-8. phase current peak position when inductance starts increase (stator rotor poles start overlap) change inductance profile.
3RZHU 6WDJH
&RQWUROOHU GHVLUHG HUURU
6SHHG &RQWUROOHU 2XWSXW 'XW\ &\FOH *HQHUDWRU
DFWXDO
Figure 3-7. Voltage Control Technique
3-Phase Motor Control with Encoder More Information This Product, www.freescale.com
MOTOROLA
Target Motor Theory
SKDVH FXUUHQW GHFD\V WKURXJK EDFN GLRGHV
SRVLWLRQ WLPH
8'&%XV
SRVLWLRQ WLPH 6SHHG &RQWUROOHU 2XWSXW
'&%XV
Figure 3-8. Voltage Control Technique Voltage Current Profiles
3.4.2 Current Control Motor
current control techniques voltage applied motor phases modulated reach desired current powered phase. most applications, desired current constant during complete sampling period speed control loop. commutation phases linked position rotor. voltage applied phase controlled current controller with external speed control loop. speed controller processes speed error, difference between desired speed actual speed, generates desired phase current. current controller evaluates difference between actual desired phase current calculates appropriate duty cycle. phase voltage defined duty cycle implemented DC-Bus voltage inverter. Thus, phase voltage modulated rate current control loop. This technique illustrated Figure 3-9. processing current controller needs linked commutation phases. When phase turned (commutated), duty cycle 100% applied phase. increasing actual phase current regularly compared desired current. soon actual current slightly exceeds desired current, current controller turned Current controller controls output duty cycle until phase turned (following commutation). procedure repeated each commutation cycle motor. current voltage profiles seen Figure 3-10. ideal cases phase current controlled follow desired current.
MOTOROLA
3-Phase Motor Control with Encoder More Information This Product, www.freescale.com
Switched Reluctance Motor Control Techniques with Encoder Position Sensor
3RZHU 6WDJH
&RQWUROOHU GHVLUHG HUURU
6SHHG &RQWUROOHU
LGHVLUHG
LHUURU
2XWSXW 'XW\ &\FOH &XUUHQW &RQWUROOHU *HQHUDWRU
DFWXDO
LDFWXDO
Figure 3-9. Current Control Technique
LGHVLUHG
SKDVH FXUUHQW GHFD\V WKURXJK EDFN GLRGHV
8'&%XV
SRVLWLRQ WLPH
SRVLWLRQ WLPH &XUUHQW &RQWUROOHU 2XWSXW
'&%XV
Figure 3-10. Current Control Technique Voltage Current Profiles
Switched Reluctance Motor Control Techniques with Encoder Position Sensor
single-chip control system provides sufficient computational power advanced algorithms permitting efficient motor control over wide speed ranges. There several ways control motor. This control technique presents current control method with shaft position information.
3-Phase Motor Control with Encoder More Information This Product, www.freescale.com
MOTOROLA
Switched Reluctance Motor Control Techniques with Encoder Position Sensor
Encoder Sensor
Whenever mechanical rotary motions have monitored, encoder most important interface between mechanics control unit. Encoders transform rotary linear movement into sequence electrical pulses. rotary encoder differentiate number discrete positions revolution. number segments determines resolution movement hence accuracy position this number called points revolution. speed encoder counts-per-second. Although there various kinds digital encoders, most common optical encoder. Rotary linear optical encoders used frequently motion position sensing. disc plate containing opaque transparent segments passes between light source (such LED) detector interrupt light beam. electronic signals that generated then into controller where position velocity information calculated based upon signals received. Many incremental encoders also have feature called index pulse. rotary encoders index pulse occurs once encoder revolution. used establish absolute mechanical reference position within encoder count 360° encoder rotation. index signal used several tasks system. used reset preset position counter and/or generate interrupt signal system controller.
Phase
Phase time
Figure 4-1. Quadrature Encoder Signals Quadrature encoders particular kind incremental encoder with least output signals, generally called Phase Phase seen Figure 4-1, channel offset degrees from channel addition second channel provides direction information feedback signal. This signal, leading lagging electrical degrees, guarantees exact determination direction rotation times. ability detect direction critical encoder rotation stops pulse edge. Without ability decode direction, counter count each transition through rising edge signal lose position. Another benefit quadrature signal scheme ability electronically multiply counts during encoder cycle. times-1 mode, counts generated rising edges channel times-2 mode, both rising falling edges channel used generate counts. times-4 mode, rising falling edges channel channel used generate counts. This increases resolution factor four. encoders with sine wave output, channels interpolated very high resolution.
Commutation Angle Calculation
motor switched-on switched-off angles complex functions many parameters variable optimum operation. Their fine tuning necessary maintain optimum performance different motor speed load conditions. control firing angle accomplished number ways strongly depends position sensor. position information precisely acquired, possible suitably utilize sophisticated algorithm.
MOTOROLA
3-Phase Motor Control with Encoder More Information This Product, www.freescale.com
Switched Reluctance Motor Control Techniques with Encoder Position Sensor
This control technique varies firing angle continuously with fixed dwell angle. switched-on angle calculated such that excitation current should reach maximum defined value beginning stator rotor tooth overlap. phase current built corresponding windings stator since inductance minimum level unaligned position there adequate time increase desired value before motoring torque being produced. conduction angle remains fixed through entire application ensure phase current decreased before reaching braking region (following aligned position). calculation neglects stator winding resistance, which simplifies equation. resistance neglect recognized only large values resistance which case very small switched reluctance machines. Figure explains proposed algorithm advance angle calculation. computation method derived from 3-6.) 3-8.) rearranged into following expression
where:
4-1.)
voltage applied phase phase resistance phase current phase inductance rotor position
idesired iphase Lunaligned
uapplied
position time
100%
Figure 4-2. Commutation Angle Calculation unaligned phase inductance considered constant near turn-on instant. voltage drop across phase resistance neglected, then following expression given 4-2.) using first order approximation:
desired unaligned actual
3-Phase Motor Control with Encoder More Information This Product, www.freescale.com
4-2.)
MOTOROLA
Switched Reluctance Motor Control Techniques with Encoder Position Sensor
where:
advanced angle
idesired desired current achieved Lunaligned unaligned inductance uphase applied phase voltage
actual actual rotor speed
Commutation Strategy
general, commutation strategy determines performance motor. commutation method uses rotor position feedback derive commutating signals inverter switches. controlled parameters applied phase voltage turn-on angle dwell angle fixed prior motor starts. number commutations mechanical revolution proportional number rotor poles number stator phases 4-3.). arises from mechanical construction motor. number motor commutations calculated follows:
NumOfCommut
4-3.)
where:
umOfCommut number commutations mechanical revolution
number rotor poles number stator phases
motor usually described terms low-speed high-speed regions. low-speed operating region graphically depicted Figure 4-3. this low-speed operating area, phase current arbitrarily controlled desired value. Increasing rotor speed makes difficult control phase current. There influence back-EMF effect combined with diminishing amount time perform commutation.
Current Actual Inductance Estimated Inductance
idesired
advance
UDC-Bus
edge
360°
uapplied
Position Time
idesired reached
100%
Current Controller Output
-UDC-Bus
Figure 4-3. Commutation Strategy
MOTOROLA 3-Phase Motor Control with Encoder More Information This Product, www.freescale.com
Switched Reluctance Motor Control Techniques with Encoder Position Sensor
commutation itself performed number ways. presented control technique utilizes encoder sensor information initiate commutation routine, which ensures turn-off previous stator phase, consecutively next stator phase turned depending direction rotor rotation. appropriate firing angle, calculated through advance angle calculation (see Section 4.2). commutation software algorithm determines necessary advance angle, advance, turning correct stator phase. full DC-Bus voltage applied after switching correct phase advance instant. actual value phase current exceeds desired current value then current controller with sufficient controller initialization started maintain actual value phase current within requested magnitude. This achieved chopping DC-Bus voltage. simplest scheme leave lower transistor during current regulation switch upper high fixed frequency with varying duty cycle. This strategy often called soft switching (see Figure 3-6). current waveform during soft switching similar that shown Figure 4-3.
Current Controller
Basically, there three different modes operation, namely, voltage control, current control, single-pulse control. current control method normally used control torque efficiently, while single-pulse mode entered high-speed operation. main difficulty when designing switched reluctance motor current controllers that winding back electromotive force (back-EMF) electrical time constant vary significantly within electrical cycle with motor speed phase current level. voltage equation given 3-4.). This equation indicates nonlinear model which dependent position, current speed. electrical time constant phase winding back-EMF vary greatly with current rotor position. Figure implies, current controller switched when desired stator phase current reached. this point, slope increasing inductance (inductance derivation over position) considered constant value, phase current preserved defined target value; then 3-4.) rearranged follows:
phase_applied
4-4.)
applied phase voltage roughly maintained near value 4-4.), where desired phase current, actual angular speed rotor. Derivation over position corresponding phase inductance determined from motor parameter measurement. Knowing these parameters, initial current controller using 4-4.) time instance (red point Figure 4-4) when controller switched
idesired reached
UDC-Bus
uapplied
uapplied
Position Time 100% Current Controller Output -UDC-Bus
Figure 4-4. Phase Voltage Generation
3-Phase Motor Control with Encoder More Information This Product, www.freescale.com MOTOROLA
System Design
System Design
System Outline
This system designed drive 3-Phase motor. application meets following performance specifications: Speed control motor with Encoder position sensor with inner current closed loop Targeted DSP56F803EVM, DSP56F805EVM, DSP56F807EVM Running 3-Phase Motor Control Development Platform variable line voltage between 115V 230V (voltage range -15% +10%) control technique incorporates current control with speed closed loop motor starts from motor position with rotor alignment direction rotation motoring mode minimal speed maximal speed 2600 input power line 230V maximal speed 1600 input power line 115V Encoder position reference commutation Manual Interface (Start/Stop switch, Up/Down push button control, indicator) master software control interface (motor Start/Stop, speed set-up) Power stage identification DC-Bus over-voltage, DC-Bus under-voltage, DC-Bus over-current over-heating fault protection master software Monitor graphical control page (required speed, actual motor speed, operational mode PC/manual, start/stop status, drive fault status, DC-Bus voltage level, identified power stage boards, system status) speed scope (observes actual desired speeds) current controller (observes actual desired phase current, applied phase voltage)
Application Description
drive, standard system concept chosen (see Figure 5-1). system incorporates following hardware parts: 3-Phase high-voltage development platform (power stage with optoisolation board, motor brake) Feedback sensors: DC-Bus voltage, current Phase current Phase current Phase temperature DSP56F80x controller
MOTOROLA
3-Phase Motor Control with Encoder More Information This Product, www.freescale.com
System Design
3-Phase Power Stage
Line
Voltage Current Temperature
LOAD
DSP56F80x Fault Protection
START STOP DOWN
Speed Cmd.
Speed Error
Speed Controller
Current Cmd.
Current Error
Current Controller
Desired Volatge
Duty DC-Bus Cycle Ripple Elimination Generation
Voltage Commutation
Remote Control Phase Current Speed Feedback
Commutation Angle Calculation
Speed Feedback
Speed Calculation
Quad Position Feedback
Figure 5-1. System Concept runs main control algorithm. generates 3-Phase output signals motor power stage according user interface input feedback signals. drive controlled different ways operational modes): Manual operational mode, required speed Start/Stop switch Down push buttons. master software operational mode, required speed master software
After RESET, drive initialized automatically enters MANUAL operational mode. Note, master software only take over control when motor stopped. When Start command detected (using Start/Stop switch master software button "Start") while fault pending, start-up sequence with rotor alignment performed motor started. Rotor position evaluated using encoder position sensor. commutation angle calculated according desired speed, desired current actual DC-Bus voltage. When actual position rotor equal reference position, commutation phases desired direction rotation done; actual phase turned following phase turned
3-Phase Motor Control with Encoder More Information This Product, www.freescale.com
MOTOROLA
System Design
actual motor speed derived from position information, additional velocity sensor unneeded. reference speed calculated according control signals (start/stop switch, up/down push buttons) master software commands (when controlled master software). acceleration/deceleration ramp implemented. comparison between reference speed measured speed gives speed error. Based speed error, speed controller generates desired phase current. When phase commutated, turned with duty cycle 100%. Then, during each cycle, actual phase current compared with desired current. soon actual current exceeds desired current, current controller turned current controller controls output duty cycle until phase turned (following commutation). Finally, 3-Phase control signals generated. procedure repeated each commutation cycle motor. DC-Bus voltage, DC-Bus current, power stage temperature measured during control process. measurements used DC-Bus over-voltage, DC-Bus under-voltage, DC-Bus over-current over-temperature protection drive. DC-Bus under-voltage over-temperature protection performed software, while DC-Bus over-current DC-Bus over-voltage fault signals utilize Fault inputs on-chip module. line voltage measured during initialization application. According detected level, 115VAC 230VAC mains recognized. line voltage detected outside -15% +10% nominal voltage, fault "Out Mains Limit" disables drive operation. above mentioned faults occur, motor control outputs disabled order protect drive. fault status only exited when fault conditions have disappeared Start/Stop switch moved STOP position. fault state indicated on-board LED. power stage uses unique configuration power devices, different than BLDC configuration. software would cause destruction BLDC power stages simultaneous switching power devices. Since application software could accidentally loaded into BLDC drive, software incorporates protection feature prevent this. Each power stage contains simple module which generates logic signal sequence that unique that type power stage. During initialization chip, this sequence read evaluated according decoding table. correct power stage identified, fault, "Wrong Power Stage", disables drive operation.
5.2.1 Initialization Start-Up
Before motor started, rotor alignment initialization control algorithms must performed (see Figure 5-2) since absolute position known.
MOTOROLA
3-Phase Motor Control with Encoder More Information This Product, www.freescale.com
System Design
Start Command Accepted
Turn Phases
Rotor Position
Wait Ensure Initial Pulse
Turn Phase
Wait 550msec
Rotor Stabilized
Measure Phase Resistance Average Measurements
Phase Aligned
Commutate Phases (Turn Phase Turn Phase
Motor Starts
Figure 5-2. Start-Up Sequence First, rotor needs aligned known position able start motor desired direction rotation. This done following steps: phases turned simultaneously (Phases After 50msec phase turned (Phase other phase stays powered (Phase After additional msec, rotor stabilized enough aligned position with respect powered phase (Phase Step provides initial impulse rotor. Phase exactly unaligned position thus does generate torque, Phase provides initial movement. Then, Phase disconnected Phase stays powered (Step stabilization pulse Phase must long enough stabilize rotor aligned position with respect that phase. total stabilization takes sec. After this time, rotor stable enough reliably start motor desired direction rotation.
3-Phase Motor Control with Encoder More Information This Product, www.freescale.com MOTOROLA
System Design
5.2.2 Position Speed Sensing
position information used generate accurate switching instants power converter, ensuring drive stability fast dynamic response. Velocity feedback derived from position information, that additional velocity sensor unneeded. members Motorola 56F80x family, except 56F801 have on-chip quadrature decoder module connected quadrature timer. This peripheral commonly used position speed sensing. quadrature decoder position counter counts up/down each edge Phase Phase signals according their order (see Figure 5-3). Phase Phase inputs controller routed through switch matrix general purpose timer module quadrature decoder module well (see Figure 5-4). timer module four available inputs normal timer input capture channels. This does preclude quadrature decoder module. Both timer decoder take advantage digital filter incorporated quadrature decoder module.
Figure 5-3. Quadrature Encoded Signals presented application uses quad decoder module approach speed measurement using 16-bit position difference counter. counter acts differentiator whose count value proportional change position since last time position counter read. speed computed calculating change position counter unit time, reading position difference counter register (POSD) calculating speed. second method employed this application rotor speed measurement also feedback signal speed controller. position difference register (POSD) regularly scanned pre-defined time period consecutively this value used compute actual rotor speed. addition, quadrature decoder module shares pins with quadrature timer module shared pins configured timer outputs, then pins available inputs quad decoder modules. quad timer module contains four identical counter/timer groups. wide variability quad timer modules, possible this module decode quadrature encoder signals sense position speed well. presented application uses configuration arranged position sensing commutation instance determination. quad timer quad timer decode primary secondary external inputs quad-encoded signals generated rotary sensor monitor movement motor shaft. Quad signal decoding provides both count direction information. timer programmed count programmed value that corresponds electric revolution then immediately re-initialize after terminal count value reached. This timer assigned master broadcast compares signals quad timer timer configured re-initialized predetermined value when master timer's compare event occurs. This counter continues repeatedly counting past compare value. When count matches compare value, interrupt enabled compare register value used commutation instances generation.
MOTOROLA
3-Phase Motor Control with Encoder More Information This Product, www.freescale.com
System Design
used Decoder module
EDGE DETECT STATE MACHINE GLITCH FILTER DELAY WATCHDOG TIMER
Phase Phase Index Home
POSITION DIFFERENCE COUNTER
POSITION COUNTER
COUNTER
Timer Input Capture Channels
SWITCH MATRIX
Timer
Timer
Timer
Timer Timer module
Figure 5-4. Decoder Timer Arrangement
5.2.3 Commutation Algorithm
motor commutation strategy uses rotor position feedback drive commutating signals inverter switches. core control algorithm includes calculation commutation angle, phases commutation. calculation commutation angle performed according 4-2.). calculated regularly during motor operation. commutation algorithm described Figure 5-5. After finish start-up routine, which includes alignment procedure initialization necessary commutation variables, rotor sufficiently stabilized ready mode. This point from which commutation routine start. first procedure commutation routine turn corresponding phase. Choosing correct phase switch depends defined rotation rotor. turn angle unaligned position, current rises linearly until poles begin overlap. regular switched reluctance motor, angle rising inductance half pole-pitch. pole pitch angle rotation between successive aligned positions. Ideally, flux should zero throughout period falling inductance, because current flowing that period produces negative braking) torque. avoid this, dwell angle dwell restricted. practice, dwell angle electrical degrees usually used, because gain torque-impulse during increasing inductance exceeds small braking torque impulse. This condition occurs when current tail extending beyond aligned position. torque negative during this tail period, small. turn-off angle instant determined.
3-Phase Motor Control with Encoder More Information This Product, www.freescale.com
MOTOROLA
System Design
START
Turn PHASE
dwell
on=f(,
actual
Turn PHASE
actual
Figure 5-5. Commutation Algorithm Flowchart next step proposed commutation algorithm calculate advance turn-on angle. entire calculation explanation presented Section 4.2. firing angle next commutation instant. presented commutation algorithm does allow parallel current conduction phases same time. angle comparison turn-on turn-off assures that current phase turned before following phase turned case electrical degree dwell angle, switching switching performed simultaneously. conduction (dwell) angle restricted, turning overtakes turning clear Figure 5-5. comparison actual block waits appropriate position commutate corresponding stator phase, next comparison actual block algorithm remains same until proper position occurs switch following stator phase. algorithm loop closed ready other commutation occurrences.
MOTOROLA 3-Phase Motor Control with Encoder More Information This Product, www.freescale.com
System Design
5.2.4 Current Controller Implementation
current controller utilization flowchart reveals algorithm process controller switching. appropriate stator phase turned DC-Bus voltage applied corresponding rotor phase. phase current rises almost linearly until predefined target value attained. this point, processing proposed algorithm current controller switched maintains actual current flowing within desired value. Before current controller switched necessary initialization required. mainly concerned with integral portion step current controller. This part controller structure preset according equation 4-4.). following commutation instance turns controller flag corresponding rotor phase fully voltage loaded until reaching desired value phase current. Figure clarifies entire controller usage algorithm.
START
Commutate
Controller
Controller iphase>idesired
Controller Controller INIT uapplied =U_dc_bus uapplied controller
Figure 5-6. Controller Utilization
3-Phase Motor Control with Encoder More Information This Product, www.freescale.com
MOTOROLA
System Design
5.2.5 Current Voltage Measurement
Precise measurement phase current DC-Bus voltage factor current control implementation.
5.2.5.1 Current Sensing
Current measurement needs investigated according current sensors used influence noise measurement. quality current measurement depends heavily type current sensors used. most useful Hall effect sensors. Unfortunately, these sensors expensive thus suitable most cost-sensitive applications. Therefore, current shunt resistors inserted into current path phase often implemented (see Figure 5-7). phase current sensed voltage drop across sense resistor.
Voltage PWM_T1 Phase
PWM_T2
sense
V_ref 1.65V
Figure 5-7. Shunt Resistors Current Sensors When power switches' soft switching used (the lower switch left during complete commutation period, while upper switch modulated PWM), current visible shunt resistor time. soft switching phase current, measured shunt resistor, shown Figure 5-8. phase current visible only when both switches turned (the phase current flows through switches sensing resistor) when both switches turned (phase current flows through freewheeling diodes sensing resistor). When both switches phase turned measured current negative, needs inverted. diagram shows that reliable current shape reconstruction, sensing needs synchronized with frequency center pulse both positive negative voltage drop polarities should measured. zero current half range, both positive negative voltage drops phase current shunt resistors measured. voltage drop then amplified according range. Proceeding like this, current read with accuracy credibility.
MOTOROLA
3-Phase Motor Control with Encoder More Information This Product, www.freescale.com
R_sense
sense
System Design
Figure illustrates actual phase currents 3-Phase motor, measured shunt resistors described above. previously specified current sensing method described from processor point view. seems measured phase current negative, which caused inverting differential amplifier. Actually, measured phase current flowing through shunt resistor sensed consecutively inverted differential amplifier.
Switch (T1) Time
Bottom Switch (T2) Time Actual Phase Current
Time
Sensed Voltage Drop
Time
Synchronization
Figure 5-8. Soft Switching Current Sensed
3-Phase Motor Control with Encoder More Information This Product, www.freescale.com
MOTOROLA
System Design
Current Sensing
Phase Current
Phase Phase Phase
0.01 0.02 0.03 0.04 0.05
-0.2 -0.4 -0.6 -0.8
Time [sec]
Figure 5-9. Phase Current Measured Current Shunt Resistors cost shunt resistor sensors create serious issue. low-voltage drop sensed across shunt current resistors, measured signals susceptible noise. technique noise elimination been developed successfully implemented. technique based assumption that same noise induced simultaneously measured signals. method supposes measurement signals simultaneously, known signal reference) signal measured. Then reference signal consists known signal noise, while measured signal consists actual signal same noise. MeasuredSignal ActualSignal Noise ReferenceSignal KnownSignal Noise 5-1.) 5-2.)
noise same, eliminated subtraction reference signal from measured signal. described above, necessary condition simultaneous sampling both signals, ensuring that noise both signals identical. ActualSignal MeasuredSignal ReferenceSignal KnownSignal 5-3.)
This technique been implemented phase current sensing. motor controlled which phases commutated sequentially, which means that when working phase turned off, following phase, direction rotation, turned Thus phase motor never powered during complete commutation interval. This phase considered reference. Because reference phase powered, reference phase current should equal zero. measured value reference current then considered noise given commutation interval. actual phase current equal difference between measured current reference current: Isensed Ireference 5-4.)
reference signal needs commutated together with commutation phases. Table 5-1. defines active, discharge reference phases commutation sequence derived from Figure 5-9.
MOTOROLA
3-Phase Motor Control with Encoder More Information This Product, www.freescale.com
System Design
Table 5-1. Commutation Sequence Reference Phase
Step
Active Phase
Discharge Phase
Reference Phase
efficiency current sensing noise reduction technique illustrated Figure 5-10. figures illustrate phase current measured (the active phase current inverted compared Figure 5-9), same current with implemented noise reduction technique. seen, implemented technique improves current sensing significantly. eliminates only noise current sensors, also noise induced sensing cables noise reference power supply.
5.2.5.2 Voltage Sensing
DC-Bus voltage sensor represented simple voltage divider. DC-Bus voltage does change rapidly. nearly constant with ripple given power supply structure. bridge rectifier rectification line voltage used, ripple frequency times line frequency. ripple amplitude should exceed nominal DC-Bus value, power stage designed correctly. measured DC-Bus voltage needs filtered order eliminate noise. most useful techniques moving average filter, that calculates average value from last samples:
DCBus
DCBus
5-1.)
order increase precision voltage sensing, voltage drop power switches diodes power stage incorporated into determination actual voltage present motor phase.
3-Phase Motor Control with Encoder More Information This Product, www.freescale.com
MOTOROLA
System Design
-0.1
active corrected discharge corrected
current
0.01
0.02 time [sec]
0.03
0.04
0.05
-0.1
active discharge
current
0.01
0.02 time [sec]
0.03
0.04
0.05
Figure 5-10. Measured 3-Phase Currents without Noise Correction with Noise Correction Implemented
MOTOROLA
3-Phase Motor Control with Encoder More Information This Product, www.freescale.com
Hardware Implementation
5.2.6 Power Module Temperature Sensing
measured power module temperature used thermal protection hardware realization shown Figure 5-11. circuit consists four diodes connected series, bias resistor, noise suppression capacitor. four diodes have combined temperature coefficient mV/C. resulting signal, Temp_sense, back input where software used safe operating limits. presented application, temperature degrees Celsius calculated according conversion equation:
Temp_sense temp
5-2.)
where: temp power module temperature degrees Celsius voltage drop diodes which measured diode-dependent conversion constant -0.0073738) diode-dependent conversion constant 2.4596)
Temp_sense
+3.3V_A
2.2k BAV99LT1 BAV99LT1 100nF
Figure 5-11. Temperature Sensing Topology
Hardware Implementation
Hardware Setup
already stated, application runs Motorola motor control DSPs using boards dedicated 3-Phase high-voltage platform. application controlled following Motorola motor control DSPs: DSP56F803 DSP56F805 DSP56F807
3-Phase Motor Control with Encoder More Information This Product, www.freescale.com
MOTOROLA
Hardware Implementation
Application hardware setup shown Figure 6-1. system hardware setup particular varies only Board used. application software identical DSPs. chip differences handled off-chip drivers particular board. Detailed application setup found document Targeting_DSP5680x_Platform that part documentation [12]. Dedicated user's manuals describe individual boards detail. User's Manuals incorporate schematic board, description individual function blocks bill materials board. individual boards ordered from Motorola standard products. Descriptions mentioned boards documents found http://www.motorola.com/ system parts supplied documented according following references: Controller Board DSP56F803: supplied DSP56803EVM described DSP56F803EVMUM/D Evaluation Module Hardware User's Manual Controller Board DSP56F805: supplied DSP56805EVM described DSP56F805EVMUM/D Evaluation Module Hardware User's Manual [10] Controller Board DSP56F807: supplied DSP56807EVM described DSP56F807EVMUM/D Evaluation Module Hardware User's Manual [11] 3-Phase High-Voltage Power Stage supplied with Optoisolation Board ECOPTHIVSR described MEMC3PSRHVPSUM/D Motorola Embedded Motion Control 3-Phase High-Voltage Power Stage User's Manual [14] Optoisolation Board (not supposed final application) supplied 3-ph. High Voltage Power Stage ECOPTHIVSR supplied separately ECOPT optoisolation board described MEMCOBUM/D Optoisolation Board User's Manual [13] Motor-Brake SR40V SG40N supplied ECMTRHIVSR Warning: optoisolation (optocouplers optoisolation amplifiers) strongly recommended during development avoid electric shock damage development equipment.
MOTOROLA
3-Phase Motor Control with Encoder More Information This Product, www.freescale.com
Hardware Implementation
Figure 6-1. 3-Phase High Voltage Platform Configuration
!W98
phiyr
phiyr
&RQWUROOHU %RDUG
3-Phase Motor Control with Encoder More Information This Product, www.freescale.com MOTOROLA
+LJK 9ROWDJH 3RZHU 6WDJH (&+,965
2SWRLVRODWLRQ %RDUG (&237
'63[(90
Quhr Xuvr 7yhpx
White1 White2 Red1 Red2 Black1 Black2
0RWRU%UDNH
(&237+,965
8yyr 9TQ$%A'" 9TQ$%A'$ 9TQ$%A'&
White
@pqr
Black
(&075+,965
9TQ$%A'" 9TQ$%A'$ 9TQ$%A'&
Hardware Implementation
Motor-Brake Specifications
Motor Brake incorporates 3-Phase Motor attached BLDC motor brake. detailed specifications listed Table 6-1. motor stator poles four rotor poles. This combination yields strokes pulses) single mechanical revolution. motor characterized dedicated inductance profile. motor inductance profile function mechanical position shown Figure 6-2. mechanical angle 90omech corresponds electrical period stroke. presented profile used determination advanced commutation angle. motor brake shaft, position encoder position Hall sensor attached. They allow position sensing required control algorithm. introduced drive uses Encoder position determination Table 6-1. Motor Brake Specifications
Manufacturer eMotor Type: Stator Rotor Poles: Motor Specification: Speed Range: Nominal Voltage: Nominal Current: Brake Type Brake Specification: Nominal Voltage: Nominal Current: Type Position Encoder
Brno, Czech Republic SR40V (3-Phase Motor) 5000 300V 1.2A SG40N 3-Phase BLDC Motor Baumer Electric 16.05A 1024-12-5 1024
Pulses Revolution
MOTOROLA
3-Phase Motor Control with Encoder More Information This Product, www.freescale.com
Software Design
Inductance mechanical angle [deg] Phase Phase Phase
Figure 6-2. Inductance Characteristic
Software Design
Control algorithm data flow State diagram Software implementation
This section describes design software blocks drive. software will described terms
Data Flow
control algorithm closed loop drive described Figure Figure 7-2. based system description. individual processes described detail following sections.
3-Phase Motor Control with Encoder More Information This Product, www.freescale.com
MOTOROLA
Software Design
Speed Settting SPEED SETTING
Master Software MASTER
Position Sensor POSITION SENSOR
omega_required_mech
omega_reqPCM_mech
position_difference
position_actual
Acceleration Ramp
Speed Calculation
page
page
omega_desired omega_actual u_dc_bus I_active
Speed Controller
I_active I_desired
Commutation Angle Calculation
Current Controller
theta u_desired theta
DC-Bus Ripple Elimination
Commutation
outputDutyCycle
&srmCmtData
Generation
Outputs Pwm_AT Pwm_AB Pwm_BT Pwm_BB Pwm_CT Pwm_CB
Figure 7-1. System Data Flow Motor Control
MOTOROLA
3-Phase Motor Control with Encoder More Information This Product, www.freescale.com
Software Design
DC-Bus Volatge Converter
3-Phase CURRENTS Converter
Correction Current
u_dc_bus
i_active
page
Figure 7-2. System Data Flow Converter
7.1.1 Acceleration Ramp
This process calculates desired speed based required speed according acceleration deceleration ramp. required speed either manually, using push buttons (when manual operational mode), master software (when master software operational mode).
7.1.2 Speed Calculation
process calculates actual speed motor. calculation based evaluation position information. on-chip Quadrature Decoder provides information position difference through 16-bit counter. When position register read, position difference counter's contents copied into position difference hold register (POSDH) position difference counter cleared. register regularly read captured value used speed calculation. speed computed reading position difference counter register pre-defined time sample. software moving average filter applied speed measurement incorporated into process greater noise immunity. actual motor speed calculated average value last four measurements.
7.1.3 Speed Controller
This process calculates desired phase current according speed error. Speed error difference between actual speed desired speed. Proportional-Integrational (PI) type controller implemented. constants speed controller tuned experimentally according load profile speed limits.
3-Phase Motor Control with Encoder More Information This Product, www.freescale.com
MOTOROLA
Software Design
7.1.4 Current Controller
This process calculates duty cycle based phase current error. Phase current error difference between actual phase current desired phase current. type controller implemented. current controller constants tuned experimentally according type used motor used.
7.1.5 DC-Bus Ripple Elimination
This process provides elimination voltage ripple DC-Bus. compensates amplitude desired phase voltage generated current controller. output calculation duty cycle that applied corresponding stator phase.
7.1.6 Generation
This process sets on-chip module generation control pulses 3-Phase motor power stage. Generation these pulses based software control register that formulated process Commutation Calculation based required duty cycle generated Speed Controller process. calculated software control word loaded into proper register duty cycle updated according required duty cycle. Generation process accessed regularly rate given frequency. frequent enough ensure precise generation commutation pulses.
7.1.7 Correction Current
This process takes care Analog-to-Digital Converter. sampling synchronized pulses. process selects proper channels converted reads processes results conversion. active discharge phase currents selected corrected using measured reference noise signal. DC-Bus voltage temperature filtered using moving average filter. Section 5.2.5 Current Voltage Measurement detailed description.
7.1.8 Commutation Angle Calculation
This process calls commutation angle calculation routine which calculates advanced angle according actual speed, DC-Bus voltage desired current (see Section 4.2). algorithm 3-Phase Motor Commutation Angle Calculation srmcac generates required advance angle commutation according principle described Section 4.2. Before calculation routine call, scaling constant must properly determined.
scaling constant scale_const
following functions algorithm need called order calculate commutation angle:
routine call adv_angle u_ph voltage across phase winding i_ph phase current w_actual actual speed
These functions called Process Commutation. detailed description algorithm found algorithm documentation.
MOTOROLA
3-Phase Motor Control with Encoder More Information This Product, www.freescale.com
Software Design
7.1.9 Commutation
This process provides comutation motor phases. on-chip module used mode generation independent output signals that controlled either software module. commutation technique distinguishes three following cases: When output needs modulated, generator controls channel directly When output needs switched inactive state (0), software output control corresponding channel handed over channel turned manually When output needs switched active state (1), software output control corresponding channel handed over channel turned manually
on-chip module enables control outputs from module either generator, using software. Setting output control enable bit, OUTCTLx, enables software drive outputs instead generator. independent mode, with OUTCTLx output OUTx controls PWMx channel. Setting clearing OUTx activates deactivates PWMx output. OUTCTLx OUTx bits output control register. This control technique requires preparation output control register. calculation OUTCTLx OUTx bits output control register, dedicated commutation algorithm, 3-Phase Motor Commutation Handler Configuration 2-Switches-per-Phase, srmcmt3ph2spp, developed. algorithm generates output control word according desired action desired direction rotation. example, when Phase needs turned off, algorithm sets corresponding OUTCTLx bits enable output control required PWMs clears OUTx bits turn PWMs. other output control register bits affected. detailed description algorithm found motor control library.
State Diagram
processes described above implemented single state machine, illustrated Figure 7-3. state machine provides transition amongst application states INIT, STOP, RUN, FAULT. following variables used invoke transition between individual states: switchState (Stop, Run): state Start/Stop switch appFault (NO_FAULT, fault): fault occurrence appOpMode (change from Manual vice versa): change operational mode
3-Phase Motor Control with Encoder More Information This Product, www.freescale.com
MOTOROLA
Software Design
S@T@U
,1,7 6WDWH
hAhy vpuThr hAhy vpuThr
hPHqr puhtr
)$8/7 6WDWH
6723 6WDWH
hAhy
vpuThr vpuThr hAhy hAhy hAhy
6WDWH
Figure 7-3. Application State Diagram
7.2.1 Application State INIT
After RESET application enters INIT state. this state, drive disabled motor cannot started. fault detected, application transits FAULT state (protection against faults). fault present, Start/Stop switch detected STOP position, application transits STOP state (protection against start after reset Start/Stop switch accidentally START position).
7.2.2 Application State STOP
STOP state entered either from INIT state from state. STOP state, drive enabled application waits START command. When application STOP state, operational mode changed, either from MANUAL mode master software mode vice versa. When operational mode changed, application always transits INIT state. fault STOP state detected, application enters FAULT state (fault protection). fault present start command accepted, application transits state motor started.
7.2.3 Application State
state entered from STOP state. state drive enabled motor running.
MOTOROLA
3-Phase Motor Control with Encoder More Information This Product, www.freescale.com
Software Design
fault state detected, application enters FAULT state (fault protection). fault present STOP command accepted application transits STOP state motor stopped.
7.2.4 Application State FAULT
STOP state entered from state. FAULT state, drive disabled application waits faults cleared. When detected that fault been eliminated, fault clear command accepted (the Start/Stop switch moved STOP position), then application transits INIT state.
Software Design
general software diagram incorporates: Main routine entered from Reset, Interrupt Service Routines (ISR). diagram illustrated Figure 7-4. After Reset, Main routine provides board identification, initialization DSP, initialization application, then enters infinite background loop. background loop contains Fault Detection, Application State Machine, scheduler routine. scheduler routine provides timing sequence tasks called Timeout Timeout Timeout Timeout flags periodically predetermined intervals Conversion Completed ISR. scheduler utilizes these flags calls required routines: routine Timeout provides user interface, calculates required speed, start-up routines speed ramp (acceleration/deceleration). routine Timeout calculates Speed Controller.
Timeout Timeout tasks performed state, instead interrupt routines, order reduce time avoid software bottlenecks. following interrupt service routines utilized: Conversion Completed services provides control tasks linked event; synchronized with pulses. Fault services faults invoked external hardware faults. services master software communication. Push Button services Push Button. Push Button Down services Down Push Button. Timer Compare services Commutation Callback.
3-Phase Motor Control with Encoder More Information This Product, www.freescale.com
MOTOROLA
Software Design
Interrupt Service Routines
Conversion Completed Interrupt
RESET
Interrupt Handlers done
Initialize Application done
Background Tasks
Fault Interrupt Fault Detection Fault Interrupt Handler done Interrupt Application State Machine done master software Interrupt Handler done IRQ0, IRQ1 Interrupt done Push Buttons Interrupt Handlers Timeout timeout Timeout
Timeout
done
Timeout done
Timeout
TMRA1 Compare Interrupt
Commutation Interrupt Handler done
Figure 7-4. Software Design General Overview
MOTOROLA
3-Phase Motor Control with Encoder More Information This Product, www.freescale.com
Software Design
7.3.1 Initialization
After Reset, initialization performed. beginning initialization, interrupts disabled; initialization they enabled. Initialization: Disable Interrupts Identify power stage board identify High-Voltage Initialize on-chip module triggered simultaneously associate interrupt with conversion completed event sample ADC_A: sample ADC_A: sample ADC_A: sample ADC_B: sample ADC_B: sample ADC_B: Quad count mode count repeatedly 1024 Initialize Quadrature Timer on-chip module (commutation callback) Quad count mode count repeatedly, binary roll over Initialize Quadrature Decoder on-chip module sets digital filter input signals connects Quadrature Decoder signals Quadrature TimerA1 Initialize on-chip module: center aligned independent mode, positive polarity modulus frequency 16kHz interrupt reload each pulse FAULT2 (DC-Bus over-current fault) manual mode, interrupt enabled FAULT1 (DC-Bus over-voltage fault) manual mode, interrupt enabled associate interrupt with Fault events Initialize brake driver Initialize driver Initialize push buttons push buttons interrupts IRQ0, IRQ1 Initialize switch driver switch driver used DSP56F805EVM DSP56F807EVM Current Phase DC-Bus Voltage Temperature Current Phase Current Phase void
Initialize Quadrature Timer on-chip module (position measurement)
3-Phase Motor Control with Encoder More Information This Product, www.freescale.com
MOTOROLA
Software Design
Application initialization: individual parameters application their initial values Start conversion Measure offset individual current sensors Measure DC-Bus voltage temperature Calculate application parameters according DC-Bus voltage Initialize Quadrature Timer Driver (ADC-PWM Synchronization) synchronization delay enable Quadrature Timer started first SYNC Initialize Driver synchronization enable 8-sample conversion Initialize variables motor start-up according start-up phase Enable interrupts
7.3.2 Fault Detection
Fault Detection routine checks application faults. fault occurs, disables outputs sets application FAULT status. Note that case DC-Bus over-current DC-Bus over-voltage faults, outputs disabled directly internal module fault protection (see Section 7.3.7 Fault ISR).
7.3.3 Application State Machine
Application State Machine provides transition between individual states application: INIT, STOP, RUN, FAULT. reference, Section State Diagram.
7.3.4 Scheduler Timeout
This routine accessed from main scheduler period Timeout msec). following tasks then performed: Push button filter debounces push button switching noise Start/Stop switch filter debounces Start/Stop switch noise According operational mode, desired speed calculated manual mode according push buttons master software control mode, according master software command Start-up routine performed required start-up switching pattern generated. detailed description refer Section 5.2.1 Initialization Start-Up. Speed command calculated using acceleration deceleration ramp using desired speed setup controlled according state drive. indicate STOP state, state FAULT state.
MOTOROLA
3-Phase Motor Control with Encoder More Information This Product, www.freescale.com
Software Design
7.3.5 Scheduler Timeout
This state accessible from main scheduler period Timeout (2.5 msec). following tasks then performed: Speed controller calculates desired phase current according actual desired speed. speed controller constants determined experimentally during initialization chip.
7.3.6 Conversion Completed
Conversion Completed most critical routine most demanding processor's time. Most application control processes need linked with this ISR. Analog-to-Digital converter initiated synchronously with reload pulse (center pulse). scans three phase currents, DC-Bus voltage temperature once. When conversion finalized, Completed called. routine provides following services calculations: Reads conversion results (phase currents, noise, DC-Bus voltage, temperature) Calculates offsets phase currents Current controller calculates desired phase voltage according desired actual phase current Provides commutation when required Records selected recorder variables master software) Loads registers Calculates references software timers Timer1 Timer2 Enables next synchronization trigger
7.3.7 Fault
Fault highest priority interrupt implemented software. case DC-Bus over-current DC-Bus over-voltage fault detection, external hardware circuit generates fault signal, that detected Fault input DSP. signal disables motor control outputs order protect power stage generates Fault interrupt, where fault condition handled. routine records corresponding fault source fault status register.
7.3.8
This interrupt handler provides communication master software service routines. These routines fully independent motor control tasks.
7.3.9 Push Button UP/Down
Push Button Interrupt Handlers take care push buttons service. Button Interrupt Handler sets Button flag, Down Button Interrupt Handler sets Down Button flag. desired speed incremented/decremented according debounced Up/Down button flag.
3-Phase Motor Control with Encoder More Information This Product, www.freescale.com
MOTOROLA
Implementation Notes
7.3.10 TMRA1 Compare
compare interrupt handler takes care commutation call. This callback routine sets-on commutate flag indicate that commutation required. commutation flag regularly checked conversion-completed routine upon successful compare, commutation routine called perform commutation itself.
Implementation Notes
Scaling Quantities
motor control application uses fractional representation real quantities except time. N-bit signed fractional format represented using 1.[N-1] format sign bit, fractional bits). Signed fractional numbers (SF) following range:
+1.0
8-1.)
words long-word signed fractions, most negative number that represented -1.0, whose internal representation $8000 $80000000, respectively. most positive word $7FFF 2-15, most positive long-word $7FFFFFFF 2-31. following equation shows relationship between real fractional representations:
Real Value Fractional Value -Real quantity range
8-2.)
where: Fractional Value fractional representation real value [Frac16] Real Value real value quantity rpm, etc.] Real quantity range maximal range quantity, defined application rpm, etc.]
8.1.1 Voltage Scaling
application voltages scaled maximal measured voltage. DC-Bus voltage scaling equation following:
DC_BUS u_dc_bus
8-3.)
Where: u_dc_bus scaled variable DC-Bus voltage [Frac16] VDC_BUS measured DC-Bus voltage VMAX maximal measurable DC-Bus voltage
MOTOROLA
3-Phase Motor Control with Encoder More Information This Product, www.freescale.com
Implementation Notes
application, VMAX 407V high voltage platform. other application voltage variables scaled same (active phase voltage u_active, discharge phase voltage u_discharge, DC-Bus under-voltage limit, start-up voltage).
8.1.2 Phase Current Scaling
application phase currents scaled maximal measured phase current. active phase current scaling equation following:
active i_active phase_max
8-4.)
Where:
i_active scaled variable active phase current [Frac16] iactive measured active phase current iphase_max maximal measurable phase current application, iphase_max 5.86A high-voltage platform. other application phase current variables scaled same (desired current i_desired, discharge current i_discharge, current offsets i_phase_A_offset, i_phase_B_offset, i_phase_C_offset).
8.1.3 Electrical Angle Scaling
application electrical angle scaled electrical angle aligned position (see Figure 8-1). electrical commutation angle scaling equation following:
on_el theta_on_el aligned_el
8-5.)
Where: theta_on_el scaled variable electrical commutation angle [Frac16]
on_el desired commutation angle [oel] aligned_el electrical angle aligned position [oel].
application, aligned_el 360oel other application electrical angle variables scaled same (angle where stator rotor poles start overlap theta_edge).
3-Phase Motor Control with Encoder More Information This Product, www.freescale.com
MOTOROLA
Implementation Notes
start_to_overlap -180
aligned
position
Figure 8-1. Electrical Angle Definition
8.1.4 Speed Scaling
Speed scaled maximal speed drive. desired start-up speed, scaling equation following:
start_up omega_desired_startup
8-6.)
Where: omega_desired_startup scaled variable desired start-up speed [Frac16]
start-up desired start-up speed [rpm] maximal speed drive [rpm]
application, 3000 rpm. other application speed variables scaled same (actual speed, omega_actual_mech, speed limits, omega_reqMAX_mech omega_reqMIN_mech, push button speed increment, omega_increment_pb).
8.1.5 Duty Cycle Scaling
duty cycle scaled maximal duty cycle drive. output duty cycle scaling equation following:
duty_cycle output output_duty_cycle -duty_cycle
8-7.)
Where: output_duty_cycle scaled variable output duty cycle [Frac16] duty_cucleoutput desired output duty cycle duty_cycleMAX max. applicable duty cycle
MOTOROLA
3-Phase Motor Control with Encoder More Information This Product, www.freescale.com
Implementation Notes
application, duty_cycleMAX other application duty cycles scaled same (high duty cycle limits speed controller, start output duty cycle outputDutyCycleStartup).
Velocity Calculation
actual speed motor calculated from time, TimeCaptured, captured on-chip Quadrature Timer between following edges position Hall sensors. actual speed, OmegaActual calculated according following equation:
SpeedCalcConst OmegaActual -TimeCaptured
8-8.)
where:
OmegaActual actual speed [rpm] TimeCaptured time, terms number timer pulses, captured between edges position sensor SpeedCalcConst constant defining relationship between actual speed number captured pulses between edges position sensor constant SpeedCalcConst calculated
SpeedCalcConst SpeedMin -SpeedMax
8-9.)
where: SpeedMin minimal measured speed [rpm] SpeedMax maximal measured speed [rpm] Minimal measured speed, SpeedMin, given configuration sensors parameters on-chip timer used speed measurement. calculated
NoPulsesPerRev SpeedMin Presc BusClockFreq
8-10.)
where: NoPulsesPerRev number sensed pulses position sensor single revolution Presc prescaler Quadrature Timer used speed measurements BusClockFreq Clock Frequency [Hz] Maximal measured speed, SpeedMax, selected
SpeedMax SpeedMin
8-11.)
where: integer constant greater than
3-Phase Motor Control with Encoder More Information This Product, www.freescale.com
MOTOROLA
Implementation
Then speed calculation constant determined
SpeedCalcConst BusClockFreq -NoPulsesPerRev Presc SpeedMax
8-12.)
application: NoPulsesPerRev Hall sensor pulses revolution motor Presc BusClockFreq 36*106 SpeedMax 3000 Then, SpeedCalcConst [rev-1]
Implementation
Motorola Embedded collection APIs, libraries, services, rules guidelines. This software infrastructure designed DSP5680x software developers create high-level, efficient portable code. application code available SDK. This chapter describes motor control application written under SDK.
Drivers Library Function
motor control application uses following drivers: driver Quadrature Timer driver Quadrature Decoder driver driver driver driver master software driver Switch driver (only DSP56F805EVM &DSP56F807EVM) Brake driver
drivers included bsp.lib library. motor control application uses following library functions: srmcmt3ph2spp motor commutation algorithm; srm.lib library) srmcacAngleCalc motor commutation angle calculation algorithm; srm.lib library) controller (standard controller, mcfunc.lib library) switchcontrol (switch control, mcfunc.lib library) boardId (board identification, bsp.lib library)
MOTOROLA
3-Phase Motor Control with Encoder More Information This Product, www.freescale.com
Implementation
Appconfig.h File
purpose appconfig.h file provide mechanism overwriting default configuration settings which defined config.h file. There appconfig.h files. first appconfig.h file dedicated External (.\ConfigExtRam directory) second dedicated FLASH memory (.\ConfigFlash directory). case motor control application, both files identical with following exceptions: appconfig.h ExtRAM target contains master software recorder buffer 25000 samples long, while appconfig.h Flash target contains master software recorder buffer only samples long. This limited memory size. appconfig.h DSP56F805EVM DSP56F807EVM contains definition switch driver, while appconfig.h DSP56F803EVM does not.
appconfig.h file divided into sections. first section defines which components libraries included application, second part overwrites standard settings components during their initialization.
Initialization Drivers
Each peripheral chip board accessible through driver. driver initialization used peripherals described this chapter. detailed description drivers document, Embedded Targeting Motorola DSP5680x Platform. following steps required driver: Include driver support appconfig.h Fill configuration structure application code specific drivers (depends driver type) Initialize configuration setting appconfig.h specific drivers (depends driver type) Call open (create) function
Access individual driver functions provided ioctl function call.
Interrupts
serves interrupt routine calls automatically clears interrupt flags. user defines callback functions called during interrupts. callback functions assigned during driver initialization open(). Callback function assignment defined item initialization structure, which used parameter open() function. Some drivers define callback function appconfig.h file.
Master Software
master software designed provide application debugging, diagnostic, demonstration tools development algorithms applications. runs connected with RS232 serial cable. small program resident communicates with master software parse commands, return status information process control information from master software, executing uses part Microsoft Internet Explorer user interface
3-Phase Motor Control with Encoder More Information This Product, www.freescale.com
MOTOROLA
Implementation
master software part Motorola Embedded selectively installed during installation. enable master software operation target board application, following lines must added appconfig.h file:
#define INCLUDE_SCI #define INCLUDE_PCMASTER support master software support
automatically includes driver installs necessary services. default baud rate communication 9600Bd. automatically master software driver changed needed. detailed description master software provided dedicated User's Manual [17]. 3-Phase Motor Control with Encoder utilizes master software remote control from enables user Take over control master software Start/stop control motor speed Required actual motor speeds Application operational mode Start/stop status Drive fault status DC-Bus voltage Identified power stage boards Identified voltage level System status
Variables read master software displayed user are:
Profiles required actual speeds together with desired phase current seen Speed Scope window. courses quickly changing variables, like phase current profiles observed Recorder windows. Recorder ONLY used when application running from External limited on-chip memory. length recorded window "Recorder Properties" bookmark "Main" "Recorded Samples". dedicated memory space defined appconfig.h file ExtRAM target. Recorder samples taken each 64.5 µsec, rate frequency. Current Controller Recorder captures: Desired phase current Active phase current Desired phase voltage
Current Controller Recorder initiated time during motor run.
MOTOROLA
3-Phase Motor Control with Encoder More Information This Product, www.freescale.com
Usage
Usage
Table 10-1. shows much memory needed advanced 3-Phase drive with Encoder drive. recorder buffer master software zero. majority memory still available other tasks. Table 10-1. FLASH Memory Usage SDK2.4 CW4.1
Memory Words) Available DSP56F803 DSP56F805 Available DSP56F807 Used Application Stack Used Application without master software, 7508 stack
Program FLASH
11590 stack
Data FLASH Program Data
3-Phase Motor Control with Encoder More Information This Product, www.freescale.com
MOTOROLA
References
References
following materials were used produce this paper: Chalupa, Pohon spinanym reluktancnim motorem, Master's Thesis, FEI-VUT BRNO, UPVE, 1994 Gallegos-Lopez, Sensorless Low-Cost Method Switched Reluctance Motor Drives, University Glasgow SPEED Laboratory, 1997 Miller, T.J.E., Switched Reluctance Motors Their Control, Magna Physics Publishing Clarendon Press, ISBN 0-19-859387-2, 1993 3-Phase Motor Control with Hall Sensors using DSP56F80x, AN1912/D, Motorola, 2000 3-Phase Sensorless Motor Control using DSP56F80x, AN1932/D, Motorola, 2001 CodeWarrior Motorola DSP56800 Embedded Systems, CWDSP56800, Metrowerks, 2001 DSP56F800 16-bit Digital Signal Processor, Family Manual, DSP56F800FM/D, Motorola, 2001 DSP56F80x 16-bit Digital Signal Processor, User's Manual, DSP56F801-7UM/D, Motorola, 2001 DSP56F803 Evaluation Module Hardware User's Manual, DSP56F803EVMUM/D, Motorola, 2001 [10] DSP56F805 Evaluation Module Hardware User's Manual, DSP56F805EVMUM/D, Motorola, 2001 [11] DSP56F807 Evaluation Module Hardware User's Manual, DSP56F807EVMUM/D, Motorola, 2001 [12] Embedded Software Development 56800/56800E, MSW3SDK000AA, available Motorola page, Motorola, 2001 [13] Motorola Embedded Motion Optoisolation Board User's Manual, MEMCOBUM/D, Motorola, 2000 [14] Motorola Embedded Motion Control 3-Phase Switched Reluctance High-Voltage Power Stage User's Manual, MEMC3PSRHVPSUM/D, Motorola, 2000 [15] Motorola Embedded Motion Control 3-Phase Switched Reluctance Low-Voltage Power Stage User's Manual, MEMC3PSRLVPSUM/D, Motorola, 2000 [16] Motorola page: http://e-www.motorola.com/ [17] User's Manual master software, included documentation, Motorola, 2001
MOTOROLA
3-Phase Motor Control with Encoder More Information This Product, www.freescale.com
References
3-Phase Motor Control with Encoder More Information This Product, www.freescale.com
MOTOROLA
References
MOTOROLA
3-Phase Motor Control with Encoder More Information This Product, www.freescale.com
Motorola reserves right make changes without further notice products herein. Motorola makes warranty, representation guarantee regarding suitability products particular purpose, does Motorola assume liability arising application product circuit, specifically disclaims liability, including without limitation consequential incidental damages. "Typical" parameters which provided Motorola data sheets and/or specifications vary different applications actual performance vary over time. operating parameters, including "Typicals" must validated each customer application customer's technical experts. Motorola does convey license under patent rights rights others. Motorola products designed, intended, authorized components systems intended surgical implant into body, other applications intended support sustain life, other application which failure Motorola product could create situation where personal injury death occur. Should Buyer purchase Motorola products such unintended unauthorized application, Buyer shall indemnify hold Motorola officers, employees, subsidiaries, affiliates, distributors harmless against claims, costs, damages, expenses, reasonable attorney fees arising directly indirectly, claim personal injury death associated with such unintended unauthorized use, even such claim alleges that Motorola negligent regarding design manufacture part. Motorola Stylized Logo registered trademarks Motorola, Inc. Motorola, Inc. Equal Opportunity/Affirmative Action Employer.
MOTOROLA Stylized Logo registered Patent Trademark Office. other product service names property their respective owners. Motorola, Inc. 2002. reach USA/EUROPE/Locations Listed: Motorola Literature Distribution; P.O. 5405, Denver, Colorado 80217. 1-303-675-2140 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, King Street, Industrial Estate, N.T., Hong Kong. 852-26668334 Technical Information Center: 1-800-521-6274 HOME PAGE:
AN1937/D
More Information This Product, www.freescale.com

Other recent searches


XC4300 - XC4300   XC4300 Datasheet
NJU7109 - NJU7109   NJU7109 Datasheet
NJU7109F3 - NJU7109F3   NJU7109F3 Datasheet
MT7118A-UR-A - MT7118A-UR-A   MT7118A-UR-A Datasheet
MC9S12B-FamilyPP - MC9S12B-FamilyPP   MC9S12B-FamilyPP Datasheet
ITT130AK - ITT130AK   ITT130AK Datasheet
CY7B8392 - CY7B8392   CY7B8392 Datasheet
ARM7TDMI - ARM7TDMI   ARM7TDMI Datasheet

 

Privacy Policy | Disclaimer
© 2012 Datasheet Archive