0% found this document useful (0 votes)
103 views61 pages

Sensorless FOC Application Note

This document provides an overview of sensorless field oriented control (FOC) for three-phase motor control using the EU6861-Q2 MCU. It describes the relevant theories, current sampling methods, space vector pulse width modulation techniques, hardware mechanisms, and motor state machine.
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
103 views61 pages

Sensorless FOC Application Note

This document provides an overview of sensorless field oriented control (FOC) for three-phase motor control using the EU6861-Q2 MCU. It describes the relevant theories, current sampling methods, space vector pulse width modulation techniques, hardware mechanisms, and motor state machine.
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 61

Application Note

Application Note

Sensorless FOC Application Note

Three-phase Motor Control


EU6861-Q2 MCU

Fortior Technology Co., Ltd.

v1.0.00 www.fortiortech.com/global/ 1 / 61
Application Note
Application Note

Table of Contents

Table of Contents ......................................................................................................................................................... 2


1 Overview .................................................................................................................................................................. 6
1.1 Introduction ................................................................................................................................................................... 6
1.2 Relevant Software/Hardware ......................................................................................................................................... 6
2 Field Oriented Control (FOC) Theories ........................................................................................................................ 7
2.1 Coordinate Transforms ................................................................................................................................................... 8
2.1.1 Clark Transform ...................................................................................................................................................... 8
2.1.2 Park Transform ....................................................................................................................................................... 9
2.1.3 Inverse Park Transform .......................................................................................................................................... 9
2.2 PI/PID Controller ............................................................................................................................................................ 9
2.3 Rotor Position Estimation ............................................................................................................................................. 10
2.3.1 Motor Model........................................................................................................................................................ 10
3 Current Sampling Theories ...................................................................................................................................... 13
3.1 Two-/Three-Shunt Sampling......................................................................................................................................... 13
3.1.1 Sampling Mode Setup and Theories .................................................................................................................... 13
3.1.2 Code description .................................................................................................................................................. 15
3.1.3 Deadtime Compensation ..................................................................................................................................... 15
3.2 Single Shunt Sampling .................................................................................................................................................. 17
3.2.1 Theories and Configuration ................................................................................................................................. 17
3.2.2 Code description .................................................................................................................................................. 19
4 Five/Seven Segment SVPWM .................................................................................................................................. 20
4.1 SVPWM Theories .......................................................................................................................................................... 20
4.2 Comparison of merits and demerits ............................................................................................................................ 21
4.3 Seven-segment SVPWM ............................................................................................................................................... 21
4.4 Five-segment SVPWM .................................................................................................................................................. 22
5 Hardware Mechanism ............................................................................................................................................. 23
5.1 Physical Drawing........................................................................................................................................................... 23
5.2 Schematic ..................................................................................................................................................................... 24
5.2.1 Directions for use ................................................................................................................................................. 24
5.2.2 Instructions .......................................................................................................................................................... 24
5.3 Power Supply................................................................................................................................................................ 25
5.3.1 Directions for use ................................................................................................................................................. 25

v1.0.00 www.fortiortech.com/global/ 2 / 61
Application Note
Application Note

5.3.2 Instructions .......................................................................................................................................................... 25


5.4 Chip Body ..................................................................................................................................................................... 26
5.4.1 Directions for use ................................................................................................................................................. 26
5.4.2 Instructions .......................................................................................................................................................... 26
5.5 BEMF Detection Circuit ................................................................................................................................................ 27
5.5.1 Instructions .......................................................................................................................................................... 27
5.6 Power Driver................................................................................................................................................................. 28
5.6.1 Instructions .......................................................................................................................................................... 28
5.7 Op-amp Configuration Circuit ...................................................................................................................................... 28
5.7.1 Instructions .......................................................................................................................................................... 28
5.8 DC Bus Voltage Sampling.............................................................................................................................................. 29
5.8.1 Instructions .......................................................................................................................................................... 29
5.9 Bootstrap Circuit .......................................................................................................................................................... 29
5.9.1 Instructions .......................................................................................................................................................... 30
6 Motor State Machine .............................................................................................................................................. 31
6.1 Flowchart...................................................................................................................................................................... 31
6.2 Program Flowchart ....................................................................................................................................................... 32
6.3 mcReady ....................................................................................................................................................................... 32
6.4 mcInit ........................................................................................................................................................................... 33
6.5 mcTailWind ................................................................................................................................................................... 34
6.5.1 FOC Estimation Mode .......................................................................................................................................... 34
6.5.2 BEMF Mode ......................................................................................................................................................... 35
6.5.3 RSD Mode ............................................................................................................................................................ 36
6.6 mcPosiCheck................................................................................................................................................................. 38
6.7 mcAlign......................................................................................................................................................................... 39
6.8 mcStart ......................................................................................................................................................................... 40
6.9 mcRun .......................................................................................................................................................................... 40
6.10 mcStop ....................................................................................................................................................................... 41
6.11 mcFault ....................................................................................................................................................................... 42
7 Startup Modes ........................................................................................................................................................ 43
7.1 Ramp Starting ............................................................................................................................................................... 43
7.1.1 Theories ............................................................................................................................................................... 43
7.1.2 Parameter Specification ....................................................................................................................................... 44
7.2 Omega Startup ............................................................................................................................................................. 45

v1.0.00 www.fortiortech.com/global/ 3 / 61
Application Note
Application Note

7.2.1 Theories ............................................................................................................................................................... 45


7.2.2 Parameter Specification ....................................................................................................................................... 45
7.3 Ramp Startup Followed by OMEGA Startup................................................................................................................. 48
7.3.1 Theories ............................................................................................................................................................... 48
7.3.2 Parameter Specification ....................................................................................................................................... 48
8 Debugging Procedures ............................................................................................................................................ 48
8.1 Motor Parameters Measurement ................................................................................................................................ 48
8.1.1 Measurement Steps ............................................................................................................................................. 48
8.1.2 Code Implementation .......................................................................................................................................... 49
8.2 Base Current ................................................................................................................................................................. 49
8.2.1 Code Implementation .......................................................................................................................................... 50
8.3 DC Bus Voltage Divider Ratio........................................................................................................................................ 50
8.3.1 Code Implementation .......................................................................................................................................... 51
8.4 Carrier Frequency and Deadtime ................................................................................................................................. 51
8.4.1 Code Implementation .......................................................................................................................................... 52
8.5 Base Speed ................................................................................................................................................................... 52
8.5.1 Code Implementation .......................................................................................................................................... 52
8.6 Hardware Driver Test.................................................................................................................................................... 52
8.6.1 Code Implementation .......................................................................................................................................... 53
9 Protection Functionality .......................................................................................................................................... 53
9.1 Hardware OCP .............................................................................................................................................................. 53
9.1.1 Theories ............................................................................................................................................................... 53
9.1.2 Code Implementation .......................................................................................................................................... 54
9.2 Software OCP ............................................................................................................................................................... 55
9.2.1 Theories ............................................................................................................................................................... 55
9.2.2 Code Implementation .......................................................................................................................................... 55
9.3 Motor Lock Protection (MLP) ....................................................................................................................................... 56
9.3.1 Theories ............................................................................................................................................................... 56
9.4 Thermal Shutdown (TSD) ............................................................................................................................................. 57
9.4.1 Theories ............................................................................................................................................................... 57
9.4.2 Code Implementation .......................................................................................................................................... 57
9.5 Phase Loss Protection .................................................................................................................................................. 58
9.5.1 Theories ............................................................................................................................................................... 58
9.5.2 Code Implementation .......................................................................................................................................... 58

v1.0.00 www.fortiortech.com/global/ 4 / 61
Application Note
Application Note

9.6 Overvoltage/Undervoltage Lockout (OVLO/UVLO) ...................................................................................................... 58


9.6.1 Theories ............................................................................................................................................................... 58
9.6.2 Code Implementation .......................................................................................................................................... 58
9.7 Bias Voltage Protection ................................................................................................................................................ 59
9.7.1 Theories ............................................................................................................................................................... 59
9.7.2 Code Implementation .......................................................................................................................................... 59
10 Revision History .................................................................................................................................................... 60
11 Copyright Notice ................................................................................................................................................... 61

v1.0.00 www.fortiortech.com/global/ 5 / 61
Application Note
Application Note

1 Overview
1.1 Introduction

This Debugging Manual illustrates the debugger for implementation of sensorless FOC with EU68XX Series MCU
for BLDC motors. Sections 2~6 are developed for theories, Sections 7~8 for debugging procedures, and Section 9 for
protection functionality.

1.2 Relevant Software/Hardware

The software code referenced herein is the EU6861Q2 Specification for Vacuum Cleaner Application, and the
hardware referenced is the EU6861 MV Motor Control DEMO Board.

v1.0.00 www.fortiortech.com/global/ 6 / 61
Application Note
Application Note

2 Field Oriented Control (FOC) Theories

