Renesas M16C/Tiny Series User manual

致尊敬的顾客
关于产品目录等资料中的旧公司名称
NEC电子公司与株式会社瑞萨科技于2010年4月1日进行业务整合(合并),整合后的
新公司暨“瑞萨电子公司”继承两家公司的所有业务。因此,本资料中虽还保留有旧公司
名称等标识,但是并不妨碍本资料的有效性,敬请谅解。
瑞萨电子公司网址:http://www.renesas.com
2010年4月1日
瑞萨电子公司
【业务咨询】http://www.renesas.com/inquiry
【发行】瑞萨电子公司(http://www.renesas.com)

Notice
1. All information included in this document is current as of the date this document is issued. Such information, however, is
subject to change without any prior notice. Before purchasing or using any Renesas Electronics products listed herein, please
confirm the latest product information with a Renesas Electronics sales office. Also, please pay regular and careful attention to
additional and different information to be disclosed by Renesas Electronics such as that disclosed through our website.
2. Renesas Electronics does not assume any liability for infringement of patents, copyrights, or other intellectual property rights
of third parties by or arising from the use of Renesas Electronics products or technical information described in this document.
No license, express, implied or otherwise, is granted hereby under any patents, copyrights or other intellectual property rights
of Renesas Electronics or others.
3. You should not alter, modify, copy, or otherwise misappropriate any Renesas Electronics product, whether in whole or in part.
4. Descriptions of circuits, software and other related information in this document are provided only to illustrate the operation of
semiconductor products and application examples. You are fully responsible for the incorporation of these circuits, software,
and information in the design of your equipment. Renesas Electronics assumes no responsibility for any losses incurred by
you or third parties arising from the use of these circuits, software, or information.
5. When exporting the products or technology described in this document, you should comply with the applicable export control
laws and regulations and follow the procedures required by such laws and regulations. You should not use Renesas
Electronics products or the technology described in this document for any purpose relating to military applications or use by
the military, including but not limited to the development of weapons of mass destruction. Renesas Electronics products and
technology may not be used for or incorporated into any products or systems whose manufacture, use, or sale is prohibited
under any applicable domestic or foreign laws or regulations.
6. Renesas Electronics has used reasonable care in preparing the information included in this document, but Renesas Electronics
does not warrant that such information is error free. Renesas Electronics assumes no liability whatsoever for any damages
incurred by you resulting from errors in or omissions from the information included herein.
7. Renesas Electronics products are classified according to the following three quality grades: “Standard”, “High Quality”, and
“Specific”. The recommended applications for each Renesas Electronics product depends on the product’s quality grade, as
indicated below. You must check the quality grade of each Renesas Electronics product before using it in a particular
application. You may not use any Renesas Electronics product for any application categorized as “Specific” without the prior
written consent of Renesas Electronics. Further, you may not use any Renesas Electronics product for any application for
which it is not intended without the prior written consent of Renesas Electronics. Renesas Electronics shall not be in any way
liable for any damages or losses incurred by you or third parties arising from the use of any Renesas Electronics product for an
application categorized as “Specific” or for which the product is not intended where you have failed to obtain the prior written
consent of Renesas Electronics. The quality grade of each Renesas Electronics product is “Standard” unless otherwise
expressly specified in a Renesas Electronics data sheets or data books, etc.
“Standard”: Computers; office equipment; communications equipment; test and measurement equipment; audio and visual
equipment; home electronic appliances; machine tools; personal electronic equipment; and industrial robots.
“High Quality”: Transportation equipment (automobiles, trains, ships, etc.); traffic control systems; anti-disaster systems; anti-
crime systems; safety equipment; and medical equipment not specifically designed for life support.
“Specific”: Aircraft; aerospace equipment; submersible repeaters; nuclear reactor control systems; medical equipment or
systems for life support (e.g. artificial life support devices or systems), surgical implantations, or healthcare
intervention (e.g. excision, etc.), and any other applications or purposes that pose a direct threat to human life.
8. You should use the Renesas Electronics products described in this document within the range specified by Renesas Electronics,
especially with respect to the maximum rating, operating supply voltage range, movement power voltage range, heat radiation
characteristics, installation and other product characteristics. Renesas Electronics shall have no liability for malfunctions or
damages arising out of the use of Renesas Electronics products beyond such specified ranges.
9. Although Renesas Electronics endeavors to improve the quality and reliability of its products, semiconductor products have
specific characteristics such as the occurrence of failure at a certain rate and malfunctions under certain use conditions. Further,
Renesas Electronics products are not subject to radiation resistance design. Please be sure to implement safety measures to
guard them against the possibility of physical injury, and injury or damage caused by fire in the event of the failure of a
Renesas Electronics product, such as safety design for hardware and software including but not limited to redundancy, fire
control and malfunction prevention, appropriate treatment for aging degradation or any other appropriate measures. Because
the evaluation of microcomputer software alone is very difficult, please evaluate the safety of the final products or system
manufactured by you.
10. Please contact a Renesas Electronics sales office for details as to environmental matters such as the environmental
compatibility of each Renesas Electronics product. Please use Renesas Electronics products in compliance with all applicable
laws and regulations that regulate the inclusion or use of controlled substances, including without limitation, the EU RoHS
Directive. Renesas Electronics assumes no liability for damages or losses occurring as a result of your noncompliance with
applicable laws and regulations.
11. This document may not be reproduced or duplicated, in any form, in whole or in part, without prior written consent of Renesas
Electronics.
12. Please contact a Renesas Electronics sales office if you have any questions regarding the information contained in this
document or Renesas Electronics products, or if you have any other inquiries.
(Note 1) “Renesas Electronics” as used in this document means Renesas Electronics Corporation and also includes its majority-
owned subsidiaries.
(Note 2) “Renesas Electronics product(s)” means any product developed or manufactured by or for Renesas Electronics.

RSBJEUM0001-0101 Rev. 1.01
1
M16C/Tiny Sensor-less PMSM Driving Platform
by 120-Degree Trapezoidal ave Commutation
M16C/Tiny
User’s Manual
RSBJ
Published by: Renesas Syste Solutions (Beijing) Co., Ltd. Beijing Technical Center.
Date: March 2008 Version 1.01
Docu ent Nu ber: RSBJEUM0001-0101
Copyright(C): Renesas Syste Solutions (Beijing) Co., Ltd. Beijing Technical Center. All rights
reserved.
Trademarks
a) General
All brand or product na es used in this anual are trade arks or registered trade arks of their respective co panies
or organizations.
b) Specific
Microsoft Windows is registered trade arks of Microsoft Corporation.
Pentiu is a registered trade ark of Intel.

