Académique Documents
Professionnel Documents
Culture Documents
Based on CY8C24x33
AN47936
Authors: Dino Gu
Jemmey Huang
Associated Project: CY3253-BLDC
Associated Part Family: CY8C24x33
Software Version: PSoC Designer™ 4.4
Associated Application Notes: AN2227, AN42102
[+] Feedback
AN47936
Figure 2 is a typical drive circuit of the three-phase BLDC 1. Compared with Virtual Neutral Point
motor. In this figure, Va, Vb, and Vc are terminal voltages,
and Vn is neutral voltage. As shown in Equation 5, the zero-crossing of BEMF phase
C can be detected by comparing Vc and Vn. However, Vn is
Figure 2. BLDC Drive Circuit usually not available in three-phase BLDC driven circuit. A
resistor network is required to construct the virtual neutral
V1 V3 V5 point Vn, as shown in Figure 3. Voltage dividers and low
pass filters are necessary to process the signals. However,
the signal/noise ratio at low speed is less because, the
BEMF amplitude is proportional to motor speed. The second
Vb problem is that the low pass filter causes phase delay at
B high speed.
Figure 3. Neutral Voltage Detection
C
Va A Vn
Vc
V4 V6 V2
dI a
Va RI a L Ea Vn Equation 1
dt
dI b
Vb RI b L Eb Vn Equation 2
dt 2. Compared with 0V During PWM-OFF
Assume that PWM is only applied on the high side switch
Vc Ec Vn Equation 3 and the low side is ON during the entire step, ignoring the
voltage drop on Vmos and Vd. The current flow during
In these equations, E is Back EMF, I is phase current, and L
PWM-OFF is shown in Figure 4. In this period:
is inductance.
Because only two currents can flow in the stator windings Va Vb 0 Equation 9
simultaneously, the two phase currents are equal and
opposite. This is shown in Equation 4. Combine Equations 8 and 9:
By adding the three terminal voltage equations (Equation 1, From this equation, it is not necessary to detect the neutral
2, and 3), the following equation is obtained. voltage. The BEMF signal is directly proportional to the float
phase voltage. As a result, to detect zero-crossing of BEMF
Va Vb Vc Ea E b Ec 3Vn Equation 5 Ec, just sample the terminal voltage Vc and compare it with
a voltage a little more than 0V.
It is evident that at the BEMF zero-crossing points the sum
Figure 4. Detecting During PWM-Off
of the three BEMFs equals zero. As a result, Equation 5 can
Vbus
be reduced to:
Va
For the nonfed phase (zero current flowing), the stator Rb
Lb
Eb
Vb Vn
terminal voltage can be rewritten as:
Lc
Ec
Ec Vc Vn Equation 7
D
Rc
Vc
r
From Equations 6 and 7:
MOS Vref
3Ec 2Vc (Va Vb ) Equation 8 GND
Comprator
[+] Feedback
AN47936
This method requires only a few external components, and 4. Simultaneous Sampling of 3 Phase
the applicable speed range is large. This sensing technique Terminal Voltages by ADC
can be used in a high voltage or low voltage system with no
effort to scale the voltage. However, the low side switch According to Equation 8 on page 2, this scheme to detect
must always be ON. In addition, a voltage reference that is a the zero crossing of BEMF Ec (Ec=0) simultaneously
little higher than 0V for a comparator cannot be easily samples the three-phase voltages Va, Vb, and Vc. The float
selected. terminal voltage Vc is then compared with half of the fed
phase voltage (Va+Vb) by firmware.
3. Compared with Half DC Bus During PWM- The algorithm is simple and does not require a filter and
ON comparator. It does not rely on PWM mode and can sample
Assume that PWM is only applied on the high side switch voltage signals at any moment of the PWM period.
and the low side is ON during the entire step. During PWM- However, it requires a high speed and multi-channel ADC. A
ON, ignore the voltage drop on Vmos and Vd. The following high MIPS controller is also required.
equation is obtained:
Implementing BEMF Zero-Crossing
Va Vbus Equation 11
Detection in PSoC
Vb 0 Equation 12 In this application, the BEMF Zero-crossing detection
scheme is based on the Compared with Half DC Bus During
As a result, from Equation 8 on page 2: PWM-ON method. Nevertheless, because of the versatility
of the PSoC chip, this BEMF Zero-crossing detection
3Ec 2Vc Vbus Equation 13 scheme does not require a high speed ADC or a high MIPS
controller. The internal multiplexer and other analog
To judge the zero-crossing of BEMF Ec (Ec = 0) is exactly resources also reduce external components. Figure 6 shows
the same as judging the sign of (2Vc-Vbus). This means, the block diagram of PSoC implementation.
you only need to sample the terminal voltage Vc and
Figure 6. PSoC Implementation
compare it with half Vbus.
This method requires only a few external components and
has a high detection range for different speeds. The PWM PSoC
duty cycle can be up to 100%. This sensing technique can P
be used in a high voltage or low voltage system with no
effort to scale the voltage.
There are two typical solutions to implement this control
algorithm. One solution is based on a high speed ADC with
the capability of synchronous sampling aligning with the
PWM. This means, the firmware samples the float terminal
voltage and the DC bus voltage in every PWM-ON period.
The comparison is then performed in the firmware to do the A brief introduction of circuit implementation in PSoC follows.
zero-crossing judgment.
The multiplexer can switch between 3-channel BEMF
The second solution is to use comparators to do the voltage signals in the sampling circuit according to the
comparison with half DC-bus voltage. The judgment is then commutation status.
done in software. In this case, the comparators’ output
always contains the PWM carrier waveform. As result, it is The synchronous sample circuit, which consists of SC
necessary to have a complex firmware to achieve that, or blocks and digital blocks, can sample the BEMF signal
use a special PWM scheme or a RC filter to simplify the to RC filter during PWM-ON period. During PMW-OFF,
firmware. the sampling circuit turns off the sampling, and the SC
block keeps the same output voltage as the PWM-ON
Figure 5. Detection During PWM-ON period. The input voltage on the comparator is also the
DC+ same as PWM-ON period.
U
V1 V3 V5
A comparator compares the analog signal after the
V synchronous sampling circuit with the DC bus scales
W down the voltage. Then the signal is output without
INT1
V4 V6 V2
+
_
PWM carrier waveform to indicate the commutation.
DC- INT2
+
_
With the sample and hold circuit, the input of the comparator
keeps the same at PWM-ON and PWM-OFF period. This
+ INT3 removes the PWM carrier waveform on the comparator
_
output and simplifies the firmware implementation.
These methods require a high MIPS controller to handle the
detection algorithm.
[+] Feedback
AN47936
The PSoC CY8C24x33 chip contains the following: Figure 8. Firmware Process Sequence
One AMUX8 user module multiplexes 3-channel
BEMF
terminal voltage signals into the sampling circuit.
One PWM8 user module works as a clock resource.
The input clock frequency is much higher than the PWM Commutate Commutate Commutate Commutate
frequency and is enabled by the PWM signal. This ZeroCrossing
ZeroCrossing
ZeroCrossing
ZeroCrossing
means, during the PWM-ON period, the clock resource Zero-Crossing Delay 30
Delay 30
degree
provides the clock to the SC module and enables the B B
degree
B
B
SC block for sample and hold. l Continuous low l
l l
a level following one a
a a
n high level n
One SC (Switch Capacitor) user module works as a 1:1 k
n
k
k
n
k
amplifier. It is driven by high frequency clocks Φ1 and
Φ2 from the clock resource mentioned earlier. From the Begin to Check ZC Continuous high level following one low level
working principle of the SC block, it is evident that at When commutation begins, there is an incorrect pulse
clock Φ1 period, the SC samples the signal. At Φ2, the impact on BEMF zero-crossing signal because of the
signal is output. flywheel of the diode. To cancel this impact, F/W
Figure 7 shows a detailed diagram of PSoC internal discards the first few PWM period samples of BEMF
configuration. after commutation. This period is called “Blank” period.
Figure 7. PSoC Internal Configuration Diagram After “Blank” period, F/W probes the zero-crossing
signal in every PWM period. However, near the zero-
Digital Block
PSoC crossing point of BEMF, the output of comparator
PWM Block
Terminal Voltage
usually has several flip-flops. This is because of the
A
B voltage ripple. To validate the zero-crossing event, F/W
C Clk GPIO judges a continuous high/low level, following a low/high
Enable ZeroCorssing
Analog
Clock
Resource
level as the valid zero-crossing event.
CS MUX PWM
Φ1 Φ2
Zero-crossing validation causes some delay during the
Comparator
Switch Capacitor
real zero-crossing moment. F/W compensates for this
Φ1
delay based on computing and experiments. The
+
Configure as Follower
Φ2
compensating value is different when running in
BEMF
Φ2 Φ1 different speeds.
+ R1
Φ1 - Φ2
C1
Half VBus In ideal cases, according to Figure 1 on page 1, the
zero-crossing of BEMF occurs at 30 electrical degrees
after the previous commutation and 30 electrical
degrees before the next commutation. As result, when a
These user modules construct a synchronous sampling zero-crossing is checked, a 30 electrical degrees delay
circuit. During PWM-ON, the clock source that provides to time must be recorded to evoke the next commutation.
the SC block is enabled, and the BEMF signal can charge to A Timer16 user module does this work. This Timer16
C1. During PWM-OFF, the voltage on C1 remains the same. user module is also used as a free-running timer to
An external RC circuit filters the glitches of BEMF. Because stamp the commutation moment and zero-crossing
of the resource limitation on CY8C24x33, the BEMF signal moment for period calculation.
is compared with the half bus voltage by an external
comparator. The output of the comparator is the BEMF Free-Run Stages of BLDC Motor
Zero-crossing signal, which is routed back to the PSoC chip
through a GPIO pin. Firmware probes the voltage level to The BEMF amplitude of BLDC is proportional to the motor
verify the BEMF Zero-crossing event. speed. If the motor is still, there is no BEMF at all. When the
motor runs at low speed, the BEMF is also too weak to be
detected. As a result, before the BEMF can be measured by
Firmware Verification of BEMF Zero- the firmware, there is a stage called the free-run stage. This
crossing Event and Commutation stage drives BLDC motor step by step to acquire the initial
BEFM zero-crossing signal before running sensorless
Figure 8 illustrates BEMF zero-crossing and commutation control.
procedure in firmware. In this figure, the upper picture is one
phase terminal voltage signal, and the second picture is the When run at a constant speed with open-loop stepping
algorithm implementation for the three-phase BEMF zero- stimulation, the rotor position is approximately 90 electrical
crossing signal. degrees ahead of that when run correctly under sensorless
control. As a result, BEMF zero crossings cannot be sensed.
To observe the zero-crossings, it is necessary to accelerate
the motor at a certain rate.
[+] Feedback
AN47936
Therefore, in this stage, the PWM duty cycle increases Figure 10 shows the block diagram of PSoC PI closed loop
gradually, and the commutating period is longer than the speed control.
usual case. A table baStartUpTimeTbl[ ] in F/W defines the
timeout of every commutating period. The value of the table Figure 10. Diagram of Speed PI Close Loop
content results from experiments based on different motor
Speed Position feedback
types. When sufficient valid zero-crossing events are
calculation
detected, F/W enters into normal synchronous running stage.
Commutation
If F/W cannot detect sufficient valid zero-crossing events
during a period of time, an error occurs and BLDC must stop
Speed
and wait for the next round of the free-running stage.
ref
- T
Figure 9. BLDC Starting Stages Σ PI PWM Inverter BLDC
+
u
Position Over Current Protection
Lock Open-Loop Acceleration
In this application, over current protection is done by H/W
us and F/W. As shown in Figure 11, R44 is the current shunt
resistor. The bus current signal is compared with Vref
ue
through an external OPAMP, which is also used as a
Close-Loop
comparator for BEMF zero-crossing detection. OC_NoHall
u0 signal is the output signal.
0
f0 fs f Figure 11. Current Sample Circuit
uk uk u k -1 K P * (e k ek -1 ) K I ek Equation 15
Meanwhile, the firmware also probes the level of the OC-
The control increment is the output, which is added to the Nohall IO pin. If a rising edge on this pin is detected, F/W
current control input. The implementation on an 8-bit prompts an interrupt and counts once. F/W judges the over
controller becomes easier. current when it counts enough rising edges. As a result, all
output PWMs are turned OFF and the motor is stopped.
[+] Feedback
AN47936
BEMF Zero-crossing
[+] Feedback
AN47936
Appendix
Figure 15. Schematic Drawing of BLDC Sensorless Control Board
[+] Feedback
AN47936
[+] Feedback
AN47936
Start
Device Initialization
Enable Interrupt
Enable PWMs
ReStart
Key Detection
N
Key Start
Y
FreeRun
Free Run
Ckeck Zero- cross
N
Set LED Status Enough Zero- cross
Determine Sector
Y
Is Valid Zero
- cross OK
N
Is CommutateFlag
Determine Sector
Adjust DutyCycle
ADC Sample
[+] Feedback
AN47936
Document History
Document Title: Sensorless BLDC Motor Control Based on CY8C24x33
Document Number: 001-47936
Revision ECN Orig. of Change Submission Date Description of Change
** 2549704 QDGU/JHU/AESA 08/08/2008 New application note.
PSoC is a registered trademark of Cypress Semiconductor Corp. "Programmable System-on-Chip," PSoC Designer is trademark 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, 2008. 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