Field oriented control (FOC), also known as vector control, is a variable frequency drive (VFD) control technique
used to control three-phase BLDC motors by controlling the amplitude and frequency of the inverter’s output voltage.
FOC essentially converts motor phase currents in a three-phase stationary coordinate system into those in a
rotating coordinate system that is stationary in relative to the rotor field axis, aiming to control the motor by controlling
the magnitude and direction of the vectors in the rotating coordinate system. The voltage, current and electromotive
force in the stator reference system are AC variables that rotate in space at synchronous speeds, making it difficult to
realize control using the control algorithm. After the coordinate transformation, the rotating synchronous vectors are
converted into stationary vectors, and both voltage and current are changed into DC variables. Then, the torque
equation is used to find out the relation between the torque and controlled variables in the rotating coordinate system,
and DC setpoints required for generation of the torque are calculated and regulated in real time, thus indirectly
controlling the motor to deliver its desired performance. With the aid of vector control block diagram, the vector control
process can be summarized as follows:
1. The three-phase stator currents are measured to get
Ia and I b . The three-phase currents are converted

through Clark Transform to two-phase currents


I and I  which are orthogonal, time-variant current

values;
2. With the motor angle calculated at the last iteration of the control loop, the two-phase currents in a stationary
reference system are converted using Park Transform to orthogonal currents
Id and I q in a rotating

coordinate system. For steady state conditions,


Id and I q are constant.

3. The
Id reference controls the rotor flux, the I q reference controls the motor’s torque output, and the

measured and reference values of these two constants are compared to get inputs to PI controllers of the
current loop. The PI controller parameters are tunned to output
Vd and Vq which are voltage vectors that

will be applied to the motor.


4. A new motor angle and speed are estimated from
V , V , I and I  using the rotor position estimation

algorithm. This new angle guides the FOC algorithm as to where to place the next voltage vector. The
calculated speed is compared with the setpoint to get an error which is then input to PI controllers of the speed
Iq
loop to generate reference;
V V
5. The d and q outputs from the PI controllers are rotated back through Park Transform to the stationary
two-axis reference frame using the new angle. This calculation provides the next quadrature voltage values
V and V . The SVPWM algorithm is then employed to find out the sector where the voltage vectors

synthesized are located and calculate the switch-on time of each leg of the three-phase switch tube. Finally,
the desired three-phase voltage outputs are generated by the three-phase inverter.

v1.0.00 www.fortiortech.com/global/ 7 / 61
Application Note
Application Note

The entire process of coordinate transformation, PI iteration, rotor position estimation and PWM generation is
illustrated inFigure 2-1.

IDREF UD VALP
PI v r1 FOC_CMPU
v r2 FOC_CMPV DRIVER
IPARK ICLARKE SVPWM PMSM
v r3 FOC_CMPW
IQREF UQ VBET
PI UDC

ID IALP IA

PARK CLARKE
IQ IBET IB

THETA
THETA_
EOME OUT UALP
UBET

Figure 2-1 Vector Control Block Diagram

2.1 Coordinate Transforms


2.1.1 Clark Transform

For calculation purposes, the Clark Transform projects the three-phase coordinate system, referenced to the stator,
into a stationary two-phase coordinate system (seeFigure 2-2). The transformation formula is presented as
Equation 2-1.
I a  Ib  Ic  0
I  I a
I   ( I a  2Ib ) / 3
Equation 2-1
β
b
a α
Iβ is
b Clark
β
(c) aα

Figure 2-2 Clark Transform

Notes: Clark Transform keeps the amplitude invariant.

v1.0.00 www.fortiortech.com/global/ 8 / 61
Application Note
Application Note

2.1.2 Park Transform

Park Transform moves a stationary two-phase reference frame onto a rotating two-phase d-q reference frame.
This d-q reference frame, also called “rotor field oriented coordinate system”, is rotating with the rotor at the same angle,
as illustrated in Figure 2-3. The transformation formula is presented as Equation 2-2, where θ
represents the rotor angle.
I d  I cos   I  sin 
I q   I a sin   I  cos 
Equation 2-2

b β

Iα Iβ Is
Id d
Iβ Park Id
Iq Iq θ
θ
α

Figure 2-3 Park Transform

2.1.3 Inverse Park Transform

After the PI iteration of the d-q axis current loop, you can get two voltage component vectors in the rotating d-q
coordinate system. The user will need to transform back to the three-phase motor voltages through inverse
transformation. Firstly, the rotating two-phase reference frame is transformed to a stationary two-phase reference frame
through Inverse Park Transform using Equation 2-3:
U   U d cos   U q sin 
U   U d sin   U q cos 
Equation 2-3

2.2 PI/PID Controller


PI/PID controller is a linear controller which generates controlled quantity by linear combination of error proportional
(P), integral (I) and differential (D) actions for controlling the target parameters with actuator. It is used to control motor
speed and position in the motor control system.
Ref
 PI Out

Fb
Control
object

Figure2-4 PI Controller

v1.0.00 www.fortiortech.com/global/ 9 / 61
Application Note
Application Note

PI algorithm:
𝑈 =𝑈 + 𝐾𝑝 × (𝐸 − 𝐸 ) + 𝐾𝑖 × 𝐸
PID algorithm:
𝑈 =𝑈 + 𝐾𝑝 × (𝐸 − 𝐸 ) + 𝐾𝑖 × 𝐸 + 𝐾𝑑 × (𝐸 − 2 × 𝐸 +𝐸 )
Where,
Uk: controlled quantity generated by computation k
Uk-1: controlled quantity generated by computation k-1
Ek: Error input at time k
Ek-1, Ek-2: Errors input at time k - 1 and time k - 2
Kp, Ki, Kd: proportional (P), integral (I) and differential (D) terms to adjust controlled quantity:
The maximum and minimum Uk are represented as PIx_UKMAX (x=0 ~ 3) and PIx_UKMIN.

In the entire control process, the rotor speed, flux and torque are each controlled by a separate PI control loop.
Given that a significant input error tends to cause windup of the PI controller, the controller output is limited under a
clamp value, and the relevant register output is constrained within the bounds PIx_UKMAX and PIx_UKMIN.

2.3 Rotor Position Estimation


2.3.1 Motor Model

The motor position can be estimated with the aid of a DC motor model represented by winding resistance,
inductance and back electromotive force (BEMF), as shown in Figure 2-5:

Figure 2-5 Motor Model

The sensorless control technology implements the FOC algorithm by estimating the motor position used to
calculate the commutation angle needed for FOC. The motor position and speed can be generally estimated from the
measured currents and calculated voltages. The SMO (sliding-mode observer)-based algorithm is one of simple and
best-performing algorithms designed for estimating the position of a BLDC motor. It develops a simplified mathematical
model of BLDC motor that is represented by winding resistance, inductance and BEMF without compromising the
motor’s control functionality, as shown in 𝑉 = 𝑅𝑖 + 𝐿 𝑖 +𝑒 Equation 2-4.

𝑉 = 𝑅𝑖 + 𝐿 𝑖 +𝑒 Equation 2-4

v1.0.00 www.fortiortech.com/global/ 10 / 61
Application Note
Application Note

is es Vs
Where, is motor current vector, BEMF vector, input voltage vector, L winding inductance, and R
winding resistance.
In the digital domain, this equation becomes:

R Ts
is ( n  1)  (1  Ts * )is ( n)  (Vs ( n )  es ( n ))
L L Equation 2-5

The above equation represents a digitalized model of motor known as current observer. The motor position and
speed estimator is based on a current observer. This mathematical model provides a software representation of the
hardware. In order to match measured current and estimated current, the digitalized motor model must be corrected
using closed loop, as shown in the figure below.

is
Vs Motor

Error<MaxSMOError
是 ( Kslide * Error )
Sign(is  is ) MaxSMOError
d  R 1 is
is   is  (vs  es  z )
dt L L

Error>0? 否
Z=-Kslide

Z=+Kslide

Figure 2-6 Current Observer Block Diagram

Considering two motor representations, one is the physical motor (shaded area) and the other is a digitalized motor
Vs
system simulated by software, with the same input voltage ( ) fed into both systems, and matching the estimated
i *
i e*
current ( from the model with measured current ( s ), we can presume that BEMF ( s ) from the digitized model is the
s)

es
same as the BEMF ( ) from the motor.
After compensating the digitized model, you have a motor model with the same variable values for the input voltage
and for current. And the next step is to estimate BEMF (
es* ) by filtering the correction factor (Z). The estimated BEMF
es* e e es
( ) is updated in each control cycle and fed back to the digital model. and are the vector components of ,
which can be used to estimate  *
. Arc cotangent is computed on the BEMF vector components to calculate theta, as
illustrated in Equation 2-6:
  arc tan(e , e )
Equation 2-6
Since the filtering function is applied in theta calculation, some phase compensation is needed before the
calculated angle is used to energize the motor windings. The amount of theta compensation depends on the rate of

v1.0.00 www.fortiortech.com/global/ 11 / 61
Application Note
Application Note

change of theta, or the motor speed. The theta compensation is performed in two steps:
1. The motor speed is calculated based on the uncompensated theta calculation.
2. The calculated speed is filtered and used to calculate the amount of compensation, as shown in Figure 2-7.
e  * +  *comp
arctan   
 e 
+

 m 1 
    ( (n)   (n  1))   K speed LPF
 i 0  *  * filtered

Figure 2-7 Speed Calculation Block Diagram

v1.0.00 www.fortiortech.com/global/ 12 / 61
Application Note
Application Note

3 Current Sampling Theories


3.1 Two-/Three-Shunt Sampling
3.1.1 Sampling Mode Setup and Theories
3.1.1.1 Theories and Configuration of Sequential Sampling Mode

start start
calculation calculation
udc udc
trig trig

