没有合适的资源?快使用搜索试试~ 我知道了~
资源推荐
资源详情
资源评论
February 2007 Rev 1 1/84
UM0312
User manual
STR750
Sensored PMSM field-oriented control software library V1.0
Introduction
The STR750 microcontroller comes with a dedicated set of peripherals designed for field
oriented control (FOC) of both permanent magnet DC/AC motors (PMDC/PMAC also called
BLDC) and AC induction motors. It is delivered with two software libraries that allow you to
develop applications to control these motors.
■ The PMSM software library
■ The AC induction motor software library
The complete library source files are delivered with the STR750-MCKIT, and are also
available for free on the ST website www.stmcu.com, in the Support section. Check this site
for the latest version of the library.
This user manual describes the PMSM software library required to control a permanent
magnet synchronous motor with an encoder and a sinewave drive, open or closed loop. The
AC induction motor software library designed to control an AC induction motor in sinewave
mode with sensors is described in the UM0324 User Manual.
The PMSM software library is composed of several C modules, compatible with the IAR
EWARM toolchain. The functions are grouped into several families, making this library an
easy way to go through any PM sensored motor project development. Used in conjunction
with the STR750-MCKIT starter kit, evaluation can be achieved in a very short time,
because the software library spares you the trouble of studying the MCU in detail.
Overall software architecture
The figure below shows the architecture of the firmware. It uses the STR750 Standard
Library extensively but it also acts directly on hardware peripherals when optimizations in
terms of execution speed or code size are required.
L
STR750
Std
Library
APPLICATION LAYER
Peripherals
PWMDMAADCTIMGPIO TB
Motor Control Library
Speed, Flux and
Torque PIDs
PM Motor Drive
Speed
feedback
Current
feedback
SVPWM
User
Interface
STR750
Std
Library
APPLICATION LAYER
Peripherals
PWMDMAADCTIMGPIO TB
Motor Control Library
Speed, Flux and
Torque PIDs
PM Motor Drive
Speed
feedback
Current
feedback
SVPWM
User
Interface
www.st.com
UM0312
2/84
PMSM software library 1.0 features (CPU running at 60MHz)
■ Permanent magnet motor with encoder:
– Open loop operation
– Closed loop operation, PID regulation with 0.5ms to 127ms sampling time
■ Current sampling method:
– 2 isolated current sensors
– 3 shunt resistors
■ Current regulation for torque and flux control:
PIDs, sampling time adjustable up to the PWM frequency
■ 16-bit space vector PWM generation frequencies:
– PWM frequency can be manually adjusted
– Centered PWM pattern type
– 11-bit resolution at 14.6kHz
● Free C source code and spreadsheet for look-up tables
● Motor control modules developed in accordance with MISRA C rules
Note: These figures are for information only; this software library may be subject to changes
depending on the final application and peripheral resources. Note that it was built using
robustness-oriented structures, thus preventing the speed or code size from being fully
optimized.
The table below summarizes the memory required by the software library, as it is delivered
(three-shunt topology for the current reading, encoder for speed feedback). These metrics
include non motor control related code, implemented for demo purposes (such as user
interface via LCD and joystick). Therefore, the figures provided should be considered as an
estimation, which would be lower in the final application.
Related documents:
Available on www.st.com:
● STR750 User Manual,
● STR750 Datasheet,
● STR750 Standard Library User Manual,
● STR7 Flash Programming Manual
Available on www.arm.com
:
ARM7TDMI-S Rev.4 Technical Reference Manual ARM DDI 0234A
ROM RAM
Size (Kbyte) 27.5 3
UM0312 Contents
3/84
Contents
1 Getting started with tools . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 10
1.1 Working environment . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 10
1.2 Software tools . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 10
1.3 Library source code . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 11
1.3.1 Download . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 11
1.3.2 File structure . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 11
1.3.3 Starting the IAR toolchain . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 12
1.4 Customizing the workspace for your STR75x device . . . . . . . . . . . . . . . . 12
1.4.1 Inkarm_xxx.xcl file (internal/external flash or RAM based project) . . . . 12
1.4.2 Extended linker file setting . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 13
2 Getting started with the library . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 15
2.1 PMSM FOC drive quick introduction . . . . . . . . . . . . . . . . . . . . . . . . . . . . 15
2.2 Pre-checks and library configuration . . . . . . . . . . . . . . . . . . . . . . . . . . . . 16
2.2.1 Library configuration file: 75x_MCconf.h file . . . . . . . . . . . . . . . . . . . . 16
2.2.2 Permanent magnet motor parameters: MC_PMSM_motor_param.h
file . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 17
2.2.3 Encoder parameters: MC_ENCODER_param.h file . . . . . . . . . . . . . . . . 18
2.2.4 Drive control parameters: MC_Control_Param.h file . . . . . . . . . . . . . 18
Maximum modulation index . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .19
Power device control parameters. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .19
Flux and torque PID regulators sampling rate . . . . . . . . . . . . . . . . . . . . . . . . . . .19
Speed regulation loop frequency . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .19
Speed controller setpoint and PID constants (initial values) . . . . . . . . . . . . . . . .20
Torque and flux controller setpoints and PID constants: . . . . . . . . . . . . . . . . . . .20
Linear variation of PID constants according to mechanical speed . . . . . . . . . . . .21
2.3 Running your own motor . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 22
2.4 Closed loop operation and PID settings . . . . . . . . . . . . . . . . . . . . . . . . . . 22
2.5 How to define and add a module . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 22
3 Running the demo program . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 24
3.1 LCD display in OPEN loop mode . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 25
3.2 LCD display in CLOSED loop mode . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 26
3.3 Setting up the system when using ICS sensors . . . . . . . . . . . . . . . . . . . . 27
Contents UM0312
4/84
3.3.1 Connecting the two ICS sensors to the motor and to STR750 . . . . . . . 27
3.3.2 Selecting PHASE_A_CHANNEL and PHASE_B_CHANNEL . . . . . . . . 28
3.4 Managing the incremental encoder . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 29
3.5 Fault messages . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 30
3.6 Note on debugging tools . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 30
4 Motor control library routines . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 31
4.1 Library reference . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 31
4.2 Motor control software layer . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 31
4.2.1 75x_svpwm_3shunt module . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 31
SVPWM_3ShuntInit . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .32
SVPWM_3ShuntCurrentReadingCalibration . . . . . . . . . . . . . . . . . . . . . . .33
SVPWM_3ShuntGetPhaseCurrentValues . . . . . . . . . . . . . . . . . . . . . . . . . . .33
SVPWM_3ShuntCalcDutyCycles . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .34
SVPWM_3ShuntGPADCConfig . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .34
4.2.2 Space vector PWM implementation . . . . . . . . . . . . . . . . . . . . . . . . . . . . 35
4.2.3 Current sampling in three shunt topology and general purpose A/D
conversions 37
4.2.4 Tuning delay parameters and sampling stator currents in three-shunt
resistor topology . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 39
Case 1: Duty cycle applied to Phase A low side switch is larger than
DT+TN+ 2TS + TH + TDMA . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .40
Case 2: DT+TN+TS < Phase A duty cycle < DT+TN+ 2TS + TH + TDMA. . . . . .42
Case 3: Phase A pulse width < DT+TN+TS . . . . . . . . . . . . . . . . . . . . . . . . . . . . .44
4.2.5 75x_svpwm_ICS module . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 48
SVPWM_IcsInit . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .48
SVPWM_IcsCurrentReadingCalibration . . . . . . . . . . . . . . . . . . . . . . . . . .49
SVPWM_IcsGetPhaseCurrentValues . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .49
SVPWM_IcsCalcDutyCycles . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .50
4.2.6 Isolated current sensor topology current sampling and general purpose
(GP) A/D conversions integration . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 50
4.2.7 MC_Clarke_Park.h module . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 51
Clarke. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .52
Park . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .53
Rev_Park . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .53
Rev_Park_Circle_Limitation . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .54
4.2.8 Detailed explanation about reference frame transformations . . . . . . . . 54
4.2.9 Circle limitation . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 56
Example: max modulation index of 95%. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .58
4.2.10 75x_encoder.c module . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 59
UM0312 Contents
5/84
ENC_Init . . . . . . . . . . . . . . . . . . . . . . . . . 59
ENC_GetPosition . . . . . . . . . . . . . . . . . . . . . 59
ENC_Get_Electrical_Angle . . . . . . . . . . . . . . . . . 59
ENC_Get_Mechanical_Angle . . . . . . . . . . . . . . . . . 60
ENC_ResetEncoder . . . . . . . . . . . . . . . . . . . . . 60
ENC_Clear_Speed_Buffer . . . . . . . . . . . . . . . . . . 60
ENC_Get_Speed . . . . . . . . . . . . . . . . . . . . . . 61
ENC_Get_Average_Speed . . . . . . . . . . . . . . . . . . 61
TIMx_UP_IRQHandler - interrupt routine . . . . . . . . . . 61
4.2.11 75x_TBTimer.c module . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 62
TB_Timebase_Timer_Init . . . . . . . . . . . . . . . . . . 62
TB_Wait . . . . . . . . . . . . . . . . . . . . . . . . . 62
TB_Set_Delay_500us . . . . . . . . . . . . . . . . . . . . 62
TB_Delay_IsElapsed . . . . . . . . . . . . . . . . . . . . 63
TB_Set_DisplayDelay_500us . . . . . . . . . . . . . . . . 63
TB_Set_DebounceDelay_500us . . . . . . . . . . . . . . . . 63
TB_DebounceDelay_IsElapsed . . . . . . . . . . . . . . . . 63
TB_IRQHandler . . . . . . . . . . . . . . . . . . . . . . 64
4.2.12 75x_it.c module . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 65
PWM_EM_IRQHandler . . . . . . . . . . . . . . . . . . . . 65
ADC_IRQHandler . . . . . . . . . . . . . . . . . . . . . . 65
4.2.13 MC_PID_regulators.c module . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 66
PID_Init . . . . . . . . . . . . . . . . . . . . . . . . . 66
PID_Flux_Regulator . . . . . . . . . . . . . . . . . . . . 67
PID_Torque_Regulator . . . . . . . . . . . . . . . . . . . 67
PID_Speed_Regulator . . . . . . . . . . . . . . . . . . . 68
PID_Reset_Integral_terms . . . . . . . . . . . . . . . . . 68
PID_Speed_Coefficients_update . . . . . . . . . . . . . . 68
PID_Integral_Speed_update . . . . . . . . . . . . . . . . 68
4.3 Application layer . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 69
4.3.1 main.c module . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 69
4.3.2 MC_Keys.c module . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 69
4.3.3 MC_Display.c module . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 69
4.3.4 75x_LCD.c module . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 69
4.3.5 MC_dac.c module . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 69
4.3.6 MC_misc.c module . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 69
5 PID regulator implementation and tuning . . . . . . . . . . . . . . . . . . . . . . . 70
5.1 Theoretical background . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 70
5.2 Regulation sampling time . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 70
剩余83页未读,继续阅读
资源评论
tuquan
- 粉丝: 0
- 资源: 9
上传资源 快速赚钱
- 我的内容管理 展开
- 我的资源 快来上传第一个资源
- 我的收益 登录查看自己的收益
- 我的积分 登录查看自己的积分
- 我的C币 登录后查看C币余额
- 我的收藏
- 我的下载
- 下载帮助
安全验证
文档复制为VIP权益,开通VIP直接复制
信息提交成功