RSBJEUM0001-0101 Rev. 1.01
2
IMPORTANT INFORMATION
READ his user’s manual before using his pla form board.
KEEP he user’s manual handy for fu ure reference.
Do no a emp o use he pla form board un il you fully unders and i s layou concep .
MCU:
Throughout this docu ent, the ter “Platfor ” shall be defined as the Renesas M16C/Tiny Sensor-less
PMSM Driving Platfor by 120-Degree Trapezoidal Wave Co utation, which is for washing achine
de o and prototype design reference.
Improvemen Policy:
Renesas Syste Solutions (Beijing) Co., Ltd. Beijing Technical Center (hereafter collectively referred to
as Renesas) pursues a policy of continuing i prove ent in design, perfor ance, and safety of this
evaluation board. Renesas reserves the right to change, wholly or partially, the specifications, design,
user’s anual, and other docu entation at any ti e without notice.
Targe User of he Produc :
Those who have carefully read and thoroughly understood the infor ation as well as restrictions
contained in the user’s anual should only use this product. Do not atte pt to use the product until you
fully understand its echanis .
Suppor :
Regarding support for the product, no services will be provided.

RSBJEUM0001-0101 Rev. 1.01
3
LIMITED WARRANTY
Renesas warrants its products to be anufactured in accordance with published specifications and free
fro defects in aterial and/or work anship. The foregoing warranty does not cover da age caused by
fair wear and tear, abnor al store condition, incorrect use, accidental isuse, abuse, neglect, corruption,
isapplication, addition or odification or by the use with other hardware or software, as the case ay be,
with which the product is inco patible. No warranty of fitness for a particular purpose is offered. The
user assu es the entire risk of using the product. Any liability of Renesas is li ited exclusively to the
replace ent of defective aterials or work anship.
DISCLAIMER
RENESAS MAKES NO WARRANTIES, EITHER EXPRESS OR IMPLIED, ORAL OR
WRITTEN, EXCEPT AS PROVIDED HEREIN, INCLUDING WITHOUT LIMITATION.
THEREOF, WARRANTIES AS TO MARKETABILITY, MECRCHANTABILITY, FITNESS
FOR ANY PARTICULAR PURPOSE OR USE, OR AGAINST INFRINGEMENT OF ANY
PATENT.
IN NO EVENT SHALL RENESAS BE LIABLE FOR ANY DIRECT, INCIDENTAL OR
CONSEQUENTIAL DAMAGES OF ANY NATURE, OR LOSSES OR EXPENSES
RESULTING
FROM ANY DEFECTIVE PRODUCT, THE USE OF ANY PRODUCT OR ITS
DOCUMENTATION, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGES.
EXCEPT AS EXPRESSLY STATED OTHERWISE IN THIS WARRANTY, THIS PRODUCT
IS
SOLD “AS IS”. AND YOU MUST ASSUME ALL RISK FOR THE USE AND RESULTS
OBTAINED FROM THE PRODUCT.

