Spansion FMO+ Series User manual

Low Voltage 3-Phase BLDC/PMSM Control
32-BIT MICROCONTROLLER
FM0+ Family
USER MANUAL
Publication Number: S6E1A1_AN710-00002 Revision 1.0 Issue Date Apr 2, 2015

U S E R M A N U A L
2 Apr 2, 2015, S6E1A1_AN710-00002
Target products
This user manual describes the following products:
Series
Product Number
FM0+ Series
S6E1A1

U S E R M A N U A L
Apr 2, 2015, S6E1A1_AN710-00002 3
Table of Contents
1. Introduction..................................................................................................................................... 5
1.1 Purpose 5
1.2 Definitions, Acronyms and Abbreviations............................................................................ 5
1.3 Document Overview............................................................................................................ 5
1.4 Reference Documents......................................................................................................... 5
2. System Hardware Environment...................................................................................................... 6
3. Development Environment............................................................................................................. 7
4. System Firmware Design ............................................................................................................... 8
4.1 FW Feature......................................................................................................................... 8
4.2 FW Structure....................................................................................................................... 8
4.3 Files Description................................................................................................................ 10
4.4 FW Control Flow................................................................................................................ 11
5. System Function........................................................................................................................... 12
5.1 Global Structure and Variable Definition ........................................................................... 12
5.1.1 Variables for Motor Running............................................................................. 12
5.1.2 Variables for FOC............................................................................................. 13
5.1.3 Variables for PID Control.................................................................................. 14
5.2 Function List...................................................................................................................... 15
6. Event Function.............................................................................................................................. 16
6.1 Function List...................................................................................................................... 16
7. Driver Function............................................................................................................................. 17
7.1 Function List...................................................................................................................... 17
8. Interrupt Function ......................................................................................................................... 18
8.1 Function List...................................................................................................................... 18
8.2 Interrupt Priority Setting..................................................................................................... 18
8.3 Interrupt Generation.......................................................................................................... 19
8.3.1 MFT.................................................................................................................. 19
8.3.2 Hall Capture ..................................................................................................... 19
8.3.3 DTTI ................................................................................................................. 20
9. Demo System............................................................................................................................... 21
9.1 Demo System Introduction................................................................................................ 21
9.1.1 Hardware Connection....................................................................................... 21
9.2 Motor Debug ..................................................................................................................... 22
9.2.1 FW Interface Configuration............................................................................... 23
9.2.2 Hall Check........................................................................................................ 28
9.2.3 Run Motor......................................................................................................... 30
9.2.4 Debug with DAC............................................................................................... 31
9.3 Troubleshooting ................................................................................................................ 31
9.3.1 Motor Start-up .................................................................................................. 31
9.3.2 Protection......................................................................................................... 32
9.3.3 Carrier Changeable On-line.............................................................................. 32
9.3.4 Hall Check........................................................................................................ 32
9.3.5 Power Consumer Higher.................................................................................. 32
10. Additional Information................................................................................................................... 34
Figures
Figure 4-1: Structure of FW........................................................................................................................ 9
Figure 4-2: Sub-files in Each Layer.......................................................................................................... 10
Figure 4-3: Diagram of the Control Flow ...................................................................................................11
Figure 5-1: Diagram of Live Watch........................................................................................................... 12

