85
1 / 85 ABOV Semiconductor 3-Shunt FOC Library 32-bit M-Series Rev. 1.00 Oct. 8, 2019 For additional information or inquiry, please contact ABOV Semiconductor or visit its website at www.abov.co.kr. Leader of Microcontroller Technology Global Top Smart MCU Innovation Company

3-Shunt FOC Library

  • Upload
    others

  • View
    2

  • Download
    0

Embed Size (px)

Citation preview

Page 1: 3-Shunt FOC Library

1 / 85

ABOV Semiconductor

3-Shunt FOC Library

32-bit M-Series

Rev. 1.00 Oct. 8, 2019

For additional information or inquiry, please contact ABOV Semiconductor or visit its website at www.abov.co.kr.

Leader of Microcontroller Technology

Global Top Smart MCU Innovation Company

Page 2: 3-Shunt FOC Library

2 / 85

2 / 85

ABOV Semiconductor

Copyright Information

Copyright Information

The content of this document is subject to change without prior notice.

This document is intended to illustrate how to apply our product, and ABOV Semiconductor is

not responsible for any copyright or patent infringement of third parties relating to the use of this

product due to this document. This document does not contain any information on the

proprietary rights of ABOV Semiconductor or of any other third party.

This product is intended to be used for general electronic devices, including office machines,

communication devices, measuring devices, and household appliances.

Please consult ABOV Semiconductor if this product is used for high-performance, high-

reliability, or safety-critical applications, such as nuclear energy control, spaceflight/aviation,

traffic signals, combustion control, and various safety equipment. We do not hold responsible

for any damages caused by products developed without consulting us in advance.

Copyright © 2019 ABOV Semiconductor Co., Ltd.

Page 3: 3-Shunt FOC Library

3 / 85

ABOV Semiconductor

Revision History

Revision History

Date Version Description

Oct. 8, 2019 1.00 Document created.

Page 4: 3-Shunt FOC Library

4 / 85

4 / 85

ABOV Semiconductor

Contents

Contents

OVERVIEW ................................................................................................................................. 10

INTRODUCTION ....................................................................................................................................... 11

ARCHITECTURE ....................................................................................................................................... 12

COMPATIBLE MCUS ................................................................................................................................ 13

GETTING STARTED .................................................................................................................................. 14

KEIL................................................................................................................................................ 14

IAR ................................................................................................................................................. 19

MDL (MOTOR DRIVER LAYER) ............................................................................................... 22

OVERVIEW .............................................................................................................................................. 23

DESCRIPTION OF FUNCTIONS ................................................................................................................... 24

MPWMn_IRQHandler .................................................................................................................... 24

MDL_ADC_Init ............................................................................................................................... 24

MDL_ADC_GetShunt ..................................................................................................................... 25

MDL_ADC_GetVDCLink ................................................................................................................ 25

MDL_ADC_GetIPMTemp............................................................................................................... 26

MDL_ADC_ResetDMA................................................................................................................... 26

MDL_MPWM_Init ........................................................................................................................... 26

MDL_MPWM_GetStatus ................................................................................................................ 27

MDL_MPWM_ClearStatus ............................................................................................................. 27

MDL_MPWM_SetHalfDuty ......................................................................................................... 28

MDL_MPWM_SetDuty ................................................................................................................ 28

MDL_MPWM_EnablePWM ........................................................................................................ 28

MDL_MPWM_DisablePWM ........................................................................................................ 29

MDL_PCU_Init ............................................................................................................................ 29

MDL_GPIO_CheckIPMFault ....................................................................................................... 29

MDL_DAC_Init ............................................................................................................................ 30

MDL_DAC_SetData .................................................................................................................... 31

MDL_UARTn_Init ........................................................................................................................ 32

MDL_UARTn_SendByte ............................................................................................................. 32

MDL_UARTn_CheckTxStatus .................................................................................................... 32

MDL_UARTn_ReceiveByte ........................................................................................................ 33

MDL_UARTn_CheckRxStatus .................................................................................................... 33

FAL (FOC ALGORITHM LAYER) .............................................................................................. 34

OVERVIEW .............................................................................................................................................. 35

DESCRIPTION OF FUNCTIONS ................................................................................................................... 37

Main Functions of FAL ................................................................................................................... 37

FAL_Init_variables ................................................................................................................... 37

FAL_SensorlessEstimator ....................................................................................................... 38

FAL_Align ................................................................................................................................ 39

FAL_Accelerate ....................................................................................................................... 40

FAL_SpeedControl .................................................................................................................. 41

FAL_CurrentControl ................................................................................................................ 42

FAL_SVPWM........................................................................................................................... 43

FAL_VoltageModulation_3Shunt ............................................................................................. 44

FAL_Check_OverCurrent ........................................................................................................ 45

FAL_Set_InitialPosition ........................................................................................................... 45

Page 5: 3-Shunt FOC Library

5 / 85

ABOV Semiconductor

Contents

FAL_ClarkeTrans .................................................................................................................... 46

FAL_InvClarkeTrans ................................................................................................................ 47

FAL_ParkTrans ....................................................................................................................... 48

FAL_InvParkTrans ................................................................................................................... 49

Calculation Functions ..................................................................................................................... 50

FAL_Sine_Q15 ........................................................................................................................ 50

FAL_Cosine_Q15 .................................................................................................................... 50

FAL_Cal_Vdc_Q14 .................................................................................................................. 50

Configuration Functions ................................................................................................................. 51

FAL_Set_op_mode .................................................................................................................. 51

FAL_Set_Bw_Daxis_CurrentCtrl ............................................................................................. 52

FAL_Set_Bw_Qaxis_CurrentCtrl ............................................................................................. 53

FAL_Set_Bw_EmfEstimator .................................................................................................... 54

FAL_Set_Bw_PLL ................................................................................................................... 55

FAL_Set_Flag15Ts .................................................................................................................. 55

FAL_Set_C15Ts_Qx ............................................................................................................... 56

Read Functions .............................................................................................................................. 57

FAL_Get_op_mode ................................................................................................................. 57

FAL_Get_Vout_Q14 ................................................................................................................ 57

FAL_Get_Flag15Ts ................................................................................................................. 58

FAL_Get_Acc_Theta_Q14 ...................................................................................................... 58

FAL_Get_Target_C15Ts_Qx ................................................................................................... 59

MAL (MOTOR APPLICATION LAYER)..................................................................................... 60

OVERVIEW .............................................................................................................................................. 61

DESCRIPTION OF FUNCTIONS ................................................................................................................... 62

MAL_MPWM_Handler ................................................................................................................... 62

MAL_MainLoop .............................................................................................................................. 62

MAL_InitVariables .......................................................................................................................... 62

MAL_WaitPowerStable .................................................................................................................. 62

MAL_UpdateADCOffset ................................................................................................................. 63

MAL_ChargeBootStrap .................................................................................................................. 63

MAL_OutputDAC ........................................................................................................................... 63

MAL_ProcessStandby.................................................................................................................... 63

MAL_ProcessAlign ......................................................................................................................... 63

MAL_ProcessAcceleration .......................................................................................................... 64

MAL_ProcessSensorless ............................................................................................................ 64

AFDT (ABOV FOC DEVELOPMENT TOOL) ............................................................................ 65

OVERVIEW .............................................................................................................................................. 66

1-SHUNT / 3-SHUNT SELECTION .............................................................................................................. 67

PARAMETER CONFIGURATION .................................................................................................................. 68

SAVE/LOAD ............................................................................................................................................ 69

Save ............................................................................................................................................... 69

Load ............................................................................................................................................... 70

EXPORT.................................................................................................................................................. 71

PARAMETER DESCRIPTION ...................................................................................................................... 73

Motor Parameter ............................................................................................................................ 73

Electrical Parameter ....................................................................................................................... 74

Align ............................................................................................................................................... 75

Acceleration ................................................................................................................................... 76

Estimator ........................................................................................................................................ 77

Page 6: 3-Shunt FOC Library

6 / 85

6 / 85

ABOV Semiconductor

Contents

Speed Controller ............................................................................................................................ 78

Current Controller ........................................................................................................................... 79

Flux Weakening ............................................................................................................................. 80

Software Overcurrent Level ........................................................................................................... 81

System ........................................................................................................................................ 81

MONITORING FUNCTION .......................................................................................................................... 82

Graph Area ..................................................................................................................................... 83

Control Area ................................................................................................................................... 85

Page 7: 3-Shunt FOC Library

7 / 85

ABOV Semiconductor

Contents

List of Figures

Figure 1.1 FOC Solution of ABOV ..................................................................................................................... 11

Figure 1.2 Layered architecture of ABOV library ............................................................................................... 12

Figure 1.3 Project folder .................................................................................................................................... 14

Figure 1.4 Project file ......................................................................................................................................... 14

Figure 1.5 KEIL project options ......................................................................................................................... 15

Figure 1.6 Project options – Debug tab ............................................................................................................. 15

Figure 1.7 Debugger configuration .................................................................................................................... 16

Figure 1.8 Debugger configuration – Flash Download tab ................................................................................ 17

Figure 1.9 Configuration of ABOV MCU Flash loader ....................................................................................... 17

Figure 1.10 Configuration of Flash loader upload path ..................................................................................... 18

Figure 1.11 IAR project folder ............................................................................................................................ 19

Figure 1.12 IAR project file ................................................................................................................................ 19

Figure 1.13 IAR project options ......................................................................................................................... 20

Figure 1.14 Designation of IAR linker configuration file .................................................................................... 20

Figure 1.15 IAR project debugger configuration ................................................................................................ 21

Figure 1.16 IAR project CMSIS-DAP configuration ........................................................................................... 21

Figure 3.1 Block diagram of the 3-Shunt FOC function ..................................................................................... 35

Figure 3.2 Flow chart of the 3-Shunt FOC algorithm ......................................................................................... 36

Figure 3.3 Block diagram of the Sensorless Estimator function ........................................................................ 38