RSBJEUM0001-0101 Rev. 1.01
4
All Righ Reserved:
This user’s anual and product are copyrighted and all rights are reserved by Renesas. No part of this
user’s anual, all or part, any be reproduced or duplicated in any for , in hardcopy or achine-readable
for , by any eans available without Renesas‘s prior written consent.
O her Impor an Things o Keep in Mind:
1. Circuitry and other exa ples described herein are eant erely to indicate the characteristics and
perfor ance of Renesas Technology‘s se iconductor products. Renesas assu es no responsibility for any
intellectual property clai s or other proble s that ay result fro applications based on the exa ples
described herein.
2. No license is granted by i plication or otherwise under any patents or other rights of any third party or
Renesas.
3. MEDICAL APPLICATIONS: Renesas Technology’s products are not authorized for use in MEDICAL
APPLICATIONS without the written consent of the appropriate officer of Renesas Technology (Asia
Sales co pany). Such use includes, but is not li ited to, use in life support syste s. Buyers of Renesas
Technology’s products are requested to notify the relevant Renesas Technology (Asia Sales offices) when
planning to use the products in MEDICAL APPLICATIONS.
Limi ed An icipa ion of Danger:
Renesas cannot anticipate every possible circu stance that ight involve a potential hazard. The
warnings in this user’s anual and on the product are therefore not all inclusive. Therefore, you ust use
the product safely at your own risk.

RSBJEUM0001-0101 Rev. 1.01
5
PREFACE
Abou his manual
This user’s anual discusses how to use three-phase otor control ti er function, and a sa ple
application of how to i ple ent position-sensor-less driving of an SPMSM by 120-degree
trapezoidal wave co utation, which is a ethod that akes use of the induced voltage of the
otor.
This exa ple applies to MCUs in the MC16C/TinyGroup
Sec ion 1 Abou his pla form
Gives specification on hardware and software
Sec ion 2 Descrip ion of Sof ware
Describes software for otor control
Sec ion 3 Fini e S a e Machine of Mo or Con rol
Describes state transition for otor control
Sec ion 4 Con rol flow
Gives progra flowchart.

