Sensorless Field Oriented Control Using the PAC5250 - Active-Semi

USER GUIDE
Sensorless Field Oriented
Control Using the PAC5250
Power Application Controller TM
www.active-semi.com
Copyright © 2014 Active-Semi, Inc.
Sensorless FOC Using PAC5250
Power Application Controller
TABLE OF CONTENTS
USER GUIDE ............................................................................................................................................ 1
Table of Contents .......................................................................................................................................... 2
Table of Figures ............................................................................................................................................ 4
Table of Tables ............................................................................................................................................. 5
Introduction.................................................................................................................................................... 6
PAC Features for Motor Control Applications ............................................................................................... 7
Solution Overview ......................................................................................................................................... 8
Application Features .................................................................................................................................. 8
Hardware Features .................................................................................................................................... 9
Inverter Stage ........................................................................................................................................ 9
PAC Controller ....................................................................................................................................... 9
Power Supply ......................................................................................................................................... 9
Motor Over-Current Protection .............................................................................................................. 9
Motor-Phase Current Measurement ...................................................................................................... 9
ADC Inputs ............................................................................................................................................. 9
Communication Interface ..................................................................................................................... 10
PWM DAC Debugging Outputs ........................................................................................................... 10
Theory of Operation .................................................................................................................................... 11
FOC Control Algorithm ............................................................................................................................ 11
Motor Position and Speed ....................................................................................................................... 12
Motor Startup ........................................................................................................................................... 12
Speed Control Mode ................................................................................................................................ 14
Torque Control Mode ............................................................................................................................... 15
Sinusoidal Motor Drive using SVPWM ........................................................................................................ 16
Overview .................................................................................................................................................. 16
SVPWM Sector PWM Waveforms .......................................................................................................... 17
EVK Design Details ..................................................................................................................................... 20
Jumpers and Test Points ......................................................................................................................... 20
PAC5220 Pin Signals .............................................................................................................................. 20
PCB Schematic ....................................................................................................................................... 22
Bill of Materials (BOM)............................................................................................................................. 23
PCB Layout ............................................................................................................................................. 24
Firmware Design ......................................................................................................................................... 27
© 2014 Copyright, Active-Semi International, Inc.
-2 Rev 0.2 October, 2014
No portion of this document may be reproduced or reused in any form without Active-Semi’s prior written consent
Sensorless FOC Using PAC5250
Power Application Controller
Firmware Architecture ............................................................................................................................. 27
Firmware Modules ................................................................................................................................... 28
Firmware Control and Data Flow ................................................................................................................ 30
Initialization .............................................................................................................................................. 30
Interrupt Service Routines ....................................................................................................................... 30
ADC ISR .............................................................................................................................................. 31
Timer A ISR ......................................................................................................................................... 31
UART ISR ............................................................................................................................................ 32
GPIOB ISR ........................................................................................................................................... 32
FOC State Machines ................................................................................................................................... 33
FOC Main State Machine ........................................................................................................................ 33
ADC Calibrate State............................................................................................................................. 33
Motor Stopped State ............................................................................................................................ 33
Startup Open Loop State ..................................................................................................................... 34
Sensorless FOC State ......................................................................................................................... 34
FOC Control State Machine .................................................................................................................... 34
MCU Resource Utilization ........................................................................................................................... 36
Conclusion................................................................................................................................................... 38
About Active-Semi....................................................................................................................................... 39
© 2014 Copyright, Active-Semi International, Inc.
-3
-
Rev 0.2 October, 2014
No portion of this document may be reproduced or reused in any form without Active-Semi’s prior written consent
Sensorless FOC Using PAC5250
Power Application Controller
TABLE OF FIGURES
Figure 1 - PAC5250 Block Diagram .............................................................................................................. 6
Figure 2- FOC Control Algorithm ................................................................................................................ 11
Figure 3- FOC Control Loop Flow ............................................................................................................... 12
Figure 4 - Motor Start-up ............................................................................................................................. 13
Figure 5 - Speed Control Flow .................................................................................................................... 14
Figure 6 - Torque Mode Flow ...................................................................................................................... 15
Figure 7 - SVM Sectors ............................................................................................................................... 16
Figure 8 - Angle 0, SVPWM Sector 2, [U,V,W] = [0,1,0] ........................................................................... 17
Figure 9 - Angle 60, SVPWM Sector 3, [U,V,W] = [0,1,0] ......................................................................... 17
Figure 10 - Angle 120, SVPWM Sector 4, [U,V,W] = [0,0,1] ..................................................................... 18
Figure 11 - Angle 180, SVPWM Sector 5, [U,V,W] = [0,0,1] ..................................................................... 18
Figure 12 - Angle 240, SVPWM Sector 6, [U,V,W] = [1,0,0] ..................................................................... 19
Figure 13 Angle 300, SVPWM Sector 0, [U,V,W] = [1,0,0] ....................................................................... 19
Figure 14 - EVK Schematic ......................................................................................................................... 22
Figure 15 - EVK Top Silkscreen .................................................................................................................. 24
Figure 16 – EVK Top Layer......................................................................................................................... 25
Figure 17 - EVK Bottom Layer .................................................................................................................... 26
Figure 18 - Firmware Library Architecture .................................................................................................. 27
© 2014 Copyright, Active-Semi International, Inc.
-4
-
Rev 0.2 October, 2014
No portion of this document may be reproduced or reused in any form without Active-Semi’s prior written consent
Sensorless FOC Using PAC5250
Power Application Controller
TABLE OF TABLES
Table 1 - SVPWM Angle and Sectors ......................................................................................................... 16
Table 2 - EVK Jumpers and Test Points ..................................................................................................... 20
Table 3 - PAC5220 Pin Functions ............................................................................................................... 21
Table 4 – Bill of Materials (BOM) ................................................................................................................ 23
Table 5 - Firmware Modules ....................................................................................................................... 29
Table 6 - FOC Main State Machine ............................................................................................................ 33
Table 7 - FOC Control State Machine ......................................................................................................... 34
© 2014 Copyright, Active-Semi International, Inc.
-5
-
Rev 0.2 October, 2014
No portion of this document may be reproduced or reused in any form without Active-Semi’s prior written consent
Sensorless FOC Using PAC5250
Power Application Controller
INTRODUCTION
Active-Semi’s PAC52XX are a family of controllers is optimized to support power applications for various
types of consumer and industrial control applications. This family has a high level of integration, enabling
customers to reduce design cost and decrease design complexity.
The PAC52XX’s powerful capabilities and peripherals make it a natural choice for motor control
applications. Potential applications span a wide variety of platforms including PMSM, BLDC and ACIM.
Applications which require the use of Field Oriented Control (FOC) will find in PAC52XX the features that
will allow for a more cost-effective system design.
Typical applications for PAC52XX devices include small appliances, fans and blowers, pumps, and
compressors. Below is a sample application diagram that showcases PAC5250 in an AC high-voltage
environment driving a motor as well as acting as a controller for a flyback converter.
Figure 1 - PAC5250 Block Diagram
This user guide covers the application features, hardware and firmware design for the PAC5250
Sensorless FOC application.
Other topics shown below are also available as Application Notes at www.active-semi.com:






PAC5250 Layout Guidelines
FOC Tuning
Choosing an Rsense Value
Choosing Rgate values for different FETs
Implementing IPD with the PAC52XX
Implementing motor start-in-motion with the PAC52XX
© 2014 Copyright, Active-Semi International, Inc.
-6
-
Rev 0.2 October, 2014
No portion of this document may be reproduced or reused in any form without Active-Semi’s prior written consent
Sensorless FOC Using PAC5250
Power Application Controller
PAC FEATURES FOR MOTOR CONTROL APPLICATIONS
The PAC52XX family of power application controllers has a rich set of features, which make it ideal for
design of a variety of motor control systems.
Below are some of the fey features that make the PAC52XX a very attractive solution for motor control
applications:











Powerful 50MHz ARM Cortex-M0 MCU facilitates the execution of calculation-heavy FOC
control algorithms
Ability to choose between integrated low voltage (52V) or high voltage gate drivers (600V)
Save cost on motor application BOM’s by eliminating the need for expensive Integrated
Power Modules (IPMs)
o For additional flexibility, the PAC52XX family includes a solution for IPM’s with no
integrated gate drivers.
Integrated power management allows for a variety of power supply environments and savings
on BOM cost. The low voltage solution integrates a controller that can be configured as a DCDC converter while the controller in the high voltage solution can be configured as a flyback
converter.
Reduced component count leads to higher reliability and smaller form factor.
Up to 14 PWM generators can be configured in complementary mode with the integrated
hardware dead-time generator
32K FLASH and 8K RAM is an optimal compromise between cost and programmability for
FOC applications.
Powerful ADC auto-sequencer allows automatic sampling of phase current and other
parameters without CPU intervention for accurate sampling based on 10ns trigger resolution
Integrated hardware over-current protection
Peripheral support for both hall-sensored and sensorless FOC operation
I/O’s and ADC inputs allow for communication with additional system components for system
integration
© 2014 Copyright, Active-Semi International, Inc.
-7
-
Rev 0.2 October, 2014
No portion of this document may be reproduced or reused in any form without Active-Semi’s prior written consent
Sensorless FOC Using PAC5250
Power Application Controller
SOLUTION OVERVIEW
Active-Semi provides a reference design for a sensorless FOC high-voltage motor control solution using
the PAC5250 power application controller.
The reference design consists of the following components:




PAC5250 HV FOC Evaluation Kit (EVK)
PAC5250 firmware for EVK
Windows GUI for configuration and solution evaluation
User’s Guide for the firmware and EVK (this document) as well as the Windows GUI
For information on Active-Semi’s High-Voltage FOC application using the PAC5250, please visit the
following:
http://www.active-semi.com/solutions/pac-applications/high-voltage-motor/
Application Features
One of the key advantages of the PAC52XX architecture is the hardware integration that the devices
provide. This enables the peripherals to support tasks without firmware intervention such as highprecision ADC sampling. This allows a more simple hardware design, while letting the firmware focus on
high-value features, such as the control loop for FOC.
The application firmware supports the following features:











Uses space-vector modulation (SVPWM) to drive a PMSM motor
Includes a sensorless speed and position estimator which eliminates the need for expensive
position sensors
Can be operated in two different modes of operation: speed or torque control
Support electrical frequency of up to 250Hz
Control loop can be run as fast as 7kHz while the speed loop runs at a lower speed, every 800us
(1.25 kHz)
Requires 16K-bytes of flash memory (only 50% of available FLASH, which may be used for
additional system features)
Debug mode can be used to view internal algorithm signals in real-time on an oscilloscope. This
feature is especially useful for debugging and tuning the control algorithm parameters.
Initial start-up using “align and go”
Graphic User Interface (GUI) allows user to control motor operation and adjust algorithm
parameters
PWM frequency can be configured to 5kHz, 10kHz, or 15KHz
Start-in-Motion allows motor to be started if it is already moving forward or backward, such as a
fan application
© 2014 Copyright, Active-Semi International, Inc.
-8
-
Rev 0.2 October, 2014
No portion of this document may be reproduced or reused in any form without Active-Semi’s prior written consent
Sensorless FOC Using PAC5250
Power Application Controller
Hardware Features
The PAC5250 provides a high level of integration into a single IC, reducing the BOM cost and raising the
bar for control board design simplicity. The control boards and reference designs made by Active-Semi
reflect this advantage.
Below is a summary of the different major sections and functionalities that PAC devices combined along
with Active-Semi’s FOC software solutions can provide.
Inverter Stage
The inverter stage contains the power drivers that provide current to the motor. They consist of either
MOSFETs or IGBTs arranged in a 3 half-bridge configuration. Each half-bridge provides current to each
one of the three motor phases. This architecture saves cost by eliminating the need for an expensive
Integrated Power Module (IPM).
PAC Controller
The PAC5250 controller generates the PWM signals that are used to control the inverter stage. In other
MOSFET/IGBT designs, a gate driver is necessary as the controller outputs do not have sufficient drive
strength to control the inverter stage. The PAC platform saves cost since the high-voltage gate drivers are
integrated.
Power Supply
The power supply section consists of either a DC-DC converter for low-voltage systems or an AC-DC
converter for high-voltage AC systems. Because PAC contains an integrated power controller that can
manage either DC-DC or flyback converters, it saves more cost and simplifies the design of the power
converter section.
Motor Over-Current Protection
The PAC5250 integrates hardware over-current protection that can be configured to immediately shut
down the inverter section when the current level exceeds a user-programmable threshold. Current
measurement for over-current protection is done via a single shunt resistor located at the common ground
node.
Motor-Phase Current Measurement
The PAC5250 features 3 individually configurable differential amplifier inputs which can be used for motor
current sensing across external shunt resistors. This gives users the flexibility to choose from different
FOC configurations such as 3-shunt, 2-shunt and single-shunt.
This FOC implementation uses two shunt resistors to measure the motor phase currents.
ADC Inputs
A variety of ADC inputs are used in this application to perform control and protection. The ADC monitors
two phase and the motor current, three phase voltages and bus voltage for proper control and protection
for the application.
© 2014 Copyright, Active-Semi International, Inc.
-9
-
Rev 0.2 October, 2014
No portion of this document may be reproduced or reused in any form without Active-Semi’s prior written consent
Sensorless FOC Using PAC5250
Power Application Controller
Communication Interface
The PAC5250 uses the UART as a communications interface. The UART is primarily used for GUI
communication. There is also a SWD programming interface for the device to update the device firmware.
Both UART and SWD are connectors are available on the EVK that allow customers to re-program the
PAC5250 device firmware, as well as use the UART for communication with the Windows GUI.
PWM DAC Debugging Outputs
In order to support tuning the PAC5250 firmware parameters for the FOC loop for particular motor,
internal signals need to be sampled to observe items such as the output regulation of PI controllers.
In order to support this capability, the PAC5250 uses some additional PWM outputs to act as a DAC
function, so these signals can be observed real-time on the PCB. These PWM signals are connected to
an RC filter on the EVK, and the output voltage can be observed with an oscilloscope to see the
continuous output of these signals, in order to tune the control loop.
© 2014 Copyright, Active-Semi International, Inc.
- 10
-
Rev 0.2 October, 2014
No portion of this document may be reproduced or reused in any form without Active-Semi’s prior written consent
Sensorless FOC Using PAC5250
Power Application Controller
THEORY OF OPERATION
FOC Control Algorithm
The diagram below shows the flow for the FOC control algorithm as implemented by this application.
Figure 2- FOC Control Algorithm
Below are brief descriptions for each of the stages of the flow chart:







Current measurement - The current for all three phases is used in the control algorithm. In this
design, two of the phase currents are measured by the ADC and the third phase current is
calculated based on these two measurements.
Clarke Transform - The phase currents are transformed from a 3-phase representation into a 2dimensional representation, referred to as Ialpha and Ibeta.
Park transform - The motor angle information is used to identify the torque and flux components
of the motor current, referred to as Iq and Id.
Speed controller – A PI controller is used to regulate the motor speed by generating the torque
current target required to maintain the desired speed.
Current controllers – PI controllers are used to regulate the torque and flux currents. The PI
controllers regulate these currents by generating the voltage vectors, Vq and Vd that represent
the magnitudes of the torque and flux components of the final drive vector applied to the motor.
Inverse Park Transform - The motor angle information is used to generate the desired drive
vector applied across the motor represented by Valpha and Vbeta.
SVM - Space Vector Modulation is used to translate the drive vector information into the actual
PWM values applied to each phase.
© 2014 Copyright, Active-Semi International, Inc.
- 11
-
Rev 0.2 October, 2014
No portion of this document may be reproduced or reused in any form without Active-Semi’s prior written consent
Sensorless FOC Using PAC5250
Power Application Controller
Motor Position and Speed
The FOC algorithm is required to calculate the motor position and speed. In some applications, this
information could be obtained by using position sensors. This method though increases the cost of the
motor and compromises motor reliability as these sensors can fail. The use of sensors may not even be
possible in some applications like compressors. Nevertheless, the applications that do use sensors will
find that the PAC platform supports this method with the availability of GPIO’s that receive the sensor
signals.
In this application – where no sensors are used – a sensorless method is required. In the FOC algorithm
for this application, a sliding mode observer is used to estimate the motor speed and position. The
observer uses the measured current and the applied voltage vector information to determine the position
of the BEMF. In order to accomplish this, motor parameters of winding resistance (Ra) and the torque and
flux components of winding inductance (Lq and Ld) are necessary.
Motor Startup
Because the observer uses the motor BEMF information, it can only estimate the motor position and
speed when the motor already is in motion above a certain speed. Therefore starting the motor from zerospeed needs to be handled differently. The startup method used by the PAC5250 solution starts the
motor by injecting a torque current that is high enough to drive the motor. During this time the speed of
the drive vector is and ramped to reach a speed where the observer can run properly. When this speed is
reached, the firmware switches over to using the estimated - instead of the forced - position and speed
information. At this point the motor is now running with closed loop control.
The figure below shows the model for the FOC control loop phases.
Figure 3- FOC Control Loop Flow
The diagram below depicts the different phases of motor start-up to get to closed loop operation.
© 2014 Copyright, Active-Semi International, Inc.
- 12
-
Rev 0.2 October, 2014
No portion of this document may be reproduced or reused in any form without Active-Semi’s prior written consent
Sensorless FOC Using PAC5250
Power Application Controller
Figure 4 - Motor Start-up
In closed loop operation the, motor can be driven in two different modes depending on the application:
speed control mode and torque control mode.
© 2014 Copyright, Active-Semi International, Inc.
- 13
-
Rev 0.2 October, 2014
No portion of this document may be reproduced or reused in any form without Active-Semi’s prior written consent
Sensorless FOC Using PAC5250
Power Application Controller
Speed Control Mode
In speed control mode a speed controller PI is used to regulate the torque required to maintain the
desired speed target. The controller will regulate the speed dynamically in response to changes in the
motor by using the speed information from the observer as shown in the figure below.
Figure 5 - Speed Control Flow
If the motor load changes the controller will adjust the target torque current accordingly. Speed control
mode is commonly used in applications such as fans and compressors.
© 2014 Copyright, Active-Semi International, Inc.
- 14
-
Rev 0.2 October, 2014
No portion of this document may be reproduced or reused in any form without Active-Semi’s prior written consent
Sensorless FOC Using PAC5250
Power Application Controller
Torque Control Mode
In torque control mode, there is no speed controller regulating the torque current. Instead, the target
torque current is set externally and the system will instead of regulate the motor speed, it will regulate the
torque that the motor will apply to the load. The final speed of the motor will depend on the speed at
which the applied torque reaches equilibrium with the force the load applies back to the motor. It will not
respond to load changes, so the speed will reduce if the load increases. Examples of cases in which
torque control may be desired are in the acceleration and deceleration of elevators, winding machines,
and some fans or blowers.
The block diagram below illustrates the control loop in torque control mode.
Figure 6 - Torque Mode Flow
© 2014 Copyright, Active-Semi International, Inc.
- 15
-
Rev 0.2 October, 2014
No portion of this document may be reproduced or reused in any form without Active-Semi’s prior written consent
Sensorless FOC Using PAC5250
Power Application Controller
SINUSOIDAL MOTOR DRIVE USING SVPWM
Overview
The Sensorless FOC application uses a Space Vector PWM (SVPWM) to generate the sinusoidal wave
voltages for each of the motor phases, in order to drive the motor. The motor drive is split into 6 “sectors”
which each make up a portion of one electrical rotation of the motor.
See the diagram below on how the application maps the SVPWM sectors to the angle, and how each
phase is energized.
SVM Sectors
Sector-> 2
4
6
5
1
Duty Cycle
3
U
V
W
-30
30
90
150
210
270
330
Angle (Deg.)
Figure 7 - SVM Sectors
When observing each of the motor phase voltages using the PAC5250 FOC Sensorless application, you
should see waveforms similar to what is shown above for the U, V and W phases.
The convention of this application is to align the angle of 0 to sector 2. The table below shows how each
of the sectors’ angles corresponds to the sector.
Table 1 - SVPWM Angle and Sectors
Angle
0
60
120
180
240
300
Sector
2
3
4
5
6
1
Each angle will be identified with the sector from the table above.
© 2014 Copyright, Active-Semi International, Inc.
- 16
-
Rev 0.2 October, 2014
No portion of this document may be reproduced or reused in any form without Active-Semi’s prior written consent
Sensorless FOC Using PAC5250
Power Application Controller
The SVPWM generates three independent PWM signals for each phase: U, V and W. The PWM signals
for each of these phases will have a different relationship with each other, depending on the angle and
sector.
SVPWM Sector PWM Waveforms
The diagrams below show the relationship of each of the phase PWMs with each other, for each of the six
SVPWM sectors.
UH
VH
WH
Figure 8 - Angle 0, SVPWM Sector 2, [U,V,W] = [0,1,0]
UH
VH
WH
Figure 9 - Angle 60, SVPWM Sector 3, [U,V,W] = [0,1,0]
© 2014 Copyright, Active-Semi International, Inc.
- 17
-
Rev 0.2 October, 2014
No portion of this document may be reproduced or reused in any form without Active-Semi’s prior written consent
Sensorless FOC Using PAC5250
Power Application Controller
UH
VH
WH
Figure 10 - Angle 120, SVPWM Sector 4, [U,V,W] = [0,0,1]
UH
VH
WH
Figure 11 - Angle 180, SVPWM Sector 5, [U,V,W] = [0,0,1]
© 2014 Copyright, Active-Semi International, Inc.
- 18
-
Rev 0.2 October, 2014
No portion of this document may be reproduced or reused in any form without Active-Semi’s prior written consent
Sensorless FOC Using PAC5250
Power Application Controller
UH
VH
WH
Figure 12 - Angle 240, SVPWM Sector 6, [U,V,W] = [1,0,0]
UH
VH
WH
Figure 13 Angle 300, SVPWM Sector 0, [U,V,W] = [1,0,0]
© 2014 Copyright, Active-Semi International, Inc.
- 19
-
Rev 0.2 October, 2014
No portion of this document may be reproduced or reused in any form without Active-Semi’s prior written consent
Sensorless FOC Using PAC5250
Power Application Controller
EVK DESIGN DETAILS
Jumpers and Test Points
Designator
J1
Description
Power Connector
J2
UART connector
J3
PWM DAC output
J4
SWD connector
S1
Switch
DRL3
DRL4
DRL5
Test Point
Test Point
Test Point
Pin
1
2
3
1
2
3
4
T,
0-3
1
2
3
4
1
2
Function
Power Supply
Return
Earth Ground
+5VDC
RX
TX
GND
Unused
+5VDC
SWDIO
SWDCL
GND
Debug
Debug
PWM DAC output
PWM DAC output
PWM DAC output
Table 2 - EVK Jumpers and Test Points
PAC5220 Pin Signals
The following are how the pin signals on the PAC5250 device are used in this application.
For more detailed information, see the data sheet for the PAC5250.
Pin # Pin Name
Pin Function
1
XOUT
Not used – leave floating.
2
VCC18
Internally generated 1.8V core power supply.
3
PC3
SW-1 switch 1 input
4
PC2
SW-1 switch 2 input
5
VCC33
Internally generated 3.3V power supply.
6
VSSA
Analog ground. Connect to VSS in a star ground configuration.
7
VSS
Ground
8
AIO0
Phase U current – negative terminal
9
AIO1
Phase U current – positive terminal
10
AIO2
Phase V current – negative terminal
11
AIO3
Phase V current – positive terminal
12
AIO4
Motor current – negative terminal
13
AIO5
Motor current – positive terminal
14
AIO6
Bus Voltage
15
AIO7
Phase U voltage
16
AIO8
Phase V voltage
17
AIO9
Phase W voltage
© 2014 Copyright, Active-Semi International, Inc.
- 20 Rev 0.2 October, 2014
No portion of this document may be reproduced or reused in any form without Active-Semi’s prior written consent
Sensorless FOC Using PAC5250
Power Application Controller
18
19
VSYS
REGO
20
CSM
21
VP
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
VHM
DRM
VSSP
DRL0
DRL1
DRL2
OM0
DRL3
ENHS2
OM2
DRL4
DRL5
DXS0
DXH0
DXB0
DXS1
DXH1
DXB1
DXS2
DXH2
DXB2
PD6
PD5
PD4
PD3
PD2
PD1
PD0
PE0
PE1
PE2
PE3
PE4
PE5
VCCIO
XIN
5V system power supply.
System regulator output. Connect to VSYS directly, or through an
external power dissipating resistor.
Switching supply current sense input. Connect to the positive side of
the current sense resistor.
Main power supply. Provides power to the power drivers as well as the
voltage feedback path for the switching supply.
Switching supply controller supply input.
Switching supply driver output.
Power Ground. Connect to VSS in a start ground configuration.
Low-side gate driver (phase U).
Low-side gate driver (phase V).
Low-side gate driver (phase W).
Unused – connect to ground.
PWM DAC output.
Unused – leave floating.
Unused – connect to ground.
PWM DAC output.
PWM DAC output.
Ultra-high-voltage high-side gate driver source (phase U).
Ultra-high-voltage high-side gate driver (phase U).
Ultra-high-voltage high-side gate driver bootstrap (phase U).
Ultra-high-voltage high-side gate driver source (phase V).
Ultra-high-voltage high-side gate driver (phase V).
Ultra-high-voltage high-side gate driver bootstrap (phase V).
Ultra-high-voltage high-side gate driver source (phase W).
Ultra-high-voltage high-side gate driver (phase W).
Ultra-high-voltage high-side gate driver bootstrap (phase W).
Debug output.
Debug output.
Debut output.
Debug output.
Debug output.
Serial wire debug (SWD) clock.
Serial wire debug (SWD) data input/output.
LED1 output.
UART Transmit Data.
UART Receive Data.
LED2 output.
Unused – leave floating.
Unused – leave floating.
Internally generated digital I/O power supply.
Unused – leave floating.
Table 3 - PAC5220 Pin Functions
© 2014 Copyright, Active-Semi International, Inc.
- 21
-
Rev 0.2 October, 2014
No portion of this document may be reproduced or reused in any form without Active-Semi’s prior written consent
Sensorless FOC Using PAC5250
Power Application Controller
PCB Schematic
Figure 14 - EVK Schematic
© 2014 Copyright, Active-Semi International, Inc.
- 22
-
Rev 0.2 October, 2014
No portion of this document may be reproduced or reused in any form without Active-Semi’s prior written consent
Sensorless FOC Using PAC5250
Power Application Controller
Bill of Materials (BOM)
Table 4 – Bill of Materials (BOM)
Designator
Quantity
Value
Desc
Vendor
Vendor PN
Manufacturer
Manufact PN
BD1
1 N/A
RECT BRIDGE GPP 10A 1000V GBU
Digikey
GBU1010DI-ND Didoes
GBU1010
C1
1 0.22uF
CAP FILM 0.22UF 760VDC RADIAL
Digikey
399-5427-ND
PHE840MX6220MB06R17
C10, C21, C22, C23
4 330pF
CAP CER 330PF 50V 10% X7R 0603
Digikey
311-1186-1-ND Yageo
CC0603KRX7R9BB331
C11
1 330uF
CAP ALUM 330UF 50V 20% RADIAL
Digikey
P5184-ND
ECA-1HM331
C12
1 560pF
CAP CER 560PF 100V 5% NP0 0805
Digikey
490-1612-1-ND Murata
GRM2165C2A561JA01D
C13, C18, C19, C20
4 1uF
CAP CER 1UF 50V 10% JB 0805
Digikey
445-11490-1-ND TDK
C2012JB1H105K085AB
C14, C15, C16, C17, C31, C35
6 1uF
CAP CER 1UF 25V 10% X5R 0603, CAP CER 1UF 25V 10%
Digikey
X5R 0603, CAP
311-1445-1-ND,
CER 1UF 25V 10%
311-1445-1-ND,
Yageo
X5R 0603, CAP
311-1445-1-ND,
CER
CC0603KRX5R8BB105
1UF 25V 311-1445-1-ND,
10% X5R 0603, CAP
445-11490-1-ND,
CER 1UF 50V 10%
445-11490-1-ND
JB 0805, CAP CE
C2, C29, C30
3 4.7nF
CAP CER 4700PF 50V 10% X7R 0805
Digikey
311-1133-1-ND Yageo
CC0805KRX7R9BB472
C24
0 1uF
CAP FILM 1UF 630VDC RADIAL
Shanghai
CBB22-105/630VPanasonic
CBB22
C25, C26, C27
3 0.1uF
CAP CER 0.1UF 630V 20% X7T 1210
Digikey
445-14941-1-ND TDK
C3225X7T2J104M160AC
C28
1 4.7uF
CAP CER 4.7UF 25V 10% X5R 0805
Digikey
445-4116-1-ND TDK
C2012X5R1E475K125AB
C3, C4
2 820pF
CAP CER 820PF 2KV 10% RADIAL
Digikey
CK45-B3DD821KYNR-ND
TDK
CK45-B3DD821KYNR
C32
1 0.01uF
CAP CER 10000PF 50V 10% X7R 0603
Digikey
445-1311-1-ND TDK
C1608X7R1H103K080AA
C33, C34, C43, C44, C45
5 0.1uF
CAP CER 0.1UF 50V Y5V 0603
Digikey
311-1343-1-ND Yageo
CC0603ZRY5V9BB104
C36, C37, C38
3 0.1uF
CAP CER 0.1UF 50V Y5V 0805
Digikey
311-1361-1-ND Yageo
CC0805ZRY5V9BB104
C5
1 82u
CAP ALUM 82UF 450V 20% RADIAL
Digikey
1189-1391-ND
450TXW82MEFC18X30
C6
1 1uF
CAP CER 1UF 630V 20% X7T SMD
Digikey
445-7110-1-ND TDK Corporation
CKG57NX7T2J105M500JH
C7
1 6.8uF
CAP ALUM 6.8UF 450V 20% RADIAL
Digikey
493-6862-ND
Nichicon
UCY2W6R8MPD
C8
1 10u
CAP ALUM 10UF 50V 20% RADIAL
Digikey
P5567-ND
Panasonic
ECA-1HHG100
C9
1 0.01uF
CAP CER 10000PF 1KV 10% RADIAL
Digikey
399-9793-ND
Kemet
C322C103KDR5TA
D1, D4, D5, D6
4 N/A
DIODE SUPER FAST 600V 1A DO41
Digikey
MUR160-TPMSTR-ND
Micro Commercial
D2
1 N/A
Schottky Diodes & Rectifiers Low VF ESD 2A 100V Schottky
Mouser Rectifier 750-SB2100E-G Comchip
SB2100E-G
D3
1 N/A
DIODE SMALL SIG 100V 0.2A SOD80
Digikey
LL4148FSCT-ND Fairchild
LL4148
DRL3, DRL4, DRL5
3 N/A
CONN HEADER .100 SINGL STR 1POS
Digikey
S1012E-01-ND
Sullins
PEC01SAAN
J2, J4
2 N/A
CONN HEADER 4POS .100 STR TIN
Digikey
609-3305-ND
FCI
68002-404HLF
J3
1 N/A
CONN HEADER 7POS .100" STR TIN
Digikey
WM8077-ND
Molex
0901200127
L1
1 N/A
Inductor 5A 30mH(Customized)
Active-Semi
Provided by Active
N/A
ET24
L3
1 1.5mH
CHOKE RF 1500UH 100MA AXIAL
Digikey
495-5553-1-ND Epcos
B78108S1155J
LED1, LED2, LED3
3 RED
LED RED CLEAR 0805 SMD
Digikey
160-1176-1-ND Lite On
LTST-C170CKT
Q1
1 N/A
MOSFET N-CH 600V 2A TO-220
Digikey
FQP2N60CFS-NDFairchild
FQP2N60C
R1, R2
2 1M (1%)
RES 1.00M OHM 1/4W 1% 1206 SMD
Digikey
311-1.00MFRCT-ND
Yageo
RC1206FR-071ML
R10
1 1.0 (1%)
RES 1 OHM 1/2W 1% 1206
Digikey
A109669CT-ND TE Connectivity
RLP73K2B1R0FTDF
R12
1 2K
RES 2K OHM 1/8W 5% 0805
Digikey
RMCF0805JT2K00CT-ND
Stackpole
RMCF0805JT2K00
R13, R47, R49
3 402K (1%)
RES 402K OHM 3/4W 1% 2010 SMD
Digikey
P402KACCT-ND Panasonic
ERJ-12SF4023U
R14, R15, R41, R42, R43
5 10k
RES 10K OHM 1/10W 5% 0603 SMD
Digikey
311-10KGRCT-NDYageo
RC0603JR-0710KL
R16
1 51
RES 51 OHM 2/3W 5% 1206 SMD
Digikey
P51ALCT-ND
ERJ-P08J510V
R19, R20, R21, R22, R23, R24
6 20
RES 20 OHM 1/8W 5% 0805 SMD
Digikey
311-20ARCT-ND Yageo
RC0805JR-0720RL
R28, R29, R30
3 1
RES 1 OHM 2W 5% 2512 SMD
Digikey
CRM2512-JW-1R0ELFCT-ND
Bourns
CRM2512-JW-1R0ELF
R3
1 10k (1%)
RES 10.0K OHM 1/10W 1% 0603 SMD
Digikey
311-10.0KHRCT-ND
Yageo
RC0603FR-0710KL
R31, R32, R33, R34, R51, R52, R53, R54, R55,
10 0R
R56
RES 0.0 OHM 1/10W JUMP 0603 SMD
Digikey
311-0.0GRCT-NDYageo
RC0603JR-070RL
R39
1 10
RES 10.0 OHM 1/4W 1% 1206 SMD
Digikey
311-10.0FRCT-NDYageo
RC1206FR-0710RL
R4, R5
2 510K
RES 510K OHM 1/4W 5% 1206 SMD
Digikey
311-510KERCT-ND
Yageo
RC1206JR-07510KL
R40, R48, R50
3 2.4K (1%)
RES 2.4K OHM 1/8W 1% 0805 SMD
Digikey
P2.40KCCT-ND
ERJ-6ENF2401V
R44, R45, R46
3 10k
RES 10K OHM 1/8W 5% 0805 SMD
Digikey
311-10KARCT-NDYageo
RC0805JR-0710KL
R57, R58, R59
3 4.3K
RES 4.30K OHM 1/10W 1% 0603 SMD
Digikey
311-4.30KHRCT-ND
Yageo
RC0603FR-074K3L
R6
1 100K
RES 100K OHM 1/4W 5% 1206 SMD
Digikey
311-100KERCT-ND
Yageo
RC1206JR-07100KL
R66
1 3k
RES 2.4K OHM 1/10W 5% 0603 SMD
Digikey
311-2.4KGRCT-NDYageo
RC0603JR-072K4L
R7
1 100
RES 100 OHM 1/8W 1% 0805 SMD
Digikey
311-100CRCT-NDYageo
RC0805FR-07100RL
R8, R11
2 51
RES 51 OHM 1/8W 5% 0805 SMD
Digikey
311-51ARCT-ND Yageo
RC0805JR-0751RL
R9, R17, R18, R25, R26, R27, R36, R37, R389 1k
RES 1.0K OHM 1/10W 5% 0603 SMD
Digikey
311-1.0KGRCT-NDYageo
RC0603JR-071KL
S1
1 N/A
SWITCH DIP 2POS EXT ACT 24V
Digikey
SW1198-ND
A6TN-2104
T1
1 N/A
EE16 transformer(Customized)
Active-Semi
Provided by Active
N/A
EE16
U1
1 N/A
N/A
Active-Semi
Provided by Active
N/A
PAC5250QF
C39, C40, C41, C42
0 NC
N/A
N/A
N/A
N/A
D7, D8, D9, D10, D11, D12
0 N/A
DIODE SMALL SIG 100V 0.2A SOD80
Digikey
LL4148FSCT-ND Fairchild
LL4148
J1
0 N/A
CONN HEADER 3POS 5.08MM VERT TIN
N/A
N/A
Molex
10-32-1031
Q2, Q3, Q4, Q5, Q6, Q7
6 N/A
IGBT 600V 48A 250W TO220AB
N/A
N/A
IR
IRGB4062DPBF
R35
0 0R(NC)
N/A
N/A
N/A
N/A
N/A
R60, R61, R62, R63, R64, R65, U, V, VCCIO,5 VSYS,
N/A W
N/A
N/A
N/A
N/A
N/A
© 2014 Copyright, Active-Semi International, Inc.
- 23
-
Kemet
Panasonic
Rubycon
Panasonic
Panasonic
Omron
N/A
MUR160-TP
Rev 0.2 October, 2014
No portion of this document may be reproduced or reused in any form without Active-Semi’s prior written consent
Sensorless FOC Using PAC5250
Power Application Controller
PCB Layout
Figure 15 - EVK Top Silkscreen
© 2014 Copyright, Active-Semi International, Inc.
- 24
-
Rev 0.2 October, 2014
No portion of this document may be reproduced or reused in any form without Active-Semi’s prior written consent
Sensorless FOC Using PAC5250
Power Application Controller
Figure 16 – EVK Top Layer
© 2014 Copyright, Active-Semi International, Inc.
- 25
-
Rev 0.2 October, 2014
No portion of this document may be reproduced or reused in any form without Active-Semi’s prior written consent
Sensorless FOC Using PAC5250
Power Application Controller
Figure 17 - EVK Bottom Layer
© 2014 Copyright, Active-Semi International, Inc.
- 26
-
Rev 0.2 October, 2014
No portion of this document may be reproduced or reused in any form without Active-Semi’s prior written consent
Sensorless FOC Using PAC5250
Power Application Controller
FIRMWARE DESIGN
The PAC5250 Sensorless FOC application comes with a complete firmware design that supports many
common features for PMSM motors. In addition to the main control loop, the application contains firmware
support for soft start, open loop start-up, start-in-motion as well as UART communication for a Windows
1
GUI.
A control application like this has very strict real-time requirements. The PWMs that drive the motor
phases, ADC sampling and control frequency all have to follow very precise and regular timing. Because
of this, the application is completely interrupt driven. After initialization, all other processing is done based
on timer interrupts, all relative to the generated PWM signals used to drive the inverter stage.
The interrupt priorities are configured such that the control loop can always run when it is supposed to,
while supporting other activities at the same time – such as UART communication.
The sub-sections below discuss more detailed design aspects as well as performance of the application
firmware.
Firmware Architecture
This firmware application is provided to the customers in two portions:


C-Language Source Code
Archived Library
See the diagram below for an example.
Library
[C archive: *.a, *.h]
Application
[C Source: *.c, *.h]
- Device Initialization
- Main FOC State
Machine
- Interrupt Service
Routines
- Timers, switch
input, AFE, ADC
- UART processing for
GUI
- Misc. Utilities
- FOC Control
- Clarke, Park
Transforms
- Sector ID
- Speed and Position
Estimator
Figure 18 - Firmware Library Architecture
1
For more feature description, see the section above on application features
© 2014 Copyright, Active-Semi International, Inc.
- 27
-
Rev 0.2 October, 2014
No portion of this document may be reproduced or reused in any form without Active-Semi’s prior written consent
Sensorless FOC Using PAC5250
Power Application Controller
Source code is provided for most of the application. The main program, Interrupt Service Routines (ISRs),
UART processing and the main FOC state machine are provided in source-code format. Customers may
use this firmware as-is, or may modify to meet the requirements of their system.
Other functions that should not change are provided in a library archive, along with header files. These
functions are the standard FOC transforms (Clarke, Park, and Inverse Park), the SVPWM drive stage as
well as the speed and position estimator.
The firmware source and library modules are provided to customers along with the IDE project for either
2
of the support PAC52XX tool-sets: CooCox CoIde or IAR Embedded Systems for ARM.
Firmware Modules
The following table contains the list of firmware modules that are included in this version of the reference
design. Files that are included in the distribution that are not shown in the project or in this table below are
not used.
File Type
Library
Library Archive
File Name
Description
libFOC.a
C-language
Header (*.h)
application.h
fix16.h
foc_core_functions.h
foc_misc_function.h
Archived library of FOC transforms, SVPWM as well
as speed and position estimator
Application definitions and function prototypes
Q-math definitions and interface
Function prototypes for FOC transforms and SVM
Function prototypes for miscellaneous support
functions (setting PID parameters, calculating motor
current, etc.)
Speed and position estimator function prototypes
FOC definitions and function prototypes
PID controller definitions and function prototypes
foc_estimator_ipmsm.h
foc.h
pid.h
Application
C-language
Header (*.h)
C-language
Source (*.c)
debug.h
version.h
application.c
debug.c
fault.c
fix16.c
foc_main_state_machine.c
foc_misc_functions.c
init.c
isr_adc.c
Debug data definitions and function prototypes. Used
for defining debugging variables as well as function
prototypes for using PWM DAC outputs for real-time
debugging and loop tuning.
Firmware version information
Utility functions for enabling and disabling the motor
and PWM DAC functions.
PWM DAC debug functions.
Fault processing and over-current reset.
Q-math library functions.
Main state machine for FOC. Determines motor startup, start-in-motion state, open to closed loop
transition, etc. Calls FOC sub-state machine in FOC
library after in closed loop operation.
Support functions for setting speed, calculating duty
cycle and saturation limits, etc.
Functions for MCU and Analog peripheral
initialization.
Interrupt Service Routine for ADC conversion series
2
For more information on CooCox CoIde or IAR Systems Embedded Workbench for ARM with
PAC52XX, see www.active-semi.com/support/resources.
© 2014 Copyright, Active-Semi International, Inc.
- 28 Rev 0.2 October, 2014
No portion of this document may be reproduced or reused in any form without Active-Semi’s prior written consent
Sensorless FOC Using PAC5250
Power Application Controller
completion. Drives main FOC state machine.
Interrupt Service Routine used to detect over-current
condition from the analog sub-system. Turns off all
peripherals, and waits in over-current state until reset
via GUI.
Miscellaneous interrupt service routines. Used to
detect faults in ARM Cortex-M0 (NMI, Hard Fault) as
well as memory controller faults.
Counts PWM frequency, so that control loop can run
at a slow multiple of switching frequency. For
example, Fs can be 15kHz and control loop can run at
5kHz.
Main program. Calls all intitilzation routines, enables
interrupts and then waits.
Generic PID controller function.
UART functions and Interrupt Service Routine (ISR).
Used for receive and transmit of UART messages for
use with the GUI.
isr_gpioB.c
isr_stubs.c
isr_timerA.c
main.c
pid.c
uart_GUI.c
Table 5 - Firmware Modules
© 2014 Copyright, Active-Semi International, Inc.
- 29
-
Rev 0.2 October, 2014
No portion of this document may be reproduced or reused in any form without Active-Semi’s prior written consent
Sensorless FOC Using PAC5250
Power Application Controller
FIRMWARE CONTROL AND DATA FLOW
The PAC5250 firmware for Sensorless FOC control has several independent code paths that are used for
various functions.
The following diagrams shows the control and data flow for the various functions within the application.
Initialization
Shortly after the PAC5250 comes out of reset, the MCU will begin executing instructions. The firmware
will be responsible for configuring both the MCU and analog peripherals, before allowing the proper
operation of the motor.
Below is a high-level flow-chart showing the initialization of the system.
MCU Reset
FOC
Initialization
MCU
Peripheral
Initialization
Analog
Peripheral
Initialization
Enable
Interrupts and
start
Wait
All of the initialization functions are called from the main program, from the file main.c.
At the end of main(), the global interrupts and ADC are enabled, and then the application is ready to start
the motor. This may be commanded by the GUI (via UART commands) or automatically started via
firmware.
Interrupt Service Routines
There are several Interrupt Service Routines (ISRs) in the application. Each has a different responsibility.
The ISRs that are used in this application are:
© 2014 Copyright, Active-Semi International, Inc.
- 30
-
Rev 0.2 October, 2014
No portion of this document may be reproduced or reused in any form without Active-Semi’s prior written consent
Sensorless FOC Using PAC5250
Power Application Controller