5.6us 5.6us
ia/ib/ic ia/ib/ic
trig trig
adc_rdy

trg_dly

pwm_al

pwm_bl

pwm_cl

Figure 3-1 Two-/Three-Shunt Sequential Current Sampling Mode

Configure FOC_CR1[CSM] = 10/11 and FOC_CR2[DSS] = 0, and select the sequential sampling mode of
double/triple resistance current. In the three-resistance current sequential sampling mode, the sampling opportunity of
one phase current (ia/ib/ic is determined according to the sector) of the three-phase current is set through the
FOC_TRGDLY register, and the other phase is sampled quickly after the sampling. In the double-resistance mode,
adjust the sampling timing of ia by setting the FOC_TRGDLY register, and sample ib quickly after sampling. Note that
the current sampling timing should be so configured that the sampling points of three phase currents are all within the
vector 000 range. Example: FOC_TRGDLY = 0xb2, then when the FOC counter counts down, the ia/ib/ic is sampled
50*T = 2.08μs before the underflow event, and the other phase ia/ib/ic is sampled after the sampling.

v1.0.00 www.fortiortech.com/global/ 13 / 61
Application Note
Application Note

3.1.1.2 Theories and Configuration of Alternate Sampling Mode

start start
calculation calculation
udc udc
trig trig

5.6us 5.6us
ia/ib/ic ia/ib/ic
trig trig

trg_dly trg_dly
pwm_al

pwm_bl

pwm_cl

Figure 3-2 Alternating sampling mode of double/triple resistance current


Configure FOC_CR1[CSM] = 10/11 and FOC_CR2[DSS] = 1, that is, choose the alternate sampling mode of
double/triple resistance current. In the double/triple resistance current alternating sampling mode, the FOC module
operates once in a carrier cycle, but only samples one phase current (ia/ib/ic according to the sector). One phase of
ia/ib/ic is collected in the previous carrier cycle, and the phase current of the other phase is collected in the next carrier
cycle, so that the current of two of the three phases is sampled alternately. Set the sampling timing of current ia (channel
0), ib (channel 1) and ic (channel 4) through the FOC_TRGDLY register. It should be noted that the sampling timing of
current should be set so that the sampling points of ia/ib/ic are all in the vector 000 range. Example: FOC_TRGDLY =
0xb2, then when the FOC counter counts down, the current will be sampled 50*T = 2.08μs before the underflow event.
The double/triple resistance current sampling mode samples the DC bus voltage after the Driver counter counts
down and the FOC module operation is completed.

3.1.1.3 Sampling mode configuration code

v1.0.00 www.fortiortech.com/global/ 14 / 61
Application Note
Application Note

3.1.2 Code description

 Line 130 sets the dead-time compensation value. Pay special attention to the fact that the dead-time
compensation can only be used in the double/triple resistance current sampling mode. In the single resistance
mode, the dead-time compensation needs to be set to 0, which can effectively improve the sine of the current
waveform at low speed.
 Line 132 sets the minimum pulse width of the lower bridge, FOC_TBLO, which is used in the three-resistance
current sampling mode. When the lower bridge is turned on for less than FOC_TBLO, the current of this phase
is not sampled, and the current is obtained by special treatment.
 In high-voltage application, the upper bridge of the high-voltage Pre-driver has the requirement that the
minimum conduction pulse must be greater than a certain value. Set the upper bridge conduction narrow
pulse elimination check FOC_TGLI. When the conduction pulse is less than the set value, it will not conduct,
which will improve the noise to some extent.

3.1.3 Deadtime Compensation


Due to the delay of the actual power tube opening and closing, the dead time must be inserted to avoid the same
bridge arm through. However, the dead time causes the output voltage loss, and the dead time compensation is to
compensate the output voltage loss of H-bridge inverter caused by the dead time.
Dead-time effect brings additional problems: for power supply control, output voltage distortion, harmonic current,
THD, the total harmonic distortion index, rises, especially for low-frequency operation; For motor control, the introduction
of 6-fold torque ripple will affect the low-speed performance and hinder the application of position-free algorithm and
high-performance frequency converter. Therefore, it is generally necessary to compensate the dead zone for
applications with high requirements on low-speed noise, vibration and current sine.
As shown in Figure 3-1, before the dead-time compensation, there is an obvious platform when the dead-time
effect causes the current to cross zero, which will introduce torque ripple and noise;
As shown in Figure 3-2, after the dead-time compensation, the sine of current is obviously improved, and the total
harmonic distortion index THD is obviously improved.

v1.0.00 www.fortiortech.com/global/ 15 / 61
Application Note
Application Note

Figure 3-3 Before Deadtime Compensation

Figure 3-4 After Deadtime Compensation

v1.0.00 www.fortiortech.com/global/ 16 / 61
Application Note
Application Note

3.2 Single Shunt Sampling


3.2.1 Theories and Configuration

Configure FOC_CR1[CSM] = 00, and select the single resistance current sampling mode. In the single resistance
current sampling mode, the FOC module samples the bus current itrip (channel 4) twice in the up-counting interval of
the Driver counter, and samples the DC bus voltage in the down-counting interval of the Driver counter after the
operation of the FOC module is completed.
Sampling in the dead time will affect the accuracy of current sampling. The FOC module needs to sample in the
effective vector application time T1 ′ and T2 ′ to remove the dead time. By configuring FOC_TRGDLY to advance or
delay the sampling time, the sampling can be completed in T1' and T2'. Example: FOC_TRGDLY = 5, the delay is 5 * t
= 208ns; FOC_TRGDLY = 0xfb (-5), it will be advanced by 208ns.

start start
calculation calculation
udc udc
itrip trig itrip trig
trig2 trig2

itrip 5.6us itrip 5.6us


trig1 trig1

pwm_al

pwm_ah

pwm_bl

pwm_bh

pwm_cl

pwm_ch
T1/2 T2/2 T1/2 T2/2

t T0 T1 T2 T0 T0 T2 T1 T0 T0 T1 T2 T0 T0 T2 T1 T0

t_dtr T0 T1' T2' T0' T0 T2' T1' T0' T0 T1' T2' T0' T0 T2' T1' T0'

dtr dtr dtr dtr


trg_dly trg_dly trg_dly trg_dly
(>0) (>0) (<0) (<0)

Figure3-5 Single-shunt Sampling Sequence

v1.0.00 www.fortiortech.com/global/ 17 / 61
Application Note
Application Note

pwm_al
Decrease Increase
pwm_bl

pwm_cl
T2=0 T2=0
t T0 T1 T0 T0 T1 T0

t’ T0 T1-ts ts T0 T0" ts T1 T0
ts=dtr+Δt

t_dtr’ T0 T1" Δt T0' T0" Δt T1' T0'

T0"=T0-ts
itrip itrip
trig1 trig2 T2'=T2-dtr
T2"=T2'-ts

Decrease Increase
pwm_al

pwm_bl

pwm_cl
T1=0 T1=0
t T0 T2 T0 T0 T2 T0

t’ T0" ts T2 T0 T0 T2-ts ts T0
ts=dtr+Δt

t_dtr’ T0" Δt T2' T0' T0 T2" Δt T0'

itrip itrip
trig1 trig2

Figure 3-6 Single-shunt Sampling Time Compensation

The sampling window of single resistor sampling is not wide enough in low-key system and sector switching. At
this time, it is necessary to adjust the output waveform to ensure the minimum sampling window required for sampling.
By setting FOC_TSMIN (FOC_TSMIN = minimum sampling window time + dead time), the FOC module will
automatically phase shift the PWM waveform.

v1.0.00 www.fortiortech.com/global/ 18 / 61
Application Note
Application Note

3.2.2 Code description

 The code on line 110 is set to single resistor sampling mode.


 Line 111 sets the sampling delay or lag, with the unit of 41.67ns;; When it is set to a positive number, the
sampling time is delayed at this time, otherwise it is advanced, and the typical value is generally 2 ~ 12 units.
 Line 112 sets 5-segment mode and 7-segment mode
 Lines 114 ~ 123 set the minimum sampling window value, paying special attention to FOC_TSMIN < carrier
period *1/16 (unit μs)

v1.0.00 www.fortiortech.com/global/ 19 / 61
Application Note
Application Note

4 Five/Seven Segment SVPWM


4.1 SVPWM Theories

SVPWM is short for Space Vector Pulse Width Modulation. The theory is based on the average equivalent principle,
that is, in a switching cycle by combining the basic voltage vector, so that the average value and the given voltage
vector is equal. At some point, the voltage vector rotates into a region, which can be obtained by the different
combinations of two adjacent non-zero vectors and zero vectors in time. The action time of the two vectors is applied
several times in a sampling period, so that the action time of each voltage vector is controlled, and the voltage space
vector nearly rotates according to the circular track, the ideal flux circle is approximated by the actual flux generated by
different switching states of the inverter, and the switching states of the inverter are determined by the results of the
comparison between the two, thus the PWM waveform is formed.
Take the first sector, for example:

Figure 4-1 Sector I Vectors

According to the diagram, it can be concluded that:

T0 = T - T1 - T2

v1.0.00 www.fortiortech.com/global/ 20 / 61
Application Note
Application Note

4.2 Comparison of merits and demerits


Merits Demerits
 The number of PWM cycle switching is