RSBJEUM0001-0101 Rev. 1.01
6
Contents
1. About This Platfor ..................................................................................................................................7
1.1 The hardware block diagra ...........................................................................................................7
1.2 The hardware resource assign ent table.........................................................................................7
1.3 software specifications ....................................................................................................................8
2 Description of Software..............................................................................................................................9
2.1 Output Pattern Switching ................................................................................................................9
2.2 Detection of Induced Voltages.......................................................................................................11
2.3 Calculation of Actual Rotation Speed ...........................................................................................12
2.4 Calculation of Target Rotation Speed............................................................................................12
2.5 Calculation of PWM Duty Cycle ..................................................................................................13
2.6 List of function odules................................................................................................................14
2.7 List of vrialbles..............................................................................................................................15
2.8 List of Macro definition ................................................................................................................16
2.9 List of constant variable ................................................................................................................16
3 Finite State Machine of Motor Control ....................................................................................................17
3.1 State Discription............................................................................................................................17
3.2 Condition Description ...................................................................................................................18
4 Control flow .............................................................................................................................................19
4.1 Main processing for sensor-less driving of an SPMSM by 120-degree trapezoidal wave
co utation........................................................................................................................................19
4.2 Initialization Processing ................................................................................................................20
4.3 Turn-off Processing .......................................................................................................................21
4.4 PWM Interrupt Processing ............................................................................................................22
4.5 Bootstrap Processing .....................................................................................................................23
4.6Turn-on Processing.........................................................................................................................24
4.7 TB1 Interrupt Processing...............................................................................................................26
4.8 Stop Check Processing ..................................................................................................................26
4.9 Run Processing..............................................................................................................................27
4.10 PWM Run Calculation Processing ..............................................................................................28
4.11 PWM Duty Calculation Processing.............................................................................................32
4.12 Calculate Rotation Speed Co and Processing.........................................................................34

RSBJEUM0001-0101 Rev. 1.01
7
1. Abou This Pla form
1.1 The hardware block diagram
1.2 The hardware resource assignment table
Used SFR Function Description Used I/O Port Function Description
TA1 U phase PWM wave P15/3
INT /ID phase induced voltage detection
TA2 phase PWM wave P16/ 4
INT /IDW W phase induced voltage detection
TA4 W phase PWM wave P17/5
INT /IDU U phase induced voltage detection
TB1 50us cycle inquiry P01/AN01 Rotation Speed Command
TB2 Carrier wave cycle control P102/AN2 Bus current sample
P103/AN3 Bus voltage sample
P72/ phase voltage
P73/V V phase voltage
P74/W W phase voltage
P75/W W phase voltage
P80/U U phase voltage
P81/U Uphase voltage
Comparator
in Uin Win
P10
2
/AN
2
(I
BUS
)
(
BUS
)
P1
5
/INT3
P1
6
/INT4
P1
7
/INT5
(
BEMF
)
(W
BEMF
)
(U
BEMF
)
P8
5
/nNMI/nSD
(SD)
P7
2
/TA1
OUT
/
P7
4
/TA2
OUT
/W
P7
5
/TA2
IN
//W
P8
1
/TA4
IN
//U
P8
0
/TA4
OUT
/U
(
P
)
(
N
)
(W
N
)
(W
P
)
(U
N
)
(U
P
)
Three-phase motor control
A/D Conversion
Induce voltage detect
P10
3
/AN
3
P7
3
/TA1
IN
//
M16C/Tiny
IPM
circuit
U
W
F
O
BUS
_IN
BUS
OUT
220 AC
(
P
)
(
N
)
(W
N
)
(W
P
)
(U
N
)
(U
P
)
bus
Sample Circuit
L
N
L
N
3
6
P cc
P cc
Motor
U
W
PO ER
circuit
ACCT
IBus
P0
1
/AN0
1
Speed Command
Potentionmeter

RSBJEUM0001-0101 Rev. 1.01
8
1.3 software specifications
Motor type permanent magnet synchronous motor(PMSM)
Numbers of pole pairs 2
Control method 120-degree commutation using trapezoidal waves
Motor Position Detection Detected by three phase induced voltage of motor
Carrier Frequency 5kHz
Range of Rotation
Speed Command
Single Direction
1000rpm to 7200 rpm
Error detection The Fo signal (forced shut-down signal) of the IPM is input
to the NMI pin of the MCU. Thus, if the Fo signal goes low,
the three-phase output is forcibly stopped and the
three-phase output pins are placed in the high-impedance
state.