Figure 3.4 Align configuration of aFDT .............................................................................................................. 39

Figure 3.5 U-phase current waveform ............................................................................................................... 39

Figure 3.6 Align configuration of aFDT .............................................................................................................. 40

Figure 3.7 U-phase current waveform ............................................................................................................... 40

Figure 3.8 Block diagram of the Speed Control function ................................................................................... 41

Figure 3.9 Block diagram of the Current Control function ................................................................................. 42

Figure 3.10 Block diagram of the SVPWM function .......................................................................................... 43

Figure 3.11 Block diagram of the Voltage Modulation function ......................................................................... 44

Figure 3.12 Block diagram of the Clarke Transformation function .................................................................... 46

Figure 3.13 Block diagram of the Inverse Clarke Transformation function ....................................................... 47

Figure 3.14 Block diagram of the Park Transformation function ....................................................................... 48

Figure 3.15 Block diagram of the Inverse Park Transformation function .......................................................... 49

Figure 3.16 Configuration of current controller bandwidth of aFDT .................................................................. 52

Figure 5.1 aFDT Communication Block Diagram .............................................................................................. 66

Figure 5.2 Selection page of FOC algorithms ................................................................................................... 67

Figure 5.3 Main page of the parameter generation ........................................................................................... 68

Figure 5.4 Popup for Save in aFDT ................................................................................................................... 69

Figure 5.5 CSV file opened in Notepad ............................................................................................................. 69

Figure 5.6 Popup for parameter generator loading ........................................................................................... 70

Figure 5.7 Popup for Export in aFDT <1> ......................................................................................................... 71

Figure 5.8 Popup for Load in aFDT <2> ............................................................................................................ 71

Figure 5.9 Header of a C file export .................................................................................................................. 72

Figure 5.10 Motor Parameter ............................................................................................................................ 73

Figure 5.11 Electrical Parameter ....................................................................................................................... 74

Figure 5.12 Align parameters ............................................................................................................................ 75

Figure 5.13 Acceleration parameters ................................................................................................................ 76

Figure 5.14 Estimator parameters ..................................................................................................................... 77

Figure 5.15 Speed Controller parameters ......................................................................................................... 78

Figure 5.16 Current Controller parameters........................................................................................................ 79

Page 8: 3-Shunt FOC Library

8 / 85

8 / 85

ABOV Semiconductor

Contents

Figure 5.17 Flux Weakening parameters .......................................................................................................... 80

Figure 5.18 Software Overcurrent Level parameter .......................................................................................... 81

Figure 5.19 System parameter .......................................................................................................................... 81

Figure 5.20 aFDT 모니터링 .............................................................................................................................. 82

Figure 5.21 Graph Area ..................................................................................................................................... 83

Figure 5.22 Control Area ................................................................................................................................... 85

Page 9: 3-Shunt FOC Library

9 / 85

ABOV Semiconductor

Contents

List of Tables

Table 1.1 Layers of the ABOV 1-Shunt FOC Library ........................................................................................ 12

Table 1.2 ABOV M Series MCUs ...................................................................................................................... 13

Table 5.1 Items in the header of a C file export ................................................................................................ 72

Table 5.2 Motor Parameter ................................................................................................................................ 73

Table 5.3 Electrical Parameter .......................................................................................................................... 74

Table 5.4 Align ................................................................................................................................................... 75

Table 5.5 Acceleration ....................................................................................................................................... 76

Table 5.6 Estimator............................................................................................................................................ 77

Table 5.7 Speed Controller ................................................................................................................................ 78

Table 5.8 Current Controller .............................................................................................................................. 79

Table 5.9 Flux Weakening ................................................................................................................................. 80

Table 5.10 Software Overcurrent Level ............................................................................................................. 81

Table 5.11 System ............................................................................................................................................. 81

Table 5.12 Graph control buttons ...................................................................................................................... 83

Table 5.13 Graph display mode ........................................................................................................................ 85

Page 10: 3-Shunt FOC Library

10 / 85

10 / 85

ABOV Semiconductor

Overview

Overview

Page 11: 3-Shunt FOC Library

11 / 85

ABOV Semiconductor

Overview

Introduction

This user’s manual targets application developers who use ABOV MCU based on 3-Shunt FOC

algorithm for their specific needs. It provides complete information of how to use ABOV 3-Shunt FOC

(Field Oriented Control) Library.

ABOV 3-Shunt FOC Library (hereafter the FOC library) is used when ABOV MCU based on 3-Shunt

FOC algorithm operates PMSM (Permanent Magnet Synchronous Motor). It is widely used to operate

not only compressors and fans of general household appliances, but also PMSMs in other applications.

Since this library is designed for use in FOC platform boards, if used in different types of boards, its

code needs to be modified. ABOV FOC solution includes a Windows GUI tool to allow developers to

modify the ABOV 3-Shunt FOC Library and its internal parameters easily.

Figure 1.1 FOC Solution of ABOV

Page 12: 3-Shunt FOC Library

12 / 85

12 / 85

ABOV Semiconductor

Overview

Architecture

The FOC library comprised of three layers.

Table 1.1 Layers of the ABOV 1-Shunt FOC Library

Layer Description

Motor Application

Layer The motor application layer excluding the FOC core algorithm.

FOC Algorithm Layer

(Locked) The FOC core algorithm layer. Internal code is not accessible.

Motor Driver Layer The MCU driver layer for peripheral controls.

Figure 1.2 Layered architecture of ABOV library

Because each layer of the FOC library is not released in code format, a software application is required

for internal parameter configuration.

aFDT (ABOV FOC Development Tool) provided by ABOV enables more intuitive and convenient

configuration of internal parameters than modification at code level. aFDT supports real-time monitoring

and tuning to allow developers to reduce time for motor tuning.

The FOC Library supports aFDT (ABOV FOC Development Tool) GUI.

MDL

Motor Driver Layer

FAL

FOC Algorithm Layer

MAL

Motor Application Layer

Page 13: 3-Shunt FOC Library

13 / 85

ABOV Semiconductor

Overview

Compatible MCUs

The FOC library supports AC33Mx128, AC33Mx064 and AC31M1x64 currently. It is under development

for A34M41x, and is updated regularly to support new motor ICs.

Table 1.2 ABOV M Series MCUs

Part No. A34M41x AC33Mx064 AC33Mx128

CPU Core Cortex-M4F Cortex-M3 Cortex-M3

Clock Speed 120MHz 48MHz 72MHz

Flash / SRAM 512+32KB / 64KB 64KB / 8KB 128KB / 12KB

Timer

16-bit x 10

32-bit FRT x 2

32-bit WDT

16-bit x 6

32-bit WDT

16-bit x 6

32-bit WDT

DMAC 8-ch 4-ch 15-ch

UART

SPI

I2C

6 / 3 / 2 2 / 1 / 1 4 / 2 / 2

3P Motor PWM 2 1 2

GPIO 107 44 64

Special Functions

CAN 2.0B

QEI x 2

PGA x 3

COMP x 4

- PGA x 4

COMP x 4

Others

IEC60730

CRC16

AES-128

IEC60730

CRC16

IEC60730

CRC16

ADC 12-bit 1.5Msps 12-bit 1.5Msps 12-bit 1.5Msps

Internal OSC 32MHz (±3%) 1MHz RingOSC 20MHz (±3%)

Analog IP POR/VDC/LVD POR/VDC/LVD POR/VDC/LVD

Op. Temp. -40 to +85℃ -40 to +85/105℃

Op.Voltage 2.2V to 5.5V 3.0V to 5.5V 3.0V to 5.5V

PKG

LQFP-120

LQFP-100

LQFP-64

LQFP-48

LQFP-32

LQFP-80

LQFP-64

Status MP MP MP

Applications

System Aircon

High speed FOC

IoT App.

Air Con.,

Refrigerator,

White goods

Air Con.

Compressor,

WashingM/C FOC

Page 14: 3-Shunt FOC Library

14 / 85

14 / 85

ABOV Semiconductor

Overview

Getting Started

KEIL

1). Copy *.FLM files in the folder ‘\Flashloader\KEIL’ and store them in the folder

‘C:\Keil_v5\ARM\Flash\’.

2). Go to ‘\Examples\Motor_Application\Keil’, and open your desired MCU folder.

Figure 1.3 Project folder

Figure 1.4 Project file

Page 15: 3-Shunt FOC Library

15 / 85

ABOV Semiconductor

Overview

3). Open the project file, and set up the Debugger as shown below.

Figure 1.5 KEIL project options

Figure 1.6 Project options – Debug tab

Page 16: 3-Shunt FOC Library

16 / 85

16 / 85

ABOV Semiconductor

Overview

Figure 1.7 Debugger configuration

Page 17: 3-Shunt FOC Library

17 / 85

ABOV Semiconductor

Overview

4). Set up the Flash Loader as shown below.

Figure 1.8 Debugger configuration – Flash Download tab

Figure 1.9 Configuration of ABOV MCU Flash loader

Page 18: 3-Shunt FOC Library

18 / 85

18 / 85

ABOV Semiconductor

Overview

Figure 1.10 Configuration of Flash loader upload path

Page 19: 3-Shunt FOC Library

19 / 85

ABOV Semiconductor

Overview

IAR

1). Copy ‘config’ folder in ‘\Flashloader\IAR’ and store it to ‘C:\Program Files (x86)\IAR Systems\Embedded

Workbench x.x\arm’ (IAR Workbench installation folder).

2). Go to \Examples\Motor_Application\IAR, and open your desired MCU folder.

Figure 1.11 IAR project folder

Figure 1.12 IAR project file

Page 20: 3-Shunt FOC Library

20 / 85

20 / 85

ABOV Semiconductor

Overview

3). Open the project file, and set up the project options as shown below.

Figure 1.13 IAR project options

Figure 1.14 Designation of IAR linker configuration file (requires change of default installation path)

Page 21: 3-Shunt FOC Library

21 / 85

ABOV Semiconductor

Overview

Figure 1.15 IAR project debugger configuration

