Application Note

The following document contains information on Cypress products.
Colophon
The products described in this document are designed, developed and manufactured as contemplated for general use,
including without limitation, ordinary industrial use, general office use, personal use, and household use, but are not
designed, developed and manufactured as contemplated (1) for any use that includes fatal risks or dangers that, unless
extremely high safety is secured, could have a serious effect to the public, and could lead directly to death, personal injury,
severe physical damage or other loss (i.e., nuclear reaction control in nuclear facility, aircraft flight control, air traffic control,
mass transport control, medical life support system, missile launch control in weapon system), or (2) for any use where
chance of failure is intolerable (i.e., submersible repeater and artificial satellite). Please note that Spansion will not be liable
to you and/or any third party for any claims or damages arising in connection with above-mentioned uses of the products.
Any semiconductor devices have an inherent chance of failure. You must protect against injury, damage or loss from such
failures by incorporating safety design measures into your facility and equipment such as redundancy, fire protection, and
prevention of over-current levels and other abnormal operating conditions. If any products described in this document
represent goods or technologies subject to certain restrictions on export under the Foreign Exchange and Foreign Trade Law
of Japan, the US Export Administration Regulations or the applicable laws of any other country, the prior authorization by the
respective government entity will be required for export of those products.
Trademarks and Notice
The contents of this document are subject to change without notice. This document may contain information on a Spansion
product under development by Spansion. Spansion reserves the right to change or discontinue work on any product without
notice. The information in this document is provided as is without warranty or guarantee of any kind as to its accuracy,
completeness, operability, fitness for particular purpose, merchantability, non-infringement of third-party rights, or any other
warranty, express, implied, or statutory. Spansion assumes no liability for any damages of any kind arising out of the use of
the information in this document.
®
®
®
TM
Copyright © 2013 Spansion Inc. All rights reserved. Spansion , the Spansion logo, MirrorBit , MirrorBit Eclipse ,
TM
ORNAND and combinations thereof, are trademarks and registered trademarks of Spansion LLC in the United States and
other countries. Other names used are for informational purposes only and may be trademarks of their respective owners.
Fujitsu Semiconductor Design (Chengdu) Co. Ltd.
Application Note
MCU-AN-510101-E-02
32-BIT MICROCONTROLLER
MB9BF506 SERIES
SPWM GENERATION
APPLICATION NOTE
ARM and Cortex-M3 are the trademarks of ARM Limited in the EU and other countries.
SPWM Generation V0.2.0
REVISION HISTORY
REVISION HISTORY
Version
Date
Updated by
Approved by
Modifications
0.1.0
2012-1-20
Alan Fang
First draft
0.2.0
2012-3-07
Alan Fang
Update
This manual contains 15 pages.
Specifications are subject to change without notice. For further information please contact each office.
All Rights Reserved.
The contents of this document are subject to change without notice.
Customers are advised to consult with sales representatives before ordering.
The information, such as descriptions of function and application circuit examples, in this document are presented solely
for the purpose of reference to show examples of operations and uses of FUJITSU SEMICONDUCTOR device; FUJITSU
SEMICONDUCTOR does not warrant proper operation of the device with respect to use based on such information. When
you develop equipment incorporating the device based on such information, you must assume any responsibility arising
out of such use of the information.
FUJITSU SEMICONDUCTOR assumes no liability for any damages whatsoever arising out of the use of the information.
Any information in this document, including descriptions of function and schematic diagrams, shall not be construed as
license of the use or exercise of any intellectual property right, such as patent right or copyright, or any other right of
FUJITSU SEMICONDUCTOR or any third party or does FUJITSU SEMICONDUCTOR warrant non-infringement of
any third-party's intellectual property right or other right by using such information. FUJITSU SEMICONDUCTOR
assumes no liability for any infringement of the intellectual property rights or other rights of third parties which would
result from the use of information contained herein.
The products described in this document are designed, developed and manufactured as contemplated for general use,
including without limitation, ordinary industrial use, general office use, personal use, and household use, but are not
designed, developed and manufactured as contemplated (1) for use accompanying fatal risks or dangers that, unless
extremely high safety is secured, could have a serious effect to the public, and could lead directly to death, personal injury,
severe physical damage or other loss (i.e., nuclear reaction control in nuclear facility, aircraft flight control, air traffic
control, mass transport control, medical life support system, missile launch control in weapon system), or (2) for use
requiring extremely high reliability (i.e., submersible repeater and artificial satellite).
Please note that FUJITSU SEMICONDUCTOR will not be liable against you and/or any third party for any claims or
damages arising in connection with above-mentioned uses of the products.
Any semiconductor devices have an inherent chance of failure. You must protect against injury, damage or loss from such
failures by incorporating safety design measures into your facility and equipment such as redundancy, fire protection, and
prevention of over-current levels and other abnormal operating conditions.
Exportation/release of any products described in this document may require necessary procedures in accordance with the
regulations of the Foreign Exchange and Foreign Trade Control Law of Japan and/or US export control laws.
The company names and brand names herein are the trademarks or registered trademarks of their respective owners.
Copyright © 2012 Fujitsu Semiconductor Design (Chengdu) Co. Ltd. All rights reserved.
MCU-AN-510101-E-02– Page 2
SPWM Generation V0.2.0
Contents
Contents
REVISION HISTORY ............................................................................................................ 2
CONTENTS .......................................................................................................................... 3
1 INTRODUCTION .............................................................................................................. 4
1.1
Purpose ................................................................................................................... 4
1.2
Definitions, Acronyms and Abbreviations ................................................................ 4
1.3
Document Overview ................................................................................................ 4
2 SPWM ALGORITHM ........................................................................................................ 5
2.1
Overview ................................................................................................................. 5
2.2
SPWM Algorithm ..................................................................................................... 6
2.3
2.2.1
Natural Sampling ....................................................................................... 6
2.2.2
Symmetric Regular Sampling..................................................................... 7
2.2.3
Asymmetric Regular Sampling ................................................................... 8
2.2.4
单极性面积等效法 .................................................................................... 10
SPWM 逆变电路的谐波分析 .................................................................................. 11
3 SPWM 应用 .................................................................................................................... 12
3.1
SPWM 在单相逆变电源中的应用 ........................................................................... 12
3.1.1
系统拓扑 .................................................................................................. 12
3.1.2
系统算法 .................................................................................................. 12
4 附加信息 ......................................................................................................................... 14
5 附录 ................................................................................................................................ 15
5.1
图表索引 ................................................................................................................ 15
MCU-AN-510101-E-02– Page 3
SPWM Generation V0.2.0
Chapter 1 Introduction
1 Introduction
1.1
Purpose
This application note describes the principle of SPWM and generation SPWM signal with 32bit microcontroller MB9BF506.
1.2
Definitions, Acronyms and Abbreviations
SPWM -
1.3
Sinusoidal Pulse Width Modulation
Document Overview
The rest of document is organized as the following:
Chapter 2 SPWM Algorithm
Chapter 3 SPWM Application
MCU-AN-510101-E-02– Page 4
SPWM Generation V0.2.0
Chapter 2 SPWM Algorithm
2
SPWM Algorithm
SPWM Algorithm
2.1
Overview
PWM technology utilizes the on/off of whole-control component to convert voltage into
voltage pulse sequences with the same breadth and different widths, thus to realize voltage
transformation, frequency conversion control and harmonic wave cancellation. According to
sampling control theory, the effects of narrow pulses with the same impulse and different
shapes are basically the same when applied to inertia. SPWM control technology controls
the on/off of semiconductor switch components based on this theory; and the output end can
obtain a series of pulses with equal breadth and expected pulse width. These pulses are
used to substitute the expected output waveform. When this technology is applied in
inverter, it not can only control the output voltage of inverter conveniently, but also control
the frequency of output voltage.
Though PWM control theory has been raised long time ago, due to the limit in the
development level of electronic component, it has not been widely applied until the rapid
development of whole-control electronic components. PWM control technology develops
considerably fast along with the development of electronics, semiconductor microelectronics
and each control theory.
MCU-AN-510101-E-02– Page 5
SPWM Generation V0.2.0
Chapter 2 SPWM Algorithm
2.2
SPWM Algorithm
2.2.1 Natural Sampling
Use sinusoidal wave as the modulate wave, a high frequency triangular wave as the carrier
wave, use sinusoidal wave modulate the carrier wave, the time of turn on or off switch is the
natural point of intersections, we call it natural sampling, as show in Figure 2-1. With this
manner, the obtained SPWM wave is very similar with sinusoidal wave, but the point of
intersection has the randomicity, the center of the pulse in one cycle is not equidistant, so
the equation of the pulse is exceed equations, calculate is very complexity, can’t control on
real-time.
Carrier wave
U
B
A
a sin ω t
tA
Ud
tB
t
δ
t
Figure 2-1: Natural sampling
MCU-AN-510101-E-02– Page 6
SPWM Generation V0.2.0
Chapter 2 SPWM Algorithm
2.2.2 Symmetric Regular Sampling
Symmetrical rule sample law is the improvement of nature sample method, it is made to be
parallel by the triangular wave axis of symmetry and sine wave point of intersection in the
time axis straight line, this parallel lines and triangular wave two waists' points of intersection
take the SPWM This method only samples in the triangular wave apex or the basic point
position to the sine wave, the principle of symmetrical rule sample method as shown in 图
2-2:
R
载波
U
B
A
a sin ω t
tA
tB
t
δ/2 δ/2
Ud
δ
t
图 2-2: 对称规则采样法
设正弦波为 a sinωt,三角波的幅值设定为单位量 1,三角波和正弦波向上平移一个单位量,
在三角波底点位置对正弦波采样,利用相似三角形原理可得如下关系式:
⁄
=
⁄
(1)
化简(1)式得到:
δ=
(1+a sin ωt)/2
ωt=(k+3/4)2π/2 (k=0,1,2…..N-1)
式中:ω为正弦波的角频率,δ为某一相开通时刻的脉冲宽度, 为三角波的周期。N 为载波
比,2π/N 为三角波周期
所对应的弧度,K 为一个周期采样的计数值。
Because only needs to carry on a sample then in each triangle carrier cycle to be possible to
obtain a switching signal, therefore simplified the formula, and may act according to the
pulse width formula real-time computation the SPWM The WPWM wave and sine wave that
approaching degree because forms has the big error, will thus create certain ning error.
MCU-AN-510101-E-02– Page 7
SPWM Generation V0.2.0
Chapter 2 SPWM Algorithm
2.2.3 Asymmetric Regular Sampling
Elements of Asymmetric Regular Sampling method is that to be namely in the apex position
sample of triangular wave, and in the basic point position sample of triangular wave, hands
over the triangular wave and A, B two spots along the time axis extension with the sine wave
point of intersection, both samples to the sine wave in a triangle wave period two. shown in
图 2-3:
&
is the time of 分别为高电平脉冲的起始时刻和关断时刻。
C
载波
U
B
A
a sin ω t
tA
tB
t
δ δ`
Ud
δ+δ`
t
图 2-3: 不对称规则采样法
设三角载波的幅值为单位量 1,正弦调制波幅值为 a,三角载波和正弦波均向上平移一个单位
量,如图 2-3 所示。根据相似三角形原理可以得到如下关系式:
sin t
⁄
sin
t
⁄
化简得:δ=
=
由以上推导得 SPWM 的脉宽为:
δ+δ`=
sin t
sin t
设载波比(三角波(载波)频率与正弦波(调制波)频率之比)为 N,由于每个载波周期
内采样两次调制波,所以:
由于 /
t =
(K = 0,2,4.....2N-2)
t =
(K = 1,3,5.....2N-1)
= N =
MCU-AN-510101-E-02– Page 8
SPWM Generation V0.2.0
Chapter 2 SPWM Algorithm
则: t =2π t =2π
t =2π
t =2π
=
π
K (k=0,2,4...2N-2)
π
= K (k=1,3,5...2N-1)
所以:
δ= (1+a sin
= (1+a sin
π
K) (k=0,2,4...2N-2)
π
K) (k=1,3,5...2N-1)
由于不对称规则采样法同时在三角载波的顶点和底点对称位置对调制波进行采样,即每个
载波周期内采样两次,所形成的 SPWM 与正弦调制波的相似度较对称规则采样法有很大的提高,
所输出的波形也与自然采样法更接近。因此本系统采用了不对称规则采样法。
MCU-AN-510101-E-02– Page 9
SPWM Generation V0.2.0
Chapter 2 SPWM Algorithm
2.2.4 单极性面积等效法
根据采样控制中的一个重要理论:冲量相等而形状不同的窄脉冲加在具有惯性的环节上时,
其效果基本相同,冲量是指窄脉冲的面积。正弦脉宽调制的等效面积法就是利用一系列等幅不
等宽的窄脉冲来代替在各个采样周期内正弦波与时间轴围成的面积。如图 2-4 所示:将正弦波
半波 N 等份,其中每等份与θ轴围成的面积都用一个高度相等的矩形脉冲来代替。N 个等幅不
等宽的矩形脉冲组合在一起就能代替一个正弦的半波。
u
a sin ω t
N
π
π
N
θ
δ
UC
θ
θ
n
θ
θ
图 2-4: 单极性面积等效法
设正弦波 u=a sinωt = a sin(θ),将正弦波正半波 N 等分,每一等份为π/弧度,则第 K
等份的面积为 ,根据面积相等的原理。
U
设调制比为
sin
∫
d
(K=1,2,3...N)
,则:
s(
)
s
根据面积中心等效的原理可得:
∫
则脉冲的中心位置:
sin
s{
d
s(
∫
)
sin
s
d
}
所以单极性脉冲的开关角为:
(k=1,2,3…N)
(k=1,2,3…N)
MCU-AN-510101-E-02– Page 10
SPWM Generation V0.2.0
Chapter 2 SPWM Algorithm
2.3
SPWM 逆变电路的谐波分析
逆变器输出电压和输出电流的谐波分量大小是衡量逆变器性能的重要指标,逆变器输出的
高次谐波会使感性负载的损耗增大,效率和功率因数降低,对电子设备产生严重的干扰,影响
周边设备的正常工作。因此有必要对 SPWM 逆变器的输出谐波进行分析和有效控制。
根据信号的傅立叶分析得:
∞
∑
d
√
为开关角度,t 为开关时刻,
∑
√ sin
t
s
ωt
k=1,3,5,…
MCU-AN-510101-E-02– Page 11
SPWM Generation V0.2.0
Chapter 3 SPWM 应用
3 SPWM 应用
SPWM 算法在 MB9BF506 逆变系统中的应用
3.1
SPWM 在单相逆变电源中的应用
3.1.1 系统拓扑
如图 3-1 所示的单相全桥逆变电路,载波 是由单片机产生的高频三角波,调制波 是
MCU 内部的基准正弦调制信号,调制单元通过不同的 SPWM 算法(不对称规则采样或者面
积等效法)产生四路高频的开关脉冲,控制全桥逆变器输出含高频分量的正弦电压,经过 LC
低通滤波器平滑滤波,消除谐波分量便能在负载 R 上得到纯净的正弦波。
V1
VD1
VD2
V2
VD4
V4
C
+
Ud
L
R
V3
VD3
调制波
载波
调制
单元
图 3-1: 单相全桥逆变拓扑
3.1.2 系统算法
MB9BF506 芯片是富士通推出的 32 位低成本的、基于 ARM Cortex-M3 内核、带有片上
Flash 存 储 器 和 SRAM 的 高 性 能 微 控 制 器 。 MB9BF506 内 部 包 含 一 个 多 功 能 定 时 器
(Multifunction Timer),能方便的产生任意周期/脉宽的 PWM 信号。
为了计算简便,系统采用对称规则采样法来实现 SPWM 波形,虽然对称规则采样法的谐
波分量比不对称规则采样法要大,但只要载波频率足够高,影响不是很大。
为了消除偶次谐波,调制比最好为奇数整数,且为 3 的倍数。并且三角波与正弦波的斜率
在过零汇合处的极性必须相反。即对调制波的采样点是关于 和π对称的,如图 3-2 所示。三
角波幅值变化范围是 0 ~ U ,设调幅比为 M , 则正弦波表示为:
U
sin
U
利用顶点采样,则上桥臂开通时刻为:
t
sin
MCU-AN-510101-E-02– Page 12
SPWM Generation V0.2.0
Chapter 3 SPWM 应用
式中的
是载波的周期,
是三角波对正弦波的采样时刻,
(
式中 N 为调制比, 是三角波载波周期
表示为:
)
对应的幅度数,K 是一个正弦周期内采样的计
数值,K = 1,2,3……N-1。
U
θ
图 3-2: 系统调制原理图
系统中的载波频率为 30KHz,则载波比 N=600,即系统在一个正弦周期内对基波采样 600
次,MCU 对这 600 个采样值计算出幅值为 1 的正弦函数sin (
)
的 0 ~ 599 个离散值,
制成表格存放在存储器中。系统重复调用表格中的数值装入 MCU 的 multifunction timer 中的
cont 计数器,从而生成连续的 SPWM 波形。
MCU-AN-510101-E-02– Page 13
SPWM Generation V0.2.0
Chapter 4 附加信息
4 附加信息
关于富士通半导体更多的产品信息,请访问以下网站:
英文版地址:
http://www.fujitsu.com/cn/fsp/services/mcu/32bit/fm3/an.html
中文版地址:
http://www.fujitsu.com/cn/fss/services/mcu/32bit/fm3/an.html
MCU-AN-510101-E-02– Page 14
SPWM Generation V0.2.0
Chapter 5 附录
5 附录
5.1
图表索引
图 2-1: 自然采样 ..................................................................................................................... 6
图 2-2: 对称规则采样法 .......................................................................................................... 7
图 2-3: 不对称规则采样法 ....................................................................................................... 8
图 2-4: 单极性面积等效法 ..................................................................................................... 10
图 3-1: 单相全桥逆变拓扑 ..................................................................................................... 12
图 3-2: 系统调制原理图 ........................................................................................................ 13
MCU-AN-510101-E-02– Page 15