Renesas RA6T2 Istruzioni per l'installazione e il funzionamento

APPLICATION NOTE
R01AN6208EJ0101 Rev.1.01 Page
1
of 71
Oct 18, 2022
RA6T2
Vector control for permanent magnetic synchronous motor with encoder - AB
incremental type encoder
Abstract
This application note describes the sample program for a permanent magnetic synchronous motor drive with
vector control using encoder based on Renesas RA6T2 microcontroller. This application note also describes
how to use the motor control development support tool, ’Renesas Motor Workbench’.
The targeted software for this application is only to be used as reference purposes only and Renesas
Electronics Corporation does not guarantee the operations. Please use this after carrying out a thorough
evaluation in a suitable environment.
Operation checking device
Operations of the target software of this application note are checked by using the following device.
- RA6T2 (R7FA6T2BD3CFP)
Contents
1. Overview .................................................................................................................................3
1.1 Development environment ......................................................................................................................3
2. System overview .....................................................................................................................4
2.1 Hardware configuration ...........................................................................................................................4
2.2 Hardware specifications ..........................................................................................................................5
2.2.1 User interface........................................................................................................................................5
2.2.2 Peripheral functions...............................................................................................................................7
2.3 Software configuration...........................................................................................................................18
2.3.1 Software file configuration...................................................................................................................18
2.3.2 Module configuration...........................................................................................................................19
2.4 Software specifications..........................................................................................................................20
2.5 Interrupt Priority.....................................................................................................................................21
3. Descriptions of the control program.......................................................................................22
3.1 Contents of control ................................................................................................................................22
3.1.1 Motor start/stop....................................................................................................................................22
3.1.2 A/D Converter......................................................................................................................................22
3.1.3 Modulation...........................................................................................................................................23
3.1.4 State transition.....................................................................................................................................25
3.1.5 Start-up method...................................................................................................................................26
3.1.6 Position Profile Generation..................................................................................................................27
(Position Profile of Trapezoidal Curve for Speed Command Value)...............................................................27

RA6T2 Vector control for permanent magnetic synchronous motor with encoder - AB incremental type encoder
R01AN6208EJ0101 Rev.1.01 Page
2
of 71
Oct 18, 2022
3.1.7 Speed Measurement...........................................................................................................................28
3.1.8 System protection function..................................................................................................................30
3.1.9 AD triggers...........................................................................................................................................31
3.2 Function specifications of vector control with encoder software...........................................................32
3.3 Contents of control ................................................................................................................................39
3.3.1 Configuration Options..........................................................................................................................39
3.3.2 Configuration Options for included modules .......................................................................................39
3.4 Control flowcharts..................................................................................................................................50
3.4.1 Main process.......................................................................................................................................50
3.4.2 50[µs] Period Interrupt (Carrier synchronized Interrupt) Process .......................................................51
3.4.3 500 [µs] Period Interrupt Process........................................................................................................52
3.4.4 Over Current Detection Interrupt Process...........................................................................................53
3.4.5 Encoder signal interrupt processing....................................................................................................54
4. Evaluation environment explanation......................................................................................55
4.1 Operating Environment .........................................................................................................................55
4.2 Importing the Demo Project...................................................................................................................55
4.3 Building and Debugging ........................................................................................................................56
4.4 Motor Demonstration Project Overview.................................................................................................57
4.4.1 Quick Start...........................................................................................................................................57
4.5 Motor Control Development Support Tool ‘Renesas Motor Workbench’ ..............................................58
4.5.1 Overview..............................................................................................................................................58
4.5.2 Easy function operation example ........................................................................................................59
4.5.3 List of variables for Analyzer function .................................................................................................63
4.5.4 Operation Example for Analyzer .........................................................................................................64
4.5.5 Tuner function......................................................................................................................................65
4.5.6 Example of changing communication speed.......................................................................................66
4.5.7 How to use the built-in communication library.....................................................................................67
5. Reference Documents...........................................................................................................70
Revision History............................................................................................................................71