RSBJEUM0001-0101 Rev. 1.01
9
2 Descrip ion of Sof ware
2.1 Output Pattern Switching
Figure 3.1.1 Time Charting
Pattern 5 Pattern 0 Pattern 1 Pattern 2 Pattern 3 Pattern 4 Pattern 5
Zero-crossing
Switch the output pattern 30
degree after the zero-crossing
of the induced voltage
0
1
3
2
4
5
Calcultation the actual rotation speed
from intervals between zero-crossings
of the induced voltages
U-BEMF
-BEMF
W-BEMF
Up
Un
p
n
Wp
Wn

RSBJEUM0001-0101 Rev. 1.01
10
Figure 3.1.2 Three-phase IGBT inverter circuit
In the 120 degree trapezoidal communication mode, three phase IGBT circuit turn-on sequence
is UpWn→Wn p→ pUn→UnWp→Wp n→ nUp, two IGBT are conducted every 60 electrical
degrees. Accordingly, PWM wave have 6 output pattern switching. It is shown as the figure 3.1.1
and figure 3.1.2
Output pattern is switched when motor rotor angles 60 electrical degree every time.
Zero-crossings of the induced voltages is at the mid of each output pattern (30 electrical degree).
In this program, the function of output pattern switching is carried out by PFCR register of
M16C62A. It can control each bit in the PFCi (i=0 to 5) to enable each one of three-phase PWM
output pins. When setting the PFCi (i=0 to 5) to “0”, three-phase PWM output pin functions act as
I/O port and can output “H” level state and “L” level state.
In order to outputting PWM wave when motor rotor angles 360 electrical degrees, PFCR register
should be set based the following table.
Table 3.1.1 PFCR correspond to different output pattern
The three-phase PWM output pins have three states, PWM wave, “H” and “L”, the output states
depend on PFCR register, Pi register and PDi register. The output states table is shown on Table
3.1.2.
Wn Wp n p Un Up
X X PFC5 PFC4 PFC3 PFC2 PFC1 PFC0
Pattern 0 0 0 0 0 0 0 0 1
Pattern 1 0 0 1 0 0 0 0 0
Pattern 2 0 0 0 0 0 1 0 0
Pattern 3 0 0 0 0 0 0 1 0
Pattern 4 0 0 0 1 0 0 0 0
Pattern 5 0 0 0 0 1 0 0 0
Up
Un
VCC
GND
Vp Wp
Vn Wn

RSBJEUM0001-0101 Rev. 1.01
11
PFCi PDi Pi Output
0 1 0 “L”
0 1 1 “H”
1 X X PWM
Table 3.1.2 three states of output pin
2.2 Detection of Induced Voltages
Figure 3.1.3 Detection of zero-crossing of induced voltage and comparator output
The output pattern of the MCU depends on position information of induced voltages. The
voltages output by the inverter are compared with half the bus voltage, and the results are fed to
the MCU. The following table shows the connection between MCU pins and induced voltage
signals.
Input pin BEMF signal
3INT/P15 _BEMF
4INT/P16 W_BEMF
5INT/P17 U_BEMF
Table 3.1.3 the connection of input pin and induce voltage
Induced voltage
Co parator
Output Signal
U
W
U
W
Vbus/2
Vbus/2
Vbus/2
30 dgr 30 dgr
Switching output pattern
Zero-crossing of induced
voltage