Figure 1.16 IAR project CMSIS-DAP configuration

Page 22: 3-Shunt FOC Library

22 / 85

22 / 85

ABOV Semiconductor

MDL (Motor Driver Layer)

MDL (Motor Driver Layer)

Page 23: 3-Shunt FOC Library

23 / 85

ABOV Semiconductor

MDL (Motor Driver Layer)

Overview

Motor Driver Layer (MDL) is a layer where MCU drivers are located. It contains MCU-dependent code

and MCU-specific functions that initialize and control internal registers for motor driving.

MDL code specifies an MCU type to be used in a project, and thus it must be predefined in the project

option. The pre-definition in the project option follows a form of the followings:

__DEF_(product code)__

For instance, MDL code of AC33Mx128 series shows that ‘__DEF_AC33Mx128__’ is predefined in the

project option file and MDL code is placed between ‘#ifdef __DEF_AC33Mx128__’ and ‘#endif’.

MDL code of a desired MCU is automatically applied to compilation by selecting one among provided

project files because it is predefined in the project option file.

MDL consists of code for port configuration, MPWM block control, and ADC block control as well as code

for some registers’ configuration.

NOTE: MDL must be modified in accordance with an MCU pin mapping, if a motor control board is

changed.

Page 24: 3-Shunt FOC Library

24 / 85

24 / 85

ABOV Semiconductor

MDL (Motor Driver Layer)

Description of Functions

This section introduces basic functions of MDL. Examples in this section are based on AC33Mx064.

For more information, please refer to the source codes of ABOV 3-Shunt FOC Library.

MPWMn_IRQHandler

Name of Function MPWMn_IRQHandler (n = 0, 1, 2 …)

Argument void

Return Value void

Description This function configures MPWM interrupt handlers that is used in the FOC library.

First, it defines an MPWM interrupt handler to be used, and calls

MAL_MPWM_Handler in the defined handler.

Code Example // If an MPWM0 is used as a handler,

void MPWM0_IRQHandler(void)

{

#ifdef __DEF_AC33Mx064__

MAL_MPWM_Handler();

#endif

}

// If an MPWM1 is used as a handler,

void MPWM1_IRQHandler(void)

{

#ifdef __DEF_AC33Mx064__

MAL_MPWM_Handler();

#endif

}

MDL_ADC_Init

Name of Function MDL_ADC_Init

Argument void

Return Value void

Description This function initializes an ADC that is used in the FOC library.

If a board is changed, the code must be modified according to pin mapping.

Application Example

MDL_ADC_Init();

Page 25: 3-Shunt FOC Library

25 / 85

ABOV Semiconductor

MDL (Motor Driver Layer)

MDL_ADC_GetShunt

Name of Function MDL_ADC_GetShunt

Argument uint32_t Number Shunt Number

Return Value uint32_t 12-bit ADC result value

Description This function returns a value resulted from shunt resistor channel ADC based on the number.

It is used to read out voltage value of the corresponding shunt.

Code Example uint32_t MDL_ADC_GetShunt(uint32_t Number)

{

#if defined(__DEF_AC33Mx064__)

if (Number == 2) {

return (AD1->DR0 >> 4); // u

} else if (Number == 1) {

return (AD0->DR0 >> 4); // v

} else {

return 0;

}

#endif

}

Application Example

uint32_t Shunt_U;

Shunt_U = MDL_ADC_GetShunt(2);

MDL_ADC_GetVDCLink

Name of Function MDL_ADC_GetVDCLink

Argument void

Return Value uint32_t 12-bit ADC result value.

Description It is used to read VDC Link voltage value.

Code Example uint32_t MDL_ADC_GetVDCLink(void)

{

#if defined(__DEF_AC33Mx064__)

return (AD1->DR1 >> 4);

#endif

}

Application Example

uint32_t VDC_Link;

VDC_Link = MDL_ADC_GetVDCLink();

Page 26: 3-Shunt FOC Library

26 / 85

26 / 85

ABOV Semiconductor

MDL (Motor Driver Layer)

MDL_ADC_GetIPMTemp

Name of Function MDL_ADC_GetIPMTemp

Argument void

Return Value uint32_t 12-bit ADC result value.

Description It is used to read the voltage value associated with IPM Temperature.

If Discrete Elements are in use or there isn’t any function for over temperature detection in current IPM, the relevant source code needs to be modified accordingly.

Code Example uint32_t MDL_ADC_GetIPMTemp(void)

{

#if defined(__DEF_AC33Mx064__)

return (AD0->DR1 >> 4);

#endif

}

Application Example

uint32_t IPM_Temperature;

IPM_Temperature = MDL_ADC_GetIPMTemp();

MDL_ADC_ResetDMA

Name of Function MDL_ADC_ResetDMA

Argument void

Return Value void

Description This function conducts DMA reset, which is required to read ADC values.

This function is required only for AC33Mx128, and does not perform any action in other MCUs.

It is recommended not to modify this function.

Application Example

MDL_ADC_ResetDMA();

MDL_MPWM_Init

Name of Function MDL_MPWM_Init

Argument void

Return Value void

Description This function initializes the MPWM used in the FOC library.

If a board is changed, code modification according to pin mapping is required.

Application Example

MDL_MPWM_Init();

Page 27: 3-Shunt FOC Library

27 / 85

ABOV Semiconductor

MDL (Motor Driver Layer)

MDL_MPWM_GetStatus

Name of Function MDL_MPWM_GetStatus

Argument void

Return Value uint32_t Status register value of MPWM

Description This function returns the status register value of MPWM that is used in the FOC library.

Code Example // If an MPWM0 is used,

uint32_t MDL_MPWM_GetStatus(void)

{

return MP0->SR;

}

// If an MPWM1 is used,

uint32_t MDL_MPWM_GetStatus(void)

{

#if defined(__DEF_AC33Mx128__)

return MP1->SR;

#endif

}

Application Example

uint16_t status;

status = MDL_getMPWMStatus();

MDL_MPWM_ClearStatus

Name of Function MDL_MPWM_ClearStatus

Argument uint32_t Status

clear value of an MPWM status register

Return Value void

Description This function clears the MPWM status register used in the FOC library.

Code Example // If an MPWM0 is used,

void MDL_clearMPWMStatus(uint32_t Status)

{

MP0->SR = Status;

}

// If an MPWM1 is used,

void MDL_clearMPWMStatus(uint32_t Status)

{

#if defined(__DEF_AC33Mx128__)

MP1->SR = Status;

#endif

}

Application Example

MDL_clearMPWMStatus(1 << 6); // Clear bit No. 6

Page 28: 3-Shunt FOC Library

28 / 85

28 / 85

ABOV Semiconductor

MDL (Motor Driver Layer)

MDL_MPWM_SetHalfDuty

Name of Function MDL_MPWM_SetHalfDuty

Argument void

Return Value void

Description This function enters half the period for the duty values of MPWM used in the FOC library.

This is the operation performed at the initial stage, and lets a motor do no action at all.

Application Example

MDL_MPWM_SetHalfDuty()

MDL_MPWM_SetDuty

Name of Function MDL_MPWM_SetDuty

Argument uint16_t *pDutyArray

Return Value void

Description This function sets MPWM Duty by receiving array values as input.

Code Example void MDL_MPWM_SetDuty(uint16_t *pDutyArray)

{

#if defined(__DEF_AC33Mx064__)

MP0->DUH = pDutyArray[0];

MP0->DVH = pDutyArray[1];

MP0->DWH = pDutyArray[2];

MP0->DUL = pDutyArray[3];

MP0->DVL = pDutyArray[4];

MP0->DWL = pDutyArray[5];

#endif

}

Application Example

MDL_MPWM_SetDuty(&(DutyArray[0]))

MDL_MPWM_EnablePWM

Name of Function MDL_MPWM_EnablePWM

Argument void

Return Value void

Description This function activates MPWM output that is used in the FOC library.

Code Example void MDL_MPWM_EnablePWM(void)

{

#if defined(__DEF_AC33Mx064__)

MP0->PSR0 = 0xCA00;

#endif

}

Application Example

MDL_MPWM_EnablePWM() // It activates MPWM output.

Page 29: 3-Shunt FOC Library

29 / 85

ABOV Semiconductor

MDL (Motor Driver Layer)

MDL_MPWM_DisablePWM

Name of Function MDL_MPWM_DisablePWM

Argument void

Return Value void

Description This function deactivates the MPWM output that is used in the FOC library.

Code Example void MDL_MPWM_DisablePWM(void)

{

#if defined(__DEF_AC33Mx064__)

MP0->PSR0 = 0xCA3F;

#endif

}

Application Example

MDL_MPWM_DisablePWM() // It deactivates MPWM output.

MDL_PCU_Init

Name of Function MDL_PCU_Init

Argument void

Return Value void

Description This function initializes each port.

If a board is changed, code modification according to pin mapping is required.

Application Example

MDL_PCU_Init();

MDL_GPIO_CheckIPMFault

Name of Function MDL_GPIO_CheckIPMFault

Argument void

Return Value uint32_t Status value of external fault signal

Description This function returns value of a GPIO port that is connected to an external fault signal.

Since 0 means usually a fault, software application used to call this function recognizes 0 as a fault.

If Discrete Elements are in use or IPM Fault Retention Time is short, the relevant source code must be modified accordingly.

Code Example uint32_t MDL_GPIO_CheckIPMFault(void)

{

#if defined(__DEF_AC33Mx064__)

return ((PB->IDR >> 6) & 0x01);

#endif

}

Application Example

if (MDL_GPIO_CheckIPMFault() == 0) {

// If return value is ‘0’,fault signal is processed.

}

Page 30: 3-Shunt FOC Library

30 / 85

30 / 85

ABOV Semiconductor

MDL (Motor Driver Layer)

MDL_DAC_Init

Name of Function MDL_DAC_Init

Argument void

Return Value void

Description This function initializes the connections of DAC equipment that is used for debugging in the FOC library.

