Simple Conference Style Presentation by Slidesgo.pptx
Motor_Control_Library_IITMRP_presentation.pdf
1. Motor Control SDK v5.x
3-Phase Motors PMSM FOC
Saurabh SONA
Staff Engineer
System Application & Integration Lab
SRA-SAIL, Greater Noida - India
2. System Application & Integration Lab(SAIL)
Greater Noida
Reference
Designs
(STEVAL/X-
NUCLEO/
STSYS)
Connectivity
(BLE, Sub
GHz, PLC)
Software GUI
and APPs
(Android,
IOS)
Generic
Support and
collaboration
Motor
Control &
Smart Power
Metering
Smart
Lighting
2
Customer Support /
Partnerships
Regions and
collaborations
Divisional Alignment
Publications /
Standardization
Pilot Projects and Sites
Startups / Universities /
ESDM
Part of
System Research & Applications (SRA)
at ST Global Level
3. Electric Motor: Classification
Electric
motors
AC
Synchronous
PMSM (FOC)
BLDC (6-step)
Asynchronous
(ACIM)
Variable
reluctance
Switched
reluctance
Stepper
DC (brushed)
Universal
• PMSM: 3-phase permanent
magnet synchronous motor
• ACIM: 3-phase induction motor
Complex driving,
Computation intensive,
Requires 3-phase timer + sync’d ADC
Limited computation need,
Basic ADC/PWM requirements
STM32/STM8
solution
offer
Software
Development
Kit (SDK)
Software
Examples
Software
Examples
3
4. Scalar drive vs Field Oriented Control 4
Both are Variable Frequency Drives (VFD)
Scalar drive (6 Step Control) Vector drive (Field Oriented Control)
Only the frequency and the magnitude
of the voltage fed to the motor are
controlled
The applied voltage is computed each
PWM cycle so as to make current follow a
precise profile
Motor current feedback not required Motor current feedback is mandatory
Torque cannot be controlled directly
and completely
Allows full and quick control of motor
torque
Does not require high computational
power
Requires high computational power
Key similarity: Both require rotor position sensing (physical sensor/sensorless)
5. BLDC 6-Step Drive 5
In BLDC drive, the electrical cycle is subdivided into six commutation steps.
For each step, the bus voltage is applied to one of the three phase windings of
the motor while the ground is applied to a second winding. The third winding
remains open. The successive steps are executed in the same way except that
the motor phase winding changes to generate a rotating stator field.
6. PMSM FOC Basics
• Field Oriented Control: stator currents (Field) are controlled in amplitude
and phase (Orientation) with respect to rotor flux
current sensing is mandatory (3shunt/1shunt/ICS)
speed / position sensing is mandatory (encoder/Hall/sensorless algo)
current controllers needed (PI/D,FF)
complex… high frequency sinusoidal references + stiff amplitude modulation..
reference frame transformation (Clarke / Park) allows to simplify the problem:
6
Te maximized if…
Φr
Φs
90el
90el
t
7. Why FOC ? 7
• Best energy efficiency even during transient operation.
• Responsive speed control to load variations.
• Decoupled control of both electromagnetic torque and flux.
• Acoustic noise reduction due to sinusoidal waveforms.
8. Types of Speed Sensors (1/2)
• Sensorless with State Observer:
• No additional hardware required (cost effective).
• Supported by all STM32Fxx MCUs.
• Cannot work in FOC at low speeds.
• Startup may have backward movement as initial rotor position is unknown.
• Hall Sensors:
• Hall sensors need to be mounted with sufficient precision inside motor. Additional
electronics required for conditioning and sensing hall sensor signals (costlier).
• Supported by SMT32F05x and above.
• No backward movement at startup as initial rotor position is known.
• Supports low speed operation.
8
9. Types of Speed Sensors (2/2)
• Optical Encoders:
• Useful for high resolution speed/position control for servo applications with very low
as well as zero speed operation.
• Encoders are relative speed sensors hence motor may have backward movement
during startup.
• Encoders are the costliest type of sensors.
• Sensorless with HFI (only available in v4.3 as of now):
• Supports very low speed operation in sensorless mode.
• Works only with Internal PMSM motors.
• Requires STM32F3xx and above.
9
10. Current sensing topologies
• To measure the motor phase currents some form of sensing and
conditioning network is required.
• The STM32 FOC SDK supports three current sensing network
• Insulated current sensor (ICS)
• Three shunts
• Single shunt
10
Three shunts Single shunt
Insulated current sesor (ICS)
Cost optimized
Best quality
11. Three shunts current reading methodology
• The sampling of the currents must be performed when the corresponding low side
switch is turned on.
11
ADC
Gate
Driver
+
-
OpAmp + Offset
+
-
OpAmp + Offset
+
-
OpAmp + Offset
12. ICS current reading methodology
• The sampling of the currents can be performed every where in the PWM period.
12
ADC
Gate
Driver
+
-
Conditioning
+
-
Conditioning
13. Single shunt current reading methodology
• For each configuration of the low side
switches, the current that is flowing in the
shunt resistor can be one of the motor
phase current.
13
ADC
+
-
OpAmp + Offset
AL BL CL iShunt
Open Open Open 0
Open Close Close iA
Open Open Close -iC
Close Open Close iB
Close Open Open -iA
Close Close Open iC
Open Close Open -iB
Close Close Close 0
iA
iShunt
14. 14
FOC diagram (speed control)
vds
vqs
+
-
+
-
PID
PID
iqs
ids
iqs*
ids*
REVERSE
PARK &
circle
limitation
CALC
SVPWM
CURRENT
READING
va,b,c
θr el
vαβs
iabc s
PARK
θr el
iαβ s
CLARKE
+
-
ωr
ωr
*
ROTOR
SPEED/POSITION
FEEDBACK
3 phase inverter
PMSM
Motor
~
Power converter
AC
Mains
~
ICS / shunts
enc / Hall
MTPA & FLUX
WEAKENING
CONTROLLER
PID
DC domain AC domain
15. 15
Presentation Title
Luenberger’s Observer
Sensorless Block diagram
CALC
SVPWM
CURRENT
READING
va,b,c
vαβ s
iabc s
iαβ s
CLARKE
PMSM
Motor
~
Power converter
~ 3 phase
inverter
vDC
meas
ICS / shunts
BACK-EMFs
CALCULATION
Bus voltage
measurement
iαβ s
vα’β’s
vBUS
b-emf α
b-emf β
Rotor
Angle/Speed
reconstruction
θr el
ωr
16. SMART
SHUTDOWN-BKIN,
DC V - TEMP
PMSM FOC – Block Diagram 16
Speed Control FOC Current Control
Motor
+
ωr
*,t
vds
vqs
+
-
-
PID
PID
iqd
iq*
id*
REVERSE
PARK +
circle
limitation
vabc
θr el
vαβ
iabc
PARK
θr el
iαβ
CLARKE
MTPA & FLUX
WEAKENING
CONTROLLER
Speed sensors:
Sensorless,
Hall,
Encoder
ROTOR
SPEED/POSITION
FEEDBACK
PID
Te*
+
-
Space
Vector
PWM
Current
sensors:
3shunt/1shunt/
ICS
PHASE CURRENTS
FEEDBACK
RAMP
GENERATOR
ωr*
Gate drivers
Power Bridge
ST
SLLIMM™
IPM
ωr
DC domain AC domain
19. Motor Control Development Workflow
Hardware
Setup
Motor
Characterization
System
Configuration
Motor Control
Workbench
Project
Configuration
CubeMX & IDE
Motor Drive
Tuning
Tune MC part
Final
Application
Development
19
20. STM32 MC Profiler
• Automatic detection of key parameters
• Zero equipment required
• Spin motor within less than 1min
• Best accuracy when Rs ≥ 1 Ω and Ls ≥ 1 mH
20
21. Motor Profiler features 21
• Measure electrical parameters of a PMSM
motor: Rs, Ls, Ke
• Measure mechanical parameters: J, F
• On the fly set up of current regulators and
Sensorless algorithm
• Run any motor in less than one minute
• No additional HW and equipment required
• Estimated parameters can be uploaded to the
ST MC Workbench GUI, for successive
settings New algorithm
Electrical motor parameters
Mechanical motor parameters
Current regulators tuning
Sensorless tuning
22. Motor Profiler Steps
Parameters detection process
22
Motor stopped
• Rs measurement
• Ls measurement
• Current regulators set-up
Open loop
• Ke measurement
• Sensorless state observer set-up
• Switch over
Closed loop
• Friction coefficient measurement
• Moment of inertia measurement
• Speed regulator set-up
10 sec
5 sec
45 sec
24. Old STM32 MC Workbench v4.3 24
• Dedicated PC software that reduces the design effort and time in the STM32 MC FW
library configuration.
• This workbench PC GUI generates all parameter header files which configures the
library according to user MC application needs.
Motor
Power Stage
Drive
Management Control Stage
26. New GUI for MCSDK5.x
Generate
26
• Generates complete project including Cube MX IOC file (Can be used to Initialize other
peripherals used by the application).
• Supports multiple IDE Toolchains.
28. SDK5.0 FW Architecture Overview 28
Motor Control Cockpit
- MC API -
Motor Control Library
- Lower Level API -
MC Loop Safety Loop FOC Loop
Init. / Config.
Revup Gate Control
Encoder
Alignment
On the Fly
Startup
Bus Voltage
Sensing
Current Sensing
& PWM Gen.
Temperature
Sensing
Speed & Position
Feedback
Max. Torque per
Ampere
Feed Forward
Flux Weakening
PID Regulator Ramp Manager
Circle Limitation
Speed & Torque
Control
Power
Measurement
Inrush Current
Limiter
Open Loop FOC
GPIO Driver
Components
Instantiation
Components
Configuration
State Machine
Components
integration
Over Current P.
Under Current P.
Over Voltage P.
Over Heating P.
Park / Park-1
Clarke / PWM
Components
integration
MC Math
UI Library
- UI API -
API Implementation
Motor 1 Functions Motor 2 Functions
DAC LCD
UART
Communication
MC Protocol
HAL / LL
Application
The FW is divided
into 3 parts:
• User Interface Library
• MC Cockpit
• Motor Control Library
29. Encoder alignment
Inrush
current limiter
MC Application – State macchine
• State machine has been enriched with new states
• Charge boot cap (it can be disabled modifing CHARGE_BOOT_CAP_ENABLING define in MCTasks.c), Offset
calibration, Clear, ICL Wait
• Parallel path for encoder alignment
29
IDLE
IDLE
START
CHARGE
BOOT
CAP
OFFSET
CALIB CLEAR START
ICLWAIT
IDLE
ALIGN
ALIGN
CHARGE
BOOT
CAP
ALIGN
OFFSET
CALIB
ALIGN
CLEAR ALIGN
START
RUN
RUN
ANY
STOP
STOP
STOP
IDLE
FAULT
NOW
FAULT
OVER
30. HAL
MC SDK FW lib architecture - v4.3 vs v5.1 30
MC WB (GUI)
Stdlib
MC WB (GUI)
LL
MC param:
Pole pairs,… Product IPs:
ADC, TIM,…
CubeMX
(GUI)
SDK v4.3
Registers
LL
Bi-directional
interaction
(limited)
Registers
SDK v5.0
Yesterday Today
CUBEMX is called by MCWB (in the
background) or by user upon request
MC code size gain: 29% (average)
CPU workload gain: Up to 21%
and/
or
MC FW lib.
STM32
Config.
MC FW lib.
STM32 Config.
Motor
Control
FOC
Appli.
Config.
Total code size gain 15% (average)
(based on LL) since v5.1
MC WB unchanged
code size < 22KB
15% code size gain from v4.3 to V5.1 !
31. 31
MC
Workbench
MC Profiler
MC Monitor
MC TOOLS
MC
Templates
CubeMX
LL/HAL
IDE
MC
project
MC SDK5.x
CMSIS
MC
Library
Today: Motor Control SDK v5.x
MC Library and MC Tools
STM32 CUBE
Customized code
32. FW Library
Version 4.3 Version 5.x
Architecture 3 main parts: MCApplication/
MCLibrary and UI_Library
Same concept: Motor Cockpit/ Motor
Control library and User Interface Library
Workspace 1 for library/ 1 for application
code
Only 1 workspace for library and
application code
API 4.3 API used as reference Simplified/ Per motor
Coding style Object Oriented C code Cube Architecture C code
Drivers used SPL HAL- LL
Peripheral
initialization
Done inside FW main file through
#define/ All MCU code present in
the code
Done automatically by CubeMx/ Only
necessary code generated
Main
readability
Main code difficult to modify
(Large/ #define parts to
understand and handle by
customer..)
Done automatically by CubeMx/ Only
necessary code generated
32
34. SDK FW library features summary
34
HALL sensor
MTPA
Speed sensor: Current sensor: Bus voltage sensor
Temperature sensor
Flux weakening
FOC
Feed forward
Motor profiler Ramp
Encoder
Sensorless
PWM
Speed PI
Iq PI
Id PI
STM32F0
STM32F3
…
1 shunt
3 shunt
ICS
Speed and Torque control
Large
MCU
portfolio
Single/Dual Motor
Sensors
Features
PI regulators Microcontrollers
FOC: Field oriented Control, HFI: High frequency Injection, ICS: Isolated Current Sensor
MTPA : Maximum Torque Per Ampere, PWM: Pulse Width Modulation, PFC: Power factor correction
Actuators
36. Motor control kits
STM32100B-MCKIT
STM3210B-MCKIT
Part Number Description
ST Link
on-board
Type
P-NUCLEO-IHM001 STM32 Nucleo Pack FOC and 6-step control for Low voltage 3-ph motors
Yes (embedded) Single drive
P-NUCLEO-IHM002 with DC Power supply
STM32100B-MCKIT Motor control starter kit for STM32F100 (128KB Flash) Value Line MCUs Yes Single drive
STM3210B-MCKIT
Motor control starter kit for STM32 (128KB flash) Performance and
Access Line microcontrollers
No Single drive
Serial communication RS232
The motor control kit connections represented below can also be applied when combining STM32
control boards and evaluation power boards.
• P-NUCLEO-IHM001
• P-NUCLEO-IHM002
Back
36
37. STEVAL-IHM042V1 STEVAL-IHM043V1
ST Complete Inverters
Part Number Description
ST Link
on-board
Type
STEVAL-IHM034V2
Dual-motor control and PFC demonstration board featuring the
STM32F103 and STGIPS20C60
No
Single/Dual
drive
STEVAL-IHM036V1
Low-power motor control board featuring the SLLIMM™
STGIPN3H60 and MCU STM32F100C6T6B
No Single drive
STEVAL-IHM038V1 BLDC ceiling fan controller based on STM32 and SLLIMM-nano No Single drive
STEVAL-IHM040V1
BLDC/PMSM driver demonstration board based on STM32 and the
SLLIMM-nano
No Single drive
STEVAL-IHM042V1
Compact, low-voltage dual-motor control board based on the
STM32F303 and L6230
Yes
Single/Dual
drive
STEVAL-IHM043V1
6-Step BLDC sensorless driver board based on the STM32F051
and L6234
No Single drive
STEVAL-IHM034V2 STEVAL-IHM036V1 STEVAL-IHM040V1
37
Back
STEVAL-IHM038V1
38. Flexible
MC Platform
MC
Connector
Full set of control boards
featuring all ST MCUs
Full set of power boards
featuring Power Transistors,
IPM, and MC Driver ICs.
+
X-NUCLEO-IHM09M1
Connector Adapter
NUCLEO-XX
Control board
STM32XX-EVAL
Control board
STEVAL-XX
Power board
38
Back
39. The MC connector
1 2
3 4
5 6
7 8
9 10
11 12
13 14
15 16
17 18
19 20
21 22
23 24
25 26
27 28
29 30
31 32
33 34
FAULT
PWM 1 High
PWM 1 Low
PWM 2 High
PWM 2 Low
PWM 3 High
PWM 3 Low
Current phase A
Current phase B
Current phase C
NTC by pass Relay
Dissipative Brake PWM
5V
PFC Sync
PFC PWM
Encoder A / Hall A / Bemf A
Encoder B / Hall B / Bemf B
GND
GND
GND
GND
GND
GND
Bus Voltage Sensing
GND
GND
GND
GND
GND
Heat sink temperature Monitor
Vdd Micro
GND
GND
Encoder Index / Hall C/ BEMF C
34-pin connector dedicated to motor control applications, it is a standard ST interface
between MCU evaluation boards and power boards.
39
Back
40. STM32 evaluation boards
with MC connector
Part Number Description ST Link on-board Type
STM32072B-EVAL Evaluation board with STM32F072VB MCU Yes Single drive
STM3210E-EVAL Evaluation board for STM32 F1 series - with STM32F103 MCU No Single drive
STM3220G-EVAL Evaluation board for STM32 F2 series - with STM32F207IG MCU Yes Single drive
STM32303E-EVAL Evaluation board for STM32F303xx microcontrollers Yes Single/Dual drive
STM32446E-EVAL Evaluation board for STM32F407 line - with STM32F407IG MCU Yes Single drive
STEVAL-IHM039V1
Dual motor drive control stage based on the STM32F415ZG
microcontroller
No Single/Dual drive
STM32303E-EVAL
STM32446G-EVAL
STM32072B-EVAL
(1) for high-voltage applications if not implemented in the evaluation board
In-circuit debugger/programmer..
ST-LINK/V2
ST-LINK/V2-ISOL (2500 VRMS high isolation voltage)(1)
For the complete list visit st.com
40
Back
41. Key hardware features 1/3
Reference /
bundle
Voltage Power
Motor type /
control type *
ST Parts Application focus
STEVAL-IPM05F 125 – 400 VDC Up to 700 W
PMSM/BLDC
FOC/6-step
3-shunt
• 1 x STGIF5CH60TS-L
• 1x TSV994
Power board: water pumps,
fans, dish washers and more
STEVAL-IPM07F 125 – 400 VDC Up to 800 W
PMSM/BLDC
FOC/6-step
Single/3-shunt
• 1 x STGIF7CH60TS-L
• 1x TSV994
Power board: water pumps,
fans and more
STEVAL-IPM10F 125 – 400 VDC Up to 1 kW
PMSM/BLDC
FOC/6-step
• 1 x STGIF10CH60TS-L
• 1x TSV994
Power board: pumps,
compressors, washing
machines and more
STEVAL-IPM10B 125 – 400 VDC Up to 1.2 kW
PMSM/BLDC
FOC/6-step
single/3-shunt
• 1 x STGIB10CH60TS-L
• 1x TSV994
Power board: pumps,
compressors, air conditioning
and more
STEVAL-IPM15B 125 – 400 VDC Up to 1.5kW
PMSM/BLDC
FOC/6-step
single/3-shunt
• 1 x STGIB15CH60TS-L
• 1x TSV994
Power board: pumps,
compressors, fans, dish
washers and more
41
Back
42. Key hardware features 2/3
Reference /
bundle
Voltage Power
Motor type /
control type *
ST parts
Application
focus
STEVAL-IHM021V2
120/230 VAC nominal
(60/50 Hz)
Up to 100 W
PMSM/BLDC
FOC/6-step
3-shunt
• 3x L6390
• 1x Viper12
• 6x STD5N52U
Power board: water pumps,
fans, dish washers, washing
machines
STEVAL-IHM023V3
90 – 285 VAC
125 – 400 VDC
Up to 1 kW
PMSM/BLDC
FOC/6-step
Single/3-shunt
• 3x L6390
• 1x Viper16
• 7x STGP10H60DF
Power board: pumps,
compressors, washing
machines and more
STEVAL-IHM028V2
90 – 285 VAC
125 – 400 VDC
Up to 2 kW
PMSM/BLDC
FOC/6-step
Single/3-shunt
•1x STGIPS20C60
• 1x VIPer26LD
• 1x STGW35NB60SD
Power board: pumps,
compressors, air conditioning
and more
STEVAL-IHM032V1
230 VAC nominal
86 to 260 VAC
Up to 150 W
PMSM/BLDC
FOC/6-step
Single/3-shunt
• 2x L6392D
• 1x L6391D
• 1x Viper12
• 6 x STGD3HF60HD
Power board: pumps,
compressors, fans, dish
washers and more
STEVAL-IHM035V2 120/230 VAC nominal Up to 100 W
PMSM/BLDC
FOC/6-step
single-shunt
• 1x STGIPN3H60
• 1x VIPer16L
Power board: pumps,
compressors, fans, dish
washers and more
STEVAL-IHM045V1
30 – 270 VAC
40 – 400 VDC
Up to 100 W
PMSM
FOC
Single/3-shunt
• 1x STGIPN3H60A
• 1x VIPer06L
• 1x TSV994
Power board: pumps,
compressors, fans, dish
washers and more
42
Back
43. Key hardware features 3/3
Reference /
bundle
Voltage
Power /
current
Motor type /
control type *
ST Parts Application focus
X-NUCLEO-IHM07M1 Up to 48V Up to 2.5A
PMSM/BLDC
FOC/6-step
Single/3-shunt
1x L6230
1x BAT30KFILM
1xTSV994IPT
Sewing machines, pumps,
drones,
X-NUCLEO-IHM08M1 10 – 48Vdc Up to 15A
PMSM/BLDC
FOC/6-step
Single/3-shunt
6xSTL220N6F7
3xL6398
1xTSV994IPT
Drones, e-bikes, drills,
pumps, etc.
X-NUCLEO-IHM09M1 - -
Motor control connector
adapter
Not silicon devices
Allow connection of STM32
NUCLEO boards with any ST
motor control power boards
43
End