reduced by 1/3, and the heating of power device
Five-segment is reduced  The harmonic interference of the current
SVPWM  The maximum duty cycle of PWM output is is greater
higher than seven degrees, the maximum can
reach 97%

Seven-  The number of switches, switch damage


 The current waveform is more close to the
segment  The highest duty cycle of 7-segment
circular, less harmonic interference
SVPWM PWM output is 93% ~ 95%

4.3 Seven-segment SVPWM

With the goal of reducing the number of switches, the basic vector action sequence assignment principle is
selected as follows: In each switch state transition, only one phase of the change, the switch state. And the zero
vector is distributed evenly in time to make the generated PWM symmetrical, so that the harmonic component of
PWM can be reduced effectively.

Figure 4-2 Section I seven-segment three-phase PWM wave

Figure 4-3 Seven-segment SVPWM phase voltage waveform

v1.0.00 www.fortiortech.com/global/ 21 / 61
Application Note
Application Note

4.4 Five-Segment SVPWM

For seven-segment SVPWM, the generating wave is symmetric and the harmonic content is small, but there are
6 switching times per switching cycle, in order to further reduce the switching times, each phase switch keeps the
same sequence arrangement in each sector state, so there are only 3 switching times in each switch cycle, but the
harmonic content is increased. The specific sequence arrangement is as follows:
 In five-segment SVPWM, the phase voltage of one phase can be constant zero (duty cycle output is 0%) or
constant 1(duty cycle is 100%) without switching during a PWM cycle. EU68XX series chip adopts constant-
zero mode.

Figure 4-4 Five-segment Three-phase PWM Waveform in Sector I

 Five-segment SVPWM also has different waveform modes in a PWM cycle, such as edge-aligned and center-
aligned two modes, EU68XX series chips use center-aligned mode.
 When the SVPWM waveform is symmetrical, the PWM duration is divided into 5 segments, which is the
source of the five-segment PWM name.

Figure 4-5 Five-segment SVPWM Phase Voltage Waveform

v1.0.00 www.fortiortech.com/global/ 22 / 61
Application Note
Application Note

5 Hardware Mechanism

This chapter introduces the hardware content of Senseless FOC debugging based on EU6861Q- medium voltage
DEMO.

5.1 Physical Drawing

v1.0.00 www.fortiortech.com/global/ 23 / 61
Application Note
Application Note

5.2 Schematic

Figure 5-1 Demo Board Schematic

5.2.1 Directions for Use

 If the BEMF detection method is used for upstream and downstream detection, it is necessary to select the
short circuit of pins 1 and 2 of BLDC, J9, J10 and J11 ports.
 When external LDO is selected, J4 port and pins 1 and 2 are shorted to select external LDO, and J8 also
needs to be shorted at this time.
 When internal LDO is selected, J4 port and 2 and 3 pins are shorted to select internal LDO, so J8 does not
need to be shorted.

5.2.2 Instructions

The DC bus voltage divider ratio, Op-amp gain, shunt resistance and voltage divider ratio of BEMF (back
electromotive force) sampling circuit should be configured properly, depending on the specific motor.

v1.0.00 www.fortiortech.com/global/ 24 / 61
Application Note
Application Note

5.3 Power Supply


J6
VDD15

2
1
+12V
Less than 15 V sub
U1
100V
+80V XL7015 R10
L1
R1 200R/1% 1 2 10K/1%
1 VIN SW
100uH/1A
J1 R2 200R/1%

2 K A1
D1
R11 LED4 GREEN
POWER

A
SS110 C10
30K C11

1
K
33nF C12

K
5 4
EN FB 220uF/25V
C4 0.1uF/25V
GND

2
100uF/100V R12
POWER-GND 3.3K
3

GND
1
J2
DC-DC POWER

Figure 5-2 Power Supply Schematic

5.3.1 Directions for use

 When the DC bus voltage is lower than 15V, J6 is shorted by jumping cap, and the external power supply
directly supplies power to the chip.
 As the VCC voltage of the chip is not recommended to be higher than 18V, in order to make the DEMO board
compatible with wide voltage, turn off J6, and the external power supply will supply power to the VCC of the
chip through the switching DC-DC conversion chip.
 The principle of switching power supply is not explained in detail in this manual. Pay special attention to the
fact that the output voltage range is 1.25V ~ 20V, which is adjustable and determined by the voltage dividing
ratio of R11 and R12.

5.3.2 Instructions

 When applying low voltage to J6 short circuit, be careful that the maximum voltage should not exceed 18V,
otherwise it is easy to burn the chip.

v1.0.00 www.fortiortech.com/global/ 25 / 61
Application Note
Application Note

5.4 Chip Body

Figure 5-3 Chip Body Schematic

5.4.1 Directions for use

EU6861Q2 is used for LV/MV 6-NMOSFET driver applications. EU6861Q2 and EU6861Q are in pin-to-pin
packages, allowing for direct replacement.

5.4.2 Instructions

Capacitors must be placed as close to the chip as possible.

v1.0.00 www.fortiortech.com/global/ 26 / 61
Application Note
Application Note

5.5 BEMF Detection Circuit

EMFU U
CMP0 R35 20K

EMFV V
CMP1 R36 20K

EMFW W
CMP2 R37 20K
D2 D3
D4
ZMM5.1 ZMM5.1
ZMM5.1
R19
R20
1K C2 R22 C3 C8
1K
1nF 1K 1nF 1nF

CMP0P U
CMP0 R46 30K
CMP0M V
R47 30K
W
R52 30K
CMP1P2
CMP1
CMP0M R45 R53 R54
C35 C36 C40
1.5K 1.5K 1.5K

1nF 1nF 1nF

Good or poor wind detection

Figure 5-4 BEMF Detection Circuit

5.5.1 Instructions

1. When the 3-way comparator is idle, the BEMF mode of the 3-way comparator shown above can be used;
2. When the 2-way comparator is idle, the 2-way comparator RSD can be used as shown below;
3. Comparators with saving RSD are often used for ground brush overcurrent protection.

v1.0.00 www.fortiortech.com/global/ 27 / 61
Application Note
Application Note

5.6 Power Driver

+80V
+80V +80V +80V
100nF/100V
C37
C46 C47
C27 C30 C31 C32 C38
100uF/100V 100uF/100V
1uF/100V 100nF/100V 1uF/100V 100nF/100V 1uF/100V
2

2
Q1 Q3 Q5
HOU R23 1 150A/100V HOV R27 1 150A/100V HOWR28 1 150A/100V
10R 10R 10R
3

3
R24 R29 R49
47K 47K 47K
U5 V1 W1
U V
1 1 1
W
U V W
2

2
Q2 Q4 Q6
LOU R25 1 150A/100V LOV R30 1 150A/100V LOW R31 1 150A/100V
10R 10R 10R
3

3
R26 R32 R50 47K
Iu+ Iv+ I_shunt
47K 47K
RS1 RS2
0R002/1% 2W 0R002/1% 2W
SINGLE RES
I_shunt1 RS3
0R002/1% 2W

THREERES
DRIVER

Figure 5-5 Power Driver Circuit Schematics

5.6.1 Instructions

1. C27, C31 and C38 capacitors cannot be connected to the I_shunt terminal of the shunt resistor, which will
cause sampling interference;
2. The power of shunt resistor may not exceed 80% of the power rating at the maximum current.
3. Single-shunt setup is employed for all vacuum cleaners, so RS1 and RS2 are directly shorted.

5.7 Op-amp Configuration Circuit

GND R33 R34 AMP0O


2K/1% 20K/1%
C33 AMP0M
100pF R51 AD3
I_shunt R55 AMP0P AMP0 20K/1%
2K/1% C39
4.7uF
VHALF R56
Gi=20/2=10
20K/1% Imax=2.25/(20/2*0.005)=45A

Figure 5-6 Op-amp Configuration Circuit Schematics

5.7.1 Instructions

1. C33 is a non-adjustable parameter with a required accuracy of 10%;

v1.0.00 www.fortiortech.com/global/ 28 / 61
Application Note
Application Note

2. ±1% tolerance resistors are required for R34, R35 and R55 and R56;
3. Here, AD3 is used for sampling the average bus voltage, which cannot be omitted;
4. Gain = R34/R33 = R56/R55;
5. Maximum sampling current = (VREF - VHALF)/gain/shunt resistor value;
6. The maximum sampling current is generally set to about 4 times the maximum bus current.

5.8 DC Bus Voltage Sampling

+80V
Gv=21
Vmax=105V
R13
20K/1%
R14 OVP
1K
R15
1K/1% C13
0.1uF/16V

Figure 5-7 DC Bus Voltage Sampling Circuit

5.8.1 Instructions

1. Parameters R14 and C13 are not adjustable;


2. ±1% tolerance resistors are required for R13 and R15;
3. Maximum sampling voltage = (R13+R15)/(R15);
4. Maximum sampling voltage selected is typically 2 times the maximum applied voltage, where the OVP
threshold must be lower than 0.8*VREF.

5.9 Bootstrap Circuit

D6
R58
VBU
+12V
C45 10R
IN4148W
U 10uF/25V

D7
VBV

C48
IN4148W
V 10uF/25V

D8
VBW

C49
IN4148W
W 10uF/25V

Figure 5-8 Bootstrap Circuit

v1.0.00 www.fortiortech.com/global/ 29 / 61
Application Note
Application Note

5.9.1 Instructions