Basic source code is designed to use SPI Interface that is developed on aFPB (ABOV FOC Platform Board).

For reference, 'USE_DAC_DEBUG' definition must be declared as 'ON' to execute the source code.

Code Example void MDL_DAC_Init(void)

{

#if (USE_DAC_DEBUG == ON)

#if defined(__DEF_AC33Mx064__)

SPI_CFG_Type SP0_config;

SP0_config.Databit = SPI_DS_16BITS;

SP0_config.CPHA = SPI_CPHA_LO;

SP0_config.CPOL = SPI_CPOL_HI;

SP0_config.DataDir = SPI_MSB_FIRST;

SP0_config.Mode = SPI_MASTER_MODE;

SP0_config.BaudRate = 10;

SPI_Init(SP0, &SP0_config);

SPI_DelayConfig(SP0, 5, 0, 2);

SPI_Cmd(SP0, ENABLE); // SPI0 enable

#endif

MDL_DAC_SetData(0, 0x7FF);

MDL_DAC_SetData(1, 0x7FF);

MDL_DAC_SetData(2, 0x7FF);

MDL_DAC_SetData(3, 0x7FF);

#endif // (USE_DAC_DEBUG == ON)

}

Application Example

MDL_DAC_Init() // DAC initializations

Page 31: 3-Shunt FOC Library

31 / 85

ABOV Semiconductor

MDL (Motor Driver Layer)

MDL_DAC_SetData

Name of Function MDL_DAC_SetData

Argument uint32_t Channel

DAC Channel

uint16_t Data Output Data

Return Value void

Description This function outputs data through a corresponding channel of the DAC equipment.

Together with a function ‘MDL_DAC_Init ()’, 'USE_DAC_DEBUG' definition must be declared as 'ON' to execute the source code.

Code Example void MDL_DAC_Init(void)

{

#if (USE_DAC_DEBUG == ON)

#if defined(__DEF_AC33Mx064__)

uint16_t Buffer;

PD->ODR &= ~(1 << 3);

Buffer = (((Channel & 0x03) << 14) | (Data & 0x0FFF) | 0x1000);

SPI_SendData(SP0, Buffer);

while ((SPI_GetStatus(SP0) & SPI_STAT_TXBUF_EMPTY) != SPI_STAT_TXBUF_EMPTY) {

__NOP();

}

while ((SPI_GetStatus(SP0) & SPI_STAT_IDLE) != SPI_STAT_IDLE) {

__NOP();

}

PD->ODR |= (1 << 3);

#endif

#endif

}

Application Example

MDL_DAC_SetData(2, 0x7FF);

Page 32: 3-Shunt FOC Library

32 / 85

32 / 85

ABOV Semiconductor

MDL (Motor Driver Layer)

MDL_UARTn_Init

Name of Function MDL_UARTn_Init (n = 0, 1, 2 …)

Argument void

Return Value void

Description This function initializes UARTn Peripheral.

If a different UART from aFPB is used or UART Configuration needs to be modified, the relevant source code must be modified.

Code Example void MDL_UARTn_Init(void)

{

#if defined(__DEF_AC33Mx064__)

//UART0 pin config setting in PCU

PCU_ConfigureFunction(PCC, 14, PC14_MUX_RXD0);

PCU_SetDirection(PCC, 14, INPUT);

PCU_ConfigurePullup(PCC, 14, ENABLE);

PCU_ConfigureFunction(PCC, 15, PC15_MUX_TXD0);

PCU_SetDirection(PCC, 15, PUSH_PULL_OUTPUT);

PCU_ConfigurePullup(PCC, 15, ENABLE);

// default: 38400-8-N-1

UART_Init(UARTn,(UART_CFG_Type *)(&UARTConfigStruct));

#endif

}

Application Example

MDL_UARTn_Init() // UARTn peripheral initialization

MDL_UARTn_SendByte

Name of Function MDL_UARTn_SendByte (n = 0, 1, 2 …)

Argument uint8_t Data Transmission Data

Return Value void

Description This function outputs data through UARTn Tx.

Application Example

MDL_UARTn_SendByte(‘A’) // prints a letter 'A'.

MDL_UARTn_CheckTxStatus

Name of Function MDL_UARTn_CheckTxStatus (n = 0, 1, 2 …)

Argument void

Return Value uint32_t Transmit Holding Register Status

Description This function enables the next transmission of Tx Data, if return value exists.

Application Example

if (MDL_UARTn_CheckTxStatus()) {

MDL_UARTn_SendByte(Tx_Buffer[Index]);

}

Page 33: 3-Shunt FOC Library

33 / 85

ABOV Semiconductor

MDL (Motor Driver Layer)

MDL_UARTn_ReceiveByte

Name of Function MDL_UARTn_ReceiveByte (n = 0, 1, 2 …)

Argument void

Return Value uint8_t Received Data

Description This function returns UARTn Rx received data.

Application Example

uint8_t Data;

Data = MDL_UARTn_ReceiveByte();

MDL_UARTn_CheckRxStatus

Name of Function MDL_UARTn_CheckRxStatus (n = 0, 1, 2 …)

Argument void

Return Value uint32_t Receive Data Ready

Description If a return value exists, that means there is Rx Data received from outside.

Application Example

uint8_t Data;

if (MDL_UARTn_CheckRxStatus()) {

Data = MDL_UARTn_ReceiveByte();

}

Page 34: 3-Shunt FOC Library

34 / 85

34 / 85

ABOV Semiconductor

FAL (FOC Algorithm Layer)

FAL (FOC Algorithm Layer)

Page 35: 3-Shunt FOC Library

35 / 85

ABOV Semiconductor

FAL (FOC Algorithm Layer)

Overview

FAL (FOC Algorithm Layer) is the core layer of the FOC algorithm. In this layer, various functions

essential for 3-Shunt FOC operations are declared, and developers can use any desired functions.

However, code is not opened to the developers.

Generally, internal variables of FAL cannot be monitored. But, since the key variables are stored in MDL

and FAL functions simply reference their addresses, the input/output variables of FAL functions can be

monitored by declaring those variables in MDL. In addition, they may be utilized in individual blocks.

Get function retrieves internal variables of FAL that need to be monitored, and Set function configures

those internal variables.

Figure 3.1 Block diagram of the 3-Shunt FOC function

Current

Reconstruction

FAL_Check_

OverCurrent

SVPWM

FAL_SVPWM()

Speed Control

FAL_SpeedControl()Voltage

Modulation

FAL_Voltage

Modulation_

3Shunt()

Shunt_A

, ,a b ci i iClarke Transformation

FAL_ClarkeTrans()

Park Transformation

FAL_ParkTrans()

Position / Speed

Estimator

FAL_SensorlessEstimator()

ˆeθ

* *,α βv v

Current Control

FAL_CurrentControl()

* *,d qv v

ˆeω

,α βi i

* *,d qi i

,d qi i

ˆmω

*

ˆeθ

Duty

PMSM

,α βi i

Flag15Ts_ _,d out q outv vFlagMTPA

Shunt_B

Page 36: 3-Shunt FOC Library

36 / 85

36 / 85

ABOV Semiconductor

FAL (FOC Algorithm Layer)

Speed Control

Current

Control

Start

End

Positon

&Speed

Estiamtion

Current

Sensing &

Reconstruction

Figure 3.2 Flow chart of the 3-Shunt FOC algorithm

Page 37: 3-Shunt FOC Library

37 / 85

ABOV Semiconductor

FAL (FOC Algorithm Layer)

Description of Functions

This section describes the functions of FAL by functionality.

Main Functions of FAL

These functions are essential for motor operations.

FAL_Init_variables

Name of Function FAL_Init_variables

Argument uint16_t *

Parameter Array variables generated by aFDT

Return Value void

Description This function initializes various control constants to the set values set of aFDT.

Application Example

if (FAL_Get_op_mode == 0) {

FAL_Init_variables(&(Parameter[0]))

}

Page 38: 3-Shunt FOC Library

38 / 85

38 / 85

ABOV Semiconductor

FAL (FOC Algorithm Layer)

FAL_SensorlessEstimator

Figure 3.3 Block diagram of the Sensorless Estimator function

Name of Function FAL_SensorlessEstimaor

Argument int16_t *

Vdss_cmd_Q14 α -axis (stationary reference frame) voltage command

int16_t *

Vqss_cmd_Q14 β

-axis (stationary reference frame) voltage command

int16_t

Idss_Q14 α -axis (stationary reference frame) current

int16_t

Iqss_Q14 β

-axis (stationary reference frame) current

int16_t *

We_Q14 Present estimated electrical angular velocity eω [rad/s]

int16_t *

Spd_actual_rpm Present estimated mechanical angular velocity mω [RPM]

int16_t *

Est_Theta_Q14 Present estimated angle eθ [radian]

Return Value void

Description This function estimates electrical angle [ eθ ], electrical angular velocity [ eω ] and

mechanical angular velocity [ mω ].

Application Example

FAL_SensorlessEstimator(&Vdss_cmd_Q14, &Vqss_cmd_Q14, Idss_Q14, Iqss_Q14, &We_Q14,

&Spd_actual_rpm, &Est_Theta_Q14);

Position / Speed

Estimator

FAL_SensorlessEstimator()

ˆeθ

* *,α βv v

,α βi i ˆ ˆ,e mω ω

Page 39: 3-Shunt FOC Library

39 / 85

ABOV Semiconductor

FAL (FOC Algorithm Layer)

FAL_Align

Name of Function FAL_Align

Argument int16_t *

Idse_cmd_Q14 d -axis (synchronous reference frame) current command

int16_t *

Iqse_cmd_Q14 q

-axis (synchronous reference frame) current command

Return Value void

Description This function performs forced alignment according to the set values of aFDT.

Application Example

FAL_Align(&Idse_cmd_Q14, &Iqse_cmd_Q14);

Figure 3.4 Align configuration of aFDT

Figure 3.5 U-phase current waveform

Page 40: 3-Shunt FOC Library

