You are on page 1of 34

Speed Control of Brushless DC MotorsSinusoidal Commutation with Hall

Sensors
Users Guide

Speed Control of Brushless DC Motors-Sinusoidal Commutation with Hall Sensors

Table of Contents
Introduction . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 3
Reference Documents . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 4

1 Brushless DC Motor Control Theory . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 5


Sinusoidal Commutation with Hall Sensor Inputs . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 6

2 Design and Implementation . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 11


Hardware Implementation . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 11
Software Implementation . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 13
Performance Details . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 17

3 Hardware Configuration and Setup Details . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 19


Programming the Kit . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
Connection of the SmartFusion Evaluation/Development Kit Board With the Trinamic Kit . . . . . . . . . . . . . . . . . .
Connections for Programming the Kit . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
Connection of BLDC Motor with Trinamic Kit . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
Power Supply Connection . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .

19
22
23
23
24

4 User Interface. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 27
5 Conclusion . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 29
A Product Support . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 31
Customer Service . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
Customer Technical Support Center . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
Technical Support . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
Website . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
Contacting the Customer Technical Support Center . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
ITAR Technical Support . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .

Revision 0

31
31
31
31
31
32

Introduction
Microsemi offers a simple, low-cost way to try the SmartFusion products for the development of motor
control application. The SmartFusion customizable system-on-chip (cSoC) field programmable gate
array (FPGA) devices contain a hard embedded microcontroller subsystem (MSS), programmable
analog circuitry (ACE), and FPGA fabric consisting of logic tiles, static random access memory (SRAM),
and phase-locked loops (PLLs). The MSS consists of a 100 MHz ARM Cortex-M3 processor,
communications matrix, system registers, Ethernet MAC, DMA engine, real-time counter (RTC),
embedded nonvolatile memory (eNVM), embedded SRAM (eSRAM), and fabric interface controller
(FIC).
The SmartFusion cSoC devices have major advantages in terms of fabric, MSS, and ACE in the
development of motor drives and control, power supply regulators, solar inverters etc. With a fabricbased motor controller, the designers have the advantage of flexibility in terms of design and having
reliable and deterministic performance.
The SmartFusion Evaluation Kit Board and SmartFusion Development Kit Board are developed in a
generic way that can be used with the custom inverter board for the development of majority of the motor
control applications. This users guide explains in detail the design of Closed loop speed control of
Brushless DC motor with sinusoidal commutation using Hall Sensors that is developed based on the
following hardware platform:

The SmartFusion Development Kit Board (A2F-DEV-KIT) or the SmartFusion Evaluation Kit
Board (A2F-EVAL-KIT) with an A2F200 device. In case of any new version of the board with
A2F500 the project has to be recompiled.

The Trinamic TMCM-AC-840-Motor Control Daughter Board Kit (TMCM-AC-840)

Figure 1 Trinamic TMCM-AC-840-Motor Control Daughter Board Kit (TMCM-AC-840)

Revision 0

Introduction