RA6T2 Vector control for permanent magnetic synchronous motor with encoder - AB incremental type encoder
R01AN6208EJ0101 Rev.1.01 Page
3
of 71
Oct 18, 2022
1. Overview
This application note explains how to implement the vector control with encoder software that drives
permanent magnetic synchronous motor (PMSM) using the RA6T2 microcontroller and how to use the motor
control development support tool, ‘Renesas Motor Workbench’.
Note that this software uses the algorithm described in the application note ‘Vector control with encoder for
permanent magnet synchronous motor (Algorithm)’(R01AN3789), so please refer to that for the details of
the algorithm.
1.1 Development environment
Table 1-1 and Table 1-2 show development environment of the software explained in this application note.
Table 1-1 Hardware Development Environment
Microcontroller
Evaluation board (Note 1)
Motor (Note 2)
Sensor (Note 3)
RA6T2
(R7FA6T2BD3CFP)
MCK-RA6T2
BLY171D-24V-4000
AMT102-V
Table 1-2 Software Development Environment
e2studio version
FSP version
Toolchain version
V2022-10
V4.1.0 and later
GCC ARM Embedded:
V10.3.1.20210824
For purchase and technical support,contact Sales representatives and dealers of Renesas Electronics
Corporation.
Notes:
1. MCK-RA6T2 (RTK0EMA270S00020BJ) is included in the kit products RTK0EM0000B12020BJ,
RTK0EMA270C00000BJ and RTK0EMXC90Z00000BJ, and it is a product of Renesas Electronics
Corporation.
RA6T2 CPU board (RTK0EMA270C00000BJ) is a product of Renesas Electronics Corporation.
2.BLY171D-24V-4000 is a product of Anaheim Automation.
Anaheim Automation (https://www.anaheimautomation.com/)
3.AMT102-V is a product of CUI Devices.
CUI Devices (https://www.cuidevices.com/)

RA6T2 Vector control for permanent magnetic synchronous motor with encoder - AB incremental type encoder
R01AN6208EJ0101 Rev.1.01 Page
4
of 71
Oct 18, 2022
2. System overview
Overview of this system is explained below.
2.1 Hardware configuration
The hardware configuration is shown below.
RA6T2
Vdc
GND
VR1
SW1 SW2
LED1 LED2
Up
Vp
Wp
Vn
Un
Wn
OC Vu
Vv
Vw
PD04
PD07
PA06 / AN006
PB00 / AN008
PD01
PD02
PB04 / GTIOC4A(Up)
PB06 / GTIOC5A(Vp)
PC13 / GTETRGC
PMSM
PA04 / AN004 IU_AIN
PA00 / AN000 IW_AIN
PC14 / GTIOC3A
PC15 / GTIOC3B
PB08 / GTIOC6A(Wp)
PB05 / GTIOC4B(Un)
PB07 / GTIOC5B(Vn)
PB09 / GTIOC6B(Wn)
PD03
LED3
PA02 / AN002 IV_AIN
Power supply circuit
A/D converter input
Bus voltage
Phase
current
Rotation speed command
Motor rotation start/stop
Error reset
Inverter circuit
Phase current
detection
Iu Iw
Iv
Switch input
LED output
GPT output
Over current detectioninput
Encoder output
Over current detection
ENC_Z port
ENC_A port
ENC_B port
GND port
Vcc port
U port
W port
V port
HU port
HW port
HV port
GND port
Vcc port
Figure 2-1 Hardware Configuration Diagram

RA6T2 Vector control for permanent magnetic synchronous motor with encoder - AB incremental type encoder
R01AN6208EJ0101 Rev.1.01 Page
5
of 71
Oct 18, 2022
2.2 Hardware specifications
2.2.1 User interface
Table 2-1 and Table 2-2 is lists of user interfaces of this system.
Table 2-1 User Interface
Item
Interface component
Function
Rotation speed
command
Variable resistor (VR)
Reference value of rotation speed input (analog
value)
START/STOP
Toggle switch (SW1)
Motor rotation start/stop command
ERROR RESET
Push switch (SW2)
Command of recovery from error status
LED1
Orange LED
- At the time of motor rotation: ON
- At the time of stop: OFF
LED2
Orange LED
- At the time of error detection: ON
- At the time of normal operation: OFF
LED2
Orange LED
- Positioning completed: ON
- Positioning not completed: OFF
Table 2-2 CPU card user interface
Item
Interface component
Function
LED1
Orange LED
- At the time of motor rotation: ON
- At the time of stop: OFF
LED2
Orange LED
- At the time of error detection: ON
- At the time of normal operation: OFF
LED2
Orange LED
- Positioning completed: ON
- Positioning not completed: OFF
RESET
Push switch (RESET)
System reset

RA6T2 Vector control for permanent magnetic synchronous motor with encoder - AB incremental type encoder
R01AN6208EJ0101 Rev.1.01 Page
6
of 71
Oct 18, 2022
List of port interfaces of this system is given in Table 2-3.
Table 2-3 Port Interfaces
R7FA6T2BD3CFP port name
Function
PA06 / AN006
Inverter bus voltage measurement
PB00 / AN008
For rotation speed command value input (analog value)
PD04
START/STOP toggle switch (SW1)
PD07
ERROR RESET push switch (SW2)
PD01
LED1 ON/OFF control
PD02
LED2 ON/OFF control
PD03
LED3 ON/OFF control
PA04 / AN004
U phase current measurement
PA02 / AN002
V phase current measurement
PA00 / AN000
W phase current measurement
PB04 / GTIOC4A
PWM output (Up)
PB06 / GTIOC5A
PWM output (Vp)
PB08 / GTIOC6A
PWM output (Wp)
PB05 / GTIOC4B
PWM output (Un)
PB07 / GTIOC5B
PWM output (Vn)
PB09 / GTIOC6B
PWM output (Wn)
PC14 / GTIOC3A
Encoder A phase input
PC15 / GTIOC3B
Encoder B phase input
PC13 / GTETRGD
PWM emergency stop input at the time of overcurrent detection

RA6T2 Vector control for permanent magnetic synchronous motor with encoder - AB incremental type encoder
R01AN6208EJ0101 Rev.1.01 Page
7
of 71
Oct 18, 2022
2.2.2 Peripheral functions
List of the peripheral functions used in this system is given in Table 2-4.
Table 2-4 List of the Peripheral Functions
Peripheral
Resource
Purpose
12-bit A/D Converter
AN000, AN002, AN004,
AN006, AN008
Measure electric current of phase U and W
Measure inverter bus voltage
Rotational speed or position command input
AGT
AGT0
500 [µs] interval timer
GPT
CH1, CH3, CH4, CH5,
CH6
Complementary PWM outputs
Encoder phase counter
Encoder count capture
POEG
Group D
Sets ports executing PWM output to high
impedance state when an overcurrent is
detected by external circuit.

RA6T2 Vector control for permanent magnetic synchronous motor with encoder - AB incremental type encoder
R01AN6208EJ0101 Rev.1.01 Page
8
of 71
Oct 18, 2022
(1) 12-bit A/D Converter (12ADC)
U-phase current (Iu), V-phase current (Iv), W-phase current (Iw), inverter bus voltage1 (Vdc), and speed
command (VR) are measured in "Single scan mode" (use a hardware trigger).
A/D conversion is implemented to be synchronized with carrier synchronized interrupt as GPT underflow
(PWM valley) by using GPT trigger function.
Figure 2-2 FSP Configuration of ADC Driver (FSP 3.5.0) [1/3]

RA6T2 Vector control for permanent magnetic synchronous motor with encoder - AB incremental type encoder
R01AN6208EJ0101 Rev.1.01 Page
9
of 71
Oct 18, 2022
Figure 2-3 FSP Configuration of ADC Driver (FSP 3.5.0) [2/3]

RA6T2 Vector control for permanent magnetic synchronous motor with encoder - AB incremental type encoder
R01AN6208EJ0101 Rev.1.01 Page
10
of 71
Oct 18, 2022
Figure 2-4 FSP Configuration of ADC Driver (FSP 3.5.0) [3/3]
Altri manuali per RA6T2
1
Indice
Altri manuali Renesas Convertitore multimediale

Renesas
Renesas AB-050-Fx4-MB-L-Q-TCT-V2 Manuale utente

Renesas
Renesas ISL8103EVAL1 Manuale utente

Renesas
Renesas Single-Chip Microcomputer M32180T2-PTC Manuale utente

Renesas
Renesas M3A-ZA53 Manuale utente

Renesas
Renesas R0E420000CFJ30 Manuale utente

Renesas
Renesas ISL6310EVAL1Z Manuale utente

Renesas
Renesas R0E53036ACFG40 Manuale utente

Renesas
Renesas RAA3064002GFP Manuale utente

Renesas
Renesas H8S/2427 Manuale utente

Renesas
Renesas R0E000200ACB10 Manuale utente



















