Professional Documents
Culture Documents
AN2227
Author: Andrey Magarita
Associated Project: Yes
Associated Part Family: CY8C27xxx
GET FREE SAMPLES HERE
Software Version: PSoC Designer™ 4.2
Associated Application Notes: AN2170
[+] Feedback
AN2227
Table 1. Driver Specifications For simplification, the driver status display LEDs and
speed setting switches are omitted.
Parameter Value Only a detailed view of the driver is provided in Figure 1.
Number Phases 3
Power modules are fairly simple and not examined here.
The driver consists of a bridge chip driver for the IGBT
Input Voltage 220V AC ±20% transistors and a current sense resistor for measuring
current, which is proportional to the total bridge-arms
Output Power 100W current. The IGBT level translator converts the logic level
signals from the PSoC (control bridge bus), into levels
Max Output Current 3.5A
suitable for driving the IGBT bridges’ low and high sides.
Output Signal Frequency: The International Rectifier IR2130 chip is used as the
Minimum 50 Hz IGBT driver. This chip has elements to protect the bridge
Maximum 120 Hz transistors from overcurrent conditions, a low-power
voltage output stage, and internal dead time control. Such
BLDC, Sensor- features let the PSoC concentrate its resources on motor
Motor
less
control and react only when a complex DriverFault event is
Motor Pole Pairs 4 raised by the IR2130. Lower cost drivers can be used by
integrating these features into the PSoC device.
Driver Flowchart
The driver flowchart is shown in Figure 1. The power
circuit includes:
AC line LC filter,
AC mains rectifier,
[+] Feedback
AN2227
BLDC
Motor
Driver Fault
AGND
MUX
MUX
PWM Generator
COMP
1.5 - 5 kHz
+
- Internal Ref
PSoC
The device handles the following signals from the power LPFs serve two functions. The first is to generate the
driver circuit: necessary phase delay for the motor phase voltages.
Thirty degrees is optimum for motor operation in this
Three voltage signals that are proportional to the application. The second function is to filter the phase
output phase voltage of the IGBT driver. voltage from the PWM frequency to generate a signal
wave, which is close to sinusoidal. When the filtered signal
The voltage signal, which is relative to the DC bus crosses AGND, the internal comparator triggers and a
voltage. This signal is the PSoC analog ground falling or rising edge signal is determined. At runtime, the
(AGND). The resistive divider attenuates this signal to awaiting edge type and queried phase channel are
double the phase signals. determined in firmware. The comparator toggle initiates
the interrupt, which is handled in the firmware.
Driver fault signal, which indicates that at least one
fault event has occurred. The PWM generator forms the pulse-with modulated
signal for high side bridge. The low side is controlled by
The phase voltage signals enter the LPFs. Their cutoff constant, clear logic levels.
frequency is three times higher than the phase switching
frequency generated by the motor driver.
The PSoC analog blocks process the phase voltages.
As mentioned above, PSoC's AGND is floating and
proportional to half the DC bus voltage, which is the
rectified and filtered AC main voltage.
[+] Feedback
AN2227
The bridge high side PWM signal-routing is routed through The main tasks of PSoC are to detect the position of the
an internal, firmware-controlled de-multiplexer. Note that rotor using the generated voltage and to perform the
the divided phase voltages are non-symmetric relative to phase switching in such a way that the new driving phase
AGND. This results in a strong influence when a small assists rotor revolution in the desired direction. This is the
PWM duty cycle is set. To resolve this, a single main condition of motor rotation stability.
compensation voltage is added simultaneously to the three
phase signals. This voltage is inversely proportional to the At first glance, a simple comparator on each phase is
PWM duty cycle and is generated by inverting and filtering enough for proper operation. But back-EMF voltage has a
the PWM output signal. more complex waveform, as shown in Figure 6 in
Appendix D. In Figure 6, the PWM induced noise from
DC bus voltage monitoring is implemented using the neighboring windings can clearly be seen because the
programmable voltage window comparator. If the voltage back-EMF winding is not loaded.
value on the DC bus (which powers the bridge high side)
is above or below preset values, an interrupt is generated. There are a couple of ways to separate the back-EMF
This stops the motor, prohibiting operation in unsafe signal from unwanted noise. The first way is to use low-
regions. If necessary, the analog-to-digital converter pass filtering to suppress the PWM-induced noise. The
(ADC) can be used to monitor the DC bus voltage. second method is to perform the phase voltage analysis
when the PWM signal is inactive and the transient process
of the winding is complete. This method is suitable for low
Device Schematic PWM duty cycle values or for low-power motors, where
Device schematics are shown in Appendix A. inductive/capacitance cross coupling between coils is
weak. The first method for noise suppression works well
The device has three elements. The power element when it is implemented using PSoC LPFs. After filtering,
includes: the signal can easily be compared to a reference signal.
Supply-Line Filter All filters have phase delay. This delay depends on the
signal frequency. Thus, the moment of windings
Rectifier commutation is changed at the same time as rotor
revolution frequency. This can cause a loss of back-EMF
DC Bus Filter signal synchronization or large torque ripples. Two
solutions for this problem are:
IGBT Transistor Bridge 1. Use the phase correction filter, analog or digital, to
provide near-constant phase delay in the operational
Voltage Converter for Low-Voltage Parts Supply frequency range.
The second element includes the IR2130 driver and 2. Apply the tunable conventional switched capacitor-
dividers for the phase voltages. The third element contains based filter.
the PSoC chip and speed selector. The speed selector is
made with opto-couplers (which perform the galvanic The first approach requires using complicated analog
isolation and are connected in parallel with DIPswitches circuits or a more expensive DSP core for multi-channel
for manual speed control) for external speed control. The signal processing. Such firmware must continuously read
three LED indicators display alarm events. These three and process triple ADC conversions in real-time. There are
parts are presented as three different circuit boards to other tasks for the drive controller, such as speed control.
provide better flexibility for specific motor applications. This makes the first approach difficult to implement with
low-cost microcontrollers. The second approach requires
external reconfigurable filters when conventional
Device Operation Details microcontrollers are used. This increases the driver price
As mentioned above, the motor control system uses the and complicates the circuit. However, PSoC has many
sensor-less back-EMF technique. The motor winding firmware-controlled filters inside. Therefore, the best
functions operate as position sensors during rotor rotation. solution is to use the tunable LPF approach. This gives the
To accomplish this, the winding, working in sensor-position optimal combination of price, quality, and complexity.
mode, is disconnected from the line supply. An Induced
voltage is generated on the winding by the revolving
magnet on the motor rotor. The sign and direction of the
voltage change indicates the rotor pole location relative to
fixed stator windings.
[+] Feedback
AN2227
The phase-delay filters can be placed in three PSoC are the bridge branch control voltages. UP is the upper
columns and the built-in comparators can be used for (high side) branch. DOWN is the lower (low side) branch.
output signal-crossing detection. Bessel filters are A high level denotes the “on” state and a low level denotes
preferred since they provide linear phase delay versus the “off” state). INT is the interrupt signal on the phases.
frequency up-to-a cutoff point. The filter phase delay at the А30, В30, and С30 are delayed 30 degrees from the
cutoff frequency is 90 degrees. The SC filter cutoff filtered voltages phase.
frequency is directly proportional to the filter clock rate,
which allows stable phase delay in the full input frequency One peculiarity of this architecture is that the control PWM
range by properly adjusting the filter clock frequency. This voltage is supplied only at the upper bridge branch (high
delay corresponds to a constant angle between the rotor side). This produces an asymmetrical signal relative to half
poles and the stator windings in commutation moment. of the supply DC bus voltage.
The phase delay angle is kept to 30 degrees in this At low PWM duty cycles, the filtered phase voltage is
application. The clock rate for the filters can be generated much smaller than half the supply voltage. This, together
using the 16-bit counter with a programmable period, with ripple on the DC bus (which is in the filter’s pass-
which can be allocated in the PSoC digital resources. band), can cause false triggers on the comparators at
Each SC filter has an output comparator that compares motor start. To prevent this, the compensation network
the filter output signal to AGND. The comparator output uses an inversed PWM signal and biases the three filters
drives the comparator bus, which can be polled in software together. This raises the filter’s DC component to half of
or trigger the interrupts. The built-in look-up table (LUT) DC supply voltage throughout the whole PWM duty cycle
allows triggering the interrupts on the rising or falling edge range.
of the comparator bus, as pre-configured in the firmware. For this purpose, the inversed main PWM signal is routed
This feature is used to detect the back-EMF signals’ zero- to an external pin and filtered using an RC filter with a
crossing events and to generate signals for motor winding voltage divider (R4, C5, and R5 on the driver schematic).
commutation. Each filter triggers interrupts which are As a result, the C1 DC voltage is inversely proportional to
handled in the firmware using a dedicated state machine the main PWM DC component. The divided voltage from
to determine the next phase switching order and adjust the C1 is summed with the back-EMF signal relative to PSoC
next interrupt polarity in runtime by modifying the content digital ground and compensates the DC component
of the LUT control register. relative to the divided "DC bus in" signal. Figure 12
Note For every motor phase change, the next expected illustrates the compensation voltages for minimum and
back-EMF signal polarity change direction is opposite the maximum rotation speeds and minimum and maximum
previous. Therefore, the comparator bus signal is inversed PWM duty cycle values. Channel_1 displays the inversed
using the LUT in the triggered interrupt service routine PWM signal and Channel_2 displays the compensation
(ISR) just after it starts. This provides hysteresis and voltage.
additional noise immunity with regard to triggering multiple
interrupts.
Figures 2 and 3 illustrate key principles of driver and motor
operation. A, B, and C are the voltages on motor phases.
UP_A, DOWN_A, UP_B, DOWN_B, UP_C, and DOWN_C
[+] Feedback
AN2227
A
B
B
C
C
A
30o
Delay
A
Down_A
Down_B
Up_C PWM
Down_C
Int A
Int B
Int C
A30
B30
AGND
C30
[+] Feedback
AN2227
+
A A A
0
C B C B C B
_
_ + _ _ +
_
Alignment State A A
1
C B C B
+ +
_ _
A A
2
C B C B
+ +
A A
3
C B C B
+ _ + _
+ +
A A
4
C B C B
_ _
+ +
A A
5
C B C B
_ _
* See Figure 2 for Voltage Diagrams
[+] Feedback
AN2227
The IR2130 driver has a bootstrap capacitor feature. The The amplitude of the AC ripple voltage also depends on
bootstrap capacitor must be charged to 10V before it can DC filter parameters. If this measured duty cycle is directly
be used. Otherwise, high side outputs are turned off selected as the maximum PWM pulse width, the
regardless of control signals. It is necessary to hold the overcurrent protection can prematurely turn off the motor.
bridge low-side power transistors on during this stage. Therefore, the maximum measurable duty cycle ratio must
be slightly decreased to prevent a false overcurrent
To precharge the bootstrap capacitor, the low side protection trigger. The measured duty cycle is decreased
transistors are switched on and the IR2130 output by 25% and used to start the PWM duty cycle value in the
DriverFault is interrogated. If this signal is low, the low-side example project.
power transistors are turned off and the cycle is repeated.
Transistor on/off switching is necessary to clear the error 5. Free Running Stage
flag of the internal IR2130 driver. In this stage, the rotor begins rotation and is synchronized
The driver preparation stage is illustrated in Figure 10. with a back-EMF signal. The stage the PWM operational
Channel_1 shows the voltage of the motor coil windings’ frequency is set to is 5 kHz (it is possible to increase to
current sense resistor during initial PWM duty cycle 8 kHz). The timeout for every winding combination is
determination. Channel_2 shows the "Fault driver" signal, determined using Table 4 in Appendix B, where units are
which triggers when the current reaches 3.5A. The falling PWM periods (200 us). This time is controlled by using
edge of this signal turns off bridge drivers inside the reprogrammable 16-bit timer interrupts. The PSoC's
IR2130 and stores this state in the driver internal trigger. CycleCounter is used for this purpose.
To make the IGBT driver operational, this trigger should be The time intervals between phase switching events during
cleared. This trigger is cleared after a preset timeout by motor start-up are much longer than during normal motor
applying a falling edge on any low-side bridge control operation. As a result, the motor coils accumulate more
input. In the project associated with this Application Note, energy during the driving stage. Considerable time is
the trigger is reset by applying pulses to the phase C lower required to dissipate this energy though the IGBT's
switch and polling the "Fault driver" in the software. If the transistors’ reverse current protection diodes when the coil
"Fault driver" signal cannot be cleared (trigger cannot be driving stops. The back-EMF signal can be received only
reset) within 2 ms, motor start attempts are aborted and a when all stored energy is dissipated and the diodes are
motor start error flag is set. closed. This limits the time interval during which the back-
EMF signal can be sensed. The dedicated 16-bit counter
is used to set the delay proportional to the current phase
switching period. This determines the interval during which
a valid back-EMF signal should be sensed. This counter is
used for other purposes later, thanks to PSoC’s dynamic
re-configuration capabilities.
[+] Feedback
AN2227
The LPF cut-off frequency has a fixed value at this driver Since this project is intended to demonstrate PSoC in
stage and is set by using the dedicated 16-bit counter, control of a sensor-less BLDC motor, the PI regulator is
Filt_Counter16, in the PSoC configuration. implemented using a simple approach. As mentioned
above, the speed control is induced once every motor
The back-EMF signal is sensed after each phase switch electrical period. The rotation period is determined by
event (starting from the second switch event). If the using the measuring counter. The regulator input signal is
expected event is well received, the driver exits from free obtained as the difference between the reference (Tref) and
running stage and switches to the synchronous rotation measured (Tmes) periods. The new PWM value is
state. calculated by using the formulae:
Figure 13 illustrates the motor start-up procedure and the
switch to back-EMF control mode. For motor start-up the ti = T ref − Ti mea
Equation 1
rotor is accelerated in the free-running stage by
decreasing the step-by-step coil switching time intervals.
These intervals are longer than normal phase switching
intervals. During these intervals, the rotor can reach
Pi PWM =
( Kint -1) DiPWM
−1 + Kint ti
+K ti
equilibrium position where the shaft torque drops. To get Kint
prg
[+] Feedback
AN2227
Conclusion
This Application Note demonstrates a PSoC sensor-less
BLDC motor driver. With minimal hardware and software
modifications, this driver can be used to control BLDC.
References
1. “Handbook of small electric motors”, William H.
Yeadon, Alan W. Yeadon, McGraw-Hill, 2001.
[+] Feedback
AN2227
10nF 630V
2
D7
~220V2 C3 C4
C5 1nF 1nF
3
C7
10nF_Y1 C8 BR805D C9 C2
~200V1 1nF 1nF 10nF
3
2mH
~200V1
EARLY
D9
~220V2
T2 VDD
DC_BUS
1 3
DC_BUS
R23 2R R24
R27 100R
DC_OUT
2 4 C13
0.33uF 1
510k
U1 2
+ R25 C12
3
C15 1000uF 25V
C10 300k 100pF 1kV 5
330uF_400V Drain C14
DC_BUS_IN
1 10nF D10
R26 ByPass 8 12V VDD
C11 Source 7
5.1k 10nF Source 6 Q7
4 Source 3 BC547
EN Source 2
J8 C16 Source
1 0.1 TNY255 R20 R28
DC_BUS_IN
2 20R 100
3
I_SENSE
4
5
CON5
[+] Feedback
AN2227
U1 C1 VDD J1
0.1 D1 UF4007 R1 10R CON2
5 28 1
HO1_IN LIN1 VB1 HO1
6 2
HO2_IN LIN2 1
7 27 + C2
HO3_IN LIN3 HO1 HO1 10uF 25V R2 47R J2
2 26 CON2
LO1_IN HIN1 VS1 1
3 24 1
LO2_IN HIN2 VB2 HO2
4 D2 2
LO3_IN HIN3 2
23 C3 + C4 UF4007
HO2 HO2 10uF 25V
0.1 R3 47R J3
22 CON2
VS2 2
11 20 1
CA- VB3 HO3
R15 2
3
12k R14 9 19 + C6
ITRIP HO3 HO3 10uF 25V
5.1k D3 UF4007 J4
18 CON2
VS3 3
10 1
I_SENSE CAO C5 LO1
R4 47R 2
16 0.1
LO1 LO1
J5
15 CON2
LO2 LO2
13 D4 D6 1
VS0 LO2
VDD 14 UF4007 UF4007 2
LO3 LO3
1
VCC 8 J6
FAULT FAULT
CON2
D5 1
LO3
IR2130 UF4007 2
C7 + C8
100uF 25V 0.1
DC_BUS_IN
I_SENSE
CON14A VDD
[+] Feedback
AN2227
U7 PC817
1 3
SW1
R7 750R
J1 2 4
1 U5 PC817
2 1 3
3
4 R8 750R SW DIP-3
2 4
SW1
CON4 U6 PC817
SW2
1 3
SW3
R9 750R
2 4
J7 VCC
U4
1 2 R6
HO3_IN DC_BUS_IN
3 4 1
HO2_IN IN3 VDD VIN VO
5 6
HO1_IN IN2
7 8 75R 0.5W +
LO3_IN IN1
9 10 C2 C6
LO2_IN 0.1
11 12 22uF 25V 78L05
LO1_IN
13 14
FAULT
CON14A VDD
[+] Feedback
AN2227
[+] Feedback
AN2227
Device
initialization
Loop
display stall event
StallCounter+1
Yes
StallFlags==1
No
StallCounterOver StallFlags = 0
No
Yes
Switch read Wait 3s
Stop
No
Speed set
Yes
Yes
[+] Feedback
AN2227
Set FreeRunCycles
Set FreeRunTimeOut
Commutation of next
phase
No
FreeRunTimeOut Over ?
Yes
Yes
Zerro Cross detect
No
No
FreeRunCycles Over ?
Yes
No
FreeRunBreak
Yes
SET MAX_PULSE_TIME
Yes MAX_PULSE_TIME
Over ?
No
Yes
Fault Driver ?
StallFlags =1 No
No
Zerro Cross Enable ?
Loop
Yes
Speed calculate
Yes
No
Calculate and Set
new DutyCycle
[+] Feedback
AN2227
Back EMF
Voltage
(a)
Delay 30°
(b)
[+] Feedback
AN2227
[+] Feedback
AN2227
[+] Feedback
AN2227
Figure 10. Scope Image for Initial Duty Cycle Determination (Driver Preparation)
Figure 11. Scope Images for the Compensation Voltage for Two Different PWM Values
(a) (b)
[+] Feedback
AN2227
Figure 12. Unfiltered Back-EMF Signal (a) and Signal After LPF
(b) When Driver Switches from Free-Running Stage to Sensored Stage
First Back EMF
commutate for CH1
(a) (b)
[+] Feedback
AN2227
Note Driver components are mounted on three separate PCBs to simplify future upgrades and modifications.
[+] Feedback
AN2227
In March of 2007, Cypress recataloged all of its Application Notes using a new documentation number and revision code. This new documentation
number and revision code (001-xxxxx, beginning with rev. **), located in the footer of the document, will be used in all subsequent revisions.
PSoC is a registered trademark of Cypress Semiconductor Corp. "Programmable System-on-Chip," PSoC Designer, and PSoC Express are trademarks
of Cypress Semiconductor Corp. All other trademarks or registered trademarks referenced herein are the property of their respective owners.
Cypress Semiconductor
198 Champion Court
San Jose, CA 95134-1709
Phone: 408-943-2600
Fax: 408-943-4730
http://www.cypress.com/
© Cypress Semiconductor Corporation, 2004-2007. The information contained herein is subject to change without notice. Cypress Semiconductor
Corporation assumes no responsibility for the use of any circuitry other than circuitry embodied in a Cypress product. Nor does it convey or imply any
license under patent or other rights. Cypress products are not warranted nor intended to be used for medical, life support, life saving, critical control or
safety applications, unless pursuant to an express written agreement with Cypress. Furthermore, Cypress does not authorize its products for use as
critical components in life-support systems where a malfunction or failure may reasonably be expected to result in significant injury to the user. The
inclusion of Cypress products in life-support systems application implies that the manufacturer assumes all risk of such use and in doing so indemnifies
Cypress against all charges.
This Source Code (software and/or firmware) is owned by Cypress Semiconductor Corporation (Cypress) and is protected by and subject to worldwide
patent protection (United States and foreign), United States copyright laws and international treaty provisions. Cypress hereby grants to licensee a
personal, non-exclusive, non-transferable license to copy, use, modify, create derivative works of, and compile the Cypress Source Code and derivative
works for the sole purpose of creating custom software and or firmware in support of licensee product to be used only in conjunction with a Cypress
integrated circuit as specified in the applicable agreement. Any reproduction, modification, translation, compilation, or representation of this Source
Code except as specified above is prohibited without the express written permission of Cypress.
Disclaimer: CYPRESS MAKES NO WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, WITH REGARD TO THIS MATERIAL, INCLUDING, BUT
NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. Cypress reserves the
right to make changes without further notice to the materials described herein. Cypress does not assume any liability arising out of the application or
use of any product or circuit described herein. Cypress does not authorize its products for use as critical components in life-support systems where a
malfunction or failure may reasonably be expected to result in significant injury to the user. The inclusion of Cypress’ product in a life-support systems
application implies that the manufacturer assumes all risk of such use and in doing so indemnifies Cypress against all charges.
Use may be limited by and subject to the applicable Cypress software license agreement.
[+] Feedback