40 / 85

40 / 85

ABOV Semiconductor

FAL (FOC Algorithm Layer)

FAL_Accelerate

Name of Function FAL_Accelerate

Argument int16_t *

Idse_cmd_Q14 d -axis (synchronous reference frame) current command

int16_t *

Iqse_cmd_Q14 q

-axis (synchronous reference frame) current command

int16_t *

Acc_Theta_Q14 Synchronous acceleration angle accθ

Return Value void

Description This function performs synchronous acceleration according to the set values of aFDT.

Application Example

FAL_Accelerate(&Idse_cmd_Q14, &Iqse_cmd_Q14, &Acc_Theta_Q14);

Figure 3.6 Align configuration of aFDT

Figure 3.7 U-phase current waveform

Page 41: 3-Shunt FOC Library

41 / 85

ABOV Semiconductor

FAL (FOC Algorithm Layer)

FAL_SpeedControl

Figure 3.8 Block diagram of the Speed Control function

Name of Function FAL_SpeedControl

Argument int16_t

Speed_cmd_rpm Command speed

*

mω [RPM]

int16_t

Spd_actual_rpm Present estimated speed mω [RPM]

int16_t

Vdse_out_Q14

d -axis (synchronous reference frame) output voltage of the FAL_SVPWM function

int16_t

Vqse_out_Q14

q-axis (synchronous reference frame) output voltage of the

FAL_SVPWM function

int16_t *

Idse_cmd d -axis (synchronous reference frame) current command

int16_t *

Iqse_cmd q

-axis (synchronous reference frame) current command

Return Value void

Description This function controls present speed [ mω ] to meet the speed command [

*

mω ].

aFDT can be used to configure the gain of the PI controller, maximum/ minimum values of the q-axis current command, and MTPA Enable Flag.

Application Example

FAL_SpeedControl(Spd_cmd_rpm, Spd_actual_rpm, Vdse_out_Q14, Vqse_out_Q14,

&Idse_cmd_Q14, &Iqse_cmd_Q14);

Speed Control

FAL_SpeedControl()

* ˆ,m mω ω

FlagMTPA

* *,d qi i

_ _,d out q outv v

Page 42: 3-Shunt FOC Library

42 / 85

42 / 85

ABOV Semiconductor

FAL (FOC Algorithm Layer)

FAL_CurrentControl

Figure 3.9 Block diagram of the Current Control function

Name of Function FAL_CurrentControl

Argument int16_t

Idse_cmd_Q14 d -axis (synchronous reference frame) current command

int16_t

Iqse_cmd_Q14 q

-axis (synchronous reference frame) current command

int16_t

Idse_Q14 d -axis (synchronous reference frame) current

int16_t

Iqse_Q14 q

-axis (synchronous reference frame) current

int16_t

Vdse_out_Q14

d -axis (synchronous reference frame) output voltage of the FAL_SVPWM function

int16_t

Vqse_out_Q14

q-axis (synchronous reference frame) output voltage of the

FAL_SVPWM function

int16_t *

Vdse_cmd_Q14 d -axis (synchronous reference frame) voltage command

int16_t *

Vqse_cmd_Q14 q

-axis (synchronous reference frame) voltage command

Return Value void

Description This function controls the current to meet the

,d q-axis current command, which

is output of the speed controller.

aFDT can be used to set the bandwidth of the current controller.

Application Example

FAL_CurrentControl(Idse_cmd_Q14, Iqse_cmd_Q14, Idse_Q14, Iqse_Q14, Vdse_out_Q14,

Vqse_out_Q14, &Vdse_cmd_Q14, &Vqse_cmd_Q14);

Current Control

FAL_CurrentControl()

* *,d qi i

,d qi i

_ _,d out q outv v

* *,d qv v

Page 43: 3-Shunt FOC Library

43 / 85

ABOV Semiconductor

FAL (FOC Algorithm Layer)

FAL_SVPWM

Figure 3.10 Block diagram of the SVPWM function

Name of Function FAL_SVPWM

Argument int16_t

Theta_Q14 Present electrical angle eθ [radian]

int16_t

We_Q14 Estimated electrical angular velocity eω [rad/s]

int16_t

Vdse_cmd_Q14 d -axis (synchronous reference frame) voltage command

int16_t

Vqse_cmd_Q14 q

-axis (synchronous reference frame) voltage command

int16_t *

Vdss_cmd_Q14 α -axis (stationary reference frame) voltage command

int16_t *

Vqss_cmd_Q14 β

-axis (stationary reference frame) voltage command

int16_t *

Vdse_out_Q14 d -axis (synchronous reference frame) output voltage

int16_t *

Vqse_out_Q14 q

-axis (synchronous reference frame) output voltage

Return Value void

Description This function performs Space Vector PWM.

It conducts 1.5 Ts Delay Compensation at a desired speed or greater by using a function FAL_Set_Flag15Ts().

Application Example

FAL_SVPWM(Theta_Q14, We_Q14, Vdse_cmd_Q14, Vqse_cmd_Q14, &Vdss_cmd_Q14, &Vqss_cmd_Q14,

&Vdse_out_Q14, &Vqse_out_Q14);

SVPWM

FAL_SVPWM()

ˆeω

Flag15Ts

ˆeθ

* *,α βv v

_ _,d out q outv v* *,d qv v

Page 44: 3-Shunt FOC Library

44 / 85

44 / 85

ABOV Semiconductor

FAL (FOC Algorithm Layer)

FAL_VoltageModulation_3Shunt

Figure 3.11 Block diagram of the Voltage Modulation function

Name of Function FAL_VoltageModulation_3Shunt

Argument int16_t *

Vdss_cmd_Q14 α -axis (stationary reference frame) voltage command

int16_t *

Vqss_cmd_Q14 β

-axis (stationary reference frame) voltage command

uint16_t *

Duty Duty

Return Value void

Description This function calculates Duty by receiving input of voltage command.

Application Example

FAL_VoltageModulation(&Vdss_cmd_Q14, &Vqss_cmd_Q14, &Duty);

Voltage Modulation

FAL_VoltageModulation

_3Shunt()

Duty

Page 45: 3-Shunt FOC Library

45 / 85

ABOV Semiconductor

FAL (FOC Algorithm Layer)

FAL_Check_OverCurrent

Name of Function FAL_Check_OverCurrent

Argument int16_t

Ia Current ADC value on A-phase

int16_t

Ib Current ADC value on B-phase

int16_t *

Ias_Q14 A-phase current converted into Q14 form

int16_t *

Ibs_Q14 B-phase current converted into Q14 form

int16_t *

Ics_Q14 C-phase current converted into Q14 form

Return Value int16_t FaultFlag

Description This function converts 3-phase currents into Q14 form, and returns their status whether they are an overcurrent.

— 0: Normal

— 1: Overcurrent

Application Example

if (FAL_Check_OverCurrent(Ia, Ib, &Ias_Q14, &Ibs_Q14, &Ics_Q14)) {

OC_cnt++;

} else {

OC_cnt = 0;

}

if (OC_cnt > 10) { // 100us*10 = 1ms

FAL_Set_op_mode(0);

PWM_OFF();

}

FAL_Set_InitialPosition

Name of Function FAL_Set_InitialPosition

Argument int16_t *

Theta_Q14 Electrical angle eθ [radian]

Return Value void

Description This function initializes the electrical angle eθ to 0.

Application Example

FAL_Set_InitialPosition(&Est_Theta_Q14);

Page 46: 3-Shunt FOC Library

46 / 85

46 / 85

ABOV Semiconductor

FAL (FOC Algorithm Layer)

FAL_ClarkeTrans

Figure 3.12 Block diagram of the Clarke Transformation function

Name of Function FAL_ClarkeTrans

Argument int16_t

A_Q14 A-axis

int16_t

B_Q14 B-axis

int16_t

C_Q14 C-axis

int16_t *

Alpah_Q14 α -axis

int16_t *

Beta_Q14 β

-axis

Return Value void

Description This function converts coordinates of 3-axis stationary reference frame into ones of 2-axis stationary reference frame.

Application Example

FAL_ClarkeTrans(Ias_Q14, Ibs_Q14, Ics_Q14, &Idss_Q14, &Iqss_Q14);

Clarke Transformation

FAL_ClarkeTrans(), ,a b c ,α β

Page 47: 3-Shunt FOC Library

47 / 85

ABOV Semiconductor

FAL (FOC Algorithm Layer)

FAL_InvClarkeTrans

Figure 3.13 Block diagram of the Inverse Clarke Transformation function

Name of Function FAL_InvClarkeTrans

Argument int16_t

Alpha_Q14 α -axis

int16_t

Beta_Q14 β

-axis

int16_t *

A_Q14 A-axis

int16_t *

B_Q14 B-axis

int16_t *

C_Q14 C-axis

Return Value void

Description This function converts coordinates of 2-axis stationary reference frame into ones of 3-axis stationary reference frame.

Application Example

FAL_InvClarkeTrans(Idss_Q14, Iqss_Q14, &Ias_Q14, &Ibs_Q14, &Ics_Q14);

Inverse Clarke

Transformation

FAL_InvClarkeTrans()

,α β , ,a b c

Page 48: 3-Shunt FOC Library

48 / 85

48 / 85

ABOV Semiconductor

FAL (FOC Algorithm Layer)

FAL_ParkTrans

Figure 3.14 Block diagram of the Park Transformation function

Name of Function FAL_ParkeTrans

Argument int16_t

Alpha_Q14 α -axis

int16_t

Beta_Q14 β

-axis

int16_t

Theta_Q14 Electrical angle eθ

int16_t *

d_Q14 d -axis

int16_t *

q_Q14 q

-axis

Return Value void

Description This function converts coordinates of 2-axis stationary reference frame into ones of 2-axis synchronous reference frame.

Application Example

FAL_ParkTrans(Idss_Q14, Iqss_Q14, Theta_Q14, &Idse_Q14, &Iqse_Q14);

