En - stm32PMSMFOCSDK Getting Started
En - stm32PMSMFOCSDK Getting Started
En - stm32PMSMFOCSDK Getting Started
3
Getting Started
Rev 1.6
Objectives 2
• What is needed:
• Windows laptop (Win 7)
• ST-LINK dongle (optional)
• USB to RS-232 dongle and a null modem cable (optional)
• A permanent magnet motor
• Multimeter (optional)
• An oscilloscope with current probe (optional)
• An insulated DC and or AC power supply
Motor control – SDK workflow
Motor control – SDK – Workflow 5
• Connect the board (if required) to the power supply and your motor.
• When the hardware is ready, if the user does not know the motor
parameters, he can identify the motor.
• How? Using the Motor Profiler!!
• Follow the instruction in Step 6.
• If want to measure the Motor parameter in the lab Step 8
Motor control – SDK – Workflow 3/4 8
• When using the Motor Profiler, the motor is running but the user can
develop his own code!
MC Workbench
Motor control – SDK – Workflow 4/4 9
• Finally, the user can send commands (e.g. start, stop, execRamp,
…) via serial communication.
based on
ST MC connector
Control stages
Power stages
Board List
Software setup
Setup
Back the HW
Download and install the STM32 PMSM FOC SDK from www.st.com.
It contains both the firmware package and the ST MC Workbench (PC GUI).
ST MC Workbench FW package
Setup
Back the HW
• If the control board or the complete system doesn’t embed the ST-LINK, a
stand-alone dongle is required.
• In any case, you must install the ST-LINK driver that can be found in the ST
website searching for part number ST-LINK/V2 or ST-LINK/V2-ISOL
(This will be required to flash the LCD FW code into the MCU).
Setup
Back the HW
• Using the USB cable, connect the control board with ST-LINK embedded
(or the ST-LINK dongle) to the A male connector into your laptop.
2. Right-click on the
“STM32 STLink” Driver icon.
6. Click “Next”.
Setup
Back the HW
7. Click “Next”.
Setup
Back the HW
• For a custom project, the user can set all the parameters individually.
Motor
Back Profiler
Open Board
configuration window
Motor
Back Profiler
• Internal permanent magnet motor (I-PMSM). In this case, the Ld/Lq ratio as input is required.
SM-PMSM I-PMSM
Motor
Back Profiler
Motor stopped
• Rs measurement
• Ls measurement
10 sec
• Current regulators set-up
Open loop
• Ke measurement 5 sec
• Sensorless state observer set-up
• Switch over
Closed loop
• Friction coefficient measurement 45 sec
• Moment of inertia measurement
• Speed regulator set-up
Motor
Back Profiler
Play Mode
• At the end of the procedure, it is possible to run and control the motor’s speed
Motor
Back Profiler
• Motor Identified: users can switch the motor on or off using the “Start”
and “Stop” buttons.
1. Applications
1
Back Finalizing
3. Board approach:
• Choose if you are using Inverter,
MC Kit or Power plus Control
boards.
• Select the board used or create
your own custom board.
Back Finalizing
4 4. Motor:
Choose the motor from a motor
database. (You can save your motor
parameters from your project.)
Back Finalizing
• Starting from the board selection or example project, the control stage
parameters will be populated with the correct values.
• For a custom project, the user can set all the parameters.
STM32303E-EVAL
Back Finalizing
• Starting from the board selection or example project, the power stage
parameters will be populated with the correct values.
• For a custom project, the user can set all the parameters.
Back Finalizing
• For a custom project, the user can set all the parameters.
Applications
Back Finalizing
• In Drive settings, choose a correct PWM frequency and torque and flux execution
𝑃𝑊𝑀 𝑓𝑟𝑒𝑞
rate in such a way that the 𝐹𝑂𝐶 𝑟𝑎𝑡𝑒 = is compatible with the
𝐸𝑥𝑒𝑐𝑢𝑡𝑖𝑜𝑛 𝑟𝑎𝑡𝑒
maximum FOC rate according to the microcontroller used.
STM32F4xx, STM32F3xx
STM32F103x LD/MD
STM32F100x, STM32F0xx
1shunt Flux Digital Motor
IPMSM MTPA 3shunt
3shunt(4) Weakening PFC(3) Profiler
• In Drive settings, decrease cut-off frequency of torque and flux regulator down to 2000 rad/s if power
stage → current reading topology is single shunt.
• In Sensing enabling and FW protections, uncheck the sensing options not supported by power stage
and check any “Set intervention threshold to power stage xxx” buttons.
• In Drive settings, initially set default target speed to at least 20% of maximum application speed.
• In additional features, start without any additional method (possible to add them later).
Back Finalizing
• If motor profiler is not used, in Start-up parameters, select the basic profile.
• Set current ramp initial and final values equal to the motor nominal current value / 2 (if load is low at low
speed, otherwise it can be set up to 0.8-1.0 times the nominal current value).
• Set speed ramp final value to approximately 30% of the maximum application speed.
• Depending on the motor inertia, it may be required to increase the speed ramp duration.
• Set minimum start-up output speed to 15% of the maximum application speed (if required, decrease it later).
• Set estimated speed band tolerance lower limit to 93.75%
• Enable the alignment at the beginning of your development (duration 2000 ms, final current ramp value from
0.5 to 1 times the motor nominal current depending on the load)
Basic
Step #7 – Example of configuration
Digital PFC
Back Example
Note. In the library’s current version, the digital PFC FW is available for the
STM32F103 line (STM32F103xC, STM32F103xD, STM32F103xE, STM32F103xF
and STM32F103xG) or for the STM32F303 line (STM32F303xB and
STM32F303xC).
Back Example
Enable PFC
Back Example
• The PFC status and register can be viewed and/or modified using
the direct access in the “Register” tab.
Back Finalizing
SDK
.h
Parameter User project
files
MC library
project
(Source code)
• Generate the configuration (.h) files for the firmware library (see Step #9).
Back Finalizing
SDK IDE
1010010..
1110010.. 110111010101
.OBJ
.h 001011110001
.EXE
files .OBJ
1100100101010
0010100101001
MC library 0101001..
.LIB
project
(Source code)
• Compile the firmware library using the available IDE (IAR, Keil and
AC6) (see step #10).
Back Finalizing
SDK IDE
1010010..
1110010.. 110111010101
.OBJ
.h 001011110001 ST-LINK
Parameter User project
.OBJ 1000010..
Linker 101010101..
.EXE
files .OBJ
1100100101010
0010100101001
MC library 0101001..
.LIB
project
(Source code)
• Flash the executable into the microcontroller using ST-LINK (see Step
#10).
End Finalizing
SDK IDE
1010010..
1110010.. 110111010101
.OBJ
.h 001011110001 ST-LINK
Parameter User project
.OBJ 1000010..
Linker 101010101..
.EXE
files .OBJ
1100100101010
0010100101001
MC library 0101001..
.LIB
project
(Source code)
• Set Max Rated Speed with the maximum motor speed according to the application
specs.
• Set Nominal Current with maximum peak current provided to each of the motor
phases according to the motor specs.
• Set Nominal DC Voltage with value of DC bus provided to the inverter or the rectified
value of AC input.
Back Finalizing
+
-
DC voltage source
Back Finalizing
I
+
V
-
DC voltage source
Back Finalizing
V I∞
0.63*I∞
τ = L/R
Back Finalizing
VBemf = Ke · ωmec
• To measure Ke, it usually suffices to turn the motor with your hands
(or using a drill or another motor mechanically coupled) and use an
oscilloscope to look for the phase-to-phase induced voltage (VBemf )
+
-
Back Finalizing
• Once all the parameters have been entered in the ST MC Workbench, select
the output path in the option form and choose ‘SystemDriveParams’ present
in the FW working folder.
• Click on the ‘Generation’ button to configure the project.
Back Finalizing
Select
project
Back Finalizing
Compile
Select
project
Back Finalizing
Monitor Connect
Select COM
port
Start
Fault ACK
ST Evaluation Board Offer
Back
ST Link
Part Number Description Type
on-board
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
Motor control starter kit for STM32 (128KB flash) Performance and
STM3210B-MCKIT Yes Single drive
Access Line microcontrollers
The motor control kit connections represented below can also be applied when combining STM32
control boards and evaluation power boards.
• P-NUCLEO-IHM001
STM3210B-MCKIT STM32100B-MCKIT • P-NUCLEO-IHM002
ST Complete Inverters 76
ST Link
Part Number Description Type
on-board
Dual-motor control and PFC demonstration board featuring the Single/Dual
STEVAL-IHM034V2 No
STM32F103 and STGIPS20C60 drive
Low-power motor control board featuring the SLLIMM™
STEVAL-IHM036V1 No Single drive
STGIPN3H60 and MCU STM32F100C6T6B
STEVAL-IHM038V1 BLDC ceiling fan controller based on STM32 and SLLIMM-nano No Single drive
BLDC/PMSM driver demonstration board based on STM32 and the
STEVAL-IHM040V1 No Single drive
SLLIMM-nano
Compact, low-voltage dual-motor control board based on the Single/Dual
STEVAL-IHM042V1 Yes
STM32F303 and L6230 drive
6-Step BLDC sensorless driver board based on the STM32F051
STEVAL-IHM043V1 No Single drive
and L6234
STM32XX-EVAL
Control board
STEVAL-XX
Power board
MC Connector
NUCLEO-XX X-NUCLEO-IHM09M1
Control board Connector Adapter
+
Back
The MC connector 78
FAULT 1 2 GND
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
STM32446E-EVAL Evaluation board for STM32F407 line - with STM32F407IG MCU Yes Single drive
Dual motor drive control stage based on the STM32F415ZG No Single/Dual drive
STEVAL-IHM039V1
microcontroller
ST-LINK/V2
In-circuit debugger/programmer.. ST-LINK/V2-ISOL (2500 VRMS high isolation voltage)(1)