The RC values are referenced to the parameters in the above figure, and no adjustment is needed.

v1.0.00 www.fortiortech.com/global/ 30 / 61
Application Note
Application Note

6 Motor State Machine


6.1 Flowchart

Start

mcSpeedRamp.FlagONOFF=1
mcStop mcReady mcInit
mcSpeedRamp.FlagONOFF=0

mcSpeedRamp.FlagONOFF=0
mcFaultSource!=0
mcFaultSource!=0
mcFaultSource!=0
mcRun mcFault mcTailWind
mcFaultSource!=0
mcSpeedRamp.FlagONOFF=0

mcSpeedRamp.FlagONOFF=0
mcStart mcAlign mcPosiCheck

mcSpeedRamp.FlagONOFF=0 mcSpeedRamp.FlagONOFF=0

Figure 6-1Motor State Machine Flowchart

As shown in Figure Figure 6-1, the motor state machine has three state transition paths:
 Run (in blue): mcReady -> mcInit -> mcTailWind -> mcPosiCheck -> mcAlign -> mcStart -> mcRun.
 Stop (in black): The state machine will switch to mcStop state from mcInit, mcCharge, mcAlign, mcStart
and mcRun states to slow down motor till it comes to a stop if a Stop signal is detected.
 Fault (in red): The state machine will switch to mcFault state from all states in case of fault. In this state,
no more fault detection will be performed, so multiple faults will not be reported simultaneously.

v1.0.00 www.fortiortech.com/global/ 31 / 61
Application Note
Application Note

6.2 Program Flowchart

Current offset
No
acquisition
Offset
While calibration
motor state
Yes
machine
Hardware_Init
Software_Init

CMP3_Interrupt
Start

Fault protection detection

Motor loop control

Interrupt Motor speed regulation


1ms
acquisition
Voltage and current
acquisition
Other functions

FOC
PWM
FG
Others

Figure 6-2 Program Execution Flowchart

6.3 mcReady

Ready state, waiting for a “Start ”command. When the bias voltage sensing is completed, the corresponding
mcCurOffset.OffsetFlag is set to 1, and the mcSpeedRamp.FlagONOFF is set to 1. When the DC bus voltage detected
falls within the normal startup range, the state machine will switch to mcInit state. Note that the DC bus voltage is
measured here to prevent the motor from triggering UVLO immediately after voltage is pulled down at startup. Please
refer to the following code implementation for details.

v1.0.00 www.fortiortech.com/global/ 32 / 61
Application Note
Application Note

6.4 mcInit

Initialization state, which is mainly designed to initialize the related variables and PI. In this state, motor is switched
off and the external ADC is triggered for current sampling. Note that the bias voltage is measured again and
mcCurOffset.OffsetFlag is set to 1 before shifting to the next state, so that the motor will not switch to the next state
before bias voltage sensing is completed at next startup, which will result in biasing deviation that will affect motor
startup. Please refer to the following code implementation for details.

v1.0.00 www.fortiortech.com/global/ 33 / 61
Application Note
Application Note

6.5 mcTailWind

Tailwind/headwind detection state; when the motor is started, the running speed (BEMFDetect.BEMFSpeed) is
calculated by BEMF detection. If the speed is greater than the set tailwind startup speed threshold, it shows that the
speed is sufficient for the estimator to estimate the accurate angle, so the motor will directly shift to mcRun state; when
headwind is detected, motor will brake or feed negative current before actuating as programmed. Note that headwind
is absent in some applications such as vacuum cleaner.
Note that in , the counter-electromotive force detection method is mainly divided into FOC detection method and
counter-electromotive force detection method. Because FOC detection method can impulse voltage, it is only suitable
for applications with low current. For example, the counter-electromotive force detection method is generally used in
high-speed and high-power applications of vacuum cleaners. Counter-electromotive force detection is generally divided
into RSD (double comparator) and BEMF (triple comparator). Please refer to the following code for details.

6.5.1 FOC Estimation Mode

This function is added before the pre positioning state. When the pre charging is completed, the FOC estimation
mode estimates the current speed and angle by setting the given current to 0, and the FOC collects current and voltage
information. The program can judge the forward and reverse rotation of the motor according to the current estimated
speed, or according to the estimated angle. The former is easy to judge, and the calculated speed is a per unit value.

v1.0.00 www.fortiortech.com/global/ 34 / 61
Application Note
Application Note

When some motors are at low speed or at standstill, the response is poor, and it is easy to mistake the estimated speed.
The latter is relatively troublesome. It handles the angle change trend through FOC interruption, and divides the angle
into three sections, less than - 170 °, more than 170 °, and between - 10 ° and 10 °. When the angle swings back and
forth below - 170 ° and above 170 ° without going through - 10 ° to 10 °, it is considered as static. In the angle of - 10 °
to 10 °, calculate the speed, judge the positive and negative rotation, and clear the jitter times. When the motor is in
forward rotation, the speed is counted from - 180 ° to - 10 °, and when the motor is in reverse rotation, the speed is
counted from 180 ° to 10 °. Therefore, when calculating the speed, only half of the electrical cycle is counted. The speed
unit calculated in this way is rpm/min.
In FOC estimation mode, SPI is required to observe whether the estimation angle is normal. For example, in
forward rotation, the angle is a change of ascending slope, while in reverse rotation, the angle is a change of descending
slope. In static rotation, the angle may not change, or it may be a form of up and down level jump. If the estimated angle
direction is incorrect or the response is not fast enough, the following three parameters need to be adjusted: Observer
bandwidth filter value ATO_ BW_ Wind, speed bandwidth filtering value SPD_ BW_ Wind, current ring Kp, Ki. In order
to speed up the estimation response, the current loop Kp and Ki will be larger than the current loop in actual operation
when judging the wind direction. After the estimated angle direction is correct, check whether the calculated speed is
correct.
After the judgment of upwind and downwind, handle according to the current speed and direction. When the motor
rotates forward and is greater than a certain value, speed tracking is adopted to directly switch the state to the operating
state. If Omega is used to start the fan, different FOC can be set according to the forward rotation speed_ EKP、FOC_
EKI to improve the reliability of closing loop. When judging reverse rotation, adopt braking mode, and set different
braking time according to different speeds. When the braking exceeds a certain number of times, a forced start can be
set. In this case, the starting current should be increased appropriately. When the motor is stationary or the forward
rotation speed is too small, it will jump to the next state directly.
Because the output duty cycle of FOC estimation mode is very small when judging the upwind and downwind, in
low-voltage applications, when the upwind and downwind speed is too high, the back electromotive force is relatively
large, and the voltage overshoot is easy to occur. Therefore, in the application of low pressure fan, in order to avoid the
voltage overshoot caused by the high speed of forward and reverse wind, it is recommended to brake before the
judgment of forward and reverse wind.

6.5.2 BEMF Mode

In BEMF mode, the controller turns off the output, compares the three-phase BEMF with the zero crossing point
through the comparator, and generates the corresponding jump edge interrupt. In the comparator interrupt, the program
processes the direction and speed according to the output level of the comparator and the timer count. The interrupt is
handled as follows:

v1.0.00 www.fortiortech.com/global/ 35 / 61
Application Note
Application Note

1. Detect the state of three BEMFs compared with zero crossing point;
2. According to the state change of the comparison between the BEMF and the zero crossing point, the forward
and reverse information is obtained;
3. Speed detection is carried out according to the time interval between the two jump edges, that is, the count
value of the timer is read;
4. Calculate the current speed according to the timer count value;
5. When it is detected that the motor is in forward rotation and the speed is relatively high, it will directly cut into
the closed loop operation.
During the comparator interrupt, the current BEMF state is judged according to the high and low levels of the
comparator output, and the forward and reverse directions are judged according to the state changes. At the same time,
the speed is processed through the count value of the timer. When the forward rotation speed of the motor is relatively
high, it starts at the rising edge of U-phase BEMF. When the motor reverse rotation is detected, the program will directly
enter the braking mode even though the detection time has not ended. Also turn off the comparator interrupt. The
program brakes at different speeds for different times. After the braking is completed, start the judgment again. When
the upwind and downwind detection time is over, if the current forward speed is low or the motor is stationary, the
program will jump to the next state. When adverse wind has ever occurred, the starting current can be set slightly higher
than the current during static starting according to the speed of adverse wind to improve the reliability of starting.
Because the BEMF values of different motors are different, BEMF mode needs to divide the BEMF voltage when
collecting the BEMF. The voltage division coefficient can be equal to that of the bus voltage. It requires three
comparators and timers, so it is necessary to initialize the comparators and timers. Because the pin of the comparator
and the pin of the op amp are shared, their applications are relatively limited. The 68 series is not suitable for dual
resistance FOC.

6.5.3 RSD Mode

The RSD sampling double comparator method realizes the BEMF detection, which has the advantage of saving
hardware resources. Because the comparison signal is the detection signal obtained by subtracting the two BEMFs,
the harmonic interference on the BEMF has obvious effect all the time. The ground wire interference signal will not be
introduced, and the robustness will be better than the traditional three comparator method.
Figure 6-1 below is the hardware schematic diagram of RSD detection of BEMF. Pay special attention to the fact
that the three filter capacitors C35, C36 and C40 must be consistent in capacitance and not too large to avoid detection
sector deviation caused by excessive signal delay and voltage and current overshoot during downwind switching.