,d qPark Transformation

FAL_ParkTrans()ˆeθ

,α β

Page 49: 3-Shunt FOC Library

49 / 85

ABOV Semiconductor

FAL (FOC Algorithm Layer)

FAL_InvParkTrans

Inverse Park Transformation

FAL_InvParkTrans()

,d q,α β

ˆeθ

Figure 3.15 Block diagram of the Inverse Park Transformation function

Name of Function FAL_InvParkeTrans

Argument int16_t

d_Q14 d -axis

int16_t

q_Q14 q

-axis

int16_t

Theta_Q14 Electrical angle eθ

int16_t *

Alpha_Q14 α -axis

int16_t *

Beta_Q14 β

-axis

Return Value void

Description This function converts coordinates of 2-axis synchronous reference frame into ones of 2-axis stationary reference frame.

Application Example

FAL_InvParkTrans(Idse_Q14, Iqse_Q14, Theta_Q14, &Idss_Q14, &Iqss_Q14);

Page 50: 3-Shunt FOC Library

50 / 85

50 / 85

ABOV Semiconductor

FAL (FOC Algorithm Layer)

Calculation Functions

These functions are used to perform mathematical calculations.

FAL_Sine_Q15

Name of Function FAL_Sine_Q15

Argument

int16_t

swTheta

This argument has a value ranging from -16384 to 16384 in Q14 form.

— -16384 corresponds to –π.

— 16384 corresponds to π.

Return Value

int16_t

This return value ranges from -32768 to 32767 in Q15 form.

— -32768 corresponds to -1.

— 32767 corresponds to 1.

Description This function returns a sine value of an input argument in Q15 form.

Application Example

int16_t Theta; // Angle variable in Q14 form (ranging from -16384 to 16384)

int16_t Sin_Theta_Q15; // Return value of the Sine function in Q15 form

Sin_Theta_Q15 = FAL_Sine_Q15(Theta);

FAL_Cosine_Q15

Name of Function FAL_Cosine_Q15

Argument

int16_t

swTheta

This argument has a value ranging from -16384 to 16384 in Q14 form.

— -16384 corresponds to –π.

— 16384 corresponds to π.

Return Value

int16_t

This return value ranges from -32768 to 32767 in Q15 form.

— -32768 corresponds to -1.

— 32767 corresponds to 1

Description This function returns a cosine value of an input argument in Q15 form.

Application Example

int16_t Theta; // Angle variable in Q14 form (ranging from -16384 to 16384)

int16_t Cos_Theta_Q15; // Return value of the Cosine function in Q15 form

Cos_Theta_Q15 = FAL_Cosine_Q15(Theta);

FAL_Cal_Vdc_Q14

Name of Function FAL_Cal_Vdc_Q14

Argument int16_t

Para AD conversion result value of DC-Link voltage

Return Value int16_t

This return value ranges from 0 to 16384 in Q14 form.

— 16384 corresponds to VdcRef.

Description This function converts AD conversion result of DC-Link voltage into the value in Q14 form.

Application Example

int16_t AD_Vdc; // DC-Link voltage value after AD conversion

int16_t Vdc_Q14; // DC-Link voltage value in Q14 form

Vdc_Q14 = FAL_Cal_Vdc_Q14(AD_Vdc);

Page 51: 3-Shunt FOC Library

51 / 85

ABOV Semiconductor

FAL (FOC Algorithm Layer)

Configuration Functions

These functions are used to configure internal parameters of FAL.

FAL_Set_op_mode

Name of Function FAL_Set_op_mode

Argument uint8_t Para

Return Value void

Description This function sets the operation mode of FAL.

— 0: IDLE state, in which PWM output maintains OFF.

— 1: Forced alignment mode, in which a certain amount of current is flowing through to align the rotor.

— 2: Synchronous acceleration mode, in which a synchronous magnetic field is created to accelerate the rotor.

— 3: Sensorless control mode

Application Example

FAL_Set_op_mode(1); //Forced alignment mode

Page 52: 3-Shunt FOC Library

52 / 85

52 / 85

ABOV Semiconductor

FAL (FOC Algorithm Layer)

FAL_Set_Bw_Daxis_CurrentCtrl

Name of Function FAL_Set_Bw_Daxis_CurrentCtrl

Argument uint16_t *

Parameter Array variable generated by aFDT

Return Value void

Description This function sets the bandwidth of the D-axis current controller to the set value configured in item “Current Controller Bandwidth” of aFDT.

Parameters necessary for bandwidth configuration are stored as array variables by aFDT.

BandWidth is current controller’s bandwidth used for initialization process.

BandWidth1 can be set as a current controller bandwidth to be used under user-specified conditions by calling a function FAL_Set_Bw_Daxis_CurrentCtrl.

Application Example

if (Spd_cmd_rpm < 2500) {

FAL_Set_Bw_Daxis_CurrentCtrl(Parameter);

);

Figure 3.16 Configuration of current controller bandwidth of aFDT

Page 53: 3-Shunt FOC Library

53 / 85

ABOV Semiconductor

FAL (FOC Algorithm Layer)

FAL_Set_Bw_Qaxis_CurrentCtrl

Name of Function FAL_Set_Bw_Daxis_CurrentCtrl

Argument uint16_t *

Parameter Array variable generated by aFDT

Return Value void

Description This function sets the bandwidth of the Q-axis current controller to the set value configured in item “Current Controller Bandwidth” of aFDT.

Parameters necessary for bandwidth configuration are stored as array variables by aFDT.

BandWidth is current controller’s bandwidth used for initialization process.

BandWidth1 can be set as a current controller bandwidth to be used under user-specified conditions by calling a function FAL_Set_Bw_Qaxis_CurrentCtrl.

Application Example

if (Spd_cmd_rpm < 2500) {

FAL_Set_Bw_Qaxis_CurrentCtrl(Parameter);

);

Page 54: 3-Shunt FOC Library

54 / 85

54 / 85

ABOV Semiconductor

FAL (FOC Algorithm Layer)

FAL_Set_Bw_EmfEstimator

Name of Function FAL_Set_Bw_EmfEstimator

Argument uint16_t *

Parameter Array variable generated by aFDT

Return Value void

Description This function sets the estimator bandwidth to the set value configured in item “Estimator” of aFDT.

Parameters necessary for bandwidth configuration are stored as array variables by aFDT.

Gr, Zeta, and Wn are setting variables for current controller which are used for initialization process.

Gr1, Zeta1, and Wn1 can change the settings of a current controller which will be used under user-specified conditions by calling a function FAL_Set_Bw_EmfEstimator.

LPF_Wspd is bandwidth of a low pass filter which is applied to filter output values of the PI controller during the Theta PLL process.

Application Example

if (FAL_Get_op_mode() > 2) {

FAL_Set_Bw_EmfEstimator(Parameter);

}

Figure 3.17 Configuration of Estimator of aFDT

Page 55: 3-Shunt FOC Library

55 / 85

ABOV Semiconductor

FAL (FOC Algorithm Layer)

FAL_Set_Bw_PLL

Name of Function FAL_Set_Bw_PLL

Argument uint16_t *

Parameter Array variable generated by aFDT

Return Value void

Description This function sets bandwidth of Phase Locked Loop of an estimator.

Parameters used as an argument are stored as array variables by aFDT.

Application Example

FAL_Set_Bw_PLL(Parameter);

FAL_Set_Flag15Ts

Name of Function FAL_Set_Flag15Ts

Argument uint8_t

Para 0 ~ 1

Return Value void

Description This function sets the 1.5 Ts Delay Compensation Flag of SVPWM.

— 0: Disabled

— 1: Enabled

Application Example

if (Spd_cmd_rpm > 1500) {

FAL_Set_Flag15TS(1);

}

Page 56: 3-Shunt FOC Library

56 / 85

56 / 85

ABOV Semiconductor

FAL (FOC Algorithm Layer)

FAL_Set_C15Ts_Qx

Name of Function FAL_Set_C15Ts_Qx

Argument uint16_t C15Ts_Qx

Return Value void

Description This function assigns a Time Delay Compensation Constant which is generated during digital PWM as an internal variable of the algorithm.

The Time Delay Compensation Constant is calculated by aFDT and stored as an array variable, and can be retrieved using a function FAL_Get_Target_C15Ts_Qx.

PWM Time Delay Compensation is required for high speed motor operations, but a sudden introduction of PWM Time Delay Compensation may cause a rapid change in the voltage command and produce pulsating currents.

When starting to compensate for the PWM Time Delay, therefore, pulsating currents can be reduced by retrieving the Current Control Constant and gradually increasing it to reach the target value (use the function FAL_Set_C15Ts_Qx to apply the Time Delay Compensation Constant within the algorithm).

Application Example

int16_t Spd_cmd_rpm // Speed command variable

int16_t MAL_C15Ts_Qx; //Time Delay Compensation Constant

if (FAL_Get_Flag15Ts() == 0) {

if (Spd_cmd_rpm >= 3000) {

FAL_Set_Flag15Ts(1);

}

} else {

if (Spd_cmd_rpm < 2500) {

FAL_Set_Flag15Ts(0);

}

}

if (FAL_Get_Flag15Ts()) {

if (MAL_C15Ts_Qx < FAL_Get_Target_C15Ts_Qx()) {

MAL_C15Ts_Qx++;

}

} else {

if (MAL_C15Ts_Qx > 0) {

MAL_C15Ts_Qx--;

}

}

FAL_Set_C15Ts_Qx(MAL_C15Ts_Qx); // It applies Time Delay Compensation Constant

// within an algorithm using this function.

Page 57: 3-Shunt FOC Library

57 / 85

ABOV Semiconductor

FAL (FOC Algorithm Layer)

Read Functions

These functions are used to monitor internal parameters of FAL.

FAL_Get_op_mode

Name of Function FAL_Get_op_mode

Argument void

Return Value uint8_t op_mode

Description This function returns the operation mode of FAL.

— 0: IDLE state

— 1: Alignment mode