U S E R M A N U A L
4 Apr 2, 2015, S6E1A1_AN710-00002
Figure 8-1: Interrupt Priority Diagram....................................................................................................... 18
Figure 8-2: Free Run Timer Interrupt........................................................................................................ 19
Figure 8-3: Base Timer Interrupt............................................................................................................... 19
Figure 8-4: DTTI Interrupt......................................................................................................................... 20
Figure 9-1: System Connection................................................................................................................ 21
Figure 9-2: Open the Workspace ............................................................................................................. 22
Figure 9-3: Interface File Diagram............................................................................................................ 23
Figure 9-4: Motor Parameter Configuration.............................................................................................. 24
Figure 9-5: ADC Port Setting.................................................................................................................... 25
Figure 9-6: PI Parameter Setting.............................................................................................................. 25
Figure 9-7: ADC Coefficient Setting.......................................................................................................... 26
Figure 9-8: Variables Setting for Motor Start-up....................................................................................... 26
Figure 9-9: Variables Setting for Acceleration........................................................................................... 27
Figure 9-10: Protection Parameter Setting............................................................................................... 27
Figure 9-11: Function Selection................................................................................................................ 27
Figure 9-12: Configuration of the Test Mode ............................................................................................ 28
Figure 9-13: Hall Check Result................................................................................................................. 29
Figure 9-14: Configuration of the Tested Hall Phase Angle...................................................................... 29
Figure 9-15: Motor Run by J-link.............................................................................................................. 30
Figure 9-16: DAC Board Connection........................................................................................................ 31
Tables
Table 3-1: MCU Development Environment ............................................................................................... 7
Table 4-1: Feature List of LVBP Solution.................................................................................................... 8
Table 4-2: Directory Description of Project................................................................................................. 9
Table 4-3: File Description of Project........................................................................................................ 10
Table 5-1: System Function List ............................................................................................................... 15
Table 6-1: Event Function List Called by the MFT ISR............................................................................. 16
Table 6-2: Event Function List by the ‘Timer_Event()’ .............................................................................. 16
Table 7-1: Driver Function List.................................................................................................................. 17
Table 4-1: System Used Interrupt Function .............................................................................................. 18
Table 9-1: Motor Parameter...................................................................................................................... 21
Table 9-2: Hall Connection....................................................................................................................... 22
Table 9-3: Motor Control Mode................................................................................................................. 24
Table 9-4: Global Structure for Hall Check............................................................................................... 28
Table 9-5: Motor Running Status by the Command Speed ...................................................................... 30
Table 9-6: DAC Show............................................................................................................................... 31
Table 9-7: Protection List.......................................................................................................................... 32

U S E R M A N U A L
Apr 2, 2015, S6E1A1_AN710-00002 5
1. Introduction
1.1 Purpose
This user manual describes SPANSION low voltage 3-phase BLDC/PMSM solution, and describes how to
use the FW library.
The document introduces the basic information of the solution including hardware, firmware, initial functions,
basic motor setting functions and FOC drive modules. When you have understood these contents, you can
get an overview of the whole low voltage 3-phase BLDC/PMSM project. And you can run a motor following
the demo project step.
1.2 Definitions, Acronyms and Abbreviations
API - Application Programming Interface
FOC - Field Oriented Control
FW - Firmware
HW - Hardware
I/O - Input and output
CW - Clockwise
CCW - Counter clockwise
LVBP - Low Voltage 3-Phase BLDC/PMSM
1.3 Document Overview
The rest of document is organized as the following:
Chapter 2explains System Hardware Environment
Chapter 3 explains Development Environment
Chapter 4explains System Firmware Design
Chapter 5 explains System Function
Chapter 6explains Event Function
Chapter 7explains Driver Function
Chapter 8 explains Interrupt Function
Chapter 9explains Demo System
1.4 Reference Documents

U S E R M A N U A L
6 Apr 2, 2015, S6E1A1_AN710-00002
2. System Hardware Environment
The following lists the MCUs used in LVBP inverter board
CPU chip: Spansion FM0+ S6E1A1 series
CPU Frequency: 40MHz
MCU pin number: 48pin
RAM Space: 88 Kbyte
Code Space: 6 Kbyte
Demo HW version: SK-MC-3P-LVPS-0 V11

U S E R M A N U A L
Apr 2, 2015, S6E1A1_AN710-00002 7
3. Development Environment
Table 3-1: MCU Development Environment
Name
Description
Part Number
Manufacturer
Remark
IAR bedded Workbench
7.3
FW code edit , compile and
debug
N/A
N/A
N/A
J-Link
Debug and Load FW by JTAG
N/A
N/A
N/A
SPANSION FLASH
LOADER
Flash download program
N/A
N/A
N/A
Source Insight V3.50
Source code edit
N/A
N/A
Editor
Eclipse
Source code edit
N/A
N/A
Editor