v1.0.00 www.fortiortech.com/global/ 36 / 61
Application Note
Application Note

Figure 6-2 RSD BEMF Detection Circuit

Figure 6-3 is the waveform of U and V phase BEMF with W phase as reference. It can be seen that the steering
direction and speed can be determined by judging the time sequence of zero crossing and the time of two zero crossing.

Figure 6-3 Voltage Waveform of U and V Phase BEMF with W Phase as Reference

In the following formula, assuming that eU, eV and eW are three-phase back electromotive force with phase
difference of 120 °, the phase relationship of eα and eβ can be calculated. It can be seen that the waveform is consistent
with the measured waveform shown in Figure 6-3. The phase difference between the two zero crossing points is 60 °

v1.0.00 www.fortiortech.com/global/ 37 / 61
Application Note
Application Note

and 120 °. Therefore, the angle and speed values of switching to the closed loop can be obtained through the detection
of sectors and the time of the two zero crossing points to achieve downwind startup.

𝑒 = 𝑈 𝑐𝑜𝑠 𝜃
2
𝑒 = 𝑈 𝑐𝑜𝑠(𝜃 + 𝑝𝑖)
3
4
𝑒 = 𝑈 𝑐𝑜𝑠(𝜃 + 𝑝𝑖)
3

1
𝑒 = 𝑒 − 𝑒 = √3 𝑈 𝑐𝑜𝑠(𝜃 + 𝑝𝑖)
6
1
𝑒 = 𝑒 − 𝑒 = √3 𝑈 𝑐𝑜𝑠(𝜃 + 𝑝𝑖)
2

6.6 mcPosiCheck

Initial position check state, which mainly uses the salient pole effect of the motor to detect the rotor position. The
difference in saturation degree of d and q axis magnetic circuits of the motor caused by high-frequency signal injection
is used to realize the detection of rotor position to detect the initial position of the motor, confirm the initial starting angle,
and improve the success rate of starting. Note that the initial position detection will introduce electromagnetic noise.
The customer determines whether this function is required according to the actual application scenario and needs.
Generally, the noise requirements are small Initial position detection is generally not used in applications where the
reverse deflection angle needs to be small. If you do not need this function, you can disable it by setting
PosCheckEnable to 0. Please refer to the following code implementation for details.

v1.0.00 www.fortiortech.com/global/ 38 / 61
Application Note
Application Note

6.7 mcAlign

Alignment state, under which the controller outputs a constant current ID or duty cycle UD to drag the motor forcibly
to a fixed angular position. Its purpose is to improve the reliability of motor starting, but it will lead to longer starting time.
For applications requiring starting time, pre positioning is generally not used. You can choose whether to enable this
functionality through AlignEnable. The state machine will switch to mcStart state upon completion of alignment.
The advantage of ID pre positioning is that the positioning torque will not change with the change of voltage, which
is equivalent to constant torque positioning. The wide voltage effect is good, but because ID is adjusted through the
internal PI closed-loop, electromagnetic noise will appear.
The advantage of UD positioning is that there is no current regulation and positioning and there is almost no noise.
The disadvantage is that the positioning torque of different voltages is different. Attention should be paid to the wide
voltage application. UD can be set to the associated bus voltage in the program, and UD can be compensated by the
current bus voltage to achieve the stability of the wide voltage positioning torque. For details, refer to the following code.

v1.0.00 www.fortiortech.com/global/ 39 / 61
Application Note
Application Note

6.8 mcStart

Start state, which is mainly used to configure the startup code of motor. After configuring the relevant register code
and variables, the state machine will shift to the next state mcRun. The motor startup process is implemented by the
ME kernel. Please refer to the following code implementation for details.

6.9 mcRun

Running state, under which, the program will perform closed-loop PI control in the start and running phases using
the Speed_response() function. Please refer to the following code implementation for details.

v1.0.00 www.fortiortech.com/global/ 40 / 61
Application Note
Application Note

6.10 mcStop

Stop state is used to stop the motor. Users can decide whether quick shutdown is required by enabling or disabling
the Stop & Brake function. Generally, the low side is fully opened for braking. Pay attention to this braking mode. Due
to the large reverse electromotive force of the motor at high speed, it will generate a large induced current, which is
easy to burn power devices. The program will generally be set lower than the shutdown speed Motor_ Stop_ Speed
will start braking. After braking, motor will shift to mcReady state, waiting for the next "Start" command.

v1.0.00 www.fortiortech.com/global/ 41 / 61
Application Note
Application Note

6.11 mcFault

Fault state; when a protection event is detected, the program will record the fault source and the state machine will
switch to mcFault state to shut down the motor for protection purpose; when the fault source is eliminated, it will shift to
mcReady state, waiting for the next "Start" command. Please refer to the following code implementation for details.

v1.0.00 www.fortiortech.com/global/ 42 / 61
Application Note
Application Note

7 Startup Modes

There are three common starting modes for the motor: ramp starting, Omega starting using position estimation
algorithm, and ramp starting followed by Omega starting. Ramp starting is suitable for heavy load and slow start
applications; Omega starting is suitable for applications with fast startup and smooth switching; the third startup mode
is suitable for applications where initial position check function is enabled.

7.1 Ramp Starting


7.1.1 Theories

The principle is that given the starting current (IQREF is non-zero), the electrical frequency of the motor is slowly
accumulated by ramp, the angle information of coordinate transformation is provided by the ramp angle, and the motor
is driven to rotate. When the speed of the driving motor reaches a certain value, the starting is completed, and the angle
information is gradually cut in to be provided by the position estimation algorithm.

In this mode, the ramp angle consists of angle THETA, speed RTHESTEP, acceleration RTHEACC and ramp
counter RTHECNT. Below is the ramp formula:

RTHESSTEP (32bit) = RTHESSTEP (32bit) + RTHEACC

THETA (16bit) = THETA (16bit) + RTHESSTEP (high 16bit)

In every cycle, ramp module makes a ramp operation and ramp counter adds 1. When the value of the counter
reaches RTHECNT, RFAE is cleared by hardware, and then the ramp is over. The estimator also estimates the angle
in the ramp. At the end of the ramp, it switches to the estimator mode. Because there is a deviation between the
estimated angle and the ramp angle, smooth switching is required. The correction value FOC can be switched by

v1.0.00 www.fortiortech.com/global/ 43 / 61
Application Note
Application Note

adjusting the angle_ The value of THECOR reduces the switching jitter and achieves smooth switching.

7.1.2 Parameter Specification

Parameter Debugging

Parameter Range Description


1. The starting current is determined by the
actual load. When debugging the fan, you
Lower than can grasp the load with your hands under
safe conditions and feel a stable torque
the
output;
Starting current maximum
2. When the starting current increases, the
running starting torque will increase, and it is easy to
current start overshoot if it is too large; If the starting
torque is too small, it is easy to fail or fail to
start.
1. The ramp increment is a function of base
speed, which affects the speed of starting
frequency increase. The higher the motor
base speed, the greater the ramp increment ;
Ramp increment 2. The motor startup speed increases as the
1-200
MOTOR_OPEN_ACC increment grows. If the ramp increment is too
Ramp
large, the actual frequency cannot align with
Starting the given frequency, causing motor goes out-
of-step; if the increment is too small, the
startup is too slow, and it is easy to pause.
1. The initial speed affects the starting speed,
and the default initial speed is 0;
Initial speed of ramp starting
2. In the case that the startup response is
MOTOR_OPEN_ACC_MIN required to be very fast, the initial speed can
be set to non-zero speed.
1. Start climbing times, the maximum value of
the register is 255;
2. The starting times increase and the starting
Number of ramp starts time increases. In some applications, the start
1-255
MOTOR_OPEN_ACC_CNT time is long, and the counter can be set to be
re assigned after counting. The number of
assignments depends on the actual
application.
1. The observer bandwidth affects the
Observer bandwidth filter
estimated speed response of the estimator;
output ATO_ BW 2. During the ramp up start, the estimator is

v1.0.00 www.fortiortech.com/global/ 44 / 61
Application Note
Application Note

independent of the ramp up start, and it is


only necessary to set a bandwidth filter value
to enable the motor to operate normally.
1. SMO's minimum speed influence
estimator's estimation;
2. The value setting is related to the speed
Minimum speed of SMO
reference, which should be lower than the
minimum speed of the motor for normal
operation, but not too small.

7.2 Omega Startup


7.2.1 Theories

The principle is that given the starting current (IQREF is non-zero), the position estimation algorithm estimates the
current speed. When the estimated speed is less than the minimum switching speed set by the user, the estimator
outputs a forced angle to drag the motor. The forced speed starts from 0, and each calculation cycle is added to the
speed increment EFREQACC. At the same time, the maximum limiting is performed according to the starting limiting
speed. When the estimated motor speed is greater than or equal to the minimum switching speed of starting, the starting
is completed, and the angle information is calculated by the estimation algorithm.

Estimated speed
ω
Reference speed
Limit

Minimum
switching
speed

0 t

Figure 7-1 Speed Curve in Omega Startup Mode

7.2.2 Parameter Specification

Parameter Debugging

Parameter Range Description


Omega 1. The starting current is determined by the
Startup Lower than
actual load. When debugging the fan, you
the
Starting current can grasp the load with your hands under
maximum
safe conditions and feel a stable torque
running current
output;

