June 2018 AN5166 Rev 1 1/18
1
AN5166
Application note
Guidelines for control and customization of power boards
with STM32 MC SDK v5.0
Introduction
This document is intended for users wishing to design their own application board to drive a
Permanent-Magnet Synchronous Motor (PMSM) starting from an ST Motor Control (MC)
board. To this end, it reviews the hardware, the firmware and the related motor control
software tools.
For new projects users can start directly with the Motor Control PC software tools provided
with the STM32 MC SDK v5.0 (X-CUBE-MCSDK and X-CUBE-MCSDK-FUL).
The following documents, available on www.st.com, are considered as references:
AN2834: How to get the best ADC accuracy in STM32 microcontrollers
UM2392: STM32 motor control SDK v5.0.0 firmware
UM2380: STM32 motor control SDK v5.0 tools
www.st.com
Contents AN5166
2/18 AN5166 Rev 1
Contents
1 General information . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 5
2 Derivative design . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 6
2.1 HW setup . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 6
2.1.1 3-phase inverter . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 7
2.1.2 Current sensing . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 8
2.1.3 Bus voltage sensing . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 10
2.1.4 Security mechanisms . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 10
2.1.5 MCU . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 11
2.2 Interactions between STM32 MC Workbench and STM32CubeMX . . . . 12
2.3 STM32 MC Workbench . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 13
2.3.1 Modifying the motor control parameters . . . . . . . . . . . . . . . . . . . . . . . . 13
2.3.2 Using another MCU . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 13
2.3.3 Clock tree configuration . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 13
2.3.4 Handling interrupts . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 13
2.3.5 Changing a dedicated pin assignment . . . . . . . . . . . . . . . . . . . . . . . . . . 14
2.4 STM32CubeMX . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 14
2.4.1 User project configuration . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 14
2.4.2 Modifying the motor control parameters . . . . . . . . . . . . . . . . . . . . . . . . 14
2.4.3 Adding new pins or changing pin assignment . . . . . . . . . . . . . . . . . . . . 15
3 Conclusion . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 16
4 Revision history . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 17