This application note describes a 3-phase synchronous permanent magnet motor control software library developed for the ST7MC drive with sinusoidal waveform. The ST7MC microcontroller contains a peripheral dedicated to 3-phase brushless motor control, making it suitable
for AC induction motors and permanent magnet DC/AC motors (PMDC/PMAC, also called
BLDC).
The library described here is made of several C modules that contain a set of convenient functions for the generation of the sinusoidal waveform, the synchronization mechanism and
closed loop control of PMAC induction motors and is compatible with both COSMIC
(www.cosmic-software.com) and METROWERKS (www.metrowerks.com) compilers.
The control of a Permanent magnet motor in six-step mode is detailed in application note
AN1905. The control of an AC induction motor is detailed in application note AN1904.
This software allows users to quickly evaluate both the MCU and the available tools, and to
have a motor running in a very short time when used together with the ST7MC starter kit
(ST7MC-KIT/BLDC) and the demonstration AMETEK BLDC motor. It also eliminates the need
for time-consuming development of sine wave generation and speed regulation algorithms by
providing ready to use functions that let the user concentrate on his application layer.
The prerequisite for using this library is the basic knowledge of C programming, AC motor
drives and power inverter hardware. In-depth know-how of ST7MC functions is only required
for customizing existing modules and when adding new ones for complete application devel
opment.
ST7MC PMAC SINE WAVE MOTOR CONTROL SOFTWARE LIBRARY
Why use PMAC?
Standard induction motors, normally designed to run at base speeds between 850 to 3500
rpm, are not particularly well suited for low-speed operation, as their efficiency drops with the
reduction in speed. They may also be unable to deliver sufficient smooth torque at low speeds.
The use of a gearbox is the traditional mechanical solution to this problem. However, the
gearbox is a complicated piece of machinery that takes up space, reduces efficiency, and
needs both maintenance and significant quantities of oil. Replacing the gearbox with perma
nent magnet motors/drive configurations saves space and installation costs, energy and maintenance, and provides more flexibility in production and facility design. These motors use
magnets to produce the magnetic rotor field rather than the magnetizing component of the
stator current like in the induction motor.
Figure 1 shows a cross section of a typical PM motor. The rotor has an iron core in the surface
of which is mounted a thin permanent magnet. An alternating magnet of opposing magnetization produces radially directed flux density across the air gap. This flux then reacts with currents in the stator windings to produce torque.
-
Figure 1. Cross Section of PM Motor
a
N
-b
a
N
-c
-b
SS
N
c
S
b
-a
1 Poles Pairs3 Poles Pairs
The two most common types of brushless PM motors are classified as:
c
S
-a
-c
N
b
– synchronous, with a uniformly rotating stator field as an induction motor. This is also referred
to as PMAC,
– switched or trapezoidal, with stator fields that are switched in discrete steps. This is also re-
ferred to as PMDC.
4/36
2
ST7MC PMAC SINE WAVE MOTOR CONTROL SOFTWARE LIBRARY
Figure 2 provides a direct comparison of ideal current excitation waveforms for typical three-
phase sinusoidal and trapezoidal PM machines.
Figure 2. Sinusoidal (PMAC) and Trapezoidal (PMDC or 6-step) Current Excitation
120°
240°
(a) Sinusoidal
Phase A
Phase B
Phase C
1
120°
2
240°
3
(b) Trapezoidal
456
2
The trapezoidal PM machine (also called PMDC or BLDC) is specifically designed to develop
nearly constant output torque when excited with a six-step switched current waveform. The
stator windings of the trapezoidal PM machine are concentrated into narrow phase belts. The
resulting back-EMF voltage induced in each stator phase winding during rotation can be mod
elled quite accurately as a trapezoidal waveform.
The sinusoidal PM machine also called PMAC or synchronous PM is specifically designed to
be excited with a sinusoidal current waveform. The stator windings of the sinusoidal PM ma
chine are instead typically distributed over multiple slots in order to approximate a sinusoidal
distribution. The resulting back-EMF waveforms generated by sinusoidal PM machine are, in
fact, sinusoidally shaped.
Except for the intrinsic characteristics of stator windings, a PM machine can be excited with
both drive methods without a great loss of efficiency, instead the main difference between the
two types of excitation is the acoustic noise generated. The abrupt variation of the trapezoidal
phase current generally introduces a great amount of acoustic and electronic noise in compar
ison to the sinusoidal phase current. Frequently the reduction of noise when a PM motor is excited with sinusoidal current in comparison to trapezoidal is appreciable even audibly and the
5/36
-
-
-
ST7MC PMAC SINE WAVE MOTOR CONTROL SOFTWARE LIBRARY
efficiency loss cause by an incorrect type of waveform excitation is negligible. The drawback
of using the PMAC method is that the PMAC software library requires at least one sensor to
detect the rotor position. The elimination of the position sensor in sinusoidal PMAC machines
is more challenging since all three phases are continuously excited. This differs in the 6-step
PMDC method where one of the three phases is unexcited during each 60° electrical interval,
making it possible to get information about bemf zerocrossing. ST7MC is not designed to con
trol PMAC machines without sensors.
ST7MC Library Version 1.0.0 overview (CPU running at 8 MHz):
– Stator Frequency Range: From 0.2 Hz up to 680.0 Hz with the resolution dependent on the
PWM frequency (typically ~0.1Hz)
– Voltage Resolution: 8-bit modulation index
– 9 to 10-bit PWM generation for sine wave (typical resolution in the inaudible PWM range)
– PWM Frequency: can be set by default to 1.95, 3.9, 7.8, 12.5 and 15.66 kHz, with centered
pattern PWM generation
-
– Brake capabilities
– Speed reversal
– Speed acquisition from Hall sensors signal
– Speed regulation and control routines
– Free C source code
The 12.5 kHz switching frequency is proposed by default, providing a PWM resolution close to
10 bit with a 16-MHz CPU clock. In addition, this frequency is a good compromise between the
reduction of switching losses and acoustic noise (rejected in the inaudible range due to cen
tred mode PWM patterns).
Note: These figures are for information only; data provided in this software library may be dependent on the use of the final application and peripheral resources. It must also be noted that
it was built using robust oriented structures, therefore preventing the speed or code size from
being fully optimized.
Table 1 below summarizes the memory required by the software library, as it is delivered.
These metrics include non motor control related code, implemented for demo purposes (such
as ADC management, software time bases, etc.). These must therefore be considered only as
indicative figures, which will be lower in the final application.
-
6/36
ST7MC PMAC SINE WAVE MOTOR CONTROL SOFTWARE LIBRARY
This section presents the available material needed to start working with the ST7MC and the
library discussed in this document.
1.1 DEVELOPMENT TOOLS
1.1.1 Integrated Development Environments (IDE)
This library has been compiled using Cosmic & Metrowerks C compilers, launched with
STVD7 release 2.5.4 (ST Visual Debugger) and STVD7 release 3.x.x.
A complete software package consists of:
– An IDE interface: ST's proprietary STVD7 (free download available on internet: www.stm-
cu.com), or third party IDE (e.g. Softec Microsystems' STVD7 for InDART-STX).
– A third party C-compiler: either Cosmic or Metrowerks (if needed, time limited evaluation ver-
sions can be obtained upon request).
The choice of the C Toolchain is left to the appreciation of the user. Both COSMIC and
METROWERKS are fully supported, and the dedicated workspace (compatible with 'STVD7'
& 'STVD7 for Indart') can be directly opened in the root of the library installation folder
(PMAC_Metrowerks.wsp, PMAC_Cosmic.wsp, pmacmotor.stw).
Note: You can use the 4K limited free version of Cosmic compiler to compile the software library. To do this you must disable the RS232 communication in the config.h as follows:
//#define ENABLE_RS232
In this case, to read the Phase Angle value you can run the program in Debugger mode, stop
it and use the Watch features.
1.1.2 Emulators
Two types of real-time development tools are available for debugging applications using
ST7MC:
– In-circuit debugger from Softec (sales type: STXF-INDART/USB).
The inDART-STX from Softec Microsystems is both an emulator and a programming tool. This
is achieved using the In-circuit debug module embedded on the MCU. The real-time features
7/36
ST7MC PMAC SINE WAVE MOTOR CONTROL SOFTWARE LIBRARY
of the Indart include access to working registers and 2 breakpoint settings. However trace is
not available.
– ST7MDT50-EMU3 emulator
Full-featured emulator: real-time with trace capability, performance analysis, advanced breakpoints, light logical analyser capabilities, etc. It can also be a programming tool when used
with the delivered ICC ADDON module (where STMC-ICC is selected as the hardware target
in STVP7). This ICC-ADDON module allows In-Circuit-Debugging with STVD7.
1.1.3 Programmers
In order to program a MCU with the generated S19 file, you should also install the ST Visual
Programmer software (please visit our internet web-site) and use a dedicated programming
interface (stick programmer for example for In-Circuit-Programming). The Visual Program
ming tool provides an easy way to erase, program and verify the MCU content.
Please note that the inDART-STX from Softec Microsystems is also a programming tool (installation of DataBlaze Programmer software is required).
-
1.1.4 Starter Kit
The present software library was fully validated using the main hardware board (a complete inverter and control board) included in ST7MC-KIT/BLDC starter kit, and the demonstration PM
motor from AMETEK. The ST7MC-KIT/BLDC starter kit also includes a low-cost inDART hard
ware emulator, making this tool an ideal set for starting a project and evaluating/using the library.
Therefore, for rapid implementation and evaluation of the software discussed in this application note, it is recommended to acquire the ST7MC-KIT/BLDC starter kit and one of the two
compatible C-toolchain (or at least time limited evaluation versions).
1.2 LIBRARY SOURCE CODE
1.2.1 Download
The complete source files are available for free on the ST website (www.stmcu.com), as a zip
file in the Technical Literature and Support Files section. A Graphical User Interface (ver. 2.0)
which supports this type of motor is to be released soon by Softec. Check
www.softecmicro.com for updates.
Important Note: It is highly recommended to check for the latest releases of the library before
starting a new development, and then verify from time to time release notes to be aware of
8/36
ST7MC PMAC SINE WAVE MOTOR CONTROL SOFTWARE LIBRARY
new features that might be of interest for the project. Registration mechanisms are also available on the web sites of ST and Softec Microsystems to automatically get update information.
1.2.2 File structure
Once the files are unzipped, the following library structure appears.
– Library release 1.0.0
This library contains the workspace for both the STVD7 2.5.x and STVD7 3.x IDEs. Two separate folders are provided, with different file structure based on the same set of source files.
This is to ensure the compatibility with STVD7 for inDART-STX, based on STVD7 2.5.4.
All build information is provided in makefiles and linker command files, in dedicated folders:
config\Cosmic and config\Metrowerks. Object files are also provided in dedicated folders.
Figure 3. Library Structure for release 1.0.0
PMAC
\config
\cosmic
\metrowerks
\object
\cosmic
\metrowerks
\source
\debug
\release
1.3 UTILITIES
1.3.1 lib.h file
The purpose of this header file is to provide useful macros and type re-definitions which will be
used throughout the entire library:
– Re-definition of data types using the following convention: a first letter indicating if a variable
is signed (s) or unsigned (u), plus a number indicating the number of available bits (for in
-
stance: u8, s16, etc.),
– Defines for assembly mnemonics used in C source code: Nop(), Trap(),...
– Common macros used for bit-level access (SetBit, ClrBit,...), to get the dimension of an array
(DIM[x]), etc.
1.4 TECHNICAL LITERATURE
More information can be found on the ST website (www.st.com/mcu).
9/36
ST7MC PMAC SINE WAVE MOTOR CONTROL SOFTWARE LIBRARY
More specifically, latest documents and software can be found at:
http://mcu.st.com/devicedocs-ST7MC2N6-15.html
In addition, a Knowledge base (FAQ) and Forum are available at:
http://www.st.com/stonline/products/support/micro/st7/st7mc.htm.
2 PMAC BASIC PRINCIPLE
2.1 HOW A PM MOTOR CAN BE RUN IN SYNCHRONOUS SINE-WAVE MODE
PMAC machines are synchronous so the average torque can be produced only when the excitation is synchronized with the rotor frequency and instantaneous position. The most direct
and powerful means of ensuring that this requirement is always met is to continuously
measure the rotor's absolute angular position and rotational speed, so that the excitation can
be switched among the PMAC motor phases in exact synchronism with the rotor's motion.
This concept, known commonly as self-synchronization uses direct feedback of the rotor an
gular position to ensure that the PMAC machine never loss synchronization. Commonly Hall
sensors are used to get information about the angular position of rotor, finding the magnetic
flow direction caused by the permanent magnet running with the rotor.
-
In Figure 4 is showed the block diagram of the PMAC self-synchronization algorithm implemented in the software library.
Figure 4. SELF-SYNCHRONIZATION ALGORITHMS FOR PMAC
Φ
A* sin(2πf+Φ)
A
The motor is supplied by a sinusoidal voltage waveform with amplitude A*, frequency f, and
phase Φ. The motor supplied by this signal is forced to run with frequency f*. For each con
troller cycle, to maintain the synchronism the new frequency of the rotor is measured and sup-
V/F
Limitation
A*
f
Phase
Synch.
f=f*
Motor
f*
-
10/36
ST7MC PMAC SINE WAVE MOTOR CONTROL SOFTWARE LIBRARY
plied to the motor by the controller. Together with the frequency synchronization the phase Φ
must be synchronized according the position of the rotor read by the Hall sensors.
To avoid giving a high voltage value based on the current frequency, a V/F limitation curve is
used to fix the maximum voltage value supplied for that stator frequency.
2.2 VARIOUS CONFIGURATIONS OF HALL SENSORS
In commerce there are motors with different numbers of Hall sensors and various Hall sensor
configurations. The most common PM motors have three, two or one hall sensors. Motors with
three hall sensors can be arranged in two configuration types: 120° spatial distribution or 60°
spatial distribution. Motors with 2 hall sensors have spatial distribution of 90°.
Figure 5 sum-
marizes the most common Hall sensor configurations and the relative waveforms of the signals that are observed from the Hall sensors during an electrical cycle of the rotor.
2.3 PHASE ANGLE
We refer as “Phase Angle” the angle between the H1 edge transition and the 90° of A winding
sinus phase. This value must be set to get the synchronism between rotor and stator and to
optimize the efficiency of the motor. This value can be different for different speed and/or load
condition. See
Figure 6.
11/36
Loading...
+ 25 hidden pages
You need points to download manuals.
1 point = 1 manual.
You can buy points or you can get point for every manual you upload.