v1.0.00 www.fortiortech.com/global/ 45 / 61
Application Note
Application Note

2. If the starting current increases, the


starting torque will increase, and if it is too
large, it is easy to start with overshoot or
noise; If the starting torque is too small, it is
easy to fail or fail to start.
1. The startup increment is a function of
base speed, which affects the speed of
starting frequency increase. The higher the
motor base speed, the greater the ramp
increment ;
Startup Increment 2. When the increment increases, the
1-200
Motor_Omega_Ramp_ACC. startup output frequency increases. If the
increment is too large, the actual frequency
of the motor cannot keep up with the given
frequency, and it is easy to lose step; The
increment is too small, the startup is too
slow, and it is easy to pause.
1. The minimum starting switching speed is
related to the speed reference. The higher
the motor speed reference is, the greater
its value will be;
2. Its value is less than the starting limit
Minimum switching speed for
speed;
startup (rpm/min)
3. If it is too small, the estimator is easy to
MOTOR_ OMEGA_ ACC_
make an error in estimation, and the motor
MIN
has not been dragged to start and switch
over, which is easy to lead to start failure; If
it is too large, it is easy to cause the startup
to fail to cut into the closed loop or the
speed to overshoot.
1. The starting limit speed is related to the
speed reference. The higher the motor
speed reference is, the greater its value will
be;
2. The value shall be less than the
Starting limit speed (rpm/min) minimum running speed of the motor and
MOTOR_ OMEGA_ ACC_ greater than the minimum switching speed;
END 3. If it is too small, the estimator is easy to
make an error in estimation, and the motor
has not been dragged to start and switch
over, which is easy to lead to start failure; If
it is too large, it is easy to cause the startup
to fail to cut into the closed loop or the

v1.0.00 www.fortiortech.com/global/ 46 / 61
Application Note
Application Note

speed to overshoot.
1. The compensation coefficient of starting
dead time voltage affects the output during
Start dead time voltage starting, which is related to the bus voltage
compensation coefficient division multiple and starting current;
0.5-2.0
(RV3_Start = (0.5- 2. It is recommended to debug from 1.0 to
2.0)*RV3_Actual) both sides, mainly ranging from 0.8-1.75.
When the starting current changes, its
value may change.
1. The bandwidth of the observer affects
the PI loop in the estimator to estimate the
speed;
2. To prevent the estimated speed from
fluctuating greatly at low speeds, the
bandwidth filtering value is generally
increased from small to large. The
acceleration time is related to the actual
Runtime observer startup time. The shorter the startup time is
ATO_BW required, the shorter the acceleration
interval is. During commissioning, it shall
be modified according to starting current
waveform and actual rotation effect;
3. If AT0_ BW is too large, it is easy to
cause reverse deflection startup can not be
pulled back to forward rotation, resulting in
out of step; If it is too small, it is easy to
cause a pause in the positive start.
1. SMO's minimum speed influence
estimator's estimation;
2. The value setting is related to the speed
reference and should be lower than the
Minimum speed of SMO
minimum speed of the motor for normal
operation, but it should not be too small,
which is greater than the starting limit
speed.
1. The specific parameter range can refer
to the PI coefficient description of the
operating current loop;
Current loop Kp, Ki
2. During debugging, it can be increased
first, and then decreased after observing
the bad current waveform.

v1.0.00 www.fortiortech.com/global/ 47 / 61
Application Note
Application Note

7.3 Ramp Startup Followed by OMEGA Startup


7.3.1 Theories

Ramp startup followed by OMEGA startup is to combine the advantages of the two. First drag the motor. After the
motor has a certain speed, start it with Omega to ensure reliability. It is mainly used for starting with initial position
detection. For parameter settings, refer to the specific debugging parameters of the previous two types of startup.
Among the three modes, the longest startup time is open-loop startup and the shortest is Omega startup. After the
motor startup parameters are configured, the motor starts to enter the running mcRun state. When the motor is running,
speed closed-loop control or other closed-loop control can be added according to performance requirements.

7.3.2 Parameter Specification


8 Debugging Procedures
8.1 Motor Parameters Measurement
8.1.1 Measurement Steps

Pole pairs, resistance, inductance and BEMF vary from one motor to another. Since these parameters have a
major bearing on FOC calculation, the parameters used to debug motor must be written to the program during
debugging. Motor parameters are measured as follows:
1. Pole pairs (P): A parameter to be assigned in motor design.
2. Phase resistance (Rs): Measure the motor's two-phase line resistance RL with a multimeter, and
then calculate phase resistance using the equation Rs = RL/2.
3. Phase inductance (Ls): Measure the two-phase line inductance LL at 1KHz frequency with an LCR
meter, and then figure out phase inductance using the equation Ls = LL/2.
4. BEMF constant (Ke): Attach the oscilloscope probe to one phase of the motor and connect one of
the motor's the other two phases to ground, rotate the load, and measure the BEMF waveform. Take a sine
wave in the middle and measure its peak-to-peak value KeVpp and frequency Kef using the following formula:

Vpp
Ke = 1000 ∗ P ∗
2 ∗ 1.732 ∗ 60 ∗ f
P denotes pole pairs.
For example, the BEMF waveform is measured as follows:

v1.0.00 www.fortiortech.com/global/ 48 / 61
Application Note
Application Note

Figure 8-1 BEMF Waveform

As shown in the above figure, the measured KeVpp is 33.2V, the Kef is 7.042Hz, and the pole pairs is 4, then:

.
BEMF Ke = 1000 ∗ 4 ∗ = 90.73 V/KRPM
∗ . ∗ ∗ .

8.1.2 Code Implementation

Write the motor parameters to the following software code. In consideration of measurement error, we multiple
inductance, resistance and Ke by the factor 1.0. When debugging, users can fine tune that factor to adjust and optimize
the motor model. Pay attention to correspondence of units.

8.2 Base Current

The base current, maximum sampling current and minimum sampling current can be calculated on the basis of
the shunt resistance Rsample, the op-amp gain Amp, and the ADC reference voltage Vs of MCU. The motor current
should be tuned so that it falls within the range between the minimum sampling current and the maximum sampling
current. If not, Rsample and Amp must be reconfigured as needed. The power of shunt resistor should be selected by
following the principle P = I Rsample < 𝑃𝑚𝑎𝑥.

v1.0.00 www.fortiortech.com/global/ 49 / 61
Application Note
Application Note

Base current Ibase = ∗


, maximum sampling current Ismax = , minimum sampling current Ismin =

− .

Example: Suppose Rsample = 0.5Ω, Amp = 4, Vs = 5.0V, then Ibase = 2.5A, Ismax = 1.25A, Ismin = −1.25A.

8.2.1 Code Implementation


1. Detect whether VHALF bias voltage is applied to the current sampling circuitry. It is recommended to attach
bias voltage to the hardware. When bias voltage is applied, you need to set AMP0_ VHALF as 1;
2. Write the above shunt resistance, gain and ADC reference voltage to the following software code.

8.3 DC Bus Voltage Divider Ratio

In the FOC - SVPWM module, the DC bus voltage must be sampled for calculation. In the HV/LV
applications, there is a difference between the supply voltage and the ADC maximum sampling voltage of MCU,
so the DC bus voltage should be processed through voltage scaling as needed. Configure the resistance values
of resistors RV1, RV2, and RV3 in the circuit (RV2 is omitted in LV applications, that is, RV2=0), then the
corresponding scaling and maximum shunt resistor value are calculated as follows:

RV1 + RV2 + RV3


RV =
RV3

The maximum sampling voltage Vsmax = RV*Vs, and the voltage spike of practical applications should be lower
than 0.8*Vsmax.

Example: RV1 = 330KΩ, RV2 = 300KΩ, RV3 = 6.8KΩ, Vs = 5.0V, the maximum sampling voltage

v1.0.00 www.fortiortech.com/global/ 50 / 61
Application Note
Application Note

.
Vsmax= .
∗ 5.0 = 468V

Figure 8-2 DC Bus Voltage Divider Circuit

8.3.1 Code Implementation

Write the above bus voltage divider parameters to the following software code. If only two shunt resistors are, fill in
0 for one of RV1 and RV2, VC1 is the voltage compensation coefficient.

8.4 Carrier Frequency and Deadtime

It is recommended that the carrier frequency should not be less than 10 times of the maximum electrical frequency.
The dead time should be determined by actual test of the VGS waveform of the upper and lower Bridges to ensure that
there is no risk of micro-conduction.
When sampling with single resistance, pay attention to avoid internal parameter overflows. When sampling with
single resistance, set the minimum sampling window value of FOC_TSMIN, FOC_TSMIN < carrier period /16(unit: us),
for example: Carrier frequency is set to 30KHZ, MIN_WIND_TIME < 30/16 = 1.875μs

v1.0.00 www.fortiortech.com/global/ 51 / 61
Application Note
Application Note

8.4.1 Code Implementation

8.5 Base Speed

The MOTOR_SPEED_BASE is typically set to 1.5 ~ 2 times of the maximum speed.

8.5.1 Code Implementation

8.6 Hardware Driver Test


1. Disable Startup Protection, Motor Lock Protection and Phase Loss Protection to avoid false triggering of
protection functionality in test mode;
2. Set the hardware OCP threshold to prevent hardware short circuit that may burn out the power device;
3. Enable AlignTestMode = 1;
4. Do not connect the motor to U, V, W terminals;
Test with oscilloscope to check whether the driver board U, V and W have tachometer output. If yes, indicate
that the driving output of the board is normal and the normal waveform is referred to
5. Figure 8-3.

