Sensorless Regulation of Brushless DC Motors

Application Note, V 1.0, July 2001
Sensorless Regulation of a Brushless DC Motor with a C164CM
V0.
It includes the protocol specification (Host – Microcontroller – Demonstrator) and the prototype
definition of the basic functions.
Application Note, V 1.0, Jan. 2001
AP1676
Sensorless Regulation of a
Brushless DC Motor with a
C164CM ( Voltage Detection Mode )
Authors: R. Weiss & T. Kattwinkel
16 – Bit CMOS Microcontroller Product
Microcontrollers
Page 1/31
Never
stop
th inking.
Sensorless Regulation of a Brushless DC Motor with a C164CM
Revision History
Revision Modifications
Date
Modified by
Page 2/31
Edition 2001-07
Published by
Infineon Technologies AG
81726 München, Germany
© Infineon Technologies AG 2006.
All Rights Reserved.
LEGAL DISCLAIMER
THE INFORMATION GIVEN IN THIS APPLICATION NOTE IS GIVEN AS A HINT FOR THE
IMPLEMENTATION OF THE INFINEON TECHNOLOGIES COMPONENT ONLY AND SHALL NOT BE
REGARDED AS ANY DESCRIPTION OR WARRANTY OF A CERTAIN FUNCTIONALITY, CONDITION OR
QUALITY OF THE INFINEON TECHNOLOGIES COMPONENT. THE RECIPIENT OF THIS APPLICATION
NOTE MUST VERIFY ANY FUNCTION DESCRIBED HEREIN IN THE REAL APPLICATION. INFINEON
TECHNOLOGIES HEREBY DISCLAIMS ANY AND ALL WARRANTIES AND LIABILITIES OF ANY KIND
(INCLUDING WITHOUT LIMITATION WARRANTIES OF NON-INFRINGEMENT OF INTELLECTUAL
PROPERTY RIGHTS OF ANY THIRD PARTY) WITH RESPECT TO ANY AND ALL INFORMATION GIVEN
IN THIS APPLICATION NOTE.
Information
For further information on technology, delivery terms and conditions and prices please contact your nearest
Infineon Technologies Office (www.infineon.com).
Warnings
Due to technical requirements components may contain dangerous substances. For information on the types
in question please contact your nearest Infineon Technologies Office.
Infineon Technologies Components may only be used in life-support devices or systems with the express
written approval of Infineon Technologies, if a failure of such components can reasonably be expected to
cause the failure of that life-support device or system, or to affect the safety or effectiveness of that device or
system. Life support devices or systems are intended to be implanted in the human body, or to support
and/or maintain and sustain and/or protect human life. If they fail, it is reasonable to assume that the health
of the user or other persons may be endangered.
Sensorless Regulation of a Brushless DC Motor with a C164CM
Contents
1
2
INTRODUCTION........................................................................................................................................................ 5
1.1
W HY USE BRUSHLESS DC MOTORS (ADVANTAGES/DISADVANTAGES)?.............................................................5
1.2
FUNCTIONAL PRINCIPLE OF A BRUSHLESS DC MOTOR..........................................................................................5
1.3
BRUSHLESS DC MOTOR WITH HALL SENSORS........................................................................................................6
1.4
BRUSHLESS DC MOTOR WITHOUT HALL SENSORS ................................................................................................6
OPERATION OF A BRUSHLESS DC MOTOR................................................................................................ 8
2.1
VISUALIZATION OF THE ROTATION INCLUDING APPROPRIATE SWITCHES OF A 3-PHASE BRUSHLESS DC
MOTOR (0° MECHANICAL TO 180° MECHANICAL)............................................................................................................8
2.1.1
Position ‘ 0° ’................................................................................................................................................... 9
2.1.2
Position ‘ 30° ’ ..............................................................................................................................................10
2.1.3
Position ‘ 60° ’ ..............................................................................................................................................11
2.1.4
Position ‘ 90° ’ ..............................................................................................................................................12
2.1.5
Position ‘ 120° ’............................................................................................................................................13
2.1.6
Position ‘ 150° ’............................................................................................................................................14
2.1.7
Position ‘ 180° ’............................................................................................................................................15
2.2
SENSORS .....................................................................................................................................................................16
2.2.1
2.3
3
SYSTEM DESCRIPTION ..............................................................................................................................................16
2.3.1
Block diagram of block commutation using Hall sensors.....................................................................16
2.3.2
Block diagram of block commutation without sensors ..........................................................................17
BLOCK COMMUTATION MODE WITH BACK-EMF DETECTION...................................................19
3.1
GENERAL....................................................................................................................................................................19
3.1.1
3.2
4
Hall sensor output signal ............................................................................................................................16
Back–EMF sensing ......................................................................................................................................19
REQUIRED PERIPHERALS..........................................................................................................................................22
3.2.1
CAPCOM6.....................................................................................................................................................22
3.2.2
ADC.................................................................................................................................................................23
IMPLEMENTATION ...............................................................................................................................................24
Page 3/31
Sensorless Regulation of a Brushless DC Motor with a C164CM
4.1
FUNCTIONAL DESCRIPTION .....................................................................................................................................24
4.1.1
General description .....................................................................................................................................24
4.1.2
Management of commutation, demagnetization and zero cross detection.........................................25
4.2
IMPLEMENTATION OF THE SOFTWARE ...................................................................................................................25
4.2.1
Initialization..................................................................................................................................................25
4.2.2
State machine................................................................................................................................................26
4.2.3
Interrupt routines .........................................................................................................................................26
4.3
PERFORMANCE ANALYSIS........................................................................................................................................28
4.3.1
Hardware requirements ..............................................................................................................................28
4.3.2
CPU load .......................................................................................................................................................28
5
CONCLUSION............................................................................................................................................................30
6
ABBREVIATIONS ....................................................................................................................................................31
Page 4/31
Sensorless Regulation of a Brushless DC Motor with a C164CM
1 Introduction
1.1 Why use brushless DC motors (advantages/disadvantages) ?
Brushless DC motors are synchronous motors suitable for use as a simple means of controlling
permanent drives (e.g. ABS pumps, EHPS pumps, fuel pumps or cooling fans). This type of 3-, 4- or
5-phase brushless DC motor will increasingly replace brushed DC motors. Brushed DC motors require
maintenance, e.g. to service coal brushes and commutator. Another major problem with a brushed DC
machine is the possibility of brush burnout in the event of an overload or stall condition.
One of the main advantages of brushless DC motors is their robustness against obsolescence (due to
the absence of brushes), and another major benefit is the high efficiency and high torque of a
brushless DC motor.
A disadvantage of this type of motor is that the rotor position is usually determined by three Hall
sensors (in the case of three phases), which are expensive and require signal conditioning, and this
positioning in the production process has to be done very precisely to assure proper operation.
1.2 Functional principle of a brushless DC motor
Figure 1 shows a three-phase brushless DC motor with two pole pairs. The rotation of the electrical
field (vector) has to be applied twice as fast as the desired mechanical speed of the brushless DC
motor. The three coils of the stator are split into two groups of coils (A, B, C and A’, B’, C’). As you can
see in Figure 1, coils A and C are energized and coil B is not energized. A 0° to 180° rotation will be
shown in detail in section 2.1 to explain the setting of the appropriate switches of the B6 bridge
pattern, the appropriate voltages relating to the coils, and the energized coils of the motor with the
suitable rotor position between 0° and 180° mechanical.
Stator
A
B'
N
C'
N
N
B
C
Rotor
S
S SS
S
NN
S
S
NN N
A'
N
A'
S
S
SSS
C
B
N
N
B'
N
C'
A
Figure 1: Functional principle of a brushless DC motor
Page 5/31
Sensorless Regulation of a Brushless DC Motor with a C164CM
1.3 Brushless DC motor with Hall sensors
A synchronous motor mainly depends on synchronous processes, e.g. ADC measurement has to be
absolutely synchronous with the energizing pattern of the coils realized by the switches of the B6
bridge. In this context, the change of state of the three Hall sensors gives an indication of the specific
time at which the next pattern of the B6 full-bridge has to be applied. Each of these Hall sensors costs
about $0.15 - $0.30, so they have a big impact on the total cost of the whole application. Typically,
external hardware is needed, such as three comparators for sensor signal conditioning.
Vbat
Power
Supply
Transceiver
ROM
PWM
Driving
Stages
RAM
Host
Timer
Protection
Diagnoses
CAN
SSC
ASC
ADC
CPU
INT
Phase
Inverter
Bridge Driver
Brushless
Motor
Hall
Sensors
Signal
Conditioning
Microcontroller (e.g. C164CM)
Figure 2: General block diagram for brushless DC motor drive with sensors
1.4 Brushless DC motor without Hall sensors
The aim of this application note is to eliminate position sensors altogether. The C164CM 16-bit µC in
its small P-TQFP 64 package (12*12 mm incl. pins) fits this type of application very well because of its
flexible capture compare unit (CAPCOM6), with two 16-bit timers and 6 + 1 output channels. Many
other features are listed at the end of the application. Three channels of the 10-bit ADC of the
C164CM and only a two-resistor voltage divider with a capacitor at each of the three phases are the
hardware necessary to realize a viable sensorless brushless DC motor. The most important point –
and at the same time a big advantage of this hardware configuration – is the aspect of minimized
costs, because even the comparators that would normally be necessary are superfluous. A 16-bit
microcontroller delivering high CPU performance, with a fast and accurate 10-bit ADC, has a big
advantage at higher speeds up to 5000 rpm because of the very acceptable CPU load even in these
conditions. A very important point in relation to the cost-effective back-EMF sensing is the very low
leakage current of the C164CM ADC (+/- 200 nA), because the back-EMF is low at low speeds and
the use of a high-impedance voltage divider is necessary.
Page 6/31
Sensorless Regulation of a Brushless DC Motor with a C164CM
Vbat
Power
Supply
Transceiver
ROM
PWM
Driving
Stages
RAM
Host
Timer
Protection
Diagnoses
CAN
SSC
Bridge Driver
ASC
ADC
Signal
Conditioning
CPU
INT
Phase
Inverter
Brushless
Motor
Microcontroller (e.g. C164CM)
Figure 3: General block diagram for sensorless BLDC motor drive
When a brushless DC motor is energized in block commutation mode, only two of the three phases
are active at a given time. The brushless DC motor rotor position has to be evaluated by the zero
crossing of the back-EMF which can be evaluated by measuring the non-energized phase. The
voltage value of the back–EMF has to be half of the maximum value to detect the precise point for
changing the coil-energizing pattern for the following 30° mechanical rotation. It is very important to
find the precise point for the next change in the energizing pattern to ensure smooth operation of this
type of motor. A big advantage in this context is the fact that the back–EMF is proportional to the
mechanical rotation speed. This means that we are able to use the measured C164CM 10-bit ADC
values directly without any type of linearization algorithm. This allows the use of very fast regulation
software, because the mechanical speed of some applications should reach up to 6000 rpm. The
amount of back-EMF is a function of the number of coil windings, mechanical speed, and flux (E = N x
φ x n). Taking account of a low rotation speed, it is very important to have a high resolution with regard
to the ADC microcontroller (10-bit +/- 2 LSB minimum) to evaluate the back-EMF with the application
necessary demand. The 16-bit broad code and data core and the 16*16 or 32 / 16-bit multiplyaccumulate as part of the C164CM instruction set e.g. allows fast processing of the 16-bit integer or
even float PI speed regulator because of the multiplications (6) and divisions (3) which are necessary
in this case.
Page 7/31
Sensorless Regulation of a Brushless DC Motor with a C164CM
2 Operation of a brushless DC motor
2.1 Visualization of the rotation including appropriate switches of a
3-phase brushless DC motor (0° mechanical to 180°
mechanical)
Only two of the three phases are energized in each state of the B6 full-bridge. The non-energized
phase can therefore be used to detect the zero crossing of the back-EMF as explained later (cf. the
black arrow in the voltage diagram shown in Figures 5, 7, 9, 11, 13, 15, 17). The following explanation
will show you the turning of a two pole-pair brushless DC motor as a function of the state of the
appropriate switches shown in Figures 4, 6, 8, 10, 12, 14, 16. In fact, driving a two pole-pair motor
means that the rotation speed of the electrical field has to be double the speed of the desired
mechanical rotation speed (Ω = ω / p, where Ω is the mechanical rotation speed, ω the rotation
frequency of the electrical field and p is the number of pole pairs).
Page 8/31
Sensorless Regulation of a Brushless DC Motor with a C164CM
2.1.1
Position ‘ 0° ’
Figure 5 shows the voltage-energizing coils C and A (stator) and the permanent magnet realized with
two pole pairs (rotor), as well as indicating the zero-crossing detection coil B. Figure 4 shows the
active switches of the B6 bridge, and Figure 5 again the appropriate rotor position (0°):
T1 - T6 : +C, -A
T1
T3
T5
BLDC
Coil A
Coil B
Coil C
Motor
T2
T4
T6
Figure 4: Appropriate switches T1, T6 of the B6 full-bridge ( coil C : pos., coil A : neg. )
A
B'
N
C'
N
N
Coil A
B
C
S
SS S
S
NN
N
S
S
S
NN
S
N
A'
A'
Coil B
S SS
C
B
Coil C
N
N
B'
N
C'
A
Figure 5: Energized coils C and A of a 2 pole-pair BLDC motor ( mechanical position : 0° )
Page 9/31
Sensorless Regulation of a Brushless DC Motor with a C164CM
2.1.2
Position ‘ 30° ’
Figure 7 shows the voltage-energizing coils C and B (stator) and the permanent magnet realized with
two pole pairs (rotor), as well as indicating the zero-crossing detection coil A. Figure 6 shows the
active switches of the B6 bridge, and Figure 7 again the appropriate rotor position (30°):
T1 - T4 : +C, -B
T1
T3
T5
BLDC
Coil A
Coil B
Coil C
Motor
T2
T4
T6
Figure 6: Appropriate switches T1, T4 of the B6 full-bridge ( coil C : pos., coil B : neg. )
mech : 30°
A
C'
B'
N
S
Coil A
N
S
B
C
N
S
S
N
S
N
S
N
N
S
N
S
A'
A'
Coil B
N
S
N
S
N
S
S
N
C'
B'
A
Figure 7: Energized coils C and B of a 2 pole-pair BLDC motor ( mechanical position : 30° )
Page 10/31
C
B
Coil C
Sensorless Regulation of a Brushless DC Motor with a C164CM
2.1.3
Position ‘ 60° ’
Figure 9 shows the voltage-energizing coils C and B (stator) and the permanent magnet realized with
two pole pairs (rotor), as well as indicating the zero-crossing detection coil C. Figure 8 shows the
active switches of the B6 bridge, and Figure 9 again the appropriate rotor position (60°):
T5 - T4 : +A, -B
T1
T3
T5
BLDC
Coil A
Coil B
Coil C
Motor
T2
T4
T6
Figure 8: Appropriate switches T4, T5 of the B6 full-bridge ( coil A : pos., coil B : neg. )
mech : 60°
A
C'
S
B'
S
S
Coil A
B
C
NNN
N
N
SS
N
S
N
N
SS
S
N
A'
A'
Coil B
NN
N
C
B
Coil C
S
S
B'
S
C'
A
Figure 9: Energized coils A and B of a 2 pole-pair BLDC motor ( mechanical position : 60° )
Page 11/31
Sensorless Regulation of a Brushless DC Motor with a C164CM
2.1.4
Position ‘ 90° ’
Figure 11 shows the voltage-energizing coils A and C (stator) and the permanent magnet realized with
two pole pairs (rotor), as well as indicating the zero-crossing detection coil B. Figure 10 shows the
active switches of the B6 bridge, and Figure 11 again the appropriate rotor position (90°):
T5 - T2 : +A, -C
T1
T3
T5
BLDC -
Coil A
Coil B
Coil C
Motor
T2
T4
T6
Figure 10: Appropriate switches T2, T5 of the B6 full-bridge ( coil A : pos., coil C : neg. )
mech : 90°
A
C'
B'
S
S
S
Coil A
B
C
N
N
N
SS S
N
NN
A'
A'
N
SS S
Coil B
N
N
NN
N
C
B
Coil C
S
S
S
B'
C'
A
Figure 11: Energized coils A and C of a 2 pole-pair BLDC motor ( mechanical position : 90° )
Page 12/31
Sensorless Regulation of a Brushless DC Motor with a C164CM
2.1.5
Position ‘ 120° ’
Figure 13 shows the voltage-energizing coils B and C (stator) and the permanent magnet realized with
two pole pairs (rotor), as well as indicating the zero-crossing detection coil A. Figure 12 shows the
active switches of the B6 bridge, and Figure 13 again the appropriate rotor position (120°):
T3 - T2 : +B, -C
T1
T3
T5
BLDC
Coil A
Coil B
Coil C
Motor
T2
T4
T6
Figure 12: Appropriate switches T2, T3 of the B6 full-bridge ( coil B : pos., coil C : neg. )
mech : 120°
A
C'
B'
S
N
N
S
Coil A
S
N
S
SS
N
N
N
S
A'
A'
Coil B
B
C
S
S
N
N
N
N
B
C
S
N
S
Coil C
S
N
C'
B'
A
Figure 13: Energized coils B and C of a 2 pole-pair BLDC motor ( mechanical position : 120° )
Page 13/31
Sensorless Regulation of a Brushless DC Motor with a C164CM
2.1.6
Position ‘ 150° ’
Figure 15 shows the voltage-energizing coils B and A (stator) and the permanent magnet realized with
two pole pairs (rotor), as well as indicating the zero-crossing detection coil C. Figure 14 shows the
active switches of the B6 bridge, and Figure 15 again the appropriate rotor position (150°):
T3 - T6 : +B, -A
T1
T3
T5
BLDC
Coil A
Coil B
Coil C
Motor
T2
T4
T6
Figure 14: Appropriate switches T3, T6 of the B6 full-bridge ( coil B : pos., coil A : neg. )
mech : 150°
A
C'
B'
N
N
N
Coil A
S
B
C
S
A'
NNN
S
A'
Coil B
S
N NN
S
SS
S
SS
S
S
C
B
Coil C
N
N
B'
N
C'
A
Figure 15: Energized coils A and C of a 2 pole-pair BLDC motor ( mechanical position : 150° )
Page 14/31
Sensorless Regulation of a Brushless DC Motor with a C164CM
2.1.7
Position ‘ 180° ’
Figure 17 shows the voltage-energizing coils C and A (stator) and the permanent magnet realized with
two pole pairs (rotor), as well as indicating the zero-crossing detection coil B. Figure 16 shows the
active switches of the B6 bridge, and Figure 17 again the appropriate rotor position (180°):
T1 - T6 : +C, -A
T1
T3
T5
BLDC
Coil A
Coil B
Coil C
Motor
T2
T4
T6
Figure 16: Appropriate switches T1, T6 of the B6 full-bridge ( coil C : pos., coil A : neg. )
mech : 180°
A
B'
N
C'
N
N
Coil A
B
C
S
SS S
S
NN
N
S
S
S
NN
S
N
A'
A'
Coil B
S SS
C
B
Coil C
N
N
B'
N
C'
A
Figure 17: Energized coils A and C of a 2 pole-pair BLDC motor ( mechanical position : 180° )
Page 15/31
Sensorless Regulation of a Brushless DC Motor with a C164CM
2.2 Sensors
The BLDC motor is a synchronous motor and so the rotor position has to be known in order to
generate the appropriate field.
2.2.1
Hall sensor output signal
Sensors are essential as a means of recognizing the positioning of a synchronous motor. The signals
generated after appropriate signal conditioning are shown in Figure 18. Depending on the location of
the Hall sensors and the number of pole pairs, different pictures emerge. In this case, a number of
pole pairs are used and the three Hall sensors are located at a 120-degree distance.
Patterns
CC6POS0
CC6POS1
CC6POS2
One revolution
Time
Figure 18: Hall sensor signals
Typically, the Hall signals are connected to the inputs of a microcontroller via a signal conditioning
unit. For higher performance, the inputs of the microcontroller have to provide fast interrupt capability.
To reduce system costs, the signal conditioning unit has to be moved either to the microcontroller or
perhaps to driver IC.
Further reduction of CPU load is possible by using the CAPCOM6 unit of the C164CM. This supports
the generation of the block commutation pattern without software support.
2.3 System description
2.3.1
Block diagram of block commutation using Hall sensors
Figure 19 shows a typical structure of a three-phase BLDC motor drive suitable for use in automotive
applications, e.g. fan cooling or water pump. The C164CM microcontroller generates the rotation
patterns for the stator field and can be used for speed or torque control. The TLE 6280 driver IC is
used to provide the output signals for the 3-phase inverter and perform certain diagnostic functions
such as short-circuit current protection, over-/undervoltage protection and overtemperature protection.
OptiMOS devices arranged as three half-bridges switch the power to the corresponding phases of the
BLDC motor.
Page 16/31
Sensorless Regulation of a Brushless DC Motor with a C164CM
VBATT
TLE 4268G
Low Drop
Voltage
Regulator
TLE6250G/58G
Hall Sensors
TLE4945
CAN/LIN
CCPOS0
Transceiver
CCPOS1
Port1
CAPCOM 6
EEPROM
CCPOS2
CC60
COUT60
CC61
M
3 Phase
3Phase
COUT61
3x
Driver
CC62
COUT62
TLE 6280GP 6 x OptiMOS
C164CM
Figure 19: Block diagram of block commutation using Hall sensors
2.3.2
Block diagram of block commutation without sensors
Figure 20 shows a typical structure of a three-phase BLDC motor drive with B-EMF detection. It looks
similar to the BLDC drive application with Hall sensors. The only difference is shown in the detection
of the rotor position. The back–EMF voltage is recorded directly at each phase. A signal conditioning
unit is required to trim the voltage (filtering, etc.). The zero cross voltage is detected for calculation of
the next commutation pattern via the AD channels.
V BATT
TLE 4268G
Low Drop
Voltage
Regulator
3x
CAPCOM 6
EEPROM
Signal
Conditioning
CC60
COUT60
Port1
CAN/LIN
Transceiver
ADC
TLE6252/58G
CC61
COUT61
3Phase
Driver
3x
CC62
M
3 Phase
COUT62
TLE 6280GP 6 x OptiMOS
C164CM
Figure 20: Block diagram of block commutation with B-EMF detection
Page 17/31
Sensorless Regulation of a Brushless DC Motor with a C164CM
Figure 21 shows a brushless DC motor evaluation kit. It is subdivided into a microcontroller board and
a power board. In conjunction with an application node and a PC-driven interface, customers may start
immediately with the evaluation of their own application.
Figure 21: BLDC motor drive evaluation boards
Infineon Technologies has all the semiconductors required for BLDC-driven applications. Figure 22
shows some of the devices needed for such applications.
OptiMOS
TLE 6280GP: 3-phase driver
TLE4274
C164CM: 16-bit microcontroller
TLE 6250G: High-speed CAN transceiver
TLE6258G: LIN transceiver
TLE4274: 5-volt voltage regulator
OptiMOS: Power MOSFET
TLE 6280GP
C164CM
Figure 22: Semiconductors for BLDC motor drive
Page 18/31
Sensorless Regulation of a Brushless DC Motor with a C164CM
3 Block commutation mode with BACK-EMF detection
3.1 General
As described in a previous section, the commutation of a brushless DC motor is performed
electronically. The rectangular-shaped three-phase voltage system (see Figure 23) is used to
generate a rotational field. Applied voltage with this easy-to-create shape helps ensure control and
drive simplicity. The rotor position must be known at certain angles in order to align the applied voltage
with the back-EMF, which is induced in the stator windings due to the movement of the permanent
magnets on the rotor. Achieving alignment between the back-EMF and the commutation events is one
of the main tasks. Under these conditions the motor behaves like a DC motor and runs at the best
operating points. Simplicity of control and good performance makes this kind of motor a good choice in
low-cost and high–efficiency applications.
Voltage
Phase A
Phase B
Phase C
60
120
V AN
180
240
V BN
300
360 [degrees]
V CN
+BEMF
Z
-BEMF
C
C
C
C
C
C
C
C = Commutation
Z = Zero Crossing
Figure 23: Simplified three-phase voltage system / back-EMF
3.1.1
Back–EMF sensing
The back-EMF sensing technique is based on the fact that only two phases of a DC-brushless motor
are connected at the same time, so the third phase can be used to sense the back-EMF voltage.
Figure 24 uses a simple model to illustrate the situation when phases A and B are energized and
phase C is used to measure the back-EMF.
Page 19/31
Sensorless Regulation of a Brushless DC Motor with a C164CM
Vbat
UC
UA
N
UB
UBack-EMF
Figure 22: Simplified model of 3-phase BLDC (coils A and B are energized, coil C will be
analyzed)
Typically, methods to detect the zero crossing of the back-EMF often described in the literature utilize
additional hardware such as OpAmps or other circuitry. Also, a speed-dependent phase delay time
has been implemented to ensure proper commutation, and the external circuitry has been configured
for a fixed motor speed. Overall, the costs for these additional components have a impact on total
system costs.
To reduce system costs further, provide more flexibility and even chop one or both of the phases,
another system approach might be considered. Each phase is connected via voltage divider circuitry
and a low-pass filter to an AD channel of the C164CM. Each revolution of the rotor of a motor is
divided into 6 commutation windows, each 60 degrees wide. For each window, an appropriate AD
channel has been selected to detect the zero cross point in order to switch to the right commutation
pattern after a dedicated phase delay time.
Phase A, B, C
AD Channel
3x
Figure 25: Passive network for zero cross detection
Basically, the external circuitry consists of a passive network such as that shown in Figure 25. The
network includes a voltage divider circuit and a low-pass filter with a cut-off frequency of 1 kHz. One
network is required for each phase.
Page 20/31
Sensorless Regulation of a Brushless DC Motor with a C164CM
Because the back-EMF voltage is a function of the rotor speed, an AD converter with a higher
resolution, at least 10-bit, is required.
Figure 26 shows the phase voltage (Channels 1 to 3) of a 3-phase BLDC motor at the inputs of the AD
channels. The rotation speed of the motor is around 1000 rpm. Channel 4 represents the required
CPU load.
Phase A
Phase B
Phase C
60 ms
Figure 26: Back-EMF voltage after low-pass filter
Page 21/31
Sensorless Regulation of a Brushless DC Motor with a C164CM
3.2 Required peripherals
3.2.1
CAPCOM6
The CAPCOM6 unit of the C164CM has been designed for applications with a requirement for digital
signal generation and event capturing (e.g. pulse width modulation, pulse width measurement). It
supports generation and control of timing sequences on up to three 16-bit capture / compare channels
plus one additional 10-bit compare timer. This peripheral fulfills all requirements for controlling 3-phase
or multiphase motor drives.
CC Channel 0
CC60
Compare Timer T12
(16Bit)
CC Channel 1
CC61
CC Channel 2
CC62
Trap Register
Port Control Logic
Offset Register
T12OF
Mode Select Register
CC6MSEL
Control
fCPU
Prescaler
Period Register
T12
CTRAP
CC60
COUT60
CC61
COUT61
CC62
COUT62
fCPU
Prescaler
Control Register
CTCON
Compare Timer T13
(10Bit)
Period Register
T13P
Compare Register
CMP13
COUT63
Block
Commutation
Control
CC6MCON
CC6POS0
CC6POS1
CC6POS2
Figure 27: Block diagram of CAPCOM6 unit
In the compare mode used for driving BLDC motors, the CAPCOM6 provides two output signals per
16-bit channel, which may have inverted polarity pulse transitions. Timer T12 can be used to control
the commutation speed. Timer 13 can be used to modulate the capture/compare outputs to influence
the speed/torque of the motor. For active freewheeling, a dead time generation is mandatory. It can be
realized with offset register T12OF. For more detailed information about the CAPCOM6 unit please
refer to the C164 manual or to application note 1673 (technical details on CAPCOM6 unit).
Page 22/31
Sensorless Regulation of a Brushless DC Motor with a C164CM
3.2.2
ADC
The Analog Digital Converter of the C164CM has been designed to measure up to eight analog
sources with 10-bit resolution. It consists of a sample and hold circuit. A multiplexer allows up to eight
analog input channels to be selected. To fulfill the different requirements of embedded applications,
the peripheral supports several conversion modes, such as fixed channel conversion, autoscan
conversions or channel injection modes. The minimum conversion time is dependent on the CPU
frequency and can be programmed. The minimum conversion time is 9.7 µs (fcpu @ 20 MHz). For
more detailed information please refer to the datasheet or the user manual.
Channel
Channel and
and Mode
Mode Control
Control
Comparator
Conversion
ConversionControl
Control
Timing Control
and Successive
Approximation
Register
INTR
INTR
Flag
Flag
INTR
INTR
Flag
Flag
AN0
8
Channel
Analog
MUX
C-NET
Switch
Tree
AN7
Channel
Information
Aref/Agnd
Channel
Selection
Result Register
Result Register for Channel Injection Mode
Figure 28: Block diagram of ADC unit
Page 23/31
Sensorless Regulation of a Brushless DC Motor with a C164CM
4 Implementation
4.1 Functional description
4.1.1
General description
The application is divided into several subfunctions. First, all relevant peripherals are configured. Next,
the rampup phase is started to accelerate the motor. During this phase, the commutation speed and
the phase voltage are increased continuously until the back-EMF voltage is interpretable. Now, the
back-EMF detection and an optional PI controller for speed or torque control may be activated.
Figure 29 provides an overview of the event-driven flow process.
Commutation n+1
Commutation n
60 ° stator field
Umax
Demagnetisation
UBEMF
Uphase(A,BC)
Zero
crossing
Umax/2 + tolerance
(falling edge)
Umax/2
Umax/2 - tolerance
(rising edge)
0
without BEMF,
acceleration
phase
Timer T3
TImer T4 [Delaytime]
counts down
ENABLE
CAPCOM6
INTERRUPT
20 KHz PWM
Single ADC
triggered by
CAPCOM6
INTERRUPT
T4
counts up plus
T4 [Delaytime]
const. speed
with BEMF
if Umax/2 is not
detected, Disable
CAMCOM6
INTERRUPT
T4 old is used
if Umax/2 is
detected three
times, Disable
CAPCOM6
INTERRUPT
T4 Interrupt
T4 counts down
Failure counter++
Single AD - Conversion
if falling edge -> Umax
T4 Interrupt
T4 = T4n - T4( n-1)
T4 counts down
Failure case if
BEMF is not
detected
next pattern is applied
Figure 29: Event flow process
Page 24/31
Sensorless Regulation of a Brushless DC Motor with a C164CM
4.1.2
Management of commutation, demagnetization and zero cross detection
The sensorless control process of the BLDC motor is based on the following events:
Commutation event (CAPCOM6 unit)
End of demagnetization (Timer T4)
Zero cross detection (ADC)
Each 60-degree window is initiated with a new commutation pattern. Timer T4 is utilized to generate a
delay time between the start of the demagnetization impact and the point in time where the zero cross
event gets closer. This value of timer T4 is strongly dependent on the motor type and the required
motor speed. The timer T4 interrupt enables the CAPCOM6 interrupt. The CAPCOM6 interrupt forces
an AD conversion of the appropriate phase voltage every 50 µs (20 kHz PWM). If the converted
voltage value is very close to the requested value three times, then a zero cross detection is
recognized. In the interim, timer T4 is used to monitor the elapsed time. Depending on motor type and
speed, the requested time is now calculated for the next commutation pattern. It is possible that the
zero cross event is not recognized due to external noise. In this case a failure counter is incremented
and switches off the AD sampling of the phase voltage. The requested time for the next commutation
pattern is calculated based on previous values. All tasks are interrupt-driven and consume little
microcontroller-related time.
4.2 Implementation of the software
The software is divided into several routines.
Initialization (ports, CAPCOM6, GPT1 (timer T3/T4))
State machine (6 commutation states)
PI controller for closed loop (optional)
Interrupt routines:
CAPCOM 6
Timer T4
Timer T3 (only used for the motor rampup time)
ADC
4.2.1
Initialization
A number of small routines perform all the necessary initializations before the motor is started:
Port initialization:
P1L.0 – P1L5 (CCx,COUTx) output
Interrupt initialization:
CAPCOM6 emergency (CC6EIC), CAPCOM6 (CC6CIC),
interrupt (ADCIC), timer T3 (T3IC), timer T4 (T4IC).
CAPCOM6 initialization:
Disable multichannel mode, passive output level is low, set timer T12
(PWM 20 kHz), set compare register CCx to start value, center
ADC
Page 25/31
Sensorless Regulation of a Brushless DC Motor with a C164CM
aligned mode, active dead time generation, enable ext. trap function
for emergency cases
ADC initialization:
Select P5.3-P5.5 as AD channels, fixed-channel single conversion,
sample time 1.6 µs, conversion time 9.7 µs
Timer initialization:
Timer T3/T4 in timer mode, prescaler 16, external up/down control
disabled
4.2.2
State machine
The state machine is required to generate the block commutation pattern for both directions. The
appropriate outputs and AD channels are also selected.
State machine for the 6
commutation pattern
next_state
State 5
?
Yes
ADC - Ch UA
Corresponding
ADC channel is selected
NO
Switch corresponding output pins
[CAPCOM6]
State 4
?
RETURN
Yes
ADC - Ch UC
NO
Switch corresponding output pins
[CAPCOM6]
State 3
?
RETURN
Yes
ADC - Ch UB
NO
Switch corresponding output pins
[CAPCOM6]
State 2
?
RETURN
Yes
ADC - Ch UA
NO
Switch corresponding output pins
[CAPCOM6]
State 1
?
RETURN
Yes
ADC - Ch UC
NO
Switch corresponding output pins
[CAPCOM6]
State 0
?
RETURN
Yes
ADC - Ch UB
RETURN
Switch corresponding output pins
[CAPCOM6]
RETURN
Figure 30: State machine flowchart
Note: The CAPCOM6 unit of the C164CM overcomes the limitation for block commutation mode!
Pattern generation for both directions operates properly.
4.2.3
Interrupt routines
The timer T3 interrupt function is applied only for the rampup phase of the motor. It generates and
changes the commutation period and the voltage level for the three phases. Upon reaching the
minimum rotation speed of the motor, the timer T3 interrupt routine is disabled.
The rampup behavior of the motor is shown in Figure 31. The rampup process is divided into three
steps. In the first step, the motor is accelerated from 0 rpm up to the minimum rotation speed in order
to analyze the BEMF detection voltage. Depending on the static torque of the motor, the dV/dT ratio of
the acceleration graph has to be configured. The second step handles the BEMF detection and the
Page 26/31
Sensorless Regulation of a Brushless DC Motor with a C164CM
synchronization to the appropriate commutation pattern. If the BEMF detection has been successful,
then the motor speed can be accelerated up to the required value.
Motor Speed [rpm]
The timer T4 interrupt routine is enabled after back-EMF detection becomes active. It handles the
whole process of each 60-degree window (demagnetization, monitoring of the window length, point in
time for commutation, etc.). ADC interrupt routines validate the current voltage level and take the
decision for zero cross detection. The CAPCOM6 interrupt routine forces an AD conversion every 50
µs. It can be enabled by the timer T3 interrupt routine.
BEMF active
dV
more static torque
dT
less static torque
Time [s]
Figure 31: Rampup behavior
ADC - INTERRUPT
ADC - INTERRUPT
No
Start BEMF
measurement
Yes
No
If
falling edge
Rising edge
ADDAT <=
Umax/2 + 5%
No
Yes
ADDAT >=
Umax/2 - 5%
No
fail_counter++
Yes
Yes
count ++
count ++
Get Umax
fail_counter >
Max_v
No
count >= 3
count >= 3
RETURN
Yes
Yes
Yes
-
Change Counting Direction
Disable CAPCOM6
Compare Rising
Edge INTERRUPT
Disable T3 INTERRUPT
Calculate rest time
No
No
RETURN
Figure 32: Zero cross detection flowchart
Page 27/31
Sensorless Regulation of a Brushless DC Motor with a C164CM
4.3 Performance analysis
4.3.1
Hardware requirements
CPU:16xCPU (16-bit, 20 MHz)
ROM: 1KB – 2 KB depending on error detection requirements
RAM: 200 bytes plus system stack
Peripherals:
CAPCOM6 unit: 16-bit timer, 50 ns resolution, three 16-bit capture/compare channels
ADC: 3-channel, 10-bit resolution, 9.7µs conversion time
Timer: 16 timer, 400ns resolution
4.3.2
CPU load
The CPU load was measured in a simple way. A flag of a dedicated port pin is set each time an
interrupt routine is entered. The flag is reset after the interrupt routine is exited.
Phase A
Phase B
Phase C
n+1
n+2
n+3
n+4
CPU Load
commutation n,
detect zero cross
Figure 33: CPU load
The CPU load depends greatly on how close to the zero cross point the AD conversions starts. It is
therefore mandatory to optimize the application for the motor used. Here is a rough overall estimation
of the CPU load without optimization:
Page 28/31
Sensorless Regulation of a Brushless DC Motor with a C164CM
CPU frequency: 20 MHz
Motor speed 1000 rpm, one pole pair
CPU load typically: 3 %
The CPU load depends greatly on how close to the zero cross point the AD conversion starts. The
CPU load may be decreased by using the DMA feature (PEC transfer) instead of continuous
verification of the phase voltage.
Page 29/31
Sensorless Regulation of a Brushless DC Motor with a C164CM
5 Conclusion
There is an increasing demand in the automotive industry for applications using BLDC motors. In the
past, many applications were addressed with DC motors. Automotive suppliers would like to use
BLDC motors in order to achieve greater robustness and efficiency. Currently, the only limitation is the
price gap between BLDC motors and DC motors. On the other hand, automotive suppliers are
intensely price-driven and need smart solutions to meet the requirements of the market.
This application note aims to provide an understanding of the functionality of a BLDC motor, explains
how such a motor is driven, describes all the necessary components and the necessity of knowing the
positioning of a synchronous motor. Furthermore, the back-EMF technique is discussed and a method
to implement the back-EMF algorithm in the C164CM is presented. To achieve a good
price/performance ratio, all the components used for back-EMF detection have been replaced by
software. Thanks to the high performance of the microcontroller and its powerful peripherals, this
software solution consumes only limited CPU resources.
The system approach discussed might be considered as a starting point for designing a complete
system-specific closed-loop BLDC application
Page 30/31
Sensorless Regulation of a Brushless DC Motor with a C164CM
6 Abbreviations
ADC:
Analog Digital Converter
BACK-EMF :
Back electromagnetic force
B6 :
Bridge with 6 switches (e.g. MOSFET) for 3 phases
BLDC:
Brushless DC
CAN:
Controller Area Network
CAPCOM:
Capture Compare Unit, peripheral that measure events or provide PWM signal
CPU:
Central Processor Unit
EHPS:
Electro Hydraulic Power Steering
LIN:
Local Interconnect Network
PI:
Proportional Integral
PWM:
Pulse width modulation
ROM:
Read only memory
RAM:
Read Access Memory
Page 31/31