— 2: Synchronous acceleration mode

— 3: Active operation mode

Application Example

uint_8 op_mode;

op_mode = FAL_Get_op_mode();

FAL_Get_Vout_Q14

Name of Function FAL_Get_Vout_Q14

Argument void

Return Value uint16_t Vout_Q14

Description This function returns output voltage.

2 2

out d qV v v

Application Example

int16_t Vout

MAL_Vout_Q14 = FAL_Get_Vout_Q14();

Page 58: 3-Shunt FOC Library

58 / 85

58 / 85

ABOV Semiconductor

FAL (FOC Algorithm Layer)

FAL_Get_Flag15Ts

Name of Function FAL_Get_Flag15Ts

Argument void

Return Value uint8_t 0 ~ 1

Description This function returns the state of 1.5 Ts Delay Compensation Flag of SVPWM.

— 0: Disabled

— 1: Enabled

Application Example

if (FAL_Get_Flag15Ts() == 0) {

if (Spd_cmd_rpm >= 3000) {

FAL_Set_Flag15Ts(1);

}

} else {

if (Spd_cmd_rpm < 2500) {

FAL_Set_Flag15Ts(0);

}

}

FAL_Get_Acc_Theta_Q14

Name of Function FAL_Get_Acc_Theta_Q14

Argument int16_t* This argument has a value ranging from -16384 to 16384 in Q14 form.

— -16384 corresponds to –π.

— 16384 corresponds to π.

Return Value void

Description This function returns synchronous acceleration angle accθ

.

Application Example

if (FAL_Get_op_mode() == 2) {

FAL_Get_Acc_Theta_Q14(&MAL_Theta_Q14);

} else {

MAL_Theta_Q14 = MAL_Est_Theta_Q14;

}

Page 59: 3-Shunt FOC Library

59 / 85

ABOV Semiconductor

FAL (FOC Algorithm Layer)

FAL_Get_Target_C15Ts_Qx

Name of Function FAL_Get_Target_C15Ts_Qx

Argument void

Return Value uint16_t C15Ts_Target_Qx

Description This function returns a Time Delay Compensation Constant which is generated during digital PWM as an internal variable of the algorithm.

The Time Delay Compensation Constant is calculated by aFDT and stored as an array variable, and can be retrieved using a function FAL_Get_Target_C15Ts_Qx.

PWM Time Delay Compensation is required for high speed motor operations, but a sudden introduction of PWM Time Delay Compensation may cause a rapid change in the voltage command and produce pulsating currents.

When starting to compensate for the PWM Time Delay, therefore, pulsating currents can be reduced by retrieving the Current Control Constant and gradually increasing it to reach the target value (use the function FAL_Set_C15Ts_Qx to apply the Time Delay Compensation Constant within the algorithm).

Application Example

int16_t Spd_cmd_rpm // Speed command variable

int16_t MAL_C15Ts_Qx; // Time Delay Compensation Constant

if (FAL_Get_Flag15Ts() == 0) {

if (Spd_cmd_rpm >= 3000) {

FAL_Set_Flag15Ts(1);

}

} else {

if (Spd_cmd_rpm < 2500) {

FAL_Set_Flag15Ts(0);

}

}

if (FAL_Get_Flag15Ts()) {

if (MAL_C15Ts_Qx < FAL_Get_Target_C15Ts_Qx()) {

MAL_C15Ts_Qx++;

}

} else {

if (MAL_C15Ts_Qx > 0) {

MAL_C15Ts_Qx--;

}

}

FAL_Set_C15Ts_Qx(MAL_C15Ts_Qx); //It applies Time Delay Compensation Constant

// within an algorithm using this function.

Page 60: 3-Shunt FOC Library

60 / 85

60 / 85

ABOV Semiconductor

MAL (Motor Application Layer)

MAL (Motor Application Layer)

Page 61: 3-Shunt FOC Library

61 / 85

ABOV Semiconductor

MAL (Motor Application Layer)

Overview

MAL (Motor Application Layer) is an application layer where functions of Motor Driver Layer and FOC

Algorithm Layer operate a motor eventually.

It is recommended to write code which is independent of MCU. In addition, sequences of function calls

in MAL example code must be maintained to ensure normal operation of libraries. If only the function

call order is kept, the code can be modified for convenience and requirements of the application.

Page 62: 3-Shunt FOC Library

62 / 85

62 / 85

ABOV Semiconductor

MAL (Motor Application Layer)

Description of Functions

Functions in this section are basic functions of MAL. For more information about the basic functions,

refer to source code of ABOV 3-Shunt FOC Library.

MAL_MPWM_Handler

Name of Function MAL_MPWM_Handler

Argument void

Return Value void

Description This function is called by MPWMn_IRQHandler of MDL and processes MPWM Interrupt Handler.

This function is the most important function in entire libraries, and structured with functions of both MDL and FAL.

Provided code can be modified to meet the application requirements while maintaining the function call sequence.

MAL_MainLoop

Name of Function MAL_MainLoop

Argument void

Return Value void

Description This is a main loop function repeating infinitely.

It is used to control the motor operation process.

Provided code can be modified to meet the application requirements.

MAL_InitVariables

Name of Function MAL_InitVariables

Argument void

Return Value void

Description This function initializes relevant parameters before starting a motor.

MAL_WaitPowerStable

Name of Function MAL_WaitPowerStable

Argument void

Return Value void

Description This function waits until power is stabilized during initial booting process.

3-Shunt Source Code is designed to wait for 1s by default, and can be modified depending on the application’s requirement.

Page 63: 3-Shunt FOC Library

63 / 85

ABOV Semiconductor

MAL (Motor Application Layer)

MAL_UpdateADCOffset

Name of Function MAL_UpdateADCOffset

Argument void

Return Value void

Description This function measures Shunt Offset value using ADC before starting motor operation and stores it as a related variable.

The Shunt Offset value may be changed depending on OP-Amp circuit design.

MAL_ChargeBootStrap

Name of Function MAL_ChargeBootStrap

Argument void

Return Value void

Description This function charges Boot Strap Capacitors before starting motor operation.

3-Shunt Source Code is designed to charge them for 100ms, and can be modified depending on the application’s requirement.

MAL_OutputDAC

Name of Function MAL_OutputDAC

Argument void

Return Value void

Description This function transmits data to a DAC equipment which is used for debugging through SPI.

MAL_ProcessStandby

Name of Function MAL_ProcessStandby

Argument void

Return Value void

Description This function is called while waiting for motor operation before receiving a motor operation command.

MAL_ProcessAlign

Name of Function MAL_ProcessAlign

Argument void

Return Value void

Description This function is called while performing forced alignment operation after receiving a motor operation command.

Page 64: 3-Shunt FOC Library

64 / 85

64 / 85

ABOV Semiconductor

MAL (Motor Application Layer)

MAL_ProcessAcceleration

Name of Function MAL_ProcessAcceleration

Argument void

Return Value void

Description This function is called while performing synchronous acceleration after forced alignment operation.

MAL_ProcessSensorless

Name of Function MAL_ProcessSensorless

Argument void

Return Value void

Description This function is called in Sensorless where B-EMF is detected by completing synchronous acceleration.

Page 65: 3-Shunt FOC Library

65 / 85

ABOV Semiconductor

aFDT (ABOV FOC Development Tool)

aFDT (ABOV FOC Development Tool)

Page 66: 3-Shunt FOC Library

66 / 85

66 / 85

ABOV Semiconductor

aFDT (ABOV FOC Development Tool)

Overview

aFDT is a program that sets algorithm coefficients and used in ABOV 3-Shunt FOC libraries. When the

coefficient is set for each block using aFDT, data array with a half word (16-bit) length is created. This

data array is passed to FOC algorithm layer (FAL) and the coefficient inside the FAL is set.

In addition, aFDT can apply the coefficient value to FAL by sending coefficient array to UART.

Finally, aFDT uses a function of export to create a C file. This C file contains a data array that sets

coefficients. Compilation and download including the C file complete the coefficient setup process.

Figure 5.1 aFDT Communication Block Diagram

Page 67: 3-Shunt FOC Library

67 / 85

ABOV Semiconductor

aFDT (ABOV FOC Development Tool)

1-Shunt / 3-Shunt Selection

Figure 5.2 Selection page of FOC algorithms

By selecting the icon ‘Enable’, a window opens where you can select 1-Shunt or 3-Shunt as shown in

Figure 5.2. You can select one according to the algorithm used by the application

Page 68: 3-Shunt FOC Library

68 / 85

68 / 85

ABOV Semiconductor

aFDT (ABOV FOC Development Tool)

Parameter Configuration

Figure 5.3 Main page of the parameter generation

Parameters are set for each block according to motor characteristics:

Parameter configuration can be performed either in Table View or in Block Diagram View according to

the setting method preferred. Table View lacks detail information but offers a good overview of all

parameters. Block Diagram View enhances understanding of the working structure of the algorithm

using a block diagram.

Clicking on a button Detail pops up a separate configuration window containing detail information about

each block. Further information about each parameter can be found in the section 5.6 Parameter

Description.

After configuration, clicking on a button sends the parameters to the ABOV FOC Platform

Board (aFPB). Internal parameters of the library can be modified and updated in real time. Please

remember that the motor must not be running when sending the parameters.

Transferring parameters does not store them permanently but reset them at MCU reset. For permanent

storage, the parameters must be exported and the project includes the parameter arrays. Further

detailed information about export process can be found in the section 5.5 Export.

Page 69: 3-Shunt FOC Library

69 / 85

ABOV Semiconductor

aFDT (ABOV FOC Development Tool)

Save/Load

Save

Click on an icon to open the following window:

Figure 5.4 Popup for Save in aFDT

Write a file name, and click on a button ‘OK’. The file is saved in a form of CSV file, and stored values

can be checked without reading with aFDT. The file can be opened in Microsoft Excel. When opened in

Notepad, contents stored in the file is displayed as shown in figure 5.5:

Figure 5.5 CSV file opened in Notepad

