dm00102383

DT0012
Design tip
Dual PMSM motor drive using STM32F303CB/CC
peripherals in “time-sharing”
By Gianluigi Forte, Dino Costanzo
Main components
STM32F303CB/CC
Analog and DSP with FPU ARM Cortex-M4 MCU up to
256KB Flash+48KB SRAM 4 ADCs, 2 DAC ch., 7 comp, 4
PGA, timers, 2.0-3.6 V operation
Introduction
The aim of this paper is to describe the intended use of STM32F303CB/CC microcontroller
to implement a simultaneous dual PMSM motor drive exploiting the internal peripherals (the
embedded PGAs and the analog to digital converters) in “time sharing” for three shunts
current reading topology. This means that, during the control of the two motors, the
peripherals are reserved for each driver in two “not-overlapping” time intervals.
Two different approaches for the motor current sensing amplification network will be
analyzed: using the embedded PGAs and using external operational amplifiers.
A hardware solution will be proposed for both cases to use the STM32303C-EVAL board
implementing these methods to share the required resources.
And finally it will be described how to setup the STM32 FOC SDK to implement the
explained methods.
1.
Time-sharing principle and resources usage
Even when the three shunts topology is used to measure the motor phase currents, just
two simultaneous sampling of voltage drop into the shunts resistor is required. Applying the
Kirchhoff’s current law the third current can be computed from the other two.
So basically, two analog to digital converters (ADCs) properly synchronized, is the
minimum requirement to implement a three shunts current reading for one motor.
Moreover, if the amplification of the current measurement signals is performed using the
embedded PGA peripheral, two of them, able to switch properly the inputs among a set of
three, are required for each motor.
To drive two PMSM motors with the same microcontroller this requirements shall be
duplicated.
April 2014
DT0012Rev 1
1/10
www.st.com
1.1. Using external operational amplifiers for the motor current sensing
amplification network
In Figure 1 is shown the block diagram of one solution to
converters (ADC1 and ADC2) to exploit the dual three
resources”.
In Figure 1 is shown the block diagram of one solution to
converters (ADC1 and ADC2) to exploit the dual three
resources”.
share the two analog to digital
shunt sampling using “shared
share the two analog to digital
shunt sampling using “shared
Figure 1 - Shared resources using external operational amplifiers
PA2 – ADC1
MC1_CurrB
PA3 – ADC1
MC2_CurrB
PC2 – ADC12
ADC1
MC1_CurrA
PC3 – ADC12
MC2_CurrA
PA6 – ADC2
MC1_CurrC
ADC2
PC0 – ADC2
MC2_CurrC
1.2. Using the embedded PGAs for the motor current sensing
amplification network
In Figure 2 is shown the block diagram of one solution to share the two embedded OPAMs
(OPAMP1 and OPAMP3) and two analog to digital converters (ADC1 and ADC3) to exploit
the dual three shunt sampling using “shared resources”.
April 2014
DT0012Rev 1
2/10
www.st.com
Figure 2 - Shared resources using embedded PGAs
PB11
PD14*
To COMP
PA7
MC1_CurrB
OPAMP1
PA3
MC2_CurrB
PA5
+
PA1
-
ADC1
MC1_CurrA
MC2_CurrA
OPAMP3
PB13
+
PB0
-
MC1_CurrC
ADC3
MC2_CurrC
Note: With reference of Figure 2, two inputs of the OPAMP1: PA5 and PA3 have to be
connected respectively to pins PB11 and PD14 to be as internal comparators input for over
current protection. The remaining OPAMPs inputs are already comparators inputs.
2.
Hardware solution
To allow the STM32303C-EVAL board to implement one of the two described techniques is
possible to use a specific daughter board to be plugged on top of the two extension
connectors CN6 and CN7.
In Figure 3 are shown the schematics of the daughter board.
April 2014
DT0012Rev 1
3/10
www.st.com
Figure 3 - Schematic of daughter board
The proposed daughter board can be configured for both methods using the R7, R8, R9,
R10, R11, R12, R13, R14, R15, R17, R18, R19 resistors as described in Table 1.
Table 1 - Daughter board allowed configurations
Configuration
Resistors
R7, R9, R11, R13, R15, R17
Shared resources using embedded PGAs
R8, R10, R12, R14, R18
R19
R7, R9, R11, R13, R17, R19
Shared resources using external
operational amplifiers
R8, R10, R12, R14, R15, R18
April 2014
DT0012Rev 1
Settings
Mounted with 5.1kΩ
Not mounted
Mounted with 0Ω
Not mounted
Mounted with 0Ω
4/10
www.st.com
Some PCB reworks, of the STM32303C-EVAL evaluation board, are needed for motor
control applications to disconnect peripherals which share I/Os with motor control. See
UM1567 paragraph 2.21.
In the Table 2 are reported the configurations of STM32303C-EVAL board switches and
solder bridges to implement the two techniques of current sensing using “shared
resources”.
Table 2 - Switches and solder bridges to be configured in STM32303C-EVAL
PGM
Resistors and solder bridges
Settings
R113, R116 R132, R134
Mounted with 0Ω
SB2, SB5
Open
SB11
Closed
PGM1
PGM2
To connect the DB_PB11 (pin51 of CN6 extension connector) to the pin PB11 of the
STM32F303VCT6 microcontroller present in the STM32303C-EVAL, is required to solder
SB11, remove R137 and mount R36 with 0Ω.
Note: For both current sensing methods using “shared resources” it is necessary to use the
two 34-pins connector CN2 and CN4 (MC connector) present in the daughter board instead
of the two (CN2 and CN4) of the STM32303C-EVAL board.
In Figure 4, Figure 5 and Figure 6 are shown respectively the top layout, the bottom layout
and the silkscreen of the daughter board.
April 2014
DT0012Rev 1
5/10
www.st.com
Figure 4 - Daughter board top layer
Figure 5 - Daughter board bottom layer
April 2014
DT0012Rev 1
6/10
www.st.com
Figure 6 - Daughter board silkscreen
3.
How to configure the firmware
For project based on STM32F303, the STM32 FOC SDK v3.4 supports the
dual PMSM motor drive using three shunts topology with “shared resource”.
Both methods are supported:

embedded PGA,

external OPAMPs.
To enable these functionalities is necessary to create a new “PMSM – Dual FOC” project
using the ST MC Workbench. Make sure that “Current reading topology” of both power
stages are selected in “Three Shunt Resistors”.
Select the required “Current sensing topology” in the “Control Stage – Analog input and
protection” section. The two setting must be the same for both motors.
Check the “Shared resource” check box in the “Control Stage – Analog input and
protection” section like shown in Figure 7.
April 2014
DT0012Rev 1
7/10
www.st.com
Figure 7 - ST MC Workbench - Control Stage - Analog Input
4.
Support material
Related design support material
STM32303C-EVAL – product evaluation board for STM32F303xx microcontrollers
Documentation
Datasheet STM32F303x
Datasheet STM32F302x
User manual, UM1567, STM32303C-EVAL evaluation board
User manual, UM1080, Quick start guide for STM32F0x/F100xx/F103xx/F2xx/F30x/F4xx PMSM
single/dual FOC SDK V3.4
User manual, UM1052, STM32F0x/F100xx/F103xx/F2xx/F30x/F4xx PMSM single/dual FOC SDK
v3.4
April 2014
DT0012Rev 1
8/10
www.st.com
5.
Revision history
Date
24-Apr-2014
April 2014
Version
1
Changes
Initial release
DT0012Rev 1
9/10
www.st.com
Please Read Carefully
Information in this document is provided solely in connection with ST products. STMicroelectronics NV and its subsidiaries
(“ST”) reserve the right to make changes, corrections, modifications or improvements, to this document, and the products and
services described herein at anytime, without notice.
All ST products are sold pursuant to ST’s terms and conditions of sale.
Purchasers are solely responsible for the choice, selection and use of the ST products and services described herein, and ST
assumes no liability whatsoever relating to the choice, selection or use of the ST products and services described herein.
No license, express or implied, by estoppel or otherwise, to any intellectual property rights is granted under this document. If
any part of this document refers to any third party products or services it shall not be deemed a license grant by ST for the
use of such third party products or services, or any intellectual property contained therein or considered as a warranty
covering the use in any manner whatsoever of such third party products or services or any intellectual property contained
therein.
UNLESS OTHERWISE SET FORTH IN ST’S TERMS AND CONDITIONS OF SALE ST DISCLAIMS ANY EXPRESS OR
IMPLIED WARRANTY WITH RESPECT TO THE USE AND/OR SALE OF ST PRODUCTS INCLUDING WITHOUT
LIMITATION IMPLIED WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE (AND THEIR
EQUIVALENTS UNDER THE LAWS OF ANY JURISDICTION), OR INFRINGEMENT OF ANY PATENT, COPYRIGHT OR
OTHER INTELLECTUAL PROPERTY RIGHT.
ST PRODUCTS ARE NOT DESIGNED OR AUTHORIZED FOR USE IN: (A) SAFETY CRITICAL APPLICATIONS SUCH
AS LIFE SUPPORTING, ACTIVE IMPLANTED DEVICES OR SYSTEMS WITH PRODUCT FUNCTIONAL SAFETY
REQUIREMENTS; (B) AERONAUTIC APPLICATIONS; (C) AUTOMOTIVE APPLICATIONS OR ENVIRONMENTS,
AND/OR (D) AEROSPACE APPLICATIONS OR ENVIRONMENTS. WHERE ST PRODUCTS ARE NOT DESIGNED FOR
SUCH USE, THE PURCHASER SHALL USE PRODUCTS AT PURCHASER’S SOLE RISK, EVEN IF ST HAS BEEN
INFORMED IN WRITING OF SUCH USAGE, UNLESS A PRODUCT IS EXPRESSLY DESIGNATED BY ST AS BEING
INTENDED FOR “AUTOMOTIVE, AUTOMOTIVE SAFETY OR MEDICAL” INDUSTRY DOMAINS ACCORDING TO ST
PRODUCT DESIGN SPECIFICATIONS. PRODUCTS FORMALLY ESCC, QML OR JAN QUALIFIED ARE DEEMED
SUITABLE FOR USE IN AEROSPACE BY THE CORRESPONDING GOVERNMENTAL AGENCY.
Resale of ST products with provisions different from the statements and/or technical features set forth in this document shall
immediately void any warranty granted by ST for the ST product or service described herein and shall not create or extend in
any manner whatsoever, any liability of ST.
ST and the ST logo are trademarks or registered trademarks of ST in various countries.
Information in this document supersedes and replaces all information previously supplied.
The ST logo is a registered trademark of STMicroelectronics. All other names are the property of their respective owners.
© 2014 STMicroelectronics - All rights reserved
STMicroelectronics group of companies
Australia - Belgium - Brazil - Canada - China - Czech Republic - Finland - France - Germany - Hong Kong - India - Israel Italy - Japan - Malaysia - Malta - Morocco - Philippines - Singapore - Spain - Sweden - Switzerland - United Kingdom - United
States of America
www.st.com
April 2014
DT0012Rev 1
10/10
www.st.com
Similar pages