Reference Documents
1. SmartFusion cSoC User Guides & Manuals
(www.microsemi.com/soc/products/smartfusion/docs.aspx)
2. SmartFusion Development Kit Board Users Guide
(www.microsemi.com/soc/documents/A2F500_DEV_KIT_UG.pdf)
3. SmartFusion Evaluation Kit Board Users Guide
(www.microsemi.com/soc/documents/A2F_EVAL_KIT_UG.pdf)
4. Trinamic Kit User Manual
(http://www.trinamic.com/tmctechlibcd/integrated_circuits/TMCM-AC-840/TMCM-AC840_manual.pdf)
5. Trinamic 603A chip User Manual
(http://www.trinamic.com/tmctechlibcd/integrated_circuits/TMC603/tmc603_datasheet.pdf)
6. BLDC motor datasheet
(http://www.trinamic.com/tmc/media/Downloads/QMot_motors/QBL4208/QBL4208_manual.pdf)

R e vi s i o n 0

1 Brushless DC Motor Control Theory


The Brushless DC Motor or the BLDC Motor is a rotating electric motor consisting of stator armature
windings and rotor permanent magnets, whereas in a conventional brushed DC motor the stator is made
up of permanent magnets and rotor consists of armature windings. The conventional DC motor
commutes itself with the use of a mechanical commutator whereas brushless DC motor needs electronic
commutation for the direction control of current through the windings. Typically, BLDC motors have three
phase windings that are wound in star or delta fashion and need a three phase inverter bridge for the
electronic commutation.
In BLDC motors the phase windings are distributed in trapezoidal fashion in order to generate the
trapezoidal BEMF waveform shown in Figure 1-1. The commutation technique generally used is called
Trapezoidal (also known as block commutation) where only two phases conduct at any given point of
time. An alternative way of commutating the motor is called sinusoidal commutation in which all the three
phases will be conducting at any given point of time. The sinusoidal BEMF voltage generated in this
fashion is shown in Figure 1-2 on page 6. The PMSM motors can also be referred to as BLDC motors
which have the windings distributed in sinusoidal fashion suited for this sinusoidal type of commutation.
The torque generated by PMSM motors is smooth as compared to BLDC motors in which torque will
have more ripples but the peak torque developed by PMSM motors is less as compared to BLDC motors.
Electrical degrees
0

60

120

180

240

300

360

Phase A

Phase B

Phase C

Figure 1-1 Trapezoidal BEMF Waveform

Revision 0

Brushless DC Motor Control Theory

Electrical degrees
0

60

120 190 240

300 360

Phase A

Phase B

Phase C

Figure 1-2 Sinusoidal BEMF Waveform

Sinusoidal Commutation with Hall Sensor Inputs


Angle Estimation using Hall Sensor State
For proper sinusoidal commutation, the absolute rotor position information is very crucial in order to
produce the synchronized voltage waveforms to the motor. To get fine position information, the motors
will be equipped with Encoders or Resolvers, but these sensors add cost to the system.For low-cost
simple solutions, the motors which have Hall sensors can be used.
The demo design uses a motor that has four pole pairs. For every electrical cycle there are six Hall state
changes and thus provides 60 degrees of precision. Each state corresponds to an electrical angle and
has six angle steps. Figure 1-3 on page 6 shows the Hall event changes and the corresponding angle
information of the motor used in the demo design.

15

001

90

101

01
1

30

CCW

01

33

110

21

100

270

Figure 1-3 Hall State Change vs Corresponding Angle for CCW Direction

R e vi s i o n 0

Speed Control of Brushless DC Motors-Sinusoidal Commutation with Hall Sensors


The Hall state change provides the information of the new electrical angle. In order to estimate the angle
within the Hall state changes as the motor rotates we can use the information available through these
Hall state changes, that is, the time taken between Hall state changes or the number of PWM cycle
events that took place between Hall event changes. With the number of PWM cycle events that took
place between Hall event changes previously, the new angle can be estimated between Hall events on
every PWM cycle. Also, the estimated angle can be corrected when the next Hall event occurs. This
method of angle estimation is not accurate and may not be suitable for applications where load changes
occur more frequently.
Hall Event (n -1)

Hall Event (n)

PWM cycle counts

Figure 1-4 PWM Cycle Counts Between Two Hall Event Change
The angle of increment count corresponds to 360 degree of electrical revolution. It is calculated using the
following formula:
Angle Increment per electrical revolution = (Number of PWM counts between Hall Change)/((Fabric
Frequency in MHz*PWM Frequency in s))
EQ 1-1
The angle of increment between Hall states or within 60 electrical degrees is calculated using the
following formula:
Angle Increment within 60 degrees = (Angle Increment per Electrical revolution)/(60)
EQ 1-2

Speed Calculation using Hall State


The Hall state changes provide the information about the position of the motor. For every electrical cycle
there will be six Hall state changes. If the time taken between the Hall state changes is available then the
speed can be computed. A moving average technique is used to calculate the speed. Using this
technique we can take the average of the six previously calculated speed values.
ActualSpeed(n)= (Speed(n)+Speed(n-1)+...+Speed(n-5))/6
EQ 1-3

Sinusoidal Voltage Generation


The instantaneous sinusoidal voltages of all the phases are computed using the following formulae:
VoltageA=Vamplitude*Sin(Angle)
EQ 1-4
VoltageB=Vamplitude*Sin(Angle - 120)
EQ 1-5
VoltageC=Vamplitude*Sin(Angle + 120)
EQ 1-6

Revision 0

Brushless DC Motor Control Theory


Where,
Angle is computed from the angle corresponding to the Hall event and the angle of increment when the
motor is rotating.
Vamplitude is the controlled output from the Proportional - Integral Controller (PI Controller).
The generated voltage waveforms are shown in Figure 1-5.

Phase A

Phase B

Phase C

Figure 1-5 Sinusoidal Voltage Waveforms

SVPWM Generation
The instantaneous space vector voltages of all the phases are computed using the following formulae:
Voff= [min(VoltageA, VoltageB, VoltageC) + max(VoltageA, VoltageB, VoltageC)]/2
EQ 1-7
Where VoltageA, VoltageB, and VoltageC are sinusoidal voltages of phases A,B, and C. These are
calculated using the above mentioned sinusoidal voltage generation theory.
VoltageAnew = VoltageA Voff
EQ 1-8
VoltageBnew = VoltageB Voff
EQ 1-9
VoltageCnew = VoltageC Voff
EQ 1-10
The final space vector voltage waveforms are shown in Figure 1-6.

VoltageAnew

VoltageBnew

Figure 1-6 Space Vector Voltage Waveforms

R e vi s i o n 0

VoltageCnew

Speed Control of Brushless DC Motors-Sinusoidal Commutation with Hall Sensors

Speed Control of Brushless DC Motor


The speed of the BLDC motor is directly proportional to the applied voltage. The commutation logic
specifies the coils that need to be energized for every 60 degrees of electrical revolution based on the
Hall inputs. The pulse width modulation (PWM) logic specifies the time interval during which the switches
should be ON and OFF to average the DC bus voltage applied thereby, controlling the speed. If the
switches are ON for the complete duration of the commutation period, then the DC bus rated voltage is
directly fed to the phase windings of the motor. Hence, the motor will run at the speed specified in the
motor datasheet. To operate at any speed below this level, the commutation pattern applied at either the
High-side or Low-side switch should be pulse width modulated with the PWM pulses at a specified
frequency called the PWM frequency.

Open Loop Speed Control


In open loop speed control, the duty cycle is directly calculated from the set reference speed and there is
no actual speed feedback for control purpose.

Speed
Reference

DutyCycle
Calculation

DutyCycle

Commutation
Logic

Inverter
Bridge

PWM

BLDC

Hall Signal

Figure 1-7 Open Loop Speed Control

Closed Loop Speed Control


In closed loop speed control, the set speed and the actual speed are compared and the error is fed to the
PI Controller, which finally outputs the required duty cycle in order to achieve the required speed
operation of the motor.

Speed
Reference

+_

Error

PI Controller

DutyCycle

Commutation
Logic

PWM

Inverter
Bridge

BLDC

Speed
Actual

Speed
Calculation

Hall Signal

Figure 1-8 Closed Loop Speed Control

Revision 0

Brushless DC Motor Control Theory

PI Controller
The regulation of speed is done with the PI controller. The error difference between the actual speed and
reference speed is calculated at every PWM cycle and is given as an input to the PI controller. The
proportional and integral gains of the controller are configurable using UART commands.

Ymax
Reference Speed

Proportional
Gain

Error

Integral
Gain

DutyCycle

Ymin

Integrator

Figure 1-9 Proportional-Integral Controller


The duty cycle output from the PI controller is given in continuous time domain as:
DutyCycle = KP*error + KI* error dt
EQ 1-11
where,
KP: Proportional Gain
KI: Integral Gain
error: Difference in Reference in speed with Actual speed
DutyCycle: Controller Duty cycle Output
In discrete time domain the same PI controller is represented by the following equations:
yn (k+1) = yn (k)+ KI*e(k)
EQ 1-12
Yn (k+1) = yn (k+1)+ KP*e(k)
EQ 1-13
where,
KP: Proportional Gain
KI: Integral Gain
e(k): Difference in Reference in speed with Actual speed
Yn (k+1): Current computed duty cycle
yn (k+1): Current integrated error term
yn (k): Previously integrated error term

10

R e visio n 0

2 Design and Implementation


The design blocks of the closed loop speed control operation of BLDC motors using sinusoidal
commutation are shown in Figure 2-1. The sinusoidal commutation algorithm is completely implemented
in fabric like PWM Unit, Sine Commutation logic, Hall pattern detection, Hall event counter, PI controller,
etc. Only control and monitoring functions are implemented in MSS. The ACE is configured for the
measurement of the three phase currents and for over current detection.

End
Reference
Speed
(End User)

Start
Ramp Function

Reference
Speed
+

PI Controller

Sine
Commutation

Inverter
Bridge

BLDC
Motor

Angle
Calculation

Block Implemented in MSS


Block Implemented in Fabric

Speed
Calculation

Hall Pattern
Detection

HALL1

HALL1

HALL2

HALL2

HALL3

HALL3

HALL Logic

Trinamic Board

Figure 2-1 Design Blocks of Closed Loop Speed Control Operation of BLDC Motors

Hardware Implementation
The logic implemented in the FPGA fabric runs on 75 MHz clock from clock conditioning circuit (CCC) in
MSS. Figure 2-2 on page 12 shows the flow chart of the algorithm implemented in the FPGA fabric. After
the reset from the MSS, the APB slave implemented in the FPGA fabric starts communicating with the
MSS through FIC. The APB slave decodes all the configuration data from the Cortex-M3 processor and
assigns the configuration data like Ki, Kp, error, PWM period, and dead time values to different modules.
Once the PWM period and dead time are configured and PWM generation is enabled from Cortex-M3
processor, then the PWM count starts ticking and the count is passed to PWM compare match unit for
every clock. The Cortex-M3 processor programs the error value to the PI controller; the PI controller
calculates the magnitude and passes it to the sine commutation logic. The sine commutation logic takes
the angle information from the Cortex-M3 processor and it calculates the PWM ON period, then the PWM
ON values are passed to the PWM compare match unit. The compare match unit generates 3 PWM
signals. These three PWM signals are fed to the dead time controller, which in turn generates 3 PWM
signals to the high side of the Inverter Bridge and 3 PWM signals to the low side of the Inverter Bridge.

Revision 0

11

Design and Implementation

S tart

A P B Interface
(C om m unication
w ith M 3 processor
through F IC )

If P W M G eneration is enabled

Configuration of different
parameters like Ki, Kp, Error,
PWM frequency, Dead time,
and Angle

Cortex- M 3
P rocessor

If P I Controller is enabled

P I C ontroller

G eneration of P W M tick
A ngle

M agnitude

P W M O n tim e values

S inusoidal com m utation logic

P W M com pare m atch


S peed calculation using H A LL
PW M
H A LL from M otor

P W M com plem entary signal


generation using D ead tim e
3 H igh side P W M signals
3 Low side P W M S ignals
T o Inverter bridge

Figure 2-2 Design Blocks of Closed Loop Speed Control Operation of BLDC Motors
The speed calculation logic takes the synchronized HALL signals from the motors and calculates the
number of clock cycles between 6 continuous HALL events; this value is passed on to the Cortex-M3
processor for speed calculation in terms of RPM. Table 2-1 shows the details of the modules
implemented in FPGA fabric.
Table 2-1 Modules Implemented in FPGA Fabric
S.No

12

Module Name

Description

ms_m_ctrl_sc_fabric_top.vhd This module is the top-level module, that integrates all the sub modules.

apb_if.vhd

This module interfaces with the Cortex-M3 processor and decodes all the
configurations required for the blocks in fabric.

pi_ctrl_sine_comm.vhd

This module has two major blocks: the PI controller and the sine commutation
logic. The PI controller takes the speed error (Desired speed - Actual speed)
from the MSS and generates the amplitude for the sine commutation. The
implementation of this module is the same as the functionality mentioned in
the "PI Controller" section. In this Microsemi's standard macros 32-Bit adder,
16x16 signed multipliers are used. It takes about ~ 20 clock cycles to
complete the operation. The sine commutation logic takes the angle values for
three phases from the MSS and generates the ON time for three PWMs.

pwm_gen.vhd

This module takes the PWM ON time values from the sine commutation logic,
and compares it against the PWM count and generates the PWM signals.

R e visio n 0

Speed Control of Brushless DC Motors-Sinusoidal Commutation with Hall Sensors


Table 2-1 Modules Implemented in FPGA Fabric (continued)
5

pwm_count.vhd

This module generates a sync pulse for every PWM period and PWM current
count to generate the PWM signals. The width of the PWM counter is 14-bit
and it is edge aligned.

pwm_comp.vhd

This module generates the complementary signals for low side switches.

hall_sync.vhd

This module synchronizes the HALL signals and generates the HALL pattern.

hall_speed_calc.vhd

This module takes the synchronized HALL signals and calculates the number
of system clocks between six consecutive HALL events. This information will
be used by the Cortex-M3 processor to calculate the speed of the motor in
revolutions per minute (RPM).

Software Implementation
The MSS operates at 75 MHz frequency and does the job of controlling and monitoring parameter
configurations of the sinusoidal commutation control algorithm. The complete motor control sinusoidal
commutation algorithm is implemented in fabric. Hence, the MSS consumes much less CPU time
(~ 21 s) and allows the system level application to work independently. For a PWM frequency of 20 kHz,
the CPU load will be < 42%.
Figure 2-3 on page 14 shows the flow chart of the control and monitoring algorithm implemented in the
software. The initialization of the MSS peripherals like watchdog, ACE, PWM, and PI controller in fabric is
done after the reset. After the initialization, a while loop runs indefinitely. The UART data from the GUI is
processed in this while loop. The GUI communicates with the MSS through UART to program the
configuration and control parameters of the motor.
Once the configuration and control parameters are programmed, it enables the PWM generation in the
fabric. The fabric generates an interrupt to the ACE to sample the current values; after the sampling is
done, the ACE generates an interrupt to the MSS. The MSS collects the current samples and then
communicates it with the fabric to derive the actual motor speed in RPMs. After this, the speed error
(Desired speed - Actual speed) is calculated and the error is programmed to the FPGA fabric. At that
point, the FPGA fabric controls the motor.

Revision 0

13

Design and Implementation

S tart

1. M S S Initializations
2. B LD C M otor Initializations

C om m unication
w ith host
through U A R T

GUI
R unning on
H ost
If C onfiguration is done
Or
C hange in configuration

C onfigure and enable the m otor


C losed loop controller functions
are executed upon Interrupt from
ACE
Interrupt from F P G A fabric ,
indicate the sam plex signal
to start the A D C sam pling

Interrupt from A C E upon


sam pling of currents
(occurs once in every
P W M cycle )

A C E is start/restart for
sam pling the phase currents

1. P hase currents are read from A C E


2. A ngle estim ation is done using H A LL w ith
interpolation
3. S peed value from F P G A fabric is
converted to R P M
4. P I Controller is called( E rror is calculated
and the error is passed to F P G A fabric)

Figure 2-3 Control and Monitoring Algorithm Implementation


Table 2-2 shows the details of the functions implemented in the MSS.
Table 2-2 Modules Implemented in MSS
S.No

14

Function

Description

init_system()

This function initializes the different peripherals of the MSS.

bldc_sine_comm_init()

This function initializes the PWM block, PI controller in fabric, and some of
the variables in the MSS.

process_uart_data()

This function communicates with the graphical user interface (GUI) running
on the host PC and decodes all the parameters and configures the different
sections of the algorithm.

ACE_PC0_Flag0_IRQHandle() This is the ISR, mapped to the ACE, which indicates completion of the
current sampling. This interrupt handler is invoked upon the occurrence of
Interrupt from the ACE. The sampling sequence to sample the current is
invoked for every PWM frequency and thus the ACE interrupt occurs at
PWM frequency. In this routine the motor currents are sampled and
translated to the original values. The speed measurement is read from the
fabric and the actual speed in terms of RPM is calculated. The speed error
(Desired speed Actual speed) is calculated and the same will be
programmed to the PI controller in the FPGA fabric.

R e visio n 0

Speed Control of Brushless DC Motors-Sinusoidal Commutation with Hall Sensors


Table 2-2 Modules Implemented in MSS (continued)
5

GPIO7_IRQHandler()

This is the ISR, mapped to the GPIO 7, which indicates start of the current
sampling. This occurs once in every PWM cycle. In this function the ACE is
restarted for current sampling.

angle_estimation()

This implements the angle estimation logic using HALL and Interpolation
technique. The angles for all three phases are derived and the
corresponding sine values are programmed to the sine commutation logic in
the FPGA fabric. The SVPWM logic is implemented in the FPGA fabric, the
min and max identification among the above mentioned three phases will be
programmed to FPGA fabric.
Min Max register definition:
max_min_reg[1:0] = 01---> Phase A has minimum value
max_min_reg[1:0] = 10---> Phase B has minimum value
max_min_reg[1:0] = 11---> Phase C has minimum value
max_min_reg[3:2] = 01---> Phase A has maximum value
max_min_reg[3:2] = 10---> Phase B has maximum value
max_min_reg[3:2] = 11---> Phase C has maximum value
Programming max_min_reg[3:0] to value 0 will enable sine PWM (SPWM).
This can be done using small modifications in this function.

PIControllerSpeed
(int32_t reference, int32_t act)

This function takes the reference speed and actual speed of the motor as
inputs and calculates the error. The error is programmed to PI controller in
the FPGA fabric. This function also integrates the ramp up, ramp down
profile for motor start, stop, and direction change based on the ramp profile
enable selection. In some of the applications, a soft start/stop or acceleration
of the motor is required. The reference speed is incremented or
decremented until the required speed reference is reached at the rate of the
ramp up speed specified or configured. However, the functionality can be
disabled if required.
The speed end reference is incremented or decremented based on the ramp
rate you specify until the set reference speed is reached and the flag
increment_speed is cleared with the value 0. As this function is called at
every PWM period, the variable g_ramp_counter is incremented by 1 and
compared with the g_ramp_count. Whenever the g-ramp-counter value
exceeds the g_ramp_count, the flag increment_speed is set to 1.

speed_cal_hall()

This function reads the number of system clocks between six consecutive
HALL events and calculates the actual motor speed in RPM.

Table 2-3 shows the macros defined in the bldc_sc.h file used to configure the different parameters of
the sinusoidal commutation algorithm.

Revision 0

15

Design and Implementation

Table 2-3 MACRO Definitions in bldc_sc.h File


S.No

Macro Name

Description

PWM_PERIOD_VAL

This value defines the PWM period. To set the PWM frequency as 20 KHz (50 s)
the value should be 3750 (50 * 10(- 6) * FPGA Frequency).

PWM_DEAD_TIME_VAL This value defines the dead time for inverter bridge. Now the value is ~ 1 s.

FAB_FEQ

This defines the frequency at which the FPGA logic is running.

IMAX

This is the maximum allowed current in Amperes that is used to derive the actual
phase currents.

PWM_FREQ_IN_US

This defines the PWM period in micro seconds.

HALL_001

These define the HALL pattern.

HALL_010
HALL_011
HALL_100
HALL_101
HALL_110
7

HALL_010_ELE_ANGL
HALL_110_ELE_ANGL
HALL_100_ELE_ANGL

These values define the electrical angles corresponding to the HALL events.
These values need to be identified and set to appropriate values for different
motors.

HALL_101_ELE_ANGL
HALL_001_ELE_ANGL
HALL_011_ELE_ANGL
Table 2-4 shows the address mapping for different parameters in the FPGA fabric.
Table 2-4 Parameter Address Mapping in FPGA Fabric
S.No

16

Register Name

Register
Address

Description

PWM_PERIOD_REG_ADDR

0x40050000UL This defines the address of the PWM period register.

PHASEA_THETA_REG_ADDR

0x40050004UL This defines the address of the Phase A angle.

PHASEB_THETA_REG_ADDR

0x40050008UL This defines the address of the Phase B angle.

PHASEC_THETA_REG_ADDR

0x4005000CUL This defines the address of the Phase C angle.

PWM_DEAD_TIME_REG_ADDR 0x40050010UL This defines the address of the Dead time register.

PWM_EN_REG_ADDR

0x40050014UL This defines the address of the PWM enable/disable


register.

HALL_REG_ADDR

0x40050018UL This defines the address of the HALL pattern register.

HALL_SPEED_VAL_REG_ADD
R

0x4005001CUL This defines the address of the Motor speed register.

PI_KI_REG_ADDR

0x40050034UL This defines the address of the KI register of the PI


controller.

10

PI_KP_REG_ADDR

0x40050038UL This defines the address of the KP register of the PI


controller.

R e visio n 0

Speed Control of Brushless DC Motors-Sinusoidal Commutation with Hall Sensors


Table 2-4 Parameter Address Mapping in FPGA Fabric (continued)
11

PI_ERROR_REG_ADDR

0x4005003CUL This defines the address of the error (Desired speed


Actual speed) register of the PI controller.

12

PI_RESULT_REG_ADDR

0x40050040UL This defines the address of the result register of the PI


controller.

Performance Details
Table 2-5 shows the software and FPGA performance details.
Table 2-5 Performance Details of Sinusoidal Commutation Algorithm in A2F200 Device
S.No

Parameter

Description

Code size

~ 61 KB

MSS frequency

75 MHz

PWM frequency

20 KHz

Total operation time for


sinusoidal commutation in MSS

FPGA operating frequency

Resource Utilizations

~21 s (which is 42% of PWM period)


75 MHz
4302 Core tiles (which is 92% of A2F200)

Revision 0

17

3 Hardware Configuration and Setup Details


This demonstration design is developed for using the SmartFusion Evaluation Kit Board with an A2F200
SmartFusion cSoC device. The project needs to be recompiled for any new version of the kit with the
A2F500 device accordingly.

Programming the Kit


1. Connect both USB cables to the evaluation board and verify that LEDs D11, D15, and LED1 turn
on.
2. Launch FlashPro v10.0 or later.

Figure 3-1 FlashPro Tool


3. Click New Project or from the File menu, choose New Project.
4. From the New Project dialog box, type SF_DMC in the Project Name field.
5. Set the Project Location to: C:\Microsemi\SF_DMC_BLDC_SC.

Revision 0

19

Hardware Configuration and Setup Details

Figure 3-2 New Project Creation in FlashPro


6. Set the Programming mode as Single device.
7. Click OK. The FlashPro GUI displays.
8. Download this file and place it in C:\Microsemi\SF_DMC_BLDC_SC
www.microsemi.com/soc/download/rsc/?f=A2F200_Sinusoidal_Commutation_PF
9. Click Configure Device and browse to the STAPL file
C:\Microsemi\SF_DMC\A2F200_kit_demo_Sinusoidal_commutation.stp
10. Click Program to write to the device.

20

R e visio n 0

Speed Control of Brushless DC Motors-Sinusoidal Commutation with Hall Sensors


11. Once the programming has been successful, then Figure 3-3 is displayed.

Figure 3-3 End of Programming in FlashPro


12. Unplug both USB cables from the SmartFusion Evaluation Kit Board.

Revision 0

21

Hardware Configuration and Setup Details

Connection of the SmartFusion Evaluation/Development Kit


Board With the Trinamic Kit
While using the SmartFusion Development Kit Board, connect the TMCM-AC-840 Daughter Board to J21
(Mixed Signal Header) via the H3 board-to-board connector.
Note: Switch off all power supplies while connecting/disconnecting the SmartFusion
Development/Evaluation Kit Board from the TMCM-AC-840 Daughter Board. There will be a small
air gap remaining between the SmartFusion Development/Evaluation Kit Board and Trinamics
daughter board as shown in Figure 3-4.

Figure 3-4 H3 Board Connector Interface to SmartFusion Kit

22

R e visio n 0

Speed Control of Brushless DC Motors-Sinusoidal Commutation with Hall Sensors

Connections for Programming the Kit


Programming with SmartFusion Development Kit
1. Connect both USB cables supplied with the kit to J9 and J15 LCPS interface via the LC
programmer board.
2. Connect 5 V power supply to J1.

Programming with SmartFusion Evaluation Kit


Connect both USB cables supplied with the kit to the USB/UART interface and the USB program and
debug interface.

Connection of BLDC Motor with Trinamic Kit


Switch off all power supplies when connecting or disconnecting any motor to/from the TMCM-AC-840
Daughter Board. Connect the supplied BLDC Motor to the 3 pole motor connector H1 (UVW).
Additionally, Hall Sensor signals can be connected to the 5 pole Hall signals connector H4 (+5 V, GND,
H1, H2, H3). For an example refer to Figure 3-5.

Figure 3-5 Connecting BLDC Motor with Trinamic Kit

Revision 0

23

Hardware Configuration and Setup Details

Motor Wiring Details


Watch the printed information next to the motor connectors on the board. Connect the motor wires
accordingly.
Table 3-1 Motor Wiring Details
Cable Type 1

Gauge

Function

Red

UL1007 AWG 26

VCC Hall Sensor +5 VDC to +24 VDC

Blue

UL1007 AWG 26

Hall A

Green

UL1007 AWG 26

Hall B

White

UL1007 AWG 26

Hall C

Black

UL1007 AWG 26

GND Hall Sensor Ground

Yellow

UL1007 AWG 20

Phase U

Red

UL1007 AWG 20

Phase V

Black

UL1007 AWG 20

Phase W

Power Supply Connection


Use the H2 connector in TMCM-AC-840 Daughter Board for the power supply and the driver supports up
to 48 V for VM603 (BLDC driver).

Figure 3-6 BLDC Driver Power Supply Connector


This kit comes with the following power supply adaptor and is safe to operate the motor under no-load
conditions only.
Note: Any testing carried out with load may cause damage to the power adaptor as it has 1A max current
limitation.

24

R e visio n 0

Speed Control of Brushless DC Motors-Sinusoidal Commutation with Hall Sensors

Dehner Elektronik SYS 1357-2424 Supply, 24 V/DC/1000 mA

Manufactured by Sunny Computer Technology Europe

Input 100 - 240 V, 1.0 A max., 50 Hz

Output +24 VDC, 1 A, 24W max

For higher current ratings (loaded conditions) DC external regulated power supply can be used and the
BLDC driver can support for the maximum voltage of 48 V and 4A. For power supply connection refer to
Figure 3-7.

Figure 3-7 Power Supply Connection

Revision 0

25

4 User Interface
1. Identify your COM port for the USB to UART Bridge in Device Manager.

Figure 4-1 COM Port Identification


2. Figure 4-2 displays the GUI for Sinusoidal commutation of BLDC Motor.

Figure 4-2 Motor Control GUI Interface

Revision 0

27

User Interface
3. Make sure that the following options are selected in Figure 4-2 on page 27:

28

Select the correct COM port as specified in the Device Manager and set the Baud Rate to
57600.

Click Connect to establish connection with the COM port. The GUI is programmed with the
default configurations to run the default motor (QBL4208-41-04-006) that comes with the kit
without any additional configurations.

Motor Configuration: KI and KP constants Configuration (Default KI = 30; KP = 5). For


default motor: 8 poles. Refer the motor datasheet for configuring the number of poles. Any
wrong configuration of number of poles will affect the actual speed calculation and the closed
loop operation.

Speed Configuration: Typically the value should be between 500 and 5000 RPM. For default
motor, the desired speed is 3000 RPM.

Speed Ramp Configuration: (Default = Enabled, default value = 500): The default value of
ramp up rate is 500 RPM/s. The maximum value should be less than desired speed. Minimum
value should be greater than zero. Higher the RAMP value, lesser is the time to reach the
desired speed.

Direction Control: Clockwise (CW) or Counter-Clockwise (CCW) rotation

Direction Profile: Stop and Start or Immediate

Inverter: (Default = Enabled)

Speed Lock: (Default = Enabled)

R e visio n 0

5 Conclusion
This users guide uses the features of SmartFusion cSoC FPGAs to develop an effective motor control
demo by partitioning the algorithms and implementing it in MSS and fabric effectively. Having the
functional blocks in fabric, the CPU is offloaded and the MSS can perform any other system level
operations. This Sinusoidal commutation application has all the control functions implemented in fabric
and MSS made to perform only control and monitoring functions.

Revision 0

29

A Product Support
The Microsemi SoC Products Group backs its products with various support services, including
Customer Service, Customer Technical Support Center, a website, electronic mail, and worldwide sales
offices. This appendix contains information about contacting Microsemi SoC Products Group and using
these support services.

Customer Service
Contact Customer Service for non-technical product support, such as product pricing, product upgrades,
update information, order status, and authorization.
From North America, call 800.262.1060
From the rest of the world, call 650.318.4460
Fax, from anywhere in the world, 408.643.6913

Customer Technical Support Center


Microsemi SoC Products Group staffs its Customer Technical Support Center with highly skilled
engineers who can help answer your hardware, software, and design questions about Microsemi SoC
Products. The Customer Technical Support Center spends a great deal of time creating application
notes, answers to common design cycle questions, documentation of known issues, and various FAQs.
So, before you contact us, please visit our online resources. It is very likely we have already answered
your questions.

Technical Support
Visit the Customer Support website (www.microsemi.com/soc/support/search/default.aspx) for more
information and support. Many answers available on the searchable web resource include diagrams,
illustrations, and links to other resources on the website.

Website
You can browse a variety of technical and non-technical information on the SoC home page, at
www.microsemi.com/soc.

Contacting the Customer Technical Support Center


Highly skilled engineers staff the Technical Support Center. The Technical Support Center can be
contacted by email or through the Microsemi SoC Products Group website.

Email
You can communicate your technical questions to our email address and receive answers back by email,
fax, or phone. Also, if you have design problems, you can email your design files to receive assistance.
We constantly monitor the email account throughout the day. When sending your request to us, please
be sure to include your full name, company name, and your contact information for efficient processing of
your request.
The technical support email address is soc_tech@microsemi.com.

Revision 0

31

Product Support

My Cases
Microsemi SoC Products Group customers may submit and track technical cases online by going to My
Cases.

Outside the U.S.


Customers needing assistance outside the US time zones can either contact technical support via email
(soc_tech@microsemi.com) or contact a local sales office. Sales office listings can be found at
www.microsemi.com/soc/company/contact/default.aspx.

ITAR Technical Support


For technical support on RH and RT FPGAs that are regulated by International Traffic in Arms
Regulations (ITAR), contact us via soc_tech_itar@microsemi.com. Alternatively, within My Cases, select
Yes in the ITAR drop-down list. For a complete list of ITAR-regulated Microsemi FPGAs, visit the ITAR
web page.

32

R e visio n 0

Microsemi Corporation (NASDAQ: MSCC) offers a comprehensive portfolio of semiconductor


solutions for: aerospace, defense and security; enterprise and communications; and industrial
and alternative energy markets. Products include high-performance, high-reliability analog
and RF devices, mixed signal and RF integrated circuits, customizable SoCs, FPGAs, and
complete subsystems. Microsemi is headquartered in Aliso Viejo, Calif. Learn more at
www.microsemi.com.
Microsemi Corporate Headquarters
One Enterprise, Aliso Viejo CA 92656 USA
Within the USA: +1 (949) 380-6100
Sales: +1 (949) 380-6136
Fax: +1 (949) 215-4996

2012 Microsemi Corporation. All rights reserved. Microsemi and the Microsemi logo are trademarks of
Microsemi Corporation. All other trademarks and service marks are the property of their respective owners.
50200322-0/06.12

You might also like