1. Drives & Control
June 2003
A. Jansen
1
Brushless DC
Motor Control
with
C868
and
CAPCOM6
2. Drives & Control
June 2003
A. Jansen
2
Agenda
Basics of a BLDC Motor
Topology
BLDC Motor with Hall Sensors
BLDC Motor with Hardware
BEMF-Detection
BLDC Motor Sensor less Control
Switching Pattern for Driving a
BLDC
How to use the CAPCOM6E for a
BLDC
Introduction CAPCOM6E for
BLDC purpose
CAPCOM6E & ADC
3. Drives & Control
June 2003
A. Jansen
3
Electrical Motor Types
Electric
Motor types
AC
Asynchronous Synchronous
Induction
Stepper
Synchronous
PMSM Switched Rel.
DC
5. Drives & Control
June 2003
A. Jansen
5
Basics of a BLDC Motor
DC Motor with 3 Brushes
V
W
U
+
-
3-Phase Brush-less DC Motor
According to the theory of DC machine, the motor rotational speed can be written as
follows:
N = ( Ud - I R ) / (Ke )
While,
“N” stands for the motor rotational speed
“Ud” stands for the DC voltage applied to the motor windings
“R” is the pure resistance of the winding while “I” stands for the winding current
“Ke” is the magnet coefficient while “” stands for the motor magnetic flux
From the above formula, there are two methods to change the speed of DC motor: One is to change the DC
voltage of the motor windings (Ud), the other one is to change the magnetic flux of the motor (). As the BLDC
motor has permanent magnet rotor, only the first method can be used in practical application. The principal of
generating variable DC voltage is to use PWM for chopping: change the duty cycle of the PWM voltage,
proportionally change the DC voltage.
6. Drives & Control
June 2003
A. Jansen
6
How an Inverter Turns a BLDC (1)
C+
B-
1
1
0
A’
B’
B C
C’
A
N
S
7. Drives & Control
June 2003
A. Jansen
7
How an Inverter Turns a BLDC (2)
C+
B-
1
1
0
A’
B’
B C
C’
A
N
S
8. Drives & Control
June 2003
A. Jansen
8
How an Inverter Turns a BLDC (3)
C+
B-
A’
B’
B C
C’
A
1
1>>0
0
N
S
9. Drives & Control
June 2003
A. Jansen
9
How an Inverter Turns a BLDC (4)
C+
A-
1
0
0
A’
B’
B C
C’
A
N
S
10. Drives & Control
June 2003
A. Jansen
10
How an Inverter Turns a BLDC (5)
B+
A-
A’
B’
B C
C’
A
N
S
1>>0
0
0
11. Drives & Control
June 2003
A. Jansen
11
How an Inverter Turns a BLDC (6)
B+
A-
A’
B’
B C
C’
A
N
S
1>>0
0
0
12. Drives & Control
June 2003
A. Jansen
12
BLDC with Hall Sensors – Switching Pattern
Typical Switching Pattern for a BLDC
Hall Sequence depends on motor construction
Output pattern levels depends on inverter topology
14. Drives & Control
June 2003
A. Jansen
14
BLDC with Hall Sensors -- Topology
Typical Circuit Block Diagram
Hall Sensors detect the position
Over current protection and control via ADC
Hall Sensor
C868
+
-
HV
Driver
V+
Motor
CC60
COUT60
CC61
COUT61
CC62
COUT62
CTRAP
CCPOS2
CCPOS1
CCPOS0
15. Drives & Control
June 2003
A. Jansen
15
Block Diagram CAPCOM6E for BLDC Usage
channel 0
channel 1
channel 2
T12
capture/compare input / output control
CC62
COUT62
CC61
COUT61
CC60
COUT60
CTRAP
channel 3
T13
CCPOS0
2
2
2
compare
capture
trap
control
1
port control
CCPOS1
CCPOS2
3
noise
filter
compare multi-channel control
compare
16. Drives & Control
June 2003
A. Jansen
16
Hardware Noise
Suppression
ch0 gets captured
value for act. speed
ch1 compare
for phase delay
ch2 compare
for timeout
CC6x
act. speed
CC60
phase delay
CC61
timeout
CC62
COUT6y
1
1
0
0
0
1
CCPOS2
CCPOS0 1 1 1 0 0 0
CCPOS1 0 0 1 1 1 1
Capture
Event
Resets T12
Usage of CAPCOM6E to Control a BLDC (1)
BEMF-Detection/Hall
Signals
HW-noise filter on
CCPOSx inputs
(BEMF-signals)
17. Drives & Control
June 2003
A. Jansen
17
Hardware Noise
Suppression
ch0 gets captured
value for act. speed
ch1 compare
for phase delay
ch2 compare
for timeout
CC6x
act. speed
CC60
phase delay
CC61
timeout
CC62
COUT6y
1
1
0
0
0
1
CCPOS2
CCPOS0 1 1 1 0 0 0
CCPOS1 0 0 1 1 1 1
Capture
Event
Resets T12
Usage of CAPCOM6E to Control a BLDC (2)
BEMF-Detection/Hall
Signals
HW-noise filter on
CCPOSx inputs
(BEMF-signals)
automatic reset of
T12 with interrupt
actual speed by
capture ch0
18. Drives & Control
June 2003
A. Jansen
18
Hardware Noise
Suppression
ch0 gets captured
value for act. speed
ch1 compare
for phase delay
ch2 compare
for timeout
CC6x
act. speed
CC60
phase delay
CC61
timeout
CC62
COUT6y
1
1
0
0
0
1
CCPOS2
CCPOS0 1 1 1 0 0 0
CCPOS1 0 0 1 1 1 1
Capture
Event
Resets T12
Usage of CAPCOM6E to Control a BLDC (3)
BEMF-Detection/Hall
Signals
HW-noise filter on
CCPOSx inputs
(BEMF-signals)
automatic reset of
T12 with interrupt
actual speed by
capture ch0
phase delay
function on ch1
19. Drives & Control
June 2003
A. Jansen
19
Hardware Noise
Suppression
ch0 gets captured
value for act. speed
ch1 compare
for phase delay
ch2 compare
for timeout
CC6x
act. speed
CC60
phase delay
CC61
timeout
CC62
COUT6y
1
1
0
0
0
1
CCPOS2
CCPOS0 1 1 1 0 0 0
CCPOS1 0 0 1 1 1 1
Capture
Event
Resets T12
Usage of CAPCOM6E to Control a BLDC (4)
BEMF-Detection/Hall
Signals
HW-noise filter on
CCPOSx inputs
(BEMF-signals)
automatic reset of
T12 with interrupt
actual speed by
capture ch0
phase delay
function on ch1
time out function
on ch2
20. Drives & Control
June 2003
A. Jansen
20
Usage of CAPCOM6E – Hall Sensor Mode (1)
Hall n n+1
Hall n+1 n+2
0 0
0 0
1
1
0
1 0
H2
H1
H0
? ?
start
Dead Time Counter
after edge detection
CCPOSx Inputs
for Hallsensor Interface
MCMOUTSH / MCMOUTSL
SW programmable state
machine
21. Drives & Control
June 2003
A. Jansen
21
Usage of CAPCOM6E – Hall Sensor Mode (2)
Hall n n+1
Hall n+1 n+2
0 0
0 0
1
1
0
1 0
H2
H1
H0
? ?
noise Correct
expected
Hall Event
compare
valid level
after
DTC count down
CCPOSx Inputs
edge detection triggers
Dead Time Counter
MCMOUTSH / MCMOUTSL
compare CCPOSx level
with programmed value
22. Drives & Control
June 2003
A. Jansen
22
Usage of CAPCOM6E – Hall Sensor Mode (2)
Hall n+1 n+2
Hall n+1 n+2
0 0
0 0
1
1
0
1 0
H2
H1
H0
? !
noise Correct
expected
Hall Event
set
CHE-flag
CCPOSx Inputs MCMOUTSH / MCMOUTSL
switch to next state on
valid edge by hardware
23. Drives & Control
June 2003
A. Jansen
23
Usage of CAPCOM6E – Hall Sensor Mode (3)
prepare next state
Hall n+1 n+2
Hall n+2 n+3
0 0
0 0
1
1
0
1 0
H2
H1
H0
? ?
wait on
edge
CCPOSx Inputs
wait on edge
MCMOUTSH / MCMOUTSL
prepare next state by
software
31. Drives & Control
June 2003
A. Jansen
31
Usage of CAPCOM6E –
Modulation and Synchronization
Correct
Hall Event
MCMP
MCMPS
to modulation
selection
6
write by software
6
T12pm
T13pm
T12c1cm
T13zm
Flag
T12zm
direct
T12om
SW-Trigger
no action
Reset
MCMOUTSL
MCMOUTL
32. Drives & Control
June 2003
A. Jansen
32
Usage of CAPCOM6E –
Modulation and Synchronization
Correct
Hall Event
MCMP
MCMPS
to modulation
selection
6
write by software
6
T12pm
T13pm
T12c1cm
T13zm
Flag
T12zm
direct
T12om
SW-Trigger
no action
Reset
MCMOUTSL
MCMOUTL
33. Drives & Control
June 2003
A. Jansen
33
Usage of CAPCOM6E –
Modulation and Synchronization
Correct
Hall Event
MCMP
MCMPS
to modulation
selection
6
write by software
6
T12pm
T13pm
T12c1cm
T13zm
Flag
T12zm
direct
T12om
SW-Trigger
no action
Reset
MCMOUTSL
MCMOUTL
34. Drives & Control
June 2003
A. Jansen
34
Usage of CAPCOM6E –
Modulation and Synchronization
Correct
Hall Event
MCMP
MCMPS
to modulation
selection
6
write by software
6
T12pm
T13pm
T12c1cm
T13zm
Flag
T12zm
direct
T12om
SW-Trigger
no action
Reset
MCMOUTSL
MCMOUTL
35. Drives & Control
June 2003
A. Jansen
35
Usage of CAPCOM6E to Control a BLDC (5)
0 0 0
1 1 0 1 0 0
1 0 0
0 1 0
0 1 1 0 0 0
0 1 0
MCMOUTSL
MCMOUTL
MCMOUTSH
MCMOUTH
C+
B-
1
1
0
A’
B’
B C
C’
A
N
S
36. Drives & Control
June 2003
A. Jansen
36
Usage of CAPCOM6E to Control a BLDC (6)
0 0 0
1 0 0 0 0 0
1 0 0
0 1 0
0 1 1 0 0 0
0 1 0
MCMOUTSL
MCMOUTL
MCMOUTSH
MCMOUTH
C+
B-
A’
B’
B C
C’
A
1
1>>0
0
N
S
37. Drives & Control
June 2003
A. Jansen
37
Usage of CAPCOM6E to Control a BLDC (7)
0 0 1
1 0 0 0 0 0
0 0 0
0 1 0
0 1 0 0 1 0
0 1 0
MCMOUTSL
MCMOUTL
MCMOUTSH
MCMOUTH
C+
A-
1
0
0
A’
B’
B C
C’
A
N
S
38. Drives & Control
June 2003
A. Jansen
38
Usage of CAPCOM6E to Control a BLDC (8)
0 0 1
0 0 0 0 0 1
0 0 0
0 0 0
0 1 0 0 1 0
0 1 1
MCMOUTSL
MCMOUTL
MCMOUTSH
MCMOUTH
B+
A-
A’
B’
B C
C’
A
N
S
1>>0
0
0
40. Drives & Control
June 2003
A. Jansen
40
BLDC in Theory – Back Electro Magnetic Force
Theory
UP = (R x i) + (L x di/dt) + eP
where
"UP" stands for phase voltage
"R" stands for winding resistance
"i" stands for actual phase current
"L" stands for phase inductance
"di/dt" stands for changment of phase current over time
"eP" stands for electromagnetic voltage caused by magnet
while
i = 0 and di/dt = 0:
UP = eP
by measuring UP
a position detection
is possible
ia
v
a
i
30°
ib
v
b
i
120°
41. Drives & Control
June 2003
A. Jansen
41
BLDC in Reality (1) – BEMF vs. Current
ia
v
a
i
Real BEMF Voltage and Current:
shape depends on magnets, motor speed, voltage
42. Drives & Control
June 2003
A. Jansen
42
BLDC in Reality (2a) – BEMF vs. Current
Zoom In:
BEMF is only visible at active switching
Phase
Current
BEMF
Voltage
43. Drives & Control
June 2003
A. Jansen
43
BLDC in Reality (2b) – BEMF vs. Current
Current Commutation in a Coil
Freewheeling diode conducts
Phase
Current
BEMF
Voltage
V+
GND
Current
Flow
Motor
V+
GND
Current Flow
Freewheeling
Diode
Motor
44. Drives & Control
June 2003
A. Jansen
44
BLDC in Reality (3) – All Important Signals
Phase
Current
BEMF
Voltage
45. Drives & Control
June 2003
A. Jansen
45
BLDC Sensor less with Hardware BEMF-Detection
Typical Circuit Block Diagram
Comparators and RC-Filter detect the BEMF zero crossing
for position detection
C868
RC
Filter
virtual
Star
-
+
-
+
-
+
+
-
HV
Driver
V+
Motor
CC60
COUT60
CC61
COUT61
CC62
COUT62
CTRAP
CCPOS2
CCPOS1
CCPOS0
46. Drives & Control
June 2003
A. Jansen
46
BLDC Sensor less Using ADC
Typical Circuit Block Diagram
Use simple resistor divider and ADC for position detection
C868
+
-
HV
Driver
V+
Motor
CC60
COUT60
CC61
COUT61
CC62
COUT62
CTRAP
AN2
AN1
AN0
BEMF
Detection
47. Drives & Control
June 2003
A. Jansen
47
CAPCOM6E & ADC
Synchronize ADC on T13
T13 period match can trigger the ADC
equidistant sampling of analog signals
exact timing guaranteed by hardware
no timing jitter due to software delays
f(n-1)
f(n) f(n+1)
f(n+2)
conversion
channel 0
T13
analog
signal
ADC
start sampling
by hardware
48. Drives & Control
June 2003
A. Jansen
48
CAPCOM6E & ADC
Synchronize T13 on T12
T13 performs delay for
stable measurement
T13 period match
triggers ADC
Useful for Current
Measurement
E.g. induction machine
Compare value
T12
T13
CC6x
Phase
Current x
synchronize
T13 on T12cm
Start ADC when
signal is stable after a
programmable delay
49. Drives & Control
June 2003
A. Jansen
49
CAPCOM6E & ADC
T13PM triggers ADC
Delay between T13PM
and high voltage
switching event due to
driving circuit
Useful for Voltage or
Current Measurement
E.g. BEMF detection
Sample shortly before
power device is
switched off (BEMF is
noise free)
BEMF
signal
IGBT
drain
volt.
CC6x
T13
Modulation for
Block-Commutation
Delay due to
IGBT driving circuit
IGBT’s gate signal
Voltage signal at
currentless phase
for position detection
Start ADC sampling
50. Drives & Control
June 2003
A. Jansen
50
CAPCOM6E & ADC
T13PM triggers ADC
Delay between T13PM
and high voltage
switching event due to
driving circuit
Useful for Voltage or
Current Measurement
E.g. Current in DC link
path
Sample shortly before
power device is switched
off (current is noise free)
IGBT
drain
volt.
CC6x
T13
Modulation for
Block-Commutation
Delay due to
IGBT driving circuit
IGBT’s gate signal
DC Link
Current
Start ADC sampling
51. Drives & Control
June 2003
A. Jansen
51
BLDC Sensor less Using ADC
T13 used for
Modulation
ADC trigger
T12 used for
Phase delay
Software (for 60°
sector)
With every T13PM
the BEMF voltage is
sampled and
compared to a BEMF-
wave table
When crossing a limit
the software
generates a CHE-
event (1)
Speed reference is
captured and phase
delay for T12ch1 is
calculated
At T12ch1 the pattern
for the next sector is
switched (2)
BEMF
Voltage
Phase
C
T13
T12
Current
Phase C
Current
Phase A
Measure
BEMF-Voltage
(Phase C)
Measure
DC-Link Current
(Phase A)
Measure
Voltage
(Phase
B)
1 2
Analog
CompareValue
CompareValue
T12_ch1
52. Drives & Control
June 2003
A. Jansen
52
BLDC Sensor less with Current Control
T13 used for
Modulation
ADC trigger
T12 used for
Phase delay
Software (for 60°
sector)
With every T13PM the
ADC alternatively
samples
BEMF voltage
Phase current
The current set value
can be controlled by
adjusting the PWM
duty cycle
BEMF
Voltage
Phase
C
T13
T12
Current
Phase C
Current
Phase A
Measure
DC-Link
Current
(Phase A)
Measure
BEMF
Voltage
(Phase C)
Measure
DC-Link Current
(Phase A)
Measure
BEMF
Voltage
(Phase
B)
Measure
DC-Link
Current
(Phase C)
1 2
CompareValue
T12_ch1
Analog
CompareValue
Control
Current Value
53. Drives & Control
June 2003
A. Jansen
53
BLDC Sensor less Scope Shots
Port pin toggles when
BEMF is below limit
BEMF
Voltage
Phase
Current
54. Drives & Control
June 2003
A. Jansen
54
Application: Line powered Industrial Drives
Power: 750 W
Current: max. 5 A
AC Input Voltage: 110 to 264 VAC
Features:
8-bit MCU: C868 with on-chip 8 kB SRAM, with 8-
bit ADC and powerful PWM module
CoolSet: TDA61831G instead of a transformer for
12V supply
6 rugged IGBT DuoPacks
EEPROM: 8 kB to store program + stand alone
boot option
Optically Isolated Serial Interface to PC for SW
development + boot from PC option
Protection: shut down protection for over current
and over temperature
Extension for alternative MCU like XC164 or
TC1775
SW environment: Keil Compiler + Debugger or
Mini Debugger (free software)
Board can be used for current/torque or speed
control
Supports Hall-Effect sensors or sensor-less
control
High Voltage 3-Phase Brushless DC / Induction Motor
Reference Design and Development Kit
55. Drives & Control
June 2003
A. Jansen
55
Low Voltage 3-Phase Brushless DC / Induction Motor
Reference Design and Development Kit
Application: Industrial & Automotive Drives
Power: 1.2 kW
Current: max. 50 A
Voltage: 12 - 24 V DC
Features:
8-bit MCU: C868 with on-chip 8 kB SRAM, with 8-
bit ADC and powerful PWM module
3-Phase Bridge Driver: TLE6280G
6 OptiMOS MOSFETs
EEPROM: 8 kB to store program + stand alone
boot option
RS232: Interface to PC for SW development +
boot from PC option
Protection: shut down protection for over current
and over temperature
Extension for alternative MCU like XC164
SW environment: Keil Compiler + Debugger or
Mini Debugger (free software)
Board can be used for current/torque or speed
control
Supports Hall-Effect sensors or sensor-less
control
Editor's Notes
This presentation gives you an introduction in basics of motorcontrol
How a BLDC in general works, where it is used and which are the typical topologies
Furthermore we show how the BLDC can be controlled
Either by sensors
Or by different sensorless techniques
We also show where these techniques are used and where are the limits
Next part of the presentation shows which signals and switching patterns are necessary to run a BLDC in general
The very technical part of the presentation shows how the CAPCOM6E can be used to generate these switching patterns and we show some tricks how to use the CAPCOM6E for an optimized control of BLDC
The CAPCOM6E helps to control a BLDC in a rather good way without much CPU load
The CAPCOM6E is available today on
C868
XC164
XC167
The CAPCOM6E is an optimized and enhancend PWM unit compared to the CAPCOM6 which is available on
C164-family
C504, C508
Let us start with the well known DC-Brush motor
We can see a magnet an 3 coils and for each coil a mechanical switch called commutator which rotates. When applying a voltage at the brushes current flows through two of the coils. This current interacts with the magnetic field of the magnet and produces a torque. Therefore the rotor will move. When the motor moves the brushes will switch to a different coil automatically and the motor will turn further. It will turn faster if we increase the voltage and it will produce more torque if we increase the magnet.
The analogon of this motor is a BLDC. Here we have replaced the brushes – which are the mechanical switches by electronic switches (with MOSFET or IGBT semiconductor). The other changement is that the rotor is now the magnet. The advantage of the electronic switches is that the are much more rugged than mechanical switches, they need no service, the switching is less noisy and faster and this motor can even work in explosives areas (like in oil) because there is no brush fire.
The rotational speed can be adjusted by the voltage; but as we have electronic switches we can apply a high frequent modulation on the switches. The motor coils will integrate the duty cycle and will see the average voltage. This PWM can be easily generated by a microcontroller and therefore the speed of the motor can be controlled
The topology of such electronic switches is called 3-phase-inverter
Now we see that we have two different time frames
The mechanical speed of the motor which is up to a few hundred Hz
The electronical switching period of the PWM which is in the kHz range
The next foils show how a 3-phase inverter principally works.
We can see the big capacitor which is a battery or represents the DC link voltage, we can see 6 switches which are connected to three coils (3-phase). The coils are connected in star connection.
There is always a pair of switches which controls one coil – this is called half bridge configuration. There is a high side switch which is connected to the V+ DC-rail voltage and the opposite one which is called low side switch which connects the coil to the GND.
Current though the motor will flow if one high side switch is on (here C+) and another lowside switch is on (here B-). The current will flow from V+ through coil C in positive direction and through coil B in negative direction to GND.
We see furthermore that we can easily generate a bridge shortcut if the highside and lowside switch is on at the same time. This will burn the inverter immediately cause very high current will flow very fast (within a few microseconds) and this situation has to be avoided at all (through hardware protection).
If BLDC motors are controlled in so called block commutation mode – which is the most common usage – we can see that always one phase is inactive (here phase A) whereas current will flow to the other phases. If we remember the DC-Brushmotor we have the same situation.
Now we see on the right side a BLDC motor with it‘s magnet and the coils A-B-C. This diagram reprents a one polepair machine.
The black arrows represent hallsensors which output a „1“ if they see a northpole and a “0“ if they see a southpole. These sensors are necessary for a position detection. BLDC-motors are synchronous motors – like a DC-brushmotor - and they only turn if the current flows through the right coils at the right time. To ensure this we can use hallsensors.
Let us assume that we switch on the lowside switch B- and the highside switch C+ the rotor will turn counterclockwise
Now we see that Hallsensor 2 changes from 1 to 0 which indicates a certain position
The Hallpattern 110 changes to 100
This will be detected by our microcontroller and we have to switch to the next PWM state
This must be C+ and A-
The motor turns further clockwise cause the PWM-switching state was correct
Next state must be A- and B+
Now motor turns further and Hall Sensor 1 changes
From 100 to the next Hall State is now 000
And motor turns another 30°
This is now an overview of all the relevant signals
The upper 3 are the Hall Sensor inputs
The middle 3 are the High Side Switches which are non-modulated
The lower 3 are the Low Side Switches which are modulated
Here we can see the two different timeframes
The switching of the Hall States is related to the mechanical speed of the motor – this is up to the few 100Hz range – a hall state will typically last for a few hundred microseconds to ~100 milliseconds
The switching frequency of the PWM is above the audible range, so mostly bigger than 14kHz up to 20-70kHz – which is a period in the 20-100 microsecond range
This means that the factor between the PWM frequency and the rotational frequency is typically 20 to 1000
This is important because this results in two different time base for the pattern generation.
Sometimes it is necessary to have a phase delay between the hallevent and the switching event. This will give us a third time which is important to drive a BLDC.
In general it can be said that this kind of signals and patterns can be easily generated by an 8bit microcontroller. This is an easy state machine which can be built in software as well as in hardware in an ASIC.
The only critical issue is the big difference between the two time bases and that the factor can vary over a big range. This will require two fast 16bit timers with a flexible prescaler arrangement.
This were the basic things on running a BLDC motor with Hall Sensors
Now let‘s have a look on the hardware topology of an inverter
This is a typical configuration for an inverter driving a BLDC using Hall Sensors.
We have the three Hall Sensors at the motor which deliver the position signal to the micro
We have the six output pattern from the micro to a driving IC, which is necessary to turn on and off the powerswitches (IGBTs or MOSFETs)
And we need at least an overcurrent protection which can be feed back to the micros hardware switchoff signal (CTRAP) and also can be used to measure the curren in the DC-link with an ADC
If we want to know how the micro generates the proper motor control pattern we have to look into the microcontroller‘s PWM unit
At IFX we have experience with this kind of PWM units for more than 10 years.
Our latest step of development is called CAPCOM6E which is a very powerful and flexible capture and compare unit which allows to drive nearly every kind of motor.
To control a BLDC the CAPCOM6E has the task
To generate the fast modulation and adjust the duty cycle for controlling the speed (~20kHz) – electrical time base
To measure the speed – mechanical timebase
React on the hall sensor event and switch the phases accordingly
Therefore the CAPCOM6E is equipped with following features
2 independant 16bit timers with a large prescaler arrangement
T12 is a 3-channel capture and compare timer – here we need the channel 1 for capturing the speed, channel two as compare for a phase delay function and channel 3 as a timeout function
T13 generates the fast PWM signal and controls the duty cycle
All timer output signals can be configured and changed within a big block which is called Multichannel-Control
This block handels also the input signals of the hall sensors
There is another important function which is the hardware switchoff-feature CTRAP – this function guarantees that all output signal will be switched into it‘s inactive state when the level is low.
To summarize the function of the CAPCOM6E
After a Hallevent there is a Hardware Noise suppression which suppresses the bouncing of the Hallsensors
After a valid Hallevent the actual T12 value is captured into the channel 0 register – this is related to the speed of the motor – the distance between two hall events is normally 60° electrical
Furthermore the T12 is reset to zero after a hall event, so the speed related value can be read from the register and need not be calculated because of a timeroverflow
Sometimes there is a need for delay between the hallevent and the switching event. This is handeled by compare channel 1
Last but not least there is an indication for a timeout by using channel 2 of T12
As we can see the CAPCOM6 can drive a BLDC quite well and many functions are supported by hardware – so the CPU load is reduced.
With the CAPCOM6 one can build up a very flexible statemachine where the timecritical signals are genereated by hardware and the non-critical signals are controlled by software.
The big problem with this kind of SW-HW-statemachines – which need to be implemented for controlling a motor - is that the software and the hardware (timers) run fully asynchronous. To avoid spikes and dirty signals there must be a synchronization of the software action and the hardware action. This synchronization has to be implemented in hardware, as the software is much to slow to react properly.
The key benefit of the CAPCOM6 is that it offers exactly these synchronization mechanism.
There is a way to build a hardware statemachine,
Which is controlled by a software statemachine.
In the following we will learn more about this.
First, let‘s have a look into the hall signal handling and this part of the statemachine which reacts on the hall events
As we could see from the first examples there are normally 3 hall sensors which levels indicate a certain state. For each of these hallstates it exists a certain output pattern. As this relationship is fixed there exists a table which shows all the hallstates and the related output states.
So one can easily build a statemachine in software which reacts on the change of a hall sensor.
Let us look into the detail:
Here we can see that Hall sensor H1 changes from high to low, or the hallstate 110 changes to hallstate 100
There exists a register which can be programmed with this states,
let us call the green state 110 the actual state n
And the blue state 100 the following state n+1
The register contains the value n and n+1 – so we need 6bit for that
Now the Sensor H1 changes it‘s level which is detected by the edge detection logic and this triggers a Downcounter
When the downcounter is finished it compares the hallsensor input levels (at CCPOSx-pins) with the value in this register MCMOUT
Now we have a three possibilities
1) the value equals the actual value n – it was just a noise spike – nothing happens
2) the value equals to the following state n+1 – we have a correct hall event cause we would expect this state if the motor turns right
3) if it was neither the actual nor the following state – it was a wrong hall event and we have to react by software cause the motor does not turn properly
Let us assume it was a correct hall event CHE, a flag is set and a hardware shadow transfer is triggered.
This will copy the next state from a shadow register into the real compare register. Now the actual state is n+1 and the following state is n+2.
The flag CHE can trigger an interrupt and the software can write the overnext state into the shadow register. For this action the software has quite a lot of time cause this is related to the slow mechanical timebase.
Here we have seen that there is a perfect decoupling of the hardware and software actions and due to the shadow transfer concept we have a synchronization of the two statemachines (hardware and software).
The last few foils showed how the CAPCOM6E handles the input signals coming from the Hallsensors – now let‘s have a view on how the output signals are generated.
The origin heart of the CAPCOM6E is a flexible modulation block which consists basically of a logic AND gate. This AND gate has 4 input pathes and we have 6 of this AND gates within the CAPCOM6E.
Each AND gate has following inputs
One of the 6 output signals of T12
The output signal of T13
The CTRAP signal
One bit of a 6bit register (MCMOUTH)
The output signals of the 6 AND gates are passed to the portpins P3.7-2
We can generate interesting signals
All inputs HIGH >> output HIGH
One input LOW >> output LOW, e.g. emergency signal
One input with a modulation >> output with modulation
Combine modulation and MCMOUT.Bit >> switch on/off modulation
Combine two modulations of T12/T13 >> over modulation
Following example shows typical BLDC signals; we have
Modulation with T13 on the Lowside switches C-, B- , A-
Two phases active – here C+ (MCMOUTH.4) and B- (MCMOUTH.3)
Phase A is the inactive phase
H1 event occurs and we have to switch
B- inactive – a LOW to MCMOUTH.3 – phase B is inactive phase now
A- active modulation cause it was inactive phase – a HIGH to MCMOUTH.1
C+ remains active
H2 event occurs and we must switch
C+ off with a LOW in MCMOUTH.4 – phase C is the inactive phase now
B+ on cause it was inactive phase - a ONE in MCMOUTH.2
A- still with modulation
Big Question – what comes next???
Something must happen on phase C – cause it is the inactive phase
C+ was active two states ago, so it is C- which must turn on; C- is a Lowside switch, so we need to modulate and
phase A will get inactive, cause it was active for two cycles
Now phase C will become active again – a ONE in MCMOUTH.5 swithches on the Loweside modulation on C-
Phase A becomes the inactive phase – A- will switch off due to a 0 in MCMOUTH.1
Phase B remains active
Phase C is still active
Phase B becomes to the inactive phase
Phase A becomes active at it‘s Highside A+
Phase C will get inactive
Phase B gets active on it‘s Lowside
Phase A remains active
Now we have a full turnaround which is 360° electrical
There is a relationship between electrical and mechanical angle which comes from the number of polepairs. If there is only one polepair, the mechanical and electrical angle is the same.
Now we have seen how the signals are generated in principal, but let us have a closer look on the synchronization features of the CAPCOM6E
There is the 6bit register MCMOUTH which has a shadow register. Both registers can be accessed by software but the Non-shadowed directly goes to the input of the big AND gate.
The software can program the shadow register fully asynchronous to the hardware events
And there is a shadow transfer event which takes care for the synchronization of software and hardware
This shadow transfer can be triggered by a pulse which comes out of another logic AND
One input of this AND is a Flag
The Flag can be set due to some possible events, e.g.
A Correct Hall Event at the Hallsensor inputs
A T13 period match, etc….
Or just by software ofcourse
The other input of the AND just makes the synchronization
Here we can have no synchronization – the Correct Hall Event directly should trigger the transfer without any delay
We can easily adjust a so called Phase Delay between the Correct Hall Event and the output switching
And we can synchronize the swithing event to the modulation of T12 or T13, i.e. the SW will not cut off active modulation, so no short spikes are generated.
Let us see everything together
Hall Pattern on MCMOUTxL
PWM Pattern on MCMOUTxH
The inverter
The Motor
A Correct Hall Event will cause a shadow transfer on the PWM pattern
The Software can prepare the next PWM state and writes into MCMOUTSH
The next Hall event will cause a shadow transfer on the MCMOUTxL for the new Hallpattern
This will again cause a shadow transfer on the PWMpattern.
As we can see the motor turns perfectly .
Implementing this statemachine is easy and all timecritical issues are handled by the CAPCOM6.
In the previous presentations we have seen the basic things to control a BLDC motor with Hallsensors.
Ofcourse many applications require a sensorless solution cause the application wants to get rid of the Hallsensors. The hallsensors have really some disadvantage because of
Noise immunity
Mounting cost
Additional wiring and „cabeling“ overhead
Reliability - dust, lifetime, temperature etc…
To run a BLDC sensorless we have to generate the same PWM pattern at the same time ofcourse – otherwise as the BLDC is a synchronous machine – it will stop or will not run properly.
The big question now is: „How can we find the actual position of the motor when it is turning???“
There are some possiblities to find out the position. The most common one and probably the most easy one is the socalled
Zero Crossing Detection of the Back EMF-signal for Block Commutation Mode
This technique will be presented in the following foils.
To understand how this technique works, we have to understand a bit the theory of a BLDC
If we just turn the motor and watch at the phase voltage – generator mode – we will see a sinesoidal or trapezoidal voltage. This voltage is generated by a magnet which is turned through a coil – everybody knows this from school.
This voltage is called Back Electro Magnetic Force.
If we turn the motor, the BEMF-voltage must change from a positive value to a negative value. So this voltage voltage indicates the position of the Rotor-Magnet. If we are able to measure this voltage, we have the position.
Unfortunately we have to use the motor not in generator mode but in motor mode, so there are some other values which have to be taken into account.
So the phase voltage consists of following parts:
There is an ohmic part because the motor coil has some resistance, so the phase current which flows through the phase resistance will generate a voltage. These are pure losses in the coil.
The other part of the voltage comes from the inductance and the change of the current over time (di by dt)
The last part comes from the BEMF-voltage.
The trick to detect this BEMF-voltage is very easy. If the phase current is zero the part which generates the phase voltage is just the BEMF-voltage itself.
So if we have no current in one phase we can detect the zero-crossing of the BEMF and we get the position.
Ideally this zero crossing event comes 30° (electrical) before the switching event. So if we detect the zero crossing we need a phase delay of about 30°and perform then the next switching state.
To summarize, the BEMF-zero crossing technique can replace the hallsensor but there are some difficulties:
This does not work at standstill and low speed, as the BEMF-signal is to low
The BEMF-voltage and shape strongly depends on construction and type of the motor
In practice the siganls does not look such nice as in theory
Here we can see the
Phase current (red)
The three hallsignals below to see the timing relationship
The phase voltage (blue)
The phase voltage changes from high to low or vice versa, when the phase current is zero
The shape of this BEMF is far away from a trapezoidal but it is good enough to detect the position
Let‘s have a zoom inside.
Now the big question N° 2 is:
„Which is the current and which is the voltage“?
Answer: Phase Current is channel 1, Phase Voltage is 2
We see that we can measure the BEMF-voltage only, if we have an active modulation. This is easy to explain, because if there is no modulation the inverter bridge is open and we cannot measure any phase voltage.
So we have to measure the phase voltage synchronous to the PWM generation.
Furthermore we see that the phase current decreases from a value to zero. The big question N° 3 is now:
„Where does the low pulse come from???“
Answer:
This is because the coil is switched off („inactive phase) and therefore the phase must change form a certain value to zero. As a coil is a current storing element, the current which is stored in the coil must commutate. So the current in the coil must flow through a freewheeling path.
In this case we are switching off a highside switch, so the commutation current comes through the opposite diode of the lowside switch. As long as the diode conducts this current, the voltage is the diode voltage ~0.7V.
Furthermore we see that the phase current decreases from a value to zero. The big question N° 3 is now:
„Where does the low pulse come from???“
Answer:
This is because the coil is switched off („inactive phase) and therefore the phase must change form a certain value to zero. As a coil is a current storing element, the current which is stored in the coil must commutate. So the current in the coil must flow through a freewheeling path.
In this case we are switching off a highside switch, so the commutation current comes through the opposite diode of the lowside switch. As long as the diode conducts this current, the voltage is the diode voltage ~0.7V.
Now all important siganls at one glance:
Current
Voltage
3 Hallsensors – just to see the relationship
Lowside switching
Highside switching
That‘s now the hardware topology
We have replaced the hall sensors by 3 resistor dividers and a comparator for each phase
Now we can use the digital hallsensor inputs CCPOSx for the CAPCOM6 interfaceing
We can also use the ADC to measure the BEMF. This is nice because we can reduce the external components to just a resistor divider and a capacitor for each phase.
To handle this we need a bit more CPU performance because we have to convert the analog voltage into a digital one.
This is normally only possible with a high performant A to D-converter, as the BEMF-signal is very short because it comes with the PWM frequency (~20kHz).
Within the C868 we have a very powerful ADC which is worth to have a look at.
The very best is that the conversion time is very short. The fastest programmable time is ~1us and we have a sampling time of about 200ns.
This makes the ADC feasable for this purpose.
A very interesting feature of this ADC is that it can be triggered automatically by a T13 Period Match. So every time T13 overflows, we will start sampling.
This is very good for equidistant sampling to ensure an exact timing for the sampling distance. There is no more jitter as if we start sampling by software
Furthermore the T13 can be synchronized on T12. A compare event of T12 can start T13 in single shot mode. Then T13 can trigger the ADC start.
Thsi is very useful, if one wants to measure e.g. phase current. Because of the switching of the power switches there will be lot of noise at the switching event. After a while the phase current will be stable.
In this case we can use the T13 as a delay timer which starts the current measurement e.g. 1us after the switching, when the current signal is noisefree.
Last but not least we can use this feature to detect the BEMF-Voltage.
Here T13 generates the PWM and the duty cycle for the BLDC. We see that at each compare event the output of the CC6x - which goes to the gate of the IGBT - is switching.
There is a delay between the input signal and the output switching on such power devices. This is because there is a driving circuit between the micro output and the gate input and the power device needs some time for switching.
This delay we will use to measure the BEMF. The BEMF signal is also very noise and the best point to measure is shortly before switching off the power switch. This time is exactly the T13 Period Match. So with every T13PM we will trigger an ADC measurement. The software has just to read and compare this value.
We can use the same principal to measure the phase current in the DC-link path ofcourse. Shortly before switching off we will have a stable signal.
To summarize we have the following tasks:
T13 generates the fast PWM
T12 generates the switching event for the next state
We measure the BEMF signal at the inactive phase (current = zero)
The software reads in the T13 interrupt service routine this value and compares it to a predefined threshold (zero crossing point).
When this threshold point is reached the software will reset the T12 to prepare the next PWM state.
After a phase delay (due to the fact that the BEMF zero crossing is about 30° before the switching event) the T12 channel 1 compare event triggers the switching into the next state.
We can see in this figure that the phase current is not constant within one switching state but rises in this case. We can optimize this current shape by controlling the duty cycle of the PWM.
This we can see here:
After we reached the threshold value of the BEMF in phase C we can measure the current in phase A. As we see the current rising, we can decrease the dutycycle and vice versa.
This was the principle of how to control a BLDC sensorless.
Let‘s have a look into the reality
We can see our know signals
Phase current
BEMF voltage
And another signal – which is a portpin which toggles if the ADC result is below the programmed threshold value.
We can see that this pintoggle starts in the middle of a PWM state which is at about 30°.
So we can see that this is not only working on paper but also in reality.
ANY QUESTIONS so far on BLDC???
Last but not least let me show you our latest development which is a Drive Starterkit for the C868
One for low voltage
One for high voltage
These boards we can deliver on special customer request.