If a CSV file is corrupted or cannot be opened, it can be opened in Notepad to check for errors.

Page 70: 3-Shunt FOC Library

70 / 85

70 / 85

ABOV Semiconductor

aFDT (ABOV FOC Development Tool)

Load

Click on an icon to open the following window:

Figure 5.6 Popup for parameter generator loading

When the selected CSV file is read, stored values are restored to the coefficient settings of aFDT.

Page 71: 3-Shunt FOC Library

71 / 85

ABOV Semiconductor

aFDT (ABOV FOC Development Tool)

Export

Click on an icon to open the following window:

Figure 5.7 Popup for Export in aFDT <1>

Go to installation path of ABOV 3-Shunt FOC Library.

Figure 5.8 Popup for Load in aFDT <2>

Page 72: 3-Shunt FOC Library

72 / 85

72 / 85

ABOV Semiconductor

aFDT (ABOV FOC Development Tool)

Select Parameter.c, and press a button Save. Previous values in Parameter.c are replaced by new

values.

The complier then applies those new settings to the compilation without additional configuration. Once

the compilation is downloaded, motor control is enabled according to the aFDT settings.

The C file created by the menu Export has a header containing following information:

Figure 5.9 Header of a C file export

Table 5.1 Items in the header of a C file export

Item Description

@File This item records a name of a stored file.

@brief This item describes a certain file.

@version This item records version of aFDT that creates a certain file.

@date This item records date when aFDT creates a certain file.

@author This item records ABOV Team Name that creates a certain file.

Page 73: 3-Shunt FOC Library

73 / 85

ABOV Semiconductor

aFDT (ABOV FOC Development Tool)

Parameter Description

This section describes aFDT parameters for each Detail window.

Motor Parameter

Motor parameters include integer values required for motor operation, such as resistance and

inductance.

Figure 5.10 Motor Parameter

Table 5.2 Motor Parameter

Item Description

PWM Carrier(Hz) Switching frequency: It determines switching speed and control cycle.

Rs(Ohm) Winding resistance of motor (phase resistance): It is used to calculate the current controller gain.

Ld(H) Inductance along magnetic flux axis: It is used to calculate current controller gain.

Lq(H) Inductance along torque axis: It is used to calculate current controller gain.

Ke(V/rad/sec) Inverse-Electromotive Force Constants: It is used for forward compensation control in current controller.

Number of poles Number of motor poles: It is used for speed calculation.

Fbase Maximum speed (frequency): It is used to calculate speed and speed controller gain

Page 74: 3-Shunt FOC Library

74 / 85

74 / 85

ABOV Semiconductor

aFDT (ABOV FOC Development Tool)

Electrical Parameter

This parameter includes values required for inverter operation.

Figure 5.11 Electrical Parameter

Table 5.3 Electrical Parameter

Item Description

VdcRef(V) Inverter DC_link voltage: It is used to calculate voltage scale.

Ibase(A) Maximum current: It is used to calculate current scale and current controller gain.

V SensorScale Voltage scale: It is used to calculate sensed voltage.

I SensoeScale Current scale: It is used to calculate sensed current

Page 75: 3-Shunt FOC Library

75 / 85

ABOV Semiconductor

aFDT (ABOV FOC Development Tool)

Align

This parameter defines the section of current flow with which the rotor is forced to align to d-axis.

Figure 5.12 Align parameters

Table 5.4 Align

Item Description

AlignTime(ms) Forced alignment time: Time spent running the current to d-axis.

Theta init(degree) Initial angle of forced alignment: d-axis initial angle settings

I align(A) Forced alignment current: Magnitude of forced alignment current

I align init(A) Initial current of forced alignment: Magnitude of the current at the start of forced alignment

Page 76: 3-Shunt FOC Library

76 / 85

76 / 85

ABOV Semiconductor

aFDT (ABOV FOC Development Tool)

Acceleration

This parameter defines the section of synchronous acceleration to detect Inverse-EMF.

Figure 5.13 Acceleration parameters

Table 5.5 Acceleration

Item Description

I accelation current(A)

Synchronous acceleration current: Current flowing during synchronous acceleration

We start(Hz) Synchronous acceleration start frequency: Electrical angular frequency at start of synchronous acceleration

We final(Hz) Synchronous acceleration end frequency: Electrical angular frequency at end of synchronous acceleration

We accelation time(ms)

Synchronous acceleration section: Time spent in synchronous acceleration section

Page 77: 3-Shunt FOC Library

77 / 85

ABOV Semiconductor

aFDT (ABOV FOC Development Tool)

Estimator

This parameter estimates speed and position using Inverse-EMF.

Figure 5.14 Estimator parameters

Table 5.6 Estimator

Item Description

Gr(Hz) Coefficient of Inverse-EMF estimator: Cutoff frequency

Zeta Coefficient of Inverse-EMF estimator: Damping ratio

Wn Coefficient of Inverse-EMF estimator: bandwidth

Gr1(Hz) Coefficient of Inverse-EMF estimator: Cutoff frequency

Zeta1 Coefficient of Inverse-EMF estimator: Damping ratio

Wn1 Coefficient of Inverse-EMF estimator: bandwidth

LPF Wspd Coefficient of speed estimator: Bandwidth

Page 78: 3-Shunt FOC Library

78 / 85

78 / 85

ABOV Semiconductor

aFDT (ABOV FOC Development Tool)

Speed Controller

This parameter is used to set Speed controller.

Figure 5.15 Speed Controller parameters

Table 5.7 Speed Controller

Item Description

Kp Proportional gain

Ki Integral gain

Is Upper Limit(A) Maximum output limit of Speed controller

Is Lower Limit(A) Minimum output limit of Speed controller

Page 79: 3-Shunt FOC Library

79 / 85

ABOV Semiconductor

aFDT (ABOV FOC Development Tool)

Current Controller

This parameter is used to set Current controller.

Figure 5.16 Current Controller parameters

Table 5.8 Current Controller

Item Description

Bandwidth(Hz) Bandwidth of Current controller

Bandwidth1(Hz) Bandwidth of Current controller

Page 80: 3-Shunt FOC Library

80 / 85

80 / 85

ABOV Semiconductor

aFDT (ABOV FOC Development Tool)

Flux Weakening

This parameter is used to set Flux weakening control.

Figure 5.17 Flux Weakening parameters

Table 5.9 Flux Weakening

Item Description

Kp Proportional gain

Ki Integral gain

Ifw Lower Limit(A) Minimum output limit of the flux weakening controller

Page 81: 3-Shunt FOC Library

81 / 85

ABOV Semiconductor

aFDT (ABOV FOC Development Tool)

Software Overcurrent Level

This parameter is used to set Overcurrent protection level.

Figure 5.18 Software Overcurrent Level parameter

Table 5.10 Software Overcurrent Level

Item Description

SW Overcurrnet Level(A)

Overcurrent software fault level

System

This parameter is used to set MCU clock frequency.

Figure 5.19 System parameter

Table 5.11 System

Item Description

System Clock(Hz) MCU system Clock

Page 82: 3-Shunt FOC Library

82 / 85

82 / 85

ABOV Semiconductor

aFDT (ABOV FOC Development Tool)

Monitoring Function

Figure 5.20 aFDT 모니터링

aFDT monitoring allows a user to graphically monitor the 14 internal variables of the FOC Algorithm

Layer (FAL).

① This graph area features a linear graph of the monitored data.

② This control area displays retrieved data numerically, or enables entering a speed command

for motor control.

Page 83: 3-Shunt FOC Library

83 / 85

ABOV Semiconductor

aFDT (ABOV FOC Development Tool)

Graph Area

Figure 5.21 Graph Area

① These buttons are used to configure how to display the graphs.

Table 5.12 Graph control buttons

Item Description

Y Auto This item changes Y scale automatically to match the maximum and the minimum values of Y-axis.

X Auto This item changes X scale automatically to match the maximum value of X-axis.

When X Auto is enabled, the graph is displayed in the Clear state for 0 to 5 seconds; as time passes, X scale changes in the order of 0 to 10 seconds, 0 to 20 seconds, and 0 to 30 seconds.

30 seconds later, the scale stops changing and the graph keeps displaying data for the last 30 seconds.

X Ext This item is used to zoom in for X-axis. Four levels are available for zoom-in: 0 to 5 seconds, 0 to 10 seconds, 0

to 20 seconds, and 0 to 30 seconds. A button of this item is enabled when X Auto is disabled.

X Con This item is used to zoom out for X-axis. Four levels are available for zoom-out: 0 to 5 seconds, 0 to 10 seconds,

0 to 20 seconds, and 0 to 30 seconds. A button of this button is enabled when X Auto is disabled.

Clear This item clears data of the current graph.

Image This item saves current graph as a JPG file.

Pause This item pauses the real-time graph display. A button of this item toggles the operation. Clicking on it again resumes the

real-time display.

Page 84: 3-Shunt FOC Library

84 / 85

84 / 85

ABOV Semiconductor

aFDT (ABOV FOC Development Tool)

② This area shows Y-axis data name and Y-axis scale. The minimum values and the maximum

values can be modified. As shown in figure 5.21, the minimum values and the maximum values

can be changed by clicking on the number ‘-5’ or ‘5’. Y-scale will be automatically adjusted

based on the input value when the minimum values and the maximum values are entered.

Page 85: 3-Shunt FOC Library

85 / 85

ABOV Semiconductor

aFDT (ABOV FOC Development Tool)

Control Area

Figure 5.22 Control Area

① These radio buttons are used to select graph display mode.

Table 5.13 Graph display mode

Item Description

Graph 1 This item displays G1.

Graph 2&3 This item displays G2 and G3.

② Enter a speed control command. A motor will run depending on the speed command just entered.

③ Decide a place where to display each variable graph: G1, G2, or G3.

④ Choose a color for each variable. Click to display the color selection window. Variable’s name and

graph color in the graph area are updated according to the selection.

③ ④ ①

G1

G2 G3