STM32 Motor Control

Home
Page
STM32 Page
INDEX
Introduction
The PMSM FOC library can be used to quickly evaluate ST
microcontrollers and complete ST application platforms, as well as to
save time when developing Motor Control algorithms to be run on ST
microcontrollers.
This PMSM FOC library is written in C language, and
implements the core Motor Control algorithms (reference frame
transformations, currents regulation, speed regulation, space-vector
modulation, energy efficiency optimizations) as well as sensors
reading/decoding algorithms (three shunts, ST-patented single DC link
shunt, isolated current sensors, incremental encoder, hall sensors) and
a sensorless algorithm for rotor position reconstruction.
When deployed with STM32F103xx
High-Density / XL-Density devices (Flash memory density between 256 and
512 Kbytes / 768 Kbytes and 1 Mbyte), the PMSM FOC library enables
simultaneous dual FOC of two different motors.
The library can be
customized to suit user application parameters (motor, sensors, power
stage, control stage, pin-out assignment) and provides a ready-to-use
Application Programming Interface (API).
A user project has been implemented to demonstrate how to interact with the Motor Control API.
The project provides an LCD User
Interface and a USART User Interface, represents a convenient real-time
fine-tuning and remote control tool for the motor control application.
A PC Graphical User Interface (GUI), the ST Motor Control Workbench, allows complete and easy customization of the PMSM FOC library. In conjunction with the STM3210B-MCKIT motor control starter kit, a PMSM motor can be made to run in a very short time using default parameters.
Presentation of the FOC controller












Click here to get presentation concerning STEVAL-IHM036V1

Click here (pdf 1,3Mbyte) to get the complete FOC controller presentation.
-
How to convert RPM to the Frequency of the sinusoid of current
that must be generated for each phase, considering the number of pole
pairs.
Suppose to have a 3 phase motor. 
Suppose to have 20000 rpm, this means 20000 laps (mechanical) per minute.
And suppose that the motor is a 4 pole pairs.
The formula for calculate the mechanical frequency (MF) is:
MF = rpm/60
20000 rpm ==> laps (mechanical) per minute ==> 20000/60 = 333.33 per second (mechanical frequency)
To calculate the electrical frequency (Hz) is necessary multiplied the mechanical frequency by the number of pole pairs.
Hz = MF x Number_of_Pole
333.33 x 4 = 1333.33 Hz
This is the frequency of the sinusoid of current that must be generated for each phase.
But...
The sinusoid must be (Nyquist)
at least twice but as we know it is not enough... we say that takes at
least 10-12 times, (most bigger is, the better is) to get an accurate
reconstruction of the curve... the PWM frequency is our sampling
frequency (in the case in which the vector control is done every period
of PWM).
So the PWM frequency is:
Fpwm >= 1333.33 * 12 = 16 KHz
Consider that 16 KHz is the minimum conditions.
If it is possible the suggestion is: go up in frequency but take care the switching losses.
LINK
See also:
Intelligent Power Module - IPM - that is here.