+ All Categories
Home > Documents > Sinusoidal Commutation With HALL UG

Sinusoidal Commutation With HALL UG

Date post: 06-Oct-2015
Category:
Upload: vishnu
View: 39 times
Download: 2 times
Share this document with a friend
Description:
Microsemi® offers a simple, low-cost way to try the SmartFusion® products for the development of motorcontrol application. The SmartFusion customizable system-on-chip (cSoC) field programmable gatearray (FPGA) devices contain a hard embedded microcontroller subsystem (MSS), programmableanalog 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 thedevelopment of motor drives and control, power supply regulators, solar inverters etc. With a fabricbasedmotor controller, the designers have the advantage
Popular Tags:

of 34

Transcript
  • Speed Control of Brushless DC Motors-Sinusoidal Commutation with Hall

    SensorsUsers Guide

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

    Revision 0 2

    Table of Contents

    Introduction . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 3Reference Documents . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 4

    1 Brushless DC Motor Control Theory . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 5Sinusoidal Commutation with Hall Sensor Inputs . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 6

    2 Design and Implementation . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 11Hardware Implementation . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 11Software Implementation . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 13Performance Details . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 17

    3 Hardware Configuration and Setup Details . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 19Programming the Kit . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 19Connection of the SmartFusion Evaluation/Development Kit Board With the Trinamic Kit . . . . . . . . . . . . . . . . . . 22Connections for Programming the Kit . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 23Connection of BLDC Motor with Trinamic Kit . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 23Power Supply Connection . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 24

    4 User Interface. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 27

    5 Conclusion . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 29

    A Product Support . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 31Customer Service . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 31Customer Technical Support Center . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 31Technical Support . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 31Website . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 31Contacting the Customer Technical Support Center . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 31ITAR Technical Support . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 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 fabric-based 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 3

  • IntroductionReference Documents1. 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-AC-840_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)4 Revision 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.

    Figure 1-1 Trapezoidal BEMF Waveform

    Phase A

    Phase B

    Phase C

    0 60 120 180 240 300 360

    Electrical degreesRevision 0 5

  • Brushless DC Motor Control TheorySinusoidal 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.

    Figure 1-2 Sinusoidal BEMF Waveform

    Phase A

    Phase B

    Phase C

    0 60 120 190 240 300 360

    Electrical degrees

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

    270

    90

    150

    010

    011

    100

    101

    100

    WCC

    110

    210 330

    306 Revision 0

  • Speed Control of Brushless DC Motors-Sinusoidal Commutation with Hall SensorsThe 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.

    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-1The 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 StateThe 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 GenerationThe 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

    Figure 1-4 PWM Cycle Counts Between Two Hall Event Change

    Hall Event ( n -1) Hall Event (n)

    PWM cycle countsRevision 0 7

  • Brushless DC Motor Control TheoryWhere,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.

    SVPWM GenerationThe 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-7Where 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-10The final space vector voltage waveforms are shown in Figure 1-6.

    Figure 1-5 Sinusoidal Voltage Waveforms

    Phase A Phase B Phase C

    Figure 1-6 Space Vector Voltage Waveforms

    VoltageCnewVoltageAnew VoltageBnew8 Revision 0

  • Speed Control of Brushless DC Motors-Sinusoidal Commutation with Hall SensorsSpeed Control of Brushless DC MotorThe 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 ControlIn 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.

    Closed Loop Speed ControlIn 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.

    Figure 1-7 Open Loop Speed Control

    DutyCycle Calculation

    Commutation Logic

    BLDC

    Hall Signal

    SpeedReference DutyCycle PWM Inverter

    Bridge

    Figure 1-8 Closed Loop Speed Control

    PI Controller Commutation LogicBLDC

    Hall Signal

    SpeedReference DutyCycle PWM Inverter

    Bridge Error

    SpeedActual

    SpeedCalculation

    +_Revision 0 9

  • Brushless DC Motor Control TheoryPI ControllerThe 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.

    The duty cycle output from the PI controller is given in continuous time domain as:

    DutyCycle = KP*error + KI* error dtEQ 1-11

    where, KP: Proportional GainKI: Integral Gainerror: Difference in Reference in speed with Actual speedDutyCycle: 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-13where, KP: Proportional GainKI: Integral Gaine(k): Difference in Reference in speed with Actual speedYn (k+1): Current computed duty cycleyn (k+1): Current integrated error termyn (k): Previously integrated error term

    Figure 1-9 Proportional-Integral Controller

    Reference Speed Error +_

    ++

    Proportional Gain

    Integral Gain

    Integrator

    Ymax

    Ymin

    DutyCycle10 Revision 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.

    Hardware ImplementationThe 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.

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

    Reference Speed

    (End User) Start

    EndReference

    Speed PI Controller

    Speed Calculation

    Hall Pattern Detection

    Angle Calculation

    Sine Commutation

    HALL Logic

    Trinamic Board

    BLDCMotor

    HALL 1

    HALL 2

    HALL 3

    HALL 1

    HALL 2

    HALL 3

    +-

    Ramp Function

    Block Implemented in Fabric

    Block Implemented in MSS

    Inverter BridgeRevision 0 11

  • Design and ImplementationThe 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.

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

    S tart

    APB Interface (C om m unication

    w ith M 3 processor through F IC )

    Cortex- M 3 Processor

    If PW M G eneration is enabled

    G eneration of PW M tick P I C ontroller

    If P I Controller is enabled

    S inusoidal com m utation logic

    M agnitudeAngle

    PW M

    PW M com pare m atch

    PW M O n tim e values

    PW M com plem entary signal generation using D ead tim e

    3 H igh side PW M signals3 Low side PW M S ignalsTo Inverter bridge

    Speed calculation using H ALL

    H ALL from M otor

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

    Table 2-1 Modules Implemented in FPGA Fabric

    S.No Module Name Description

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

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

    3 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.

    4 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.12 Revision 0

  • Speed Control of Brushless DC Motors-Sinusoidal Commutation with Hall SensorsSoftware ImplementationThe 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.

    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.

    6 pwm_comp.vhd This module generates the complementary signals for low side switches.

    7 hall_sync.vhd This module synchronizes the HALL signals and generates the HALL pattern.

    8 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).

    Table 2-1 Modules Implemented in FPGA Fabric (continued)Revision 0 13

  • Design and ImplementationTable 2-2 shows the details of the functions implemented in the MSS.

    Figure 2-3 Control and Monitoring Algorithm Implementation

    S tart

    1. M SS Initia lizations 2. BLD C M otor Initia lizations

    C om m unication w ith host

    through U AR T

    G U I R unning on

    H ost

    If C onfiguration is doneO r

    C hange in configuration

    C onfigure and enable the m otorC losed loop controller functions are executed upon Interrupt from AC E

    Interrupt from AC E upon sam pling of currents

    (occurs once in every PW M cycle )

    1. Phase currents are read from AC E2. Angle estim ation is done using H ALL w ith

    interpolation3. Speed value from FPG A fabric is

    converted to R PM

    4. P I Controller is called ( E rror is calculated and the error is passed to FPG A fabric)

    Interrupt from FPG A fabric , indicate the sam plex signal to start the AD C sam pling AC E is start/restart for

    sam pling the phase currents

    Table 2-2 Modules Implemented in MSS

    S.No Function Description

    1 init_system() This function initializes the different peripherals of the MSS.

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

    3 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.

    4 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.14 Revision 0

  • Speed Control of Brushless DC Motors-Sinusoidal Commutation with Hall SensorsTable 2-3 shows the macros defined in the bldc_sc.h file used to configure the different parameters of the sinusoidal commutation algorithm.

    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.

    6 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 valuemax_min_reg[1:0] = 10---> Phase B has minimum valuemax_min_reg[1:0] = 11---> Phase C has minimum value

    max_min_reg[3:2] = 01---> Phase A has maximum valuemax_min_reg[3:2] = 10---> Phase B has maximum valuemax_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.

    7 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.

    8 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-2 Modules Implemented in MSS (continued)Revision 0 15

  • Design and ImplementationTable 2-4 shows the address mapping for different parameters in the FPGA fabric.

    Table 2-3 MACRO Definitions in bldc_sc.h File

    S.No Macro Name Description

    1 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).

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

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

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

    5 PWM_FREQ_IN_US This defines the PWM period in micro seconds.

    6 HALL_001HALL_010HALL_011HALL_100HALL_101HALL_110

    These define the HALL pattern.

    7 HALL_010_ELE_ANGLHALL_110_ELE_ANGLHALL_100_ELE_ANGLHALL_101_ELE_ANGLHALL_001_ELE_ANGLHALL_011_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.

    Table 2-4 Parameter Address Mapping in FPGA Fabric

    S.No Register NameRegister Address Description

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

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

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

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

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

    6 PWM_EN_REG_ADDR 0x40050014UL This defines the address of the PWM enable/disable register.

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

    8 HALL_SPEED_VAL_REG_ADDR

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

    9 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.16 Revision 0

  • Speed Control of Brushless DC Motors-Sinusoidal Commutation with Hall SensorsPerformance DetailsTable 2-5 shows the software and FPGA performance details.

    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.

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

    Table 2-5 Performance Details of Sinusoidal Commutation Algorithm in A2F200 Device

    S.No Parameter Description

    1 Code size ~ 61 KB

    2 MSS frequency 75 MHz

    3 PWM frequency 20 KHz

    4 Total operation time for sinusoidal commutation in MSS

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

    5 FPGA operating frequency 75 MHz

    6 Resource Utilizations 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 Kit1. 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.

    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.

    Figure 3-1 FlashPro ToolRevision 0 19

  • Hardware Configuration and Setup Details6. 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.stp10. Click Program to write to the device.

    Figure 3-2 New Project Creation in FlashPro20 Revision 0

  • Speed Control of Brushless DC Motors-Sinusoidal Commutation with Hall Sensors11. Once the programming has been successful, then Figure 3-3 is displayed.

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

    Figure 3-3 End of Programming in FlashProRevision 0 21

  • Hardware Configuration and Setup DetailsConnection 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 Kit22 Revision 0

  • Speed Control of Brushless DC Motors-Sinusoidal Commutation with Hall SensorsConnections for Programming the Kit

    Programming with SmartFusion Development Kit1. 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 KitConnect 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 KitSwitch 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 KitRevision 0 23

  • Hardware Configuration and Setup DetailsMotor Wiring DetailsWatch the printed information next to the motor connectors on the board. Connect the motor wires accordingly.

    Power Supply ConnectionUse 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).

    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.

    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

    Figure 3-6 BLDC Driver Power Supply Connector24 Revision 0

  • Speed Control of Brushless DC Motors-Sinusoidal Commutation with Hall SensorsDehner 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 ConnectionRevision 0 25

  • 4 User Interface

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

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

    Figure 4-1 COM Port Identification

    Figure 4-2 Motor Control GUI InterfaceRevision 0 27

  • User Interface3. Make sure that the following options are selected in Figure 4-2 on page 27: 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)28 Revision 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, includingCustomer Service, Customer Technical Support Center, a website, electronic mail, and worldwide salesoffices. This appendix contains information about contacting Microsemi SoC Products Group and usingthese support services.

    Customer ServiceContact 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.1060From the rest of the world, call 650.318.4460Fax, from anywhere in the world, 408.643.6913

    Customer Technical Support CenterMicrosemi SoC Products Group staffs its Customer Technical Support Center with highly skilledengineers who can help answer your hardware, software, and design questions about Microsemi SoCProducts. The Customer Technical Support Center spends a great deal of time creating applicationnotes, 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 answeredyour questions.

    Technical SupportVisit 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.

    WebsiteYou 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 CenterHighly skilled engineers staff the Technical Support Center. The Technical Support Center can becontacted by email or through the Microsemi SoC Products Group website.

    EmailYou 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, pleasebe sure to include your full name, company name, and your contact information for efficient processing ofyour request.The technical support email address is [email protected] 0 31

  • Product SupportMy CasesMicrosemi 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([email protected]) or contact a local sales office. Sales office listings can be found atwww.microsemi.com/soc/company/contact/default.aspx.

    ITAR Technical SupportFor technical support on RH and RT FPGAs that are regulated by International Traffic in Arms Regulations (ITAR), contact us via [email protected]. 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 Revision 0

  • 50200322-0/06.12

    2012 Microsemi Corporation. All rights reserved. Microsemi and the Microsemi logo are trademarks ofMicrosemi Corporation. All other trademarks and service marks are the property of their respective owners.

    Microsemi Corporation (NASDAQ: MSCC) offers a comprehensive portfolio of semiconductorsolutions for: aerospace, defense and security; enterprise and communications; and industrialand alternative energy markets. Products include high-performance, high-reliability analogand RF devices, mixed signal and RF integrated circuits, customizable SoCs, FPGAs, andcomplete subsystems. Microsemi is headquartered in Aliso Viejo, Calif. Learn more atwww.microsemi.com.

    Microsemi Corporate HeadquartersOne Enterprise, Aliso Viejo CA 92656 USAWithin the USA: +1 (949) 380-6100Sales: +1 (949) 380-6136Fax: +1 (949) 215-4996

    IntroductionReference Documents

    1 Brushless DC Motor Control TheorySinusoidal Commutation with Hall Sensor InputsAngle Estimation using Hall Sensor StateSpeed Calculation using Hall StateSinusoidal Voltage GenerationSVPWM GenerationSpeed Control of Brushless DC Motor

    2 Design and ImplementationHardware ImplementationSoftware ImplementationPerformance Details

    3 Hardware Configuration and Setup DetailsProgramming the KitConnection of the SmartFusion Evaluation/Development Kit Board With the Trinamic KitConnections for Programming the KitProgramming with SmartFusion Development KitProgramming with SmartFusion Evaluation Kit

    Connection of BLDC Motor with Trinamic KitMotor Wiring Details

    Power Supply Connection

    4 User Interface5 ConclusionA Product SupportCustomer ServiceCustomer Technical Support CenterTechnical SupportWebsiteContacting the Customer Technical Support CenterEmailMy CasesOutside the U.S.

    ITAR Technical Support


Recommended