RSBJEUM0001-0101 Rev. 1.01
12
In our program, when motor mode changes into turnon mode, TB1 interrupt is enabled, after the
next carrier wave cycle interrupt, motor woke mode become run mode. Every 50us, TB1
interrupts. If the TB1 interrupt request bit is set to 1, after another 50us, the TB1 interrupt request
bit is still set to 1, the zero-crossing of induced voltages is detected, and it is at the mid-point (30
electrical degrees) of each output pattern. Switching of the output pattern is delayed by 30
electrical degrees from zero-crossing detected. The process avoid occurring wrong pulses to be
mistaken the detection of zero-crossing of induced voltages because of motor demagnetization
at the point of output pattern switching. The U phase processing is shown as figure 3.1.2
When motor work mode changes into stop mode, tb1s is set to “0”, TB1 interrupt stops but
interrupt enable is still open. The detection of induced voltage is shown as figure 3.1.1
2.3 Calculation of Actual Rotation Speed
The actual rotation speed is calculated by interval between two zero-crossings of induced
voltages. The interval comprises certain carrier wave cycle pulses. In the PWM mode, 6 intervals
are passed every 360 electrical degree. So if counting the carrier wave pulses every a rotate, the
actual rotation speed can be calculated by the following formula.
Actual rotation speed= 6interval crossingZero
5kHz2π
×−
×
(3.3.1)
In the actual programming, the method of lookup table can be used. Given an array of
zero-crossing interval pulses, the corresponding actual rotation speed can be calculated based
the above formula. A zero-crossing interval pulses is subtracted 13, the corresponding actual
rotation speed can be looked up using the sequence number of array.
2.4 Calculation of Target Rotation Speed
The target rotation speed is brought towards the current rotation speed command at a rate of 0.5
rad/s every certain interval until target rotation speed is approach to the rotation speed command.
If knowing current target rotation speed, the carrier wave cycle pulses between intervals of
zero-crossings can be calculated using the above formula.

RSBJEUM0001-0101 Rev. 1.01
13
2.5 Calculation of P M Duty Cycle
Figure 3.1.4 Relationship between PWM Duty Cycle and Rotation Speed Command
PWM duty cycle depends on counting values of TAi. The actual rotation speed is proportion to
PWM duty cycle, the bigger is PWM duty cycle, the faster is the actual rotation speed. In the
course of approaching rotation speed command, the carrier wave cycle pulses can be acquired
by target rotation speed every time. Every result is saved a 1dimension array including 12 data
units. Then 12 elements are added to calculate average value, a current carrier wave pulses
between zero-crossings can be gotten.
According to formula 3.3.1, the current actual rotation speed will be gotten. Consequently, the
PWM duty cycle is changed according to the conditions given below.
Condition Amount of change
Target rotation speed > Actual rotation speed +
∆
duty
Target rotation speed > Actual rotation speed -
∆
duty
TB2
TAi
Sawtooth Wave
odulation
Output
Slow
Fast

RSBJEUM0001-0101 Rev. 1.01
14
2.6 List of function modules
Module name Label name Input Output Description
Motor control main
processing
Main_PWM_120slc20_PFCR( )
—— Main processing
Initialization
processing
PWMInitial( ) —— Set initial values for AD
conversion, zero-crossing
detection ,and three phase
PWM
PWM interrupt
processing
PWMInt( ) —— Call the turnoff, bootstrap,
turnon and run processing
Turn off processing TurnoffPWM( ) —— Turns off the three pahse
PWM outputs and checks
whether to proceed to startup
operation
Turn on Processing
TurnonPWM( ) —— Performs startup operation
and check run mode switch
Bootstrap processing
BootstrapPWM ( ) —— Charging for 3-phase IGBT
circuit
TB1 int processing TB1Int ( ) —— Performs 50us timer inquiry
and detect induced voltage
Run
Processing
RunPWM ( ) —— Normal PWM operation
processing
Run calculation
processing
Cal PwmRun ( ) —— Performs sensor-less control
and Output pattern switching
PWM duty calculation
processing
CalPWMDuty ( ) —— Calculates actual rotation
speed and PWM duty
Stop check processing
StopCheck( ) UNIT_16
Stop
check
result
Check whether the
processing is stopped by a
rotation speed command or
an error
Calculate Rotation
Speed Command
CalSpeedCnd( ) UINT_16 UNIT_16
Ad rotation
Input speed
alue command
Convert AD value to rotation
speed command

