没有合适的资源?快使用搜索试试~ 我知道了~
stm32驱动手册f103
4星 · 超过85%的资源 需积分: 9 18 下载量 178 浏览量
2010-03-31
17:28:43
上传
评论 1
收藏 2.15MB PDF 举报
温馨提示
试读
121页
STM32f103操作手册,详细介绍了STM32 的结构,使用方法,不过是英文的,看起来有些麻烦。
资源推荐
资源详情
资源评论
January 2008 Rev 1 1/121
UM0492
User manual
STM32F103xx
permanent-magnet synchronous motor FOC software library V1.0
Introduction
This user manual describes the permanent magnet synchronous motor (PMSM) FOC
software library, a field oriented control (FOC) firmware library for 3-phase permanent-
magnet motors developed for the STM32F103xx microcontrollers.
These 32-bit, ARM Cortex™-M3 cored ST microcontrollers (STM32F103xx) come with a set
of peripherals that makes it suitable for performing both permanent-magnet and AC
induction motor FOC. In particular, this manual describes the STM32F103xx software library
developed to control sine-wave driven permanent-magnet motors in both torque and speed
control mode. These motors may be equipped with an encoder, with three Hall sensors or
they may be sensorless. The control of an AC induction motor equipped with encoder or
tacho generator is described in the UM0483 user manual.
The PMSM FOC is made of several C modules, compatible with the free-of-charge IAR
EWARM KickStart edition toolchain version 4.42. It is used to quickly evaluate both the MCU
and the available tools. In addition, when used together with the STM32F103xx motor
control starter kit (STM3210B-MCKIT) and PM motor, a motor can be made to run in a very
short time. It also eliminates the need for time-consuming development of FOC and speed
regulation algorithms by providing ready-to-use functions that let the user concentrate on
the application layer. Moreover, it is possible to get rid of any speed sensor thanks to the
sensorless algorithm for rotor position reconstruction.
A prerequisite for using this library is basic knowledge of C programming, PM motor drives
and power inverter hardware. In-depth know-how of STM32F103xx functions is only
required for customizing existing modules and for adding new ones for a complete
application development.
Figure 1 shows the architecture of the firmware. It uses the STM32F103xx standard library
extensively but it also acts directly on hardware peripherals when optimizations in terms of
execution speed or code size are required.
Figure 1. Firmware architecture
Application layer
STM32F103xx
standard
library
Speed, flux and
torque PIDs
Speed
feedback
Current
feedback
FOC drive
SVPWM
User
interface
STM32F103xx motor control library
STM32F103xx peripherals
ai14812
www.st.com
Contents UM0492
2/121
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 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 11
1.4 Customizing the workspace for your STM32F103xx derivative . . . . . . . . 12
1.4.1 Inkarm_xxx.xcl file (internal Flash or RAM based project) . . . . . . . 12
1.4.2 Extended linker file setting . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 13
2 Introduction to the sensorless FOC of PM motors . . . . . . . . . . . . . . . 14
2.1 Introduction to the PM synchronous motor FOC drive . . . . . . . . . . . . . . . 14
2.1.1 PM motor structures . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 16
2.1.2 PMSM field oriented control (FOC) fundamental equations . . . . . . . . . 17
2.2 Introduction to sensorless rotor position / speed feedback . . . . . . . . . . . 18
2.3 Introduction to flux weakening control . . . . . . . . . . . . . . . . . . . . . . . . . . . 20
3 Running the demo program . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 22
3.1 Torque control mode . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 22
3.2 Speed control mode . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 24
3.3 Currents and speed regulator tuning . . . . . . . . . . . . . . . . . . . . . . . . . . . . 25
3.4 Observer and PLL gain tuning . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 27
3.5 DAC functionality . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 27
3.6 Power stage feedbacks . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 28
3.7 Fault messages . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 28
3.7.1 Overcurrent . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 29
3.7.2 Overheating . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 29
3.7.3 Bus overvoltage . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 29
3.7.4 Bus undervoltage . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 30
3.7.5 Startup failed . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 30
3.7.6 Error on speed fdbck . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 30
3.8 Setting up the system when using ICS sensors . . . . . . . . . . . . . . . . . . . . 31
UM0492 Contents
3/121
3.8.1 Selecting PHASE_A_ADC_CHANNEL and
PHASE_B_ADC_CHANNEL . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 31
3.9 Setting up the system when using an encoder . . . . . . . . . . . . . . . . . . . . . 32
3.10 Setting up the system when using Hall-effect sensors . . . . . . . . . . . . . . . 33
3.11 Progressive sensorless system development . . . . . . . . . . . . . . . . . . . . . 35
3.12 Setting up the system when using a brake resistor . . . . . . . . . . . . . . . . . 36
3.12.1 How to configure the FOC software library for brake resistor
management . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 37
3.12.2 How to modify the MB459 board for brake resistor management . . . . . 37
3.13 Note on debugging tools . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 37
4 Getting started with the library . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 39
4.1 Library configuration file: stm32f10x_MCconf.h . . . . . . . . . . . . . . . . . 39
4.2 Drive control parameters: MC_Control_Param.h . . . . . . . . . . . . . . . . . 41
4.3 Incremental encoder parameters: MC_encoder_param.h . . . . . . . . . . . 44
4.4 Hall sensor parameters: MC_hall_prm.h . . . . . . . . . . . . . . . . . . . . . . . 46
4.5 State observer parameters: MC_State_Observer_param.h . . . . . . . . 47
4.5.1 State observer parameters . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 47
4.5.2 Startup parameters . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 48
4.5.3 Statistics parameters . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 50
4.6 Permanent-magnet synchronous motor parameters:
MC_PMSM_motor_param.h 50
4.6.1 Basic motor parameters . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 50
4.6.2 Motor parameters for sensorless FOC . . . . . . . . . . . . . . . . . . . . . . . . . . 51
4.6.3 Additional parameters for flux weakening operation . . . . . . . . . . . . . . . 51
5 Library functions . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 53
5.1 Current reading in three shunt resistor topology and space
vector PWM generation: stm32f10x_svpwm_3shunt module . . . . . . . 53
5.1.1 List of available functions . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 53
5.1.2 Space vector PWM implementation . . . . . . . . . . . . . . . . . . . . . . . . . . . . 57
5.1.3 Current sampling in three shunt topology and general purpose A/D
conversions . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 58
5.1.4 Tuning delay parameters and sampling stator currents in three shunt
resistor topology 60
5.2 Isolated current sensor reading and space vector PWM
generation: stm32f10x_svpwm_ics module . . . . . . . . . . . . . . . . . . . 64
5.2.1 List of available functions and interrupt service routines . . . . . . . . . . . . 65
Contents UM0492
4/121
5.2.2 Current sampling in isolated current sensor topology and integrating
general-purpose A/D conversions . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 67
5.3 PMSM field-oriented control: MC_FOC_Drive module . . . . . . . . . . . . . . 68
5.3.1 List of available C functions . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 68
5.4 Reference frame transformations: MC_Clarke_Park module . . . . . . . . 70
5.4.1 List of available C functions . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 71
5.4.2 Detailed explanation about reference frame transformations . . . . . . . . 75
5.4.3 Circle limitation . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 76
5.5 Encoder feedback processing: stm32f10x_encoder module . . . . . . . . 78
5.5.1 List of available functions and interrupt service routines . . . . . . . . . . . . 78
5.6 Hall sensor feedback processing: stm32f10x_hall module . . . . . . . . 81
5.6.1 List of available functions . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 81
5.6.2 Speed measurement implementation . . . . . . . . . . . . . . . . . . . . . . . . . . 85
5.6.3 Electrical angle extrapolation implementation . . . . . . . . . . . . . . . . . . . . 87
5.7 Sensorless speed / position detection: MC_State_Observer
and MC_State_Observer_Interface modules . . . . . . . . . . . . . . . . . 88
5.7.1 List of available C functions . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 89
5.8 Currents and speed regulators: MC_PID_regulators module . . . . . . . 94
5.8.1 List of available functions . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 94
5.8.2 PID regulator theoretical background . . . . . . . . . . . . . . . . . . . . . . . . . . 97
5.8.3 Regulator sampling time setting . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 97
5.8.4 Adjusting speed regulation loop Ki, Kp and Kd vs. motor frequency . . . 98
5.9 General purpose time base: stm32f10x_Timebase module . . . . . . . 100
5.9.1 List of available functions and interrupt service routines . . . . . . . . . . . 100
5.10 Power stage check-up: MC_MotorControl_Layer module . . . . . . . . 103
5.10.1 List of available functions . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 103
5.11 Main interrupt service routines: stm32f10x_it module . . . . . . . . . . . 107
5.11.1 List of non-empty interrupt service routines . . . . . . . . . . . . . . . . . . . . . 108
Appendix A Additional information. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 110
A.1 Adjusting CPU load related to FOC algorithm execution . . . . . . . . . . . . 110
A.2 Selecting the update repetition rate based on the PWM
frequency for 3 shunt resistor configuration . . . . . . . . . . . . . . . . . . . . . . 111
A.3 Fixed-point numerical representation . . . . . . . . . . . . . . . . . . . . . . . . . . . 112
A.4 A priori determination of flux and torque current PI gains. . . . . . . . . . . . 113
A.5 Current regulators fine tuning . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 116
UM0492 Contents
5/121
A.6 A priori determination of state observer gains. . . . . . . . . . . . . . . . . . . . . 118
A.7 Speed formats. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 119
A.8 References . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 119
Revision history . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 120
剩余120页未读,继续阅读
资源评论
- cuibv2014-02-18英文的确实有些麻烦,不过结合别的一起看还比较有帮助.
zxszyy
- 粉丝: 0
- 资源: 2
上传资源 快速赚钱
- 我的内容管理 展开
- 我的资源 快来上传第一个资源
- 我的收益 登录查看自己的收益
- 我的积分 登录查看自己的积分
- 我的C币 登录后查看C币余额
- 我的收藏
- 我的下载
- 下载帮助
安全验证
文档复制为VIP权益,开通VIP直接复制
信息提交成功