U S E R M A N U A L
8 Apr 2, 2015, S6E1A1_AN710-00002
4. System Firmware Design
This chapter introduces the FW structure of low voltage 3 phase motor project.
4.1 FW Feature
The features of the low voltage 3 phase motor solution are shown in Table 4-1.
Table 4-1: Feature of LVBP Solution
No.
Feature
Description
Remark
1.
Hall Self-check
Hall status self-check
Hall phase angle self-check
Check whether the hall circuit in hardware part is
normal.
2.
Adjustable Carrier Frequency
online
Carrier frequency can be set by the corresponding
variable in user interface
3.
Rotor Angle Control
Rotor electrical phase angle was corrected by hall or
sensor-less estimation module
4.
Rotor Speed Calculate
Calculate speed through hall or sensor-less
estimation module
5.
FOC Control
Using FOC control algorithm
6.
VF Control
Using VF control algorithm with the hall sensor
7.
Self-adaption Start Up
Motor can startup with different type load without
changing parameter
8.
Speed regulate
This function is used to speed up or slow down a
motor by the command from host via UART or
debugger
9.
Brake
Stop motor by braking down
10.
Current Sample
Dual-shunt sample
Single shunt sample algorithm
11.
Protect
DC voltage protection
A/D offset protection
Lock rotor protection
Motor phase lost protection
Over Current Protection
12.
DAC
Use the DAC board to display the variables by the
SPI
4.2 FW Structure
There are 5 layers in the FW structure of IAR, which are shown in Figure 4-1.

U S E R M A N U A L
Apr 2, 2015, S6E1A1_AN710-00002 9
Figure 4-1: Structure of FW
The C source and Header files which are included in each layer are shown in Table 4-2
Table 4-2: Directory Description of Project
Layer
Folder
Description
global
H01_global,
S01_global
MCU system file
driver
H02_driver,
S02_driver
MCU register setting function such as GPIO, interrupt, MFT,AD
module
H03_module,
S03_module
Algorithm folder for basic motor control such as FOC frame transform , SVM,
math, PID, filter
app
H04_app,
S04_app
Application folder for the files of application functions such as speed and position
generator by hall sensor or sensor-less rotor estimation, protection, motor
start-up, field weaken, brake, and etc.
user
H05_User,
S05_User
Customer interface folder of the files for motor Configuration and HW setting
Note: if you want to quick start the motor, you can refer to the setting for user layer at 9.2.1FW Interface
Configuration and chapter 5System Function
The sub-files in each folder are shown in Figure 4-2, and the structure of header files is the same with C
files.

U S E R M A N U A L
10 Apr 2, 2015, S6E1A1_AN710-00002
Figure 4-2: Sub-files in Each Layer
4.3 Files Description
The detailed descriptions for each file are shown in Table 4-3.
Table 4-3: Description of Project Files
Folder
File
Description
s03_module
coordinate_transform.c
FOC axis convert
filter.c
One order low pass filter
math.c
The math module including the functions such as
SQRT,COS and SIN
pid_regulator.asm
The PID module for current and speed PI
s04_app
adc_sample.c
The ADC process module based on the ADC ISR
brake.c
The brake module including the speed down by brake
limitation.c
The FOC current and voltage limitation module
hall_capture.c
Hall capture module
motor_ctrl.c
The main file of the motor control including the main function
of FOC process of motor and the start/stop function of
motor
motor_startup_hall.c
The motor start-up module with hall sensor
timer_event.c
Timer event module
speed_set.c
The speed setting module
spi.c
The SPI module for the DAC board
FM0_LowVoltageBldc-V1.0.0.a
The library file including the sensor-less position calculate
module by sensor-less estimation, hall check module, the
motor start-up module with sensor-less motor, the SVPWM
module, and the protect module
s05_user
Customer_interface.c
The motor parameter setting
main.c
Main function
startup_s6xxxx.asm
MCU interrupt vector list
Init_mcu.c
MCU system initialization including interrupt priority list
Isr.c
The ISR file for all of the interrupt routine of the MCU