RSBJEUM0001-0101 Rev. 1.01
15
2.7 List of vrialbles
Item Label Data Type
Resolution
Description
Stop state s_StopMode UINT_16 2^0
Output state g_OutputMode
UINT_8 2^0 Operation mode
Output angle g_MotTheta UINT_16 2^11
Startup control
counter
s_StartCnt UINT_16 2^0
Target rotation
speed calculation
counter
s_TargetCnt UINT_16 2^0 Counter used to provide the period
(2ms) of target rotation speed
calculation.
Rotation speed
command
g_SpeedCnd UINT_16 2^1 ADC input
rpm = SpeedCnd /2^1/(2p)/ number of
pole pairs×60
Target rotation
speed
g_SpeedTgt UINT_16 2^1 The value changed toward the rotation
speed command value at a rate of 0.5
rad per 2 ms.
Actual rotation
speed
g_SpeedAct UINT_16 2^1 Detect from the zero-crossing
interval of the induced voltages
Zero-crossings
interval counter
s_DltCnt UINT_16 2^0 Counter that measures the interval
between zero-crossings (60°).
Counter clock period is the carrier
period.
Delay time counter
for switching to the
next output pattern
s_ReloadCnt UINT_16 2^0 Counter used to provide a time period
from a pattern switching until detection
of induced voltage zero-crossings is
enabled. Counter clock period is the
carrier period
output pattern g_Stage UINT_16 2^0 Current output pattern
Next output
Pattern
s_ReloadStg UINT_16 2^0 Next pattern that is determined based
on the induced-voltage zero-crossing
detection.
PWM duty clcye g_PwmDuty UINT_16 2^13
Bootstrap charge
delay counter
s_BootstpCnt
UINT_16 2^0 A period delay for charging for every
IGBT
Bootstrap charge
Step counter
s_BootstpStep
UINT_8 2^0 Three-phase IGBT circuit bootstrap
Current
zero-crossings
interval counter
g_DltCntRef UINT_16 2^0
Former
zero-crossings
interval counter
g_PreDltCnt UINT_16 2^0
Zero-crossing
interval array
g_DltCntArray[
12]
UINT_16 2^0 Save 12 times zero-crossing interval
pulses
Average
zero-crossing
interval pulse
g_AvrDltCnt UINT_16 2^0
External Interrupt
counter
s_IntCnt UINT_16 2^0 Detect two INTi interrupts for induced
voltage
AD rotation speed
command
s_ADSpeed UINT_16 2^12 Change AD value into rotation speed
AD rotation speed
sum
s_ADSum UINT_32 2^12 16 times AD value sum
zero-crossing
interval array po
inter
s_CalCnt UINT_8 2^0 Calculate average zero-crossing

RSBJEUM0001-0101 Rev. 1.01
16
interval pulse
AD sample interval
g_swtime UINT_16 2^0 Sample once every 16 carrier wave
interrupt
Induced voltage
detection disable
time counter
g_ChkOnCnt UINT_16 2^0 Counter used to provide a time delay
for detect a induced voltage
zero-crossing.
2.8 List of Macro definition
Macro name Macro value
Resolution Description
M_CTRL_TS 6711 2^25 Control cycle 0.0002* 2^25
M_K_SPEED_AD_REF 6032 2^12 A-D conversion ratio (240*2*pi/1024)* 2^12
M_Sft_SPEED_AD_RE 11
M_Start_Hz 419 2^1 Carrier wave cycle 5k, startup rotation speed
M_Sft_TURNON_MODE 15 2^0
M_TURNON_MODE_TIM
E
1500 2^0 Start up time
M_THETA_60DEG 2145 2^11 Pi/3* 2^11
M_THETA_360DEG 12868 2^11 2*Pi*2^11
M_CARR_CNT 4000 2^0 Carrier wave cycle is 5k
M_TURNOFF 0 2^0 Turnoff work mode
M_BOOTSTRAP 1 2^0 Bootstrap work mode
M_TURNON 2 2^0 Turnon work mode
M_RUN 3 2^0 Run work mode
M_INI_DUTY_120 1600 2^15 Initial PWM duty (0.08*2^15)
M_MIN_DUTY_120 328 2^15 Min PWM duty ( 0.01*2^15 )
M_MAX_DUTY_120 29488 2^15 Max PWM duty ( 0.9*2^15 )
M_BOOT_DUTY_120 3276 2^15 Bootstrap PWM duty ( 0.1*2^15 )
M_Sft_DUTY_120_TIME 15 2^0
M_BOOTSTRAPSTEP 3 Bootstrap mode step
2.9 List of constant variable
Item Label Data Type
Description
Output pattern switching
table
PFCRTbl[ ] UINT_8 Comprise 6 output pattern PWM wave
Zero-crossing interval
counter table
Tgt_Dlt_Conv[ ]
UINT_8 Convert target rotation speed to
zero-crossing interval pulse
Actual rotation speed
table
Dlt_Act _Conv[ ]
UINT_8 Convert zero-crossing interval pulse to
actual
rotation speed
PFCR output table for
bootstrap mode
PFCRTblBoot[ ]
UINT_8 Include three elements for three phase IGBT
circuit charging

RSBJEUM0001-0101 Rev. 1.01
17
3 Fini e S a e Machine of Mo or Con rol
The state of motor control can be shown by finite state machine (FSM). The following figure is the
FSM of BLDC in this software. It concludes four states, the states can be switched to other states
under the certain conditions.
3.1 State Discription
1. Turnoff mode expresses that the rotation speed command from A/D converts is 0, and MCU
will not output PWM wave. Under this mode, if rotation speed command from A/D converts is
not equal to zero, motor work mode changes into bootstrap mode, the target rotation speed and
actual rotation are set to the minimum rotation speed, 1000rpm.
2. Bootstrap mode indicate that under the condition of single power supply for IPM module,
bootstrap circuit finish the function of charging for upper arm IGBT of 3 phase IGBT circuit. This
method is implemented by MCU outputting bootstrap-duty PWM wave. In order to prove to
enough charging time of upper arm IGBT, the bootstrap mode last certain time. When three
phase IGBT circuit bootstrap mode is finished, the motor work mode changes into turnon mode,
otherwise the bootstrap mode is continue.
When no rotation speed command is detected or three phase motor output control timer is
disabled, the motor work mode come back turnoff mode.
3. Turnon mode points motor starts to run while MCU outputs initial-duty PWM wave. Output
pattern switching is forcibly implemented by controlling PWM duty changing amount to calculate
motor rotation angle. Passing 1500 carrier wave cycle interrupt, motor work mode changes into
Run mode, or it will continue turnon mode.
When no rotation speed command is detected or three phase motor output control timer is
disabled, the motor work mode come back turnoff mode.
4. Run mode indicates that motor works normally while MCU outputs PWM wave by inputting
certain rotation speed command. And the rotation speed command is synchronous to rotate
magnetic field frequency, so zero-crossing of induced voltage can be detected accurately to
decide to output pattern stwiching by 50us timer interrupt.
When no rotation speed command is detected or three phase motor output control timer is
Trunoff
Mode
Bootstrap
Mode
Trunon
Mode
Run
Mode
12 3
4
7
6
58
9 10 11

RSBJEUM0001-0101 Rev. 1.01
18
disabled, the motor work mode come back turnoff mode.
No intervals of zero-crossing of induced voltages are detected when counter of zero-crossing
interval exceeds certain values, the motor work mode change into turnon mode.
3.2 Condition Description
Condition number Description
① Rotation speed command is not equal to zero
② The three phase IGBT charging process is over
③ Motor rotation speed is synchronous to rotate magnetic field frequency after passing
some carrier wave cycle interrupts
④ No rotation speed command
⑤
⑥
⑦
Rotation speed command is equal to zero or three phase motor output control timer
disable
⑧ No intervals of zero-crossing of induced voltages are detected
⑨ The three phase IGBT charging process is not over
⑩ Don’t satisfied condition No.3 and No.6
Always acquire accurate motor position information
11
This manual suits for next models
1
Table of contents
Other Renesas Network Hardware manuals

Renesas
Renesas Synergy AE-CAP1 User manual

Renesas
Renesas YCONNECT-IT-RZN2L User manual

Renesas
Renesas R-IN32M4-CL2 TESSERA User manual

Renesas
Renesas RH850/U2A 144pin User manual

Renesas
Renesas QB-RL78G1A User manual

Renesas
Renesas H8S/2633 User manual

Renesas
Renesas RX600 Series User manual

Renesas
Renesas S1JA User manual

Renesas
Renesas R-IN32 Series User manual

Renesas
Renesas H8S/2268 Series Owner's manual