ADC
Timer A
UART
GPIOB
3
The highest priority interrupt is Timer A (priority 0) . This allows Timer A to quickly count the number of
15kHz periods that have expired, even if the control loop or UART are current running. This is critical for
proper operation of the control loop and application.
The ADC interrupt priority is set to a 1. This allows it to run higher than all other interrupts, other than the
Timer A interrupt.
The UART and all other interrupts are set to a 2. These functions are not time critical, and this allows
them to run when there is time available, and won’t affect the operation of the other critical FOC functions.
Each of the application ISRs are described below in more detail.
ADC ISR
This is the main ISR for the FOC processing. This interrupt is configured to have an interrupt priority of 1.
The Timer A interrupt (which counts the number of 15kHz periods) is the highest priority
The ADC uses its auto-sequences for converting several critical parameters as the motor is running
(current, bus voltage, etc.). This happens at the PWM frequency, so that these samples are always taken
in the same place in the PWM waveform.
When this interrupt is generated and the ISR is called, it will perform the following actions:


Check the number of times the 15kHz timer has interrupted. If it is a multiple of three, then do the
following:
o Call the FOC Main state machine (at a period of 5kHz).
o Update the PWM DAC variables for debugging
Clear the interrupt flag and exit
Timer A ISR
This ISR is used to count the number of 15kHz periods.
This application supports a switching frequency (Fs) of 15kHz and a control frequency of 5kHz. Timer A
counts the number of 15kHz period, so that the ADC ISR can only call the control loop when there have
been three of the Timer A interrupts, which will result in calling the FOC state machine at a period of
5kHz.
When this timer is called, it simply increments a counter, then clears the interrupt flag and exits.
Since this is the highest priority interrupt, even if the ADC interrupt (or any other interrupt) is being
serviced, this will pre-empt the MCU so that the counter may be incremented.
3
The ARM Cortex-M0 interrupt priorities are numbered 0 to 3, where 0 is the highest priority.
© 2014 Copyright, Active-Semi International, Inc.
- 31 Rev 0.2 October, 2014
No portion of this document may be reproduced or reused in any form without Active-Semi’s prior written consent
Sensorless FOC Using PAC5250
Power Application Controller
UART ISR
The UART ISR handles receiving and transmitting of UART characters to an external host. In this case,
the host is a Windows GUI, which uses a USB to UART adapter to communicate between the PC and
target.
The UART priority is set to a 3, as the performance of the UART is not as important as the FOC control
operation.
When the UART interrupt is generated, the type of interrupt is checked. When processing receive
characters, the firmware assembles them into a single message, then acts on the message (reads or
writes data to the target). When the message has been completely received, the firmware turns off the
receive interrupt, and turns on the transmit interrupt so that the response may be sent to the host.
When all of the transmit characters have been sent out, then the transmit interrupt is disabled and the
receive interrupt is turned back on.
GPIOB ISR
The firmware application configures the analog sub-system to provide over-current protection. Upon an
over-current event, the analog peripherals will generate a interrupt on PB0. The application uses GPIOB’s
Interrupt Service Routine to handle such events.
If an interrupt is received on GPIOB, the firmware takes the following actions:



Disable the motor and PWM DAC outputs
Reset the duty cycles to 0%
Clear the interrupt flag and exit
When in this over-current state, the system is latched off. The GUI may reset this via a UART command,
but unless it is it will remain non-operational until a power cycle.
© 2014 Copyright, Active-Semi International, Inc.
- 32
-
Rev 0.2 October, 2014
No portion of this document may be reproduced or reused in any form without Active-Semi’s prior written consent
Sensorless FOC Using PAC5250
Power Application Controller
FOC STATE MACHINES
FOC Main State Machine
The Main FOC Main State Machine is the high-level state machine that handles system calibration, motor
startup motor, transition and error handling. The main state machine in this application is run when the
ADC completes a series of conversions of the phase and motor currents, and DC bus voltage, and has
enough information to run the control loop.
The FOC Main State Machine is shown in the diagram below.
CL speed reached
Motor Enabled
Cal complete
Reset
ADC
Calibrate
Startup
Open
Loop
Motor
Stopped
System Error
Sensorless
FOC
Motor Disabled
Motor Disabled
System Error
FOC Control State Machine
(open or closed loop)
Table 6 - FOC Main State Machine
Note that certain features – like Start-in-Motion – are not shown in this diagram, and will be detailed in a
separate application note.
ADC Calibrate State
The main state machine will reset to a state of ADC Calibrate. In this state, the ADC offset is measured
and calibrated for accurate current and voltage measurements during operation. This operation is only
performed on device reset, unless there is an internal error. When complete, the state machine advances
to the Motor Stopped state.
Motor Stopped State
In this state, the system will wait until commanded to turn on the motor, usually via a UART command
from a GUI. The firmware may also easily be changed to automatically start the motor after a delay in this
state.
© 2014 Copyright, Active-Semi International, Inc.
- 33
-
Rev 0.2 October, 2014
No portion of this document may be reproduced or reused in any form without Active-Semi’s prior written consent
Sensorless FOC Using PAC5250
Power Application Controller
When either of these two events happens, the state machine will advance to the Startup Open Loop
state.
Startup Open Loop State
In this state, the motor will run in open loop mode until it reaches the configured open loop speed, at
which time it will advance into the Sensorless FOC state. The FOC Control state machine (in the library)
will control the operation in this state, and has the configurable parameters that the user may set to
control at which speed this transition takes place.
Sensorless FOC State
In this state, the system is controlling the motor with a closed loop using the FOC control algorithm. Like
the Startup Open Loop State, the actual FOC Control State Machine will control motor regulation, via its
set of configurable parameters.
Several operational conditions may cause the application to exit this state. The motor may be
commanded off, via the GUI, in which case the state will advance to the Motor Stopped state.
Additionally, there are user-configurable parameters that are checked to make sure that the closed loop
speed is not below or above a threshold. If these parameters are violated, the application will advance to
the Motor Stopped state.
During any of the states shown above, the UART may be used to communicate with the target, to read
out status or change configuration information at any time.
FOC Control State Machine
The FOC Control State Machine controls the main FOC loop. This state machine handles both open and
closed loop operation and is located in the FOC library. The FOC Main State Machine – described above
– will call this state machine at a regular period to perform open or closed loop control.
The figure below shows a high-level diagram of this state machine.
Clarke
Speed/
Position
Estimator
Inverse
Park
Park
Update
Speed
SetPoint
SVM
Table 7 - FOC Control State Machine
The FOC Control State Machine contains the start components from a FOC control loop:



Clarke and Park Transforms
Speed and Position Estimator
SVM for PWM output
© 2014 Copyright, Active-Semi International, Inc.
- 34
-
Rev 0.2 October, 2014
No portion of this document may be reproduced or reused in any form without Active-Semi’s prior written consent
Sensorless FOC Using PAC5250
Power Application Controller
In this state machine, after the current speed and position is calculated, the application checks to see if
the speed set-point has been changed, so that it can be used as a reference the next time the control
loop runs.
At the end of this state machine – before control is handed back to the FOC Main State Machine – the
new PWM is set by the output of the SVM block.
© 2014 Copyright, Active-Semi International, Inc.
- 35
-
Rev 0.2 October, 2014
No portion of this document may be reproduced or reused in any form without Active-Semi’s prior written consent
Sensorless FOC Using PAC5250
Power Application Controller
MCU RESOURCE UTILIZATION
To enable the proper operation of this application, the firmware configures and uses many of the device
peripherals.
The table below shows all the used peripherals and their functions.
Peripheral
Misc MCU Peripherals
Clock Control
Instance
Usage
n/a
PLL enabled (100MHz). HCLK = 50MHz, ACLK = 100MHz.
ACLK supplies Timer A.
Timers/Dead-time Generators
Timer A
CCR0
CCR4
CCR5
CCR6
Timer B
CCR0
Timer C
CCR0
Timer D
CCR0
DTGA0
DTGA0H
DTGA0L
DTGA1
DTGA1H
DTGA1L
DTGA2
DTGA2H
DTGA2L
Communication
UART
n/a
GPIO
GPIO A
PA0
PA1
PA2
PA3
PA4
PA5
PA6
PA7
GPIO B
GPIO C
GPIO D
GPIO E
PB0
PC0
PC2
PC3
PD0
PD1
PD7
PE0
PE1
ADC interrupt trigger
Phase U, high-side gate driver PWM (input to DTGA0)
Phase V, high-side gate driver PWM (input to DTGA1)
Phase W, high-side gate driver PWM (input to DTGA2)
PWM DAC output 1
PWM DAC output 2
PWM DAC output 3
Phase U, high-side gate driver PWM (output to PA6/DXH0)
Phase U, low-side gate driver PWM (output to PA0/DRL0)
Phase V, high-side gate driver PWM (output to PA7/DXH1)
Phase V, low-side gate driver PWM (output to PA1/DRL1)
Phase W, high-side gate driver PWM (output to PD7/DXH2)
Phase W, low-side gate driver PWM (output to PA2/DRL2)
GUI RX/TX
Phase U, low-side gate driver PWM. Input from DTGA0L,
output to DRL0
Phase V, low-side gate driver PWM. Input from DTGA1L,
output to DRL1
Phase W, low-side gate driver PWM. Input from DTGA2L,
output to DRL2
PWM DAC 1. Input from Timer B, CCR0. Output to DRL3.
PWM DAC 2. Input from Timer C, CCR0. Output to DRL4.
PWM DAC 3. Input from Timer D, CCR0. Output to DRL5.
Phase U, high-side gate driver PWM. Input from DTGA0H.
Output to DXH0.
Phase V, high-side gate driver PWM. Input from DTGA1H.
Output to DXH1.
Analog sub-system over-current interrupt.
Analog sub-system AIO<n> ADC MUX input to MCU.
SW toggle switch MCU output 1.
SW toggle switch MCU output 2.
SWD Data Input/Output (programming port)
SWD Clock Input (programming port)
Phase W, high-side gate driver PWM. Input from DTGA2H.
Output to DXH2.
LED 1 output.
UART Transmit Data.
© 2014 Copyright, Active-Semi International, Inc.
- 36
-
Rev 0.2 October, 2014
No portion of this document may be reproduced or reused in any form without Active-Semi’s prior written consent
Sensorless FOC Using PAC5250
Power Application Controller
PE2
PE3
ADC
ADC Configuration
AIO Channels
AS0
AS0
Sequence
AIO10
AIO32
AIO54
AIO6
AIO7
AIO8
AIO9
UART Receive Data.
LED2 output.
Auto, independent triggers, /7 divider, repeat mode
PWMA0 trigger input
Iu, Iv, Iw and Vbus
Phase U current.
Phase V current.
Phase W current.
VDC main bus voltage.
Phase U voltage.
Phase V voltage.
Phase W voltage.
© 2014 Copyright, Active-Semi International, Inc.
- 37
-
Rev 0.2 October, 2014
No portion of this document may be reproduced or reused in any form without Active-Semi’s prior written consent
Sensorless FOC Using PAC5250
Power Application Controller
CONCLUSION
This application note shows how the PAC family of power application microcontroller IC’s can provide a
powerful solution for designs which need an FOC implementation to drive a PMS motor. Not only does
the PAC platform provide all the processing power and peripherals necessary for motor control, but also it
does so at a lower cost due to the highest level of integration that is available in the market today.
Designers will find in PAC a much simpler, quicker, and more cost-effective way to implement a motor
control system that will meet tomorrow’s challenges in a wide variety of applications.
© 2014 Copyright, Active-Semi International, Inc.
- 38
-
Rev 0.2 October, 2014
No portion of this document may be reproduced or reused in any form without Active-Semi’s prior written consent
Sensorless FOC Using PAC5250
Power Application Controller
ABOUT ACTIVE-SEMI
Active-Semi, Inc. headquartered in Dallas, TX is a leading innovative semiconductor company with
proven power management, analog and mixed-signal products for end-applications that require power
conversion (AC/DC, DC/DC, DC/AC, PFC, etc.), motor drivers and control and LED drivers and control
along with ARM microcontroller for system development.
Active-Semi’s latest family of Power Application Controller (PAC)™ ICs offer high-level of integration with
32-bit ARM Cortex M0, along with configurable power management peripherals, configurable analog
front-end with high-precision, high-speed data converters, single-ended and differential PGAs, integrated
low-voltage and high-voltage gate drives. PAC IC offers unprecedented flexibility and ease in the systems
design of various end-applications such as Wireless Power Transmitters, Motor drives, UPS, Solar
Inverters and LED lighting, etc. that require a microcontroller, power conversion, analog sensing, highvoltage gate drives, open-drain outputs, analog & digital general purpose IO, as well as support for wired
and wireless communication. More information and samples can be obtained from http://www.active-
semi.com or by emailing [email protected]
Active-Semi shipped its 1 Billionth IC in 2012, and has over 120 in patents awarded and pending
approval.
LEGAL INFORMATION & DISCLAIMER
Copyright © 2012-2013 Active-Semi, Inc. All rights reserved. All information provided in this document is subject to legal disclaimers.
Active-Semi reserves the right to modify its products, circuitry or product specifications without notice. Active-Semi products are not intended, designed,
warranted or authorized for use as critical components in life-support, life-critical or safety-critical devices, systems, or equipment, nor in applications where
failure or malfunction of any Active-Semi product can reasonably be expected to result in personal injury, death or severe property or environmental damage.
Active-Semi accepts no liability for inclusion and/or use of its products in such equipment or applications. Active-Semi does not assume any liability arising
out of the use of any product, circuit, or any information described in this document. No license, express, implied or otherwise, is granted under any patents,
copyrights or other intellectual property rights of Active-Semi or others. Active-Semi assumes no liability for any infringement of the intellectual property rights
or other rights of third parties which would result from the use of information contained herein. Customers should evaluate each product to make sure that it
is suitable for their applications. Customers are responsible for the design, testing, and operation of their applications and products using Active-Semi
products. Customers should provide appropriate design and operating safeguards to minimize the risks associated with their applications and products. All
products are sold subject to Active-Semi's terms and conditions of sale supplied at the time of order acknowledgment. Exportation of any Active-Semi
product may be subject to export control laws.
Active-Semi™, Active-Semi logo, Solutions for Sustainability™, Power Application Controller™, Micro Application Controller™, Multi-Mode Power
Manager™, Configurable Analog Front End™, and Application Specific Power Drivers™ are trademarks of Active-Semi, I. ARM® is a registered trademark
and Cortex™ is a trademark of ARM Limited. All referenced brands and trademarks are the property of their respective owners.
© 2014 Copyright, Active-Semi International, Inc.
- 39
-
Rev 0.2 October, 2014
No portion of this document may be reproduced or reused in any form without Active-Semi’s prior written consent