U S E R M A N U A L
Apr 2, 2015, S6E1A1_AN710-00002 11
4.4 FW Control Flow
The control flow for the motor is shown as Figure 4-3. There are 4 interrupts that are red highlighted for the
motor FOC control, hall capture and AD converter. The timer events are executed in the end-less loop and
the timers are generated in the zero detection interrupt ‘Mft_Frt_IsrHandler ‘of the free run timer 0.
Figure 4-3: Diagram of the Control Flow
Initial Functions
FeedWDT
Motor Start/Stop
Start
Timer_Event
Uart_Communicate
Hall Interrupt
Hall statue check
Hall correct angle generate
Current U\V\W sample
FOC control
Speed &Position
Generate
Protection(High Priority)
PID
SVPWM
Other Algorithm
DC bus sample and calculate
Speed Calculate from Hall
Current Sample
ADC unit0 ISR
MFT ISR
PWC ISR for Hall
End-less loop in main.c

U S E R M A N U A L
12 Apr 2, 2015, S6E1A1_AN710-00002
5. System Function
This chapter describes the global structure, variables, and system functions.
5.1 Global Structure and Variable Definition
The variable for user interface can be found in section ‘9.2.1FW Interface Configuration’.
Any structure or variable that you want to watch can be pasted into the ‘Live Watch’ window of IAR as shown
in Figure 5-1.
Figure 5-1: Diagram of Live Watch
5.1.1 Variables for Motor Running
MotorCtrl_stcRunPar
The structure is used to control motor and get the basic running information for the motor such as real
running speed, DC bus voltage, rotor angle and etc. Detailed information can be found in the comments for
each variable.

U S E R M A N U A L
Apr 2, 2015, S6E1A1_AN710-00002 13
SpdSt_stcSet
The structure is used to set the drum speed. It is the global structure for the Speed Set module that is
realized in the file ‘s04_app/ speed_set.c’. Detailed information can be found in the comments for each
variable. The variables in this structure are not recommended to modify.
5.1.2 Variables for FOC
The variables for the FOC control are introduced in this section.
typedef struct stc_SpdSet
{
int32_t i32SpdCommand; //setting speed , unit:rpm
int32_t i32SpdCommandPre; //previous setting speed , unit:rpm
uint32_t u32SpdMax; //the maximum speed limit
uint32_t u32SpdMin; //the min speed limit
uint16_t u16SpdChgTime; //speed change time from spd A to B
uint16_t u16AcceLmt; //the acceleration limit at speed up
uint16_t u16DeceLmt; //the acceleration limit at speed down
char_t cRotateDir; //motor running direction
} stc_SpdSet_t;
extern stc_SpdSet_t SpdSt_stcSet;
typedef struct
{
int32_t i32CommandSpdRpm; //user set speed
int32_t i32TargetSpdRpm; //speed pi reference speed
int32_t i32CommandSpdRpmMax; //speed max defined in customerinterface.c
int32_t i32CommandSpdRpmMin; //speed min defined in customerinterface.c
int32_t i32MotorSpdRpmRt; //motor's real time speed
int32_t i32MotorSpdRpmRtf; //motor's real time speed filter value
int32_t i32Vbus; //real time dc voltage
int32_t i32Q22_DeltaThetaTs; //forward angle in every PWM
int32_t i32Q22_DeltaThetaKTs; //the calculated factor of i32Q22_DeltaThetaTs
int32_t i32Q22_ElecAngle; //rotor's electrical angle
uint8_t u8RunningStage; //start running stage
uint8_t u8Runninglevel; //motor running level: open loop or close loop or oriented
char_t cStartupcomplete; //flag
char_t cCloseloop; //motor run in close loop flag
char_t cRunDir; //run direction: CW or CCW
char_t cRunStatus; //motor run or stop status
uint16_t u16FaultCode; //fault code for protection
uint8_t u8InitStage;
/** other definition for product lines */
int16_t u16BrakeTime; //brake times for brake stage
char_t cWorkMode; //motor work mode:low or high speed
} stc_motor_run_t;
extern stc_motor_run_t MotorCtrl_stcRunPar;

U S E R M A N U A L
14 Apr 2, 2015, S6E1A1_AN710-00002
D&Q axis Current and Voltage
MotorCtrl_stcIdqRef
Reference current value on the 2 axis rotation frames
->i32Q8_Xd;
Reference current on D-axis ‘Idref’
->i32Q8_Xq;
Reference current on Q-axis ‘Iqref’
->i32Q12_Cos
Cosine value of the rotor position used for the frame transform
->i32Q12_Sin
Sine value of the rotor position used for the frame transform
MotorCtrl_stcIdqSensed
current value on the 2 axis rotation frames
->i32Q8_Xd;
Real-time current on D-axis ‘Id’
->i32Q8_Xq;
Real-time current on Q-axis ‘Iq’
->i32Q12_Cos
Cosine value of the rotor position used for the frame transform
->i32Q12_Sin
Sine value of the rotor position used for the frame transform
MotorCtrl_stcVdqRef
Voltage value on the 2 axis rotation frames
->i32Q8_Xd;
Real-time voltage on D-axis ‘Vd’
->i32Q8_Xq;
Real-time voltage on Q-axis ‘Vq’
->i32Q12_Cos
Cosine value of the rotor position used for the frame transform
->i32Q12_Sin
Sine value of the rotor position used for the frame transform
Alpha&Beta axis Current and Voltage
MotorCtrl_stcIabSensed
->i32Q8_Xa
Real-time current on α-axis ‘Id’
->i32Q8_Xb
Real-time current on β-axis ‘Id’
MotorCtrl_stcVabRef
->i32Q8_Xa
Real-time voltage on α-axis ‘Id’
->i32Q8_Xb
Real-time voltage on β-axis ‘Id’
Motor_Offset
The AD middle points of amplifier part on the HW are got in this structure. If the middle voltage of the
amplifying circuit for the phase current is changed, the AD offset result will also be changed at same
direction.
Adc_stcMotorOffset
Structure for the ADC middle points of phase current
->i32Xu
AD middle point for current Iu AD sample
->i32Xv
AD middle point for current Iv AD sample
->i32Xw
AD middle point for current Iw AD sample
2048 = 2.5V, the offset error threshold is set by ‘AD_OFFEST_MAX_VALUE’
5.1.3 Variables for PID Control
The variables used for PID control are introduced in this part.
MotorCtrl_stcPidCtrl
The structure is used for PID control that enables or disables the corresponding PI regulator. The detailed
information can be found in the comments for each variable.

U S E R M A N U A L
Apr 2, 2015, S6E1A1_AN710-00002 15
MotorCtrl_stcIdqRef
Reference current value on the 2 axis rotation frames
->cIdEN
Id PI Enable
->cIqEN
Iq PI Enable
->cSpdEN
speed PI Enable
->cFdWkEN;
field weaken PI Enable
-> u16SpdPICyc
execute cycle of speed PI
-> u16FdWkPICyc
execute cycle of field weaken PI
->u16SpdPICnt
counter for speed PI
->u16FdWkPICnt
counter for field weaken PI
->cPIChangeEnable
Enable the PI parameter change
5.2 Function List
The functions for the system control are shown in Table 5-1.
Table 5-1: System Function List
Prototype
Description
Remark
void main(void)
Main function of the whole project
main.c
void MotorCtrl_RunInit(uint16_t
Sample_freq)
The function for the motor start control but not for the motor
start-up.
motor_ctrl.c
void MotorCtrl_Stop(void)
The function for the motor stop control
motor_ctrl.c
void MotorCtrl_InitPar(uint16_t
u16SampleFreq)
The key variable and the register initial at the motor start
motor_ctrl.c
void MotorCtrl_HallSensorProcess(void)
The main function of the motor control with hall sensor that is
called in each of the MFT zero detect ISR
motor_ctrl.c
void MotorCtrl_SensorLessProcess(void)
The main function of the motor control with sensor-less that is
called in each of the MFT zero detect ISR
motor_ctrl.c
void MotorCtrl_HallVFProcess(void)
The main function of the VF motor control with hall sensor that
is called in each of the MFT zero detect ISR
motor_ctrl.c
void Timer_Counter(void)
The 1ms/5ms/50ms timer generated by the MFT ISR
timer_event.c
void Timer_Event(void)
The timer event for the motor control or the advanced function
timer_event.c

U S E R M A N U A L
16 Apr 2, 2015, S6E1A1_AN710-00002
6. Event Function
The primary functions for the motor inverter control are introduced in this chapter
6.1 Function List
The functions for the motor control that are called in the MFT ISR ‘Mft_Frt_IsrHandler ()’ and timer .c
‘Timer_Event()’ are shown in Table 6-1 and
Table 6-2 Table 6-1: Event Function Called by the MFT ISR
Prototype
Description
MotorCtrl_SpdHall ()
The speed calculate function of the hall module
Adc_MotorCurrentSense ()
The phase current restoration from ADC converter
Clark(&MotorCtrl_stcIuvwSensed,
&MotorCtrl_stcIabSensed)
The function of the Clarke frame transform
Park(&MotorCtrl_stcIabSensed,
&MotorCtrl_stcIdqSensed);
The function of the Park frame transform
MotorFee_PostionEstimate
(&Motor_stcFeeEsti,&MotorCtrl_stcVabReal,
&MotorCtrl_stcIabSensed)
The function of the rotor position estimator
MotorCtrl_PositionGenerateSensorLess()
The function of the rotor position calculation from the estimator and
hall module
MotorCtrl_PositionGenerateHall ()
The function of the rotor position generation
void Pid_Reg0(stc_pid_t *pstcPid, int32_t
i32QN_E0);
The d/q current PI regulator
Startup_HallMotor()
The motor start-up function for the hall sensor motor
InvPark(&MotorCtrl_stcVdqRef,
&MotorCtrl_stcVabRef)
The function of the inverse Clarke frame transform
Svm_Calc(&MotorCtrl_stcSvmCalc);
The SVPWM function
SingleShunt(&MotorCtrl_stcSvmGen)
The function for the OCCP register setting according to the SVPWM
calculate result
Protect_HallLockRotor
(&Protect_stcHallLock,Hall_stcCapture);
The protection function for the hall lost detect
Protect_OpenPhase();
The protection function for the open phase detect
SPI_Draw1(i32Temp)
The function for DAC board to observe the FW variables by SPI
Table 6-2: Event Function List Called by the ‘Timer_Event()’
Prototype
Description
Remark
SpdSt_CommandReceive
(&SpdSt_stcSet,&SpdSt_stcReg);
The speed set function used for the motor speed acceleration
or deceleration
1ms
timer
SpdSt_TargetReg (&SpdSt_stcReg);
The speed regulation function for the middle speed generation
PID_ParameterChange()
The function of the PID Parameter Change
CV_LimitCtrl()
The function of the FOC current and voltage limitation
5ms
Protect_LockRotor (…)
The function of the motor lock protection
Protect_Voltage (….)
The function of the DC bus over and under protection
Timer_CarrierChange()
Function for carrier changeable on-line
50ms

U S E R M A N U A L
Apr 2, 2015, S6E1A1_AN710-00002 17
7. Driver Function
The MCU peripheral resources used for motor control are introduced in this chapter.
7.1 Function List
Most of the MCU peripheral driver functions are located in the file ‘S05_user/init_mcu.c’
Table 7-1: Driver Function List
Prototype
Description
Remark
void InitMcu_Nvic (void)
Enable the motor interrupt control and set the priority.
Init_mcu.c
void InitMcu_Clock (void)
MCU clock initial
Init_mcu.c
void InitMcu_Wdg (void)
Watch dog initial
Init_mcu.c
void InitMcu_Gpio (void)
The used GPIO initial, user can add the GPIO for other
usage
Init_mcu.c
void InitMcu_MotorSvpwm (void)
The SVPWM initial such as the FRT mode and cycle, AD
trigger source, OCCP mode, etc.
Init_mcu.c
void InitMcu_MotorSvmEn (void)
Enable the SVPWM output
Init_mcu.c
void InitMcu_MotorSvmDis (void)
Disable the SVPWM output
Init_mcu.c
void InitMcu_Adc(uint16_t
u16SampleFreq)
The AD initial such as the port setting, converter time setting,
trigger point, etc.
Init_mcu.c
void MotorCtrl_ConfigPwm (void)
Configuration the PWM such as the dead time of the
SVPWM, max duty
Init_mcu.c
void InitMcu_Basetimer (void)
The PWC registers initial for hall capture
Init_mcu.c
void Brake_IPMLowArmOn (void)
Porting setting for motor brake
Brake.c
void Brake_IPMAllArmOff void)
Release the port to finish the brake
Brake.c

U S E R M A N U A L
18 Apr 2, 2015, S6E1A1_AN710-00002
8. Interrupt Function
8.1 Function List
Table 8-1: System Used Interrupt Function
Prototype
Description
Remark
__root void HWD_Handler (void)
The HW watch dog ISR
S05_user/isr.c
__root void Swd_IsrHandler (void)
The software watch dog ISR
S05_user/isr.c
__root void Bt_0_7_IsHandler (void)
PWC interrupt for Hall interrupt
s05_user/isr.c
__root void Mft_Frt_IsrHandler (void)
The MFT zero detect ISR for the motor control
s05_user/isr.c
__root void Mft_Wfg_IsrHandler (void)
The HW over-current ISR
s05_user/isr.c
__root void Adc_0_IsrHandler (void)
The ADC unit0 ISR, trigger at the zero point for the 3 shunts
s05_user/isr.c
8.2 Interrupt Priority Setting
Each interrupt priority can be set by the function ‘void InitMcu_Nvic (void)’ which is located at the file
‘S05_user/init_mcu.c’’. Users are not recommended to modify it. The priority diagram for motor control is
shown in Figure 8-1.
Figure 8-1: Interrupt Priority Diagram
Watch Dog
ADC Unit 0
MFT
Base Timer
MFS
Priority
H
L
DTTI

U S E R M A N U A L
Apr 2, 2015, S6E1A1_AN710-00002 19
8.3 Interrupt Generation
The diagram of the interrupt used for the motor control is briefly introduced in this section.
8.3.1 MFT
The multifunction timer is used to generate the interrupt for the motor control algorithm and trigger the AD
sample at the zero point.
Figure 8-2: Free Run Timer Interrupt
8.3.2 Hall Capture
The PWC timer is used to capture the hall status change and the pulse of the edge of the hall signal.
Figure 8-3: Base Timer Interrupt
H
L
One motor ele-cycle
Bt_0_7_IsHandler
Hall signal Voltage High or Low level
Hall Edge
change
interrupt and
base timer
over flow
interrupt
Trigger Hall interrupt
Motor speed calculate
and rotor phrase angle
core
Base timer Count Over Flow
Mft_Frt_IsrHandler
Free run timer 0, UP/DOWN mode, PWM cycle: 62.5 us, 16K Hz
Trigger AD unit0 and FOC interrupt
A/D unit0: sample U, V,
W current
FOC interrupt to drive
motor

U S E R M A N U A L
20 Apr 2, 2015, S6E1A1_AN710-00002
8.3.3 DTTI
The DTTI0 is used to trigger the HW fault protection from the IPM. When the phase current is large enough
to trigger the HW over-current fault, the interrupt is got and all of the drive signals for the motor control will
be shut off immediately.
Figure 8-4: DTTI Interrupt
Mft_Wfg_IsrHandler
IPM fault signal low voltage
H
L
Trigger over Current
Interrupt, PWM closed
Table of contents
Popular Microcontroller manuals by other brands

Texas Instruments
Texas Instruments CC3235MODSF SimpleLink user guide

IDT
IDT Microclock 5X1503 Series user guide

ST
ST STM32F746IGT6 user manual

Texas Instruments
Texas Instruments MSP432P401R manual

Espressif Systems
Espressif Systems ESP32-C3 Series Hardware Design Guidelines

Intersil
Intersil ISL94203EVKIT1Z user guide

Telit Wireless Solutions
Telit Wireless Solutions SE880 RDK user manual

Texas Instruments
Texas Instruments LM26EVM user guide

Franklin Wireless
Franklin Wireless S600W user manual

Fujitsu
Fujitsu MB91460 SERIES Application note

Fujitsu
Fujitsu F2MC-16LX Series Application note

Analog Devices
Analog Devices ADuCM4050 EZ-KIT manual