v1.0.00 www.fortiortech.com/global/ 52 / 61
Application Note
Application Note

Figure 8-3 U-phase Output Waveform in Test Mode

8.6.1 Code Implementation

9 Protection Functionality

This Section mainly introduces the protection basics and parameter setting commonly used in the program. The
basic protection functionalities provided in the program include hardware OVP, software OVP, MLP, startup protection,
phase loss protection, OVLO/UVLO and bias voltage protection. Users may customize new protection functionalities
as needed.
Note that protection values vary with project, motor and PCB, and the protection value of each protection
function fit with the actual project. If you find that the protection functionality, especially motor lock protection or
phase protection, cannot be triggered, or the protection is mistakenly triggered when motor operates normally, it
suggests that the protection setpoint is incorrect and must be adjusted.

9.1 Hardware OCP


9.1.1 Theories

Hardware OCP is generally triggered by CMP3 interrupt and INT0 external interrupt, and the time from threshold
triggered to protection finished is less than 2μs, allowing for hardware protection with a quick response.
The following is the port diagram of CMP3. The hardware OCP threshold can be set either through P23 input or
through the output of the internal 9-bit DAC configuration. The OverHardcurrentValue cannot be greater than the
maximum sampled current and the Peak current indicated in the power device’s user guide, generally set as 1.5 times
or more of the peak phase current.

v1.0.00 www.fortiortech.com/global/ 53 / 61
Application Note
Application Note

CMP3HYS
CMP3EN

CMP3MOD[1:0]
P2.0

P2.3

P2.7/C3P CMP3OUT
P2_AN[6]
P2_OE[6]
P2.6/C3M
VREF

9Bit
DAC0DAT[8:0]
DAC

DACEN

Figure 9-1 CMP3 Port Diagram

9.1.2 Code Implementation

 Configure the hardware OCP threshold source as internal DAC


 Configure the hardware OCP threshold

When hardware OCP is detected, that is, the CMP_ISR(void) interrupt 7 InterruptFunction is invoked, where the
driver output is disabled, i.e. MOE = 0, and the state machine shifts to the Fault state, i.e. mcState = mcFault. The
system returns error source mcFaultSource = FaultHardOVCurrent.

v1.0.00 www.fortiortech.com/global/ 54 / 61
Application Note
Application Note

9.2 Software OCP


9.2.1 Theories

Software OCP is mainly triggered after reading three-phase currents FOC__IA, FOC__IB and FOC__IC. If the
phase currents read within OverSoftCurrentClrTime exceed the software OCP for OverSoftCurrentTime, the program
will return an overcurrent error and the motor will shift to the mcFault state for lockout. Note that the software OCP
response finishes within 1ms interrupt, and slow response time cannot replace the hardware OVP.

9.2.2 Code Implementation

v1.0.00 www.fortiortech.com/global/ 55 / 61
Application Note
Application Note

9.3 Motor Lock Protection (MLP)


9.3.1 Theories

MLP is mainly triggered to shut down the motor for protection or restart the motor when motor lock condition is
detected, which is implemented in three ways:
Method 1: By detecting the square of BEMF FOC_ESQU calculated by the estimator; under normal conditions,
the higher the motor speed, the larger the FOC_ESQU will be. In the case of motor stall, the estimated speed
will be very high when motor goes out-of-step but FOC_ESQU will be low.
Program implementation: Motor stall is established when FOC_ESQU value is smaller than the preset
Stall_DectEsValue1 after Stall_Delay_DectTime; or when the estimated speed is higher than the preset
Stall_DectSpeed value, but the FOC_ESQU value is smaller than the preset Stall_DectEsValue2.

Method 2: By detecting the estimated speed; motor stall is established when the estimated speed is higher
than the preset MOTOR_SPEED_STAL_MAX_RPM value or is lower than the preset
MOTOR_SPEED_STAL_MIN_RPM value.

Method 3: When the motor is started, the program will shift from Mode 0 to Mode 1 after judging that the
estimated speed is greater than MOTOR_LOOP_RPM, where the motor starts with a fixed current before
running in the normal loop. User can determine whether the motor lock condition is present from the Mode. If
Mode 0 persists after the FOCMode_DectTime has elapsed, it suggests startup failure, that is, motor lock has
occurred.

v1.0.00 www.fortiortech.com/global/ 56 / 61
Application Note
Application Note

9.4 Thermal Shutdown (TSD)


9.4.1 Theories
The figure below provides a common schematic representation of thermal shutdown, where the voltage
divider is used with a NTC thermistor, the resistance of which decreases gradually with increasing temperature.
A resistance value corresponds to each given temperature. Temperature detector (TD) is connected to one AD
port of the chip. The program senses the voltage applied to the AD port. When the voltage becomes less than
the voltage at the given temperature, it indicates that the NTC resistor temperature exceeds the setpoint and
thus TSD is triggered.

温度检测
+5V

R19
10K-1%
R36 TMP
TMP
1K-1%
RT1
47K-1% C22
104/16V

GND

Figure 9-2 Temperature Detection Schematic

9.4.2 Code Implementation

Where, OVER_ Temperature is the protection setpoint, 1.0 is the resistance 1 Ω of NTC resistor at 80℃,
UNDER_Temperature is the recovery value, 2.23 is the resistance 2.23 Ω of NTC resistor at 70℃ .
Note: If the pull-up resistor value is not 10K and the pull-up voltage is not 5V, the defied formula should be
modified.

v1.0.00 www.fortiortech.com/global/ 57 / 61
Application Note
Application Note

9.5 Phase Loss Protection


9.5.1 Theories

When one phase of a three-phase motor is lost, the three-phase current becomes asymmetrical. Hence,
phase loss protection can be implemented by detecting the maximum value of three-phase current within a given
period of time in the program and judging whether it is asymmetrical.
Program implementation: Phase loss is established if the maximum current of one phase measured is
greater than PhaseLossTimes the maximum current of the other phase which is greather than
PhaseLossCurrentValue.
Notes: In some applications, phase loss may not be detected in the above ways because the lost phase
may have burrs, which may cause the maximum sensed current to be close to those of the other two phases.
Solution: Phase loss can be determined by comparing the accumulated current value within a given period of
time through integration.

9.5.2 Code Implementation

9.6 Overvoltage/Undervoltage Lockout (OVLO/UVLO)


9.6.1 Theories

The program senses the voltage applied on the AD2 port and triggers overvoltage lockout when the sensed voltage
exceeds the setpoint; and the overvoltage fault is cleared when the sensed voltage is again below the overvoltage
recovery value. When the sensed voltage is lower than the undervoltage lockout setpoint, the program will trigger
undervoltage lockout; and the undervoltage fault is cleared when the sensed voltage is again below the undervoltage
recovery value.

9.6.2 Code Implementation

v1.0.00 www.fortiortech.com/global/ 58 / 61
Application Note
Application Note

9.7 Bias Voltage Protection


9.7.1 Theories

Bias voltage is measured before the motor starts up. When VHALF is attached, the theoretical value of bias voltage
is 2048 which converts to 16383 after being moved left by 3 bits; when VHALF is not connected, the theoretical value
of bias voltage is 0; when the error of measured bias voltage exceeds GetCurrentOffsetValue of its theoretical value,
the bias voltage is considered abnormal. 0.05 represents 5%.

9.7.2 Code Implementation

v1.0.00 www.fortiortech.com/global/ 59 / 61
Application Note
Application Note

10 Revision History
Rev.: 1st digit - Schematic Diagram 2nd digit - Module 3rd & 4th digits - Details

Effective Revised Approved


Rev. Changes
Date by by
You
V1.0.00 MCU First release 2022-06-16
Yuchao

v1.0.00 www.fortiortech.com/global/ 60 / 61
Application Note
Application Note

11 Copyright Notice
Copyright by Fortior Technology Co., Ltd. All Rights Reserved.

Right to make changes —Fortior Technology Co., Ltd RSVs the right to make changes in the products - including
circuits, standard cells, and/or software - described or contained herein in order to improve design and/or performance.
The information contained in this manual is provided for the general use by our customers. Our customers should be
aware that the personal computer field is the subject of many patents. Our customers should ensure that they take
appropriate action so that their use of our products does not infringe upon any patents. It is the policy of Fortior
Technology Co., Ltd. to respect the valid patent rights of third parties and not to infringe upon or assist others to infringe
upon such rights.

This manual is copyrighted by Fortior Technology Co., Ltd. You may not reproduce, transmit, transcribe, store in a
retrieval system, or translate into any language, in any form or by any means, electronic, mechanical, magnetic, optical,
chemical, manual, or otherwise, any part of this publication without the expressly written permission from Fortior
Technology Co., Ltd.

If there are any differences between the Chinese and the English contents, please take the Chinese version as the
standard.

Fortior Technology Co.,Ltd.

(Singapore):1003 Bukit Merah Central, #04-22, INNO Center,(s)159836


Customer service:info@fortiortech.com
URL: http://www.fortiortech.com/global/

Contained herein
Copyright by Fortior Technology Co., Ltd all rights Reserved.

v1.0.00 www.fortiortech.com/global/ 61 / 61

You might also like

pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy