USER MANUAL
UM-YROTATE-IT-RX23T Rev. 1.0 Page 1 of 83
October 6, 2015
YROTATE-IT-RX23T
Rotate it!Motor Control RX23T
Introduction
The Renesas Motor Control Kit called YROTATE-IT-RX23T, is based on the RX23T device from the powerful 32-bit RX
microcontrollers family running at 40MHz and delivering up to 80DMIPs.
The kit enables engineers to easily test and evaluate the performance of the RX23T in a laboratory environment when
driving any 3-phase Permanent Magnet Synchronous Motor (e.g. AC Brushless Motor) using an advanced sensorless Field
Oriented Control algorithm. Typical applications for this type of solution are compressors, air conditioning, fans, air
extractors, pumps, home appliances inverters and industrial drives.
The phase current measurement is done via three shunts which offers a low cost solution, avoiding the need for an
expensive current sensor or hall sensor. A single shunt current reading method is also available to ensure an even more
compacter bill of material.
The powerful user-friendly PC Graphical User Interface (GUI) gives real time access to key motor performance parameters
and provides a unique motor auto-tuning facility. Furthermore, it becomes also possible to select the best switching
frequency and control frequency (e.g. control loop) to adapt the control dynamics suitable to the application
requirements.
The hardware is designed for easy access to key system test points and for the ability to hook up to an RX23T debugger
known as E1. Although the board is normally powered directly from the USB port of a Host PC, connectors are provided
to utilise external power supplies where required.
The YROTATE-IT-RX23T is an ideal tool to check out all the key performance parameters of your selected motor, before
embarking on a final end application system design.
Target Device:
RX23T Microcontrollers Family
UM-YROTATE-IT-
RX23T
Rev. 1.0
October 6, 2015
RX23T YROTATE-IT-RX23T Motor Control Kit
UM-YROTATE-IT-RX23T Rev. 1.0 Page 2 of 83
October 6, 2015
Contents
1. Specifications & Hardware overview ....................................................................................................... 3
2. Connectors description ............................................................................................................................. 7
3. Power supply selection ............................................................................................................................. 8
4. LEDs functions description ...................................................................................................................... 10
5. Test points for debugging ...................................................................................................................... 11
6. Internal power stage description ........................................................................................................... 12
7. Current reading methods selection ........................................................................................................ 14
8. Interface to an external power stage ..................................................................................................... 16
9. Single shunt current reading .................................................................................................................. 20
10. Current reading timing in three shunts and single shunt configurations ............................................. 21
11. Website material: www.renesas.eu/motorcontrol .............................................................................. 24
12. Microcontroller RX23T short overview ................................................................................................. 25
13. Permanent Magnets Brushless Motor model ....................................................................................... 27
14. Sensorless Field Oriented Control algorithm ........................................................................................ 32
15. Software Tools used ............................................................................................................................. 33
16. Software description and Resources used ............................................................................................ 37
17. Start-up procedure – Embedded software ........................................................................................... 44
18. Reference system transformations in details ....................................................................................... 46
19. Rotor position estimation..................................................................................................................... 47
20. PC Graphical User Interface in details .................................................................................................. 50
21. EEPROM parameters: detailed description .......................................................................................... 56
22. Motor Auto-calibration using the PC GUI ............................................................................................. 57
23. Updating the RX23T Flash memory using the Renesas Programming Flash Tool ................................. 68
24. Integration of user code to the motor control algorithm ..................................................................... 73
25. Communication Protocol between the MCU and the PC GUI ............................................................... 74
RX23T YROTATE-IT-RX23T Motor Control Kit
UM-YROTATE-IT-RX23T Rev. 1.0 Page 3 of 83
October 6, 2015
1. Specifications & Hardware overview
ITEM
SPECIFICATIONS
TYPE OF MOTORS SUPPORTED
3-phase Permanent Magnet Synchronous (PMSM, PMAC, BLAC)
3-phase Brushless DC (BLDC)
KIT MOTOR PARTNAME NANOTEC
DB42S03, 24V
DC
, 4000 RPM
KIT MAX INPUT RANGE External power supply from: 20V
DC
to 48V
DC,
6A
peak
TRANSISTOR USED Renesas Mosfets: RJK0654DPB, 60V, 30A
POWER SUPPLY OPTION Either USB connection or external supply: up to 48V
DC
CURRENT DETECTION One or three shunts configuration (10mΩ)
USB IC USED ON THE BOARD FT232R - USB UART IC from FDTI, 76.6KBd communication speed
MICROCONTROLLER RX23T (R5F523T5ADFM), 64-pin LFQFP, 40MHz, 64KB Flash, 10KB RAM
MCU PERFORMANCE 40MHz, 80DMIPs, 166 CoreMark
KEY FEATURES Floating Point Unit, 3-phase inverter Timer
12-bit A/D Converter, fast on-chip Comparators, Port Output Enable
MCU EMBEDDED FIRMWARE Sensorless vector control algorithm (Field Oriented Control)
SWITCHING FREQUENCY 4KHz to 64KHz, 16KHz by default (PWM frequency)
CONTROL LOOP FREQUENCY
(SAMPLING FREQUENCY) 4KHz to 16KHz, 8KHz by default
CONTROL LOOP TIMING 50µs including debug features and auto-tuning/self-identification
40µs including only the sensorless vector control algorithm
CODE SIZE IN FLASH / RAM 24KB / 3KB
TOOL USED, VERSION e²studio 4.0.2.008. , CS+ , RXC Toolchain, CC RX version v2.03.00
COMPILER OPTIMIZATION LEVEL Maximum, optimize for speed, little-endian data, RX V2 Core enable
ENVIRONMENT STANDARDS RoHS compliant including China regulations
WEEE, RoHS
RX23T YROTATE-IT-RX23T Motor Control Kit
UM-YROTATE-IT-RX23T Rev. 1.0 Page 4 of 83
October 6, 2015
The inverter kit YROTATE-IT-RX23T is a single board inverter, based on the 32-bit RX series microcontroller RX23T and
includes a low-voltage MOSFETs power stage and a communication stage. The PCB is a four layers board and ensure
the management of Permanent Magnet Motors up to 48V
DC
and up to 6A
max
.
Please find below the content of the YROTATE-IT-RX23T kit:
To obtain the maximum flexibility, the inverter reference kit includes:
A complete 3-phase inverter on-board with a low voltage motor, so it becomes easy to test the powerful
sensorless algorithm running on the Renesas 32-bit RX23T microcontroller (e.g. MCU).
An insulated USB communication with the PC offering communication speed up to 76.6KBd.
Connectors for hall sensors and encoder connections. Both encoder and hall sensors are not managed in the
sensorless software but they can be supported under request.
Compatibility with the existing Motor Control Reference Platform external power stages, the first delivering
up to 1.5KW at 230V
AC
and the second up to 60V
DC
, 60A
DC
.
USB power supply possibility to avoid external power supplies where galvanic insulation is lost.
RX23T YROTATE-IT-RX23T Motor Control Kit
UM-YROTATE-IT-RX23T Rev. 1.0 Page 5 of 83
October 6, 2015
To achieve these aims, three different DC-DC converters are used:
1. A step-up DC-DC converter to increase the voltage from the USB standard (5V) up to 13.5V
DC
2. A step-down converter and a low dropout linear converter, from the DC bus first to 15V and then to the CPU
supply voltage: 5V, please find below the PCB overview.
The full schematics and CAD design files (e.g. Gerber) of the inverter kit are available on the website:
www.renesas.eu/motorcontrol , in the section related to the YROTATE-IT-RX23T development kit.
In the YROTATE-IT-RX23T kit, the RX23T in a 64-pin package was selected to ensure the management of inverter,
external communications, three shunts, the EEPROM communication, the E1 debugger, three voltages phases, the
over-current detection, the Bus voltage monitoring, etc.
The picture below is showing the detailed I/O pins assignment of the RX23T to manage the complete kit.
ZIGBEE/MCU programming or GUI
communication selection
COMMUNICATION
-
DOWN
STEP_UP
EXTERNAL POWER
STAGE INTERFACE
LOW VOLTAGE
POWER STAGE
CONTROL
STAGE
HALL, ENCODER,
ANALOG INPUT
INSULATION
SUPPLY INPUT
OPTIONAL ZIGBEE
MODULE
LINEAR REGULATOR FOR 5V SUPPLY
RX23T YROTATE-IT-RX23T Motor Control Kit
UM-YROTATE-IT-RX23T Rev. 1.0 Page 6 of 83
October 6, 2015
RX23T YROTATE-IT-RX23T Motor Control Kit
UM-YROTATE-IT-RX23T Rev. 1.0 Page 7 of 83
October 6, 2015
EXTERNAL POWER SUPPLY
CONNECTORS
USB CONNECTOR
EXTERNAL POWER
STAGE CONNECTOR
MOTOR CONNECTOR
HALL
CONNECTOR
E1 CONNECTOR
ENCODER CONNECTOR
ANALOG INPUT CONNECTOR
PMODE
CONNECTOR
CONNECTOR FOR
ICS OSCILLOSCOPE
2. Connectors description
As in the following figure, you can find the position and the description of the connectors present on the board. Please
refer to the board schematics for the full description of the connectors.
The E1 connector is used for the programming and the debugging of the software running on the RX23T. It can be
connected either to the E2studio and the CS+ development environments.
The external power stage connector is compatible with the power stages, designed for Renesas inverter kits, which
are able, the first one to drive 230V
AC
motor up to 1.5KW, and the second one up to 60V
DC
, 60A
DC
. The schematics and
Gerber file of the power stage are available on the website: www.renesas.eu/motorcontrol
RX23T YROTATE-IT-RX23T Motor Control Kit
UM-YROTATE-IT-RX23T Rev. 1.0 Page 8 of 83
October 6, 2015
3. Power supply selection
As stated before, there are two ways to supply power to the board.
1. The first possibility is to use directly the PC USB supply. In this case the current you can give to the motor is
limited by the USB current capabilities.
2. The second possibility is to use an external voltage DC source to supply the board.
The recommended power supply voltage is between 20V
DC
to 48V
DC
. In this case the communication stage is insulated
from the inverter. The selection between the two possibilities is made through two jumpers: JP1 and JP2. Please find
below the description:
7
7
7
7
7
7
7
7
JP2
JP
1
1
1
3
3
4
4
6
6
PC USB SUPPLY SELECTION
7
7
7
7
7
7
7
7
JP2
JP
1
1
1
3
3
4
4
6
6
EXTERNAL SUPPLY SELECTION
JP1, JP2
RX23T YROTATE-IT-RX23T Motor Control Kit
UM-YROTATE-IT-RX23T Rev. 1.0 Page 9 of 83
October 6, 2015
1) The first jumper configuration connects the USB ground to the inverter ground and the output of the step-up
converter to the inverter DC link.
Please notice that in this case there is no galvanic insulation between the device connected to the USB and
the board.
2) The second jumper configuration connects the external power supply ground to the inverter ground and the
external + V
DC
to the inverter DC link.
Please find below the configuration of the RX23T kit using the internal MOSFETs power stage.
Please find below the configuration of the RX23T kit connected to the external 1.5KW, 230V
AC
power stage.
Power stage jumper JP1: correct
position
Microcontroller board + external power stage board:
Power supply +24V
DC
from J4 or J5 of the power stage
RX23T YROTATE-IT-RX23T Motor Control Kit
UM-YROTATE-IT-RX23T Rev. 1.0 Page 10 of 83
October 6, 2015
4. LEDs functions description
Some of the LEDs available on the board are directly connected to the hardware and allow the user to understand the
status of the board. Please refer to the LED map for the following indications:
DL4 is connected to the output of the 15V step-down DC-DC converter and indicates the presence of the
switches drive supply;
DL5 is connected to the output of the 5V linear converter and indicates the presence of the 5V logic power
supply.
Other LEDs in the board are driven via software, in particular:
DL1 is the USB communication indicator and blinks when there are data exchanges between the PC and the
board.
DL2 is blinking slowly if the control section of the RX23T microcontroller is running normally. In case of
hardware or software alarms, the LED DL3 is blinking quickly.
DL3 is free for the user and in the default software it is ON when the main control interrupt is active. It give to
the user a quick and simple way to measure the timing of the control loop of the algorithm.
DL5
DL1
DL3
DL4
DL2
RX23T YROTATE-IT-RX23T Motor Control Kit
UM-YROTATE-IT-RX23T Rev. 1.0 Page 11 of 83
October 6, 2015
5. Test points for debugging
Several specific test points are available on the board to visualize with the oscilloscope the behaviour of some internal
analog signals.
Furthermore, it is possible to visualize internal variables as analog waveforms using filtered PWM outputs. Finally, it
is very useful during the tuning process for adapting the software to a new motor to use the test points.
Please find below the description of the test points:
TP13, TP14: are connected to the two USB communication signals, for debug purposes. Please refer
to the board schematics for more details.
TP4, TP5, and TP6: they are connected to the three inverter outputs (sources of the higher switches)
TP7, TP8, and TP9: they are connected to the sources of the lower switches of the inverter
TP1, TP3, TP12, TP15, TP16: they are connected to some microcontroller ports
TP17, TP18, TP19 are connected to the board GND
TP10, TP11 are two filtered PWM outputs which can be used to visualize the behaviour of internal
variables
TP2 not used
TP9, TP8, TP7
TP6, TP5, TP4
TP2
TP18, TP17, TP12, TP1, TP3
TP19, TP10, TP11, TP15,
TP16
TP13, TP14
RX23T YROTATE-IT-RX23T Motor Control Kit
UM-YROTATE-IT-RX23T Rev. 1.0 Page 12 of 83
October 6, 2015
6. Internal power stage description
The power stage is a complete 3-phase bridge composed with discrete low voltage and high current MOSFETs. The
MOSFETs are the Renesas RJK0654DPB n-channel power MOSFETs. Please refer to the data-sheet available on the
Renesas website: www.renesas.eu for the switches characteristics and to the board schematics for the details on the
driving circuit. The maximum current is 30A, and the maximum voltage is 60V
DC
.
The inverter has the classical schema with the three shunts on the lower arms, with the possibility to use a single shunt
by removing two of them.
CURRENT READING
SHUNTS
3 PHASES BRIDGE
RX23T YROTATE-IT-RX23T Motor Control Kit
UM-YROTATE-IT-RX23T Rev. 1.0 Page 13 of 83
October 6, 2015
Please find below the schematics extract showing the draying in mode details.
Furthermore, the three driving circuits for the six low voltage MOSFETS RJK0654DPB are described below.
Furthermore, the signals from the gate driver circuits called “PUL, PVL, PWL” are used to manage the risk of over-
current in the board. The signals are directly linked to the RX23T Microcontroller module called the Port Output
Enable (e.g. POE) to stop the PWM signal in hardware and protect the 3-phase power stage.
In case of over-current, the POE module will set in hardware the six PWM signals in high impedance mode to ensure
safe-fail mechanism. Please find below the extract of the schematics regarding the over-current management.
RX23T YROTATE-IT-RX23T Motor Control Kit
UM-YROTATE-IT-RX23T Rev. 1.0 Page 14 of 83
October 6, 2015
7. Current reading methods selection
As shown in the following figure, some jumpers are placed on the board (see schematics): JP7, JP17, JP18, JP8, JP19,
JP20, JP9, JP21 and JP22. The jumpers allows the reading of the motor current by using external operational
amplifiers or internal one as shown here below:
Configuration 1: external op. amp.: JP7, JP8, JP8 closed, JP17, JP18, JP19, JP20, JP21, JP22 open
Configuration 2: internal op. amp.: JP7, JP8, JP8 open, JP17, JP18, JP19, JP20, JP21, JP22 closed
NOTE: the RX23T microcontroller family is not equipped with internal operational amplifiers. But the RX24T family
is equipped with on-chip Op-amp, also called Programmable Gain Amplifier (PGA).
Please find below more details about the circuit used to read the current flowing through the shunts.
MOTOR CURRENT
MEASUREMENT JUMPERS:
JP7, JP17, JP18
JP8, JP19, JP20
JP9, JP21, JP22
RX23T YROTATE-IT-RX23T Motor Control Kit
UM-YROTATE-IT-RX23T Rev. 1.0 Page 15 of 83
October 6, 2015
In case of 3-phase Brushless motors that need to be
driven in sensorless block commutation mode, the RX23T
kit integrates the possibility to manage the motor phases
voltage.
These are measured for the back EMF signals detection
using the A/D inputs: AN100 to AN102.
Please find on the right the detailed schematics made for
the phase voltages reading.
RX23T YROTATE-IT-RX23T Motor Control Kit
UM-YROTATE-IT-RX23T Rev. 1.0 Page 16 of 83
October 6, 2015
8. Interface to an external power stage
Since internal power stage allows only the management of low voltage motors, an interface with an external power
stage has been developed.
The selection between the internal power stage and the external power stages is ensured by jumpers. It is a safe way
to ensure that the right voltage and current signals are active. When the external power stage is connected to the kit,
it is by default the active one. So the microcontroller pins are directly connected to the external power stage
connector.
In this case the internal power stage should be disconnected, and this must be done by disconnecting the appropriate
jumpers
.
Please find below the jumpers description.
JP10: if closed, then the internal power stage DC Bus voltage is connected to the opportune A/D converter pin.
JP7, JP8, and JP9: if closed, then the internal power stage currents measurements (U, V, W) are connected to
the opportune A/D converter pins.
JP11 to JP16: if closed then the inverter driving signals are connected to the internal power stage drivers.
JP6: it allows the following selection:
POWER SUPPLY
SELECTION: JP6
INVERTER DRIVING
SIGNALS: JP11 TO 16
VBUS MEASUREMENT
SIGNALS: JP10
RX23T YROTATE-IT-RX23T Motor Control Kit
UM-YROTATE-IT-RX23T Rev. 1.0 Page 17 of 83
October 6, 2015
o if pins 1 and 2 are shorted, then the external power stage low voltage supply (between 15V to 24V) is
connected to the internal DC Bus Voltage; in this case both the step-down converters of the board will
work;
o If pins 2 and 3 are shorted, then the external power stage low voltage supply cannot be used to supply
the board.
Please be careful to take into account the following precautions:
1. Please avoid to connect both the external power stage connector (J6) and to close the jumpers JP6 to JP16: this
would produce short circuits between signals coming from different sources.
2. In JP6, chose the configuration with the pins 1 and 2 shorted, when external power supply board is used.
Please find below the drawing of the interface connector.
For a comparison, find below the drawing of the corresponding connector in the 1.5KW, 230V
AC
external power stage
(E6108A).
If using a different external power stage, please keep present the following notes:
a) The PWM drive signals are directly connected to the microcontroller output pins, and there is no pull-up or
pull-down resistor connected, so the polarization has to be done in the power stage. In case of alarm, the
microcontroller output pins can be placed in high impedance state, so the external polarization is necessary.
These output commands are logic level signals, with limited current output capability, so an external driver is
probably required. A further line is connected to the microcontroller: it is the external alarm signal, connected
to the POE input pin; this pin is polarized with a 10K pull-up toward the logic supply.
RX23T YROTATE-IT-RX23T Motor Control Kit
UM-YROTATE-IT-RX23T Rev. 1.0 Page 18 of 83
October 6, 2015
b) The analog measurement signals from power stage, in particular the current readings and the DC link voltage
reading are clamped (with diodes from logic GND and to logic V
cc
) and weakly filtered, then directly connected
to the A/D converter input pins of the microcontroller, so the external power stage has to take care of the gain
and the offset of these signals.
c) The ground connection is always active, and it represents the reference for all the interface signals.
In the next figure a simple example regarding how the power board connections have to be arranged, is presented.
In this schema it is supposed that the power board has its own supply for the power module (+15V); +15 to +24V supply
from power board is also used to supply the microcontroller (thanks to jumper JP6 in microcontroller board).
Please refer to the complete schematics for further details that are available on the website:
www.renesas.eu/motorcontrol.
Two power stages are currently available under request, were successfully tested with the YROTATE-IT-RX23T kit.
On the left hand side, the power stage can manage 300V
DC
for 20A and the right hand side 60V
DC
for 100A.
RX23T YROTATE-IT-RX23T Motor Control Kit
UM-YROTATE-IT-RX23T Rev. 1.0 Page 19 of 83
October 6, 2015
+VBUS
+5V
Intelligent
Power
Module OUT V
OUT W
PWGND
UL
VL
WL
UH
VH
WH
ALRM
GND
VCC VBUS
OUT U
+15V
1
2
3
4
5
6
7
8
9
10
11
12
13 14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
MOTOR
1
2
3
+5V
Current
Sensor
+5V
Current
Sensor
+5V
Current
Sensor
THERMAL SENSOR
+15V
RX23T YROTATE-IT-RX23T Motor Control Kit
UM-YROTATE-IT-RX23T Rev. 1.0 Page 20 of 83
October 6, 2015
9. Single shunt current reading
While the normal configuration of the board and the standard software are based on three shunts current reading,
we also offer the possibility to configure the board for single shunt current reading.
Some hardware modifications are required and a different software version has to be program into the RX23T flash
memory.
The required hardware modifications are the following (please refer to the board schematics):
Remove from the board the shunts R90 and R96 (they are the shunts related to the phases U and W)
Close the soldering points PS1 and PS2 (those soldering points put the three inverter harms in common, below
the lower switches and above the shunts)
Remove the capacitors C70, C72, C85, it speeds up the current reading circuit
The components involved in the modifications are indicated in the figure below.
R96, R90
C72, C70, C85
PS2, PS1
RX23T YROTATE-IT-RX23T Motor Control Kit
UM-YROTATE-IT-RX23T Rev. 1.0 Page 21 of 83
October 6, 2015
10. Current reading timing in three shunts and single shunt configurations
The figures below show the different situations related to the two configurations. The first figure is related to three
shunts current reading, the other are related to the single shunt current reading.
Three shunts configuration
In the three shunts configuration the current in one shunt is equal to the corresponding phase current when the
corresponding lower switch is ON.
The most suitable moment to read the current in this configuration is at the trough of the PWM.
By default the YROTATE-IT-RX23T kit is delivered in the three shunts configuration.
Single shunt configuration
In the single shunt configuration, only when one or two of the lower switches are ON the current through the shunt is
related with the phase current.
When only one of the lower switches is ON, the current in the shunt is equal to the current of the corresponding
inverter phase.
When two of the lower switches are ON, the current in the shunt is equal to the sum of the currents of the
corresponding phases that is it is minus the current of the third phase.
Important Note:
The software project available on the website: www.renesas.eu/motorcontrol is designed under e²studio environment
and only for three shunts configuration. An additional version is available under the CubeSuite CS+ Environment.
The three shunts software project designed under for e²studio is called: “YRotateItRX23T_3s_V1.zip”
RX23T YROTATE-IT-RX23T Motor Control Kit
UM-YROTATE-IT-RX23T Rev. 1.0 Page 22 of 83
October 6, 2015
Furthermore, the circuit below is used to measure in real-time the motor currents flowing through the shunts
resistors. In the Bill of Material, the shunt are called R
90
, R
93
, R
96
as described on the page 7 of the schematics.
The default value is R
90
= R
93
= R
96
= 100m
The amplifier circuit is made to manage up to 5A flowing through the shunts and the output of the amplifier is
connected directly to the Microcontroller RX23T.
Please find below the equations related to the amplifier circuit that are useful to change the range of currents to be
measured through the three shunts.
If R100 = R137 = R136 = R99 and R97 = R96, then the amplification of the circuit is (R100/2)/R97 = 5/1 = 5.
So the output voltage (V
out
to MCU) is :
V
out
= 2.5V V
shunt
x (R100/2)/R97 , and V
shunt
= R
shunt
x I
shunt
So
V
out
= 2.5V (R
shunt
x I
shunt
) x (R100/2)/R97
And the term
Delta_V = (R
shunt
x I
shunt
) x (R100/2)/R97
It is mandatory to keep between -2.5V and 2.5V with some margin (margin of 0.3V could be enough) so:
-2.2V < Delta_V < 2.2V
So the maximum current will be:
I
shunt max dc
= 2.2V / (R
shunt
x (R100/2)/R97)
Vout to MCU
I
Shunt
V
Shunt
JP’s must be open
10K
10K 10K
10K
0R
RX23T YROTATE-IT-RX23T Motor Control Kit
UM-YROTATE-IT-RX23T Rev. 1.0 Page 23 of 83
October 6, 2015
The default values are the following:
R
shunt
= 0.1ohm, R100 = 10K, R97 = 1K , so I
shunt max dc
= 4.4Adc
To manage different values it is enough to change R
shunt
R100 and R97 but it is important to keep the following
conditions:
R100 = R137 = R136 = R99
R96 = R97
Finally, the shunt resistor value needs to be updated in the software itself in the file called: “pws_E6132.h ” as shown
below:
RX23T YROTATE-IT-RX23T Motor Control Kit
UM-YROTATE-IT-RX23T Rev. 1.0 Page 24 of 83
October 6, 2015
11. Website material: www.renesas.eu/motorcontrol
The complete kit material is available on-line at the address: www.renesas.eu/motorcontrol
The latest updates of the downloadable material for the YROTATE-IT-RX23T kit is listed below:
Items Description of Resources
Auto-tuning Video-Tutorial Short video explaining how to easily tune any Brushless AC
motor in 45 seconds using just the intuitive PC Graphical User
Interface
Drivers
Drivers and setup files for the PC Graphical User Interface
YROTATE-IT-RX23T Drivers
Embedded Software
Source files for code flashed by default into the Renesas
microcontroller
Royalty-Free software
e²Studio Source Code
CubeSuite CCS+ Source Code
Manuals
Relevant documentation for the kit, the motor and the
microcontroller, the MOSFETs.
Languages: English, Japanese, Korean, Chinese
Kit Motor Specifications
Renesas Datasheets
Tuned Motors Specifications
Schematics-Gerber-BoM
Schematics, Gerber files of Bill of Materials for both the main
kit and the two external power stages
(not included as part of
the kit)
External Power Stages
Main Board
RX23T YROTATE-IT-RX23T Motor Control Kit
UM-YROTATE-IT-RX23T Rev. 1.0 Page 25 of 83
October 6, 2015
12. Microcontroller RX23T short overview
The RX23T Group is 32-bit microcontroller and suited for single inverter control and has a built-in FPU (floating-point
processing unit) that enables it to easily program complex inverter control algorithms. This helps to greatly reduce the
man-hours required for software development and maintenance. Furthermore, thanks to the RX200 core the current
consumed in software standby mode with RAM retention is a mere 0.45μA. RX23T MCUs operate in a broad voltage
range from 2.7 V to 5.5 V, which is useful for inverter control, and are highly compatible with the RX62T Group at the
pin arrangement and software level.
The main specifications of the RX23T microcontrollers are as follows:
Item RX23T Group
CPU core
RX CPU v2 core
running at 40MHz
, delivering 2DMIPs/MHz
General registers: 32-bit x 16, 32-bit multiplier & Divider
Two types of Multiply-accumulator memory-to-memory operations and register-
to-register operations
Power supply voltage 2.7 to 5.5V
Floating-point operation unit Single-precision floating-point operation unit
Flash / RAM memory Max.128 KB / 10KB
On-chip peripheral
functions
Transfer
Data transfer controller (DTCa)
Timers
Multi
-
function timer pulse unit 3: 16
-
bit x 6 channels (MTU3c)
Port output enable 3 (POE3b)
8-bit timer (TMR): 8-bit x 2 channels x 2 units
Compare match timer (CMT): 16-bit x 2 channels x 2 units
Communications
Serial communications interface (SCIg): 2 channels
I2C bus interface (RIICa): 1 channel
Serial peripheral interface (RSPIa): 1 channel
Analog
12
-
bit A/D converter (S12ADE): 10 channels
Comparator C (CMPC): 3 channels
D/A converter for generating ref. voltage for comparator C (DA)
Safety
Clock frequency accuracy measurement circuit (CAC)
Data operation circuit (DOC)
14-bit independent watchdog timer (IWDTa)
A/D converter self-diagnostic/open-circuit detection function
CRC calculator (CRC)
Register write protection
Clock generation
circuit
Main clock oscillator
Low-speed on-chip oscillator (LOCO)
PLL frequency synthesizer
Dedicated on-chip oscillator for the IWDT
Other
Multi
-
function pin controller (MPC)
Power-on reset circuit (POR)
Voltage detection circuit (LVDAb)
Packages PLQP0048KB-A(48-pin,LFQFP,77mm0.5mm pitch
PLQP0052JA-A(52-pin,LQFP,1010mm0.65mm pitch
PLQP0064KB-A(64-pin,LFQFP,1010mm0.5mm pitch)
RX23T YROTATE-IT-RX23T Motor Control Kit
UM-YROTATE-IT-RX23T Rev. 1.0 Page 26 of 83
October 6, 2015
Please find below the RX23T microcontroller block diagram.
Please find below the memory line-up including the part-names.
RX23T YROTATE-IT-RX23T Motor Control Kit
UM-YROTATE-IT-RX23T Rev. 1.0 Page 27 of 83
October 6, 2015
13. Permanent Magnets Brushless Motor model
The synchronous permanent magnets motor (sinusoidal brushless motor) is widely used in the industry. More and
more home appliance makers are now using such brushless motor, mainly because of the intrinsic motor efficiency.
The permanent magnet motor is made with few components:
1. A stator formed by stacking sheared metal plates where internally the copper wiring is wound, constructing
the stator winding
2. A rotor in which permanent magnets are fixed
3. Two covers with ball bearings that keep together the stator and the rotor; the rotor is free to rotate inside the
stator
The working principle is quite simple: if we supply the motor with a three-phase system of sinusoidal voltages, at
constant frequency, in the stator windings flow sinusoidal currents, which create a rotating magnetic field.
The permanent magnets in the rotor tend to stay aligned with the rotating field, so the rotor rotates at synchronous
speed.
The main challenge in driving this type of motor is to know the rotor position in real-time, so mainly implementation
are using a position sensor or a speed sensor.
In our implementation, the system is using either one or three shunts to detect the rotor position in real-time.
Let’s analyse the motor from a mathematic point of view.
If we apply three voltages v
a
(t), v
b
(t), v
c
(t) to the stator windings, the relations between phase voltages and currents
are:
+
+
+
va
vb
vc
ia
ic
ib
“a” winding
How current flows
into “a” winding
“a” winding
magnetic axis
“b” winding
“c” winding
Motor axis
(shaft)
RX23T YROTATE-IT-RX23T Motor Control Kit
UM-YROTATE-IT-RX23T Rev. 1.0 Page 28 of 83
October 6, 2015
dt
d
iRv
dt
d
iRv
dt
d
iRv
c
cSc
b
bSb
a
aSa
λ
λ
λ
+=
+=
+=
- λ
i
is the magnetic flux linkage with the i-th stator winding
- R
S
is the stator phase resistance (the resistance of one of the stator windings)
The magnetic flux linkages λ
i
are composed by two items, one due to the stator currents, one to the permanent
magnets.
The permanent magnet creates a magnetic field that is constant in amplitude and fixed in position in respect to the
rotor. This magnetic field can be represented by vector Λ
m
whose position in respect to the stator is determined by
the angle ϑ between the vector direction and the stator reference frame.
The contribution of the permanent magnets in the flux linkages depends on the relative position of the rotor and the
stator represented by the mechanical-electric angle ϑ.
ϑ
Λ
m
a
a’
b
c
c’
b’
a axis
b axis
c axis
Real axes (a, b, c) and equivalent ones (
α
,
β
); a fixed amplitude vector can be completely determined by its
position respect the (α, β) system (angle ϑ)
α
α
α
axis
β
β
β
axis
RX23T YROTATE-IT-RX23T Motor Control Kit
UM-YROTATE-IT-RX23T Rev. 1.0 Page 29 of 83
October 6, 2015
It is, in every axis, the projection of the constant flux vector Λ
m
in the direction of the axis:
)
3
4
cos(
)
3
2
cos(
)cos(
π
ϑλ
π
ϑλ
ϑ
λ
Λ+=
Λ+=
Λ
+
=
mcc
mbb
maa
Li
Li
Li
Supposing that the rotor is rotating at constant speed ω (that is: ϑ(t) = ωt) the flux linkages derivatives can be
calculated, and we obtain:
)
3
4
sin(
)
3
2
sin(
)sin(
π
ϑω
π
ϑω
ϑω
Λ+=
Λ+=
Λ+=
m
b
bSc
m
b
bSb
m
a
aSa
dt
di
LiRv
dt
di
LiRv
dt
di
LiRv
A “three phases system” may be represented by an equivalent “two phases system”. So the by using specific
transformations, our three equations system is equivalent to a two equations system. It is basically a mathematical
representation in a new reference coordinates system.
In the two phases (α,β) fixed system the above equations become:
dt
d
iRv
dt
d
iRv
S
S
β
ββ
α
αα
λ
λ
+=
+=
For the magnetic field equations, we got:
)sin(
)cos(
ϑλλ
ϑ
λ
λ
ββββ
αααα
mm
mm
LiLi
LiLi Λ+=+=
Λ
+
=
+
=
After performing the derivation:
mm
mm
dt
di
L
dt
di
L
dt
ddt
di
L
dt
di
L
dt
d
α
βββ
β
ααα
ωλϑω
λ
ωλϑω
λ
+=Λ+=
=Λ=
)cos(
)sin(
Finally, we obtain for the voltages in (α,β) system:
RX23T YROTATE-IT-RX23T Motor Control Kit
UM-YROTATE-IT-RX23T Rev. 1.0 Page 30 of 83
October 6, 2015
mS
mS
dt
di
LiRv
dt
di
LiRv
α
β
ββ
β
α
αα
ωλ
ωλ
++=
+=
A second reference frame is used to represent the equations as the frame is turning at the rotor speed. So the “d” axis
is chosen in the direction of the magnetic vector Λ
m
, and with the “q axis orthogonal to the “d” axis. The new
reference system is (d, q).
The reference frame transformations from the (α,β) system to the (d, q) system depends on the instantaneous position
angle ϑ
So we obtain two inter-dependant equations in the (d, q) system:
md
q
qSq
q
d
dSd
Li
dt
di
LiRv
Li
dt
di
LiRv
Λ+++=
+=
ωω
ω
These two equations represent the mathematical motor model.
A control algorithm which wants to produce determined currents in the (d, q) system must impose voltages given from
the formulas above.
This is ensured by closed loop PI control on both axis “d” & “q” (Proportional Integral).
Since there is a mutual influence between the two axes, decoupling terms can be used.
In the block scheme the mechanic part is included, where “p” is the number of pole pairs, while “B” represents friction,
“J” the inertia, “τ
load
“ the load torque and “τ the motor torque.
1/(R+sL)
1/(R+sL) (3/2)p
Λ
1/(B+sJ)
τ
load
p
Λ
pL
V
d
V
q
+
-
+
- -
+
ω
mec
I
d
I
q
τ
+
L
ω
e
Λω
e
RX23T YROTATE-IT-RX23T Motor Control Kit
UM-YROTATE-IT-RX23T Rev. 1.0 Page 31 of 83
October 6, 2015
Λ××= p
2
3
τ
The angular speed ω is represented in the scheme as ω
e
to distinguish the electrical speed from the mechanical one.
Let’s now consider the equations we have seen in (α,β) system:
dt
d
iRv
dt
d
iRv
S
S
β
ββ
α
αα
λ
λ
+=
+=
These equations show that magnetic flux can be obtained from applied voltages and measured currents simply by
integration:
diRv
dtiRv
S
t
S
t
)(
)(
0
0
0
0
ββββ
αααα
λλ
λλ
+=
+=
Furthermore:
ββ
αα
λϑ
λ
ϑ
Li
Li
m
m
=Λ
=
Λ
)sin(
)cos(
If the synchronous inductance L is small, the current terms can be neglected, if not they have to be considered. In
general:
ββββββ
αααααα
λλϑ
λλϑ
LidtiRvLiy
LidtiRvLix
S
t
m
S
t
m
+==Λ=
+==Λ=
)()sin(
)()cos(
0
0
0
0
So in the (α,β) system phase we obtain from the flux components:
)arctan( y
x
=
ϑ
The system speed ω can be obtained as the derivative of the angle ϑ.
)(t
dt
d
ϑω
=
Based on this, a sensorless control algorithm was developed to give the imposed phase voltages, to measure phase
currents, to estimate the angular position ϑ and finally the system speed.
RX23T YROTATE-IT-RX23T Motor Control Kit
UM-YROTATE-IT-RX23T Rev. 1.0 Page 32 of 83
October 6, 2015
14. Sensorless Field Oriented Control algorithm
Please, find below the sensorless vector control algorithm block diagram.
The main difference between the three shunts configuration and the single shunt one is in the “Current Reading”
block, the rest of the algorithm remains the same in principle, even if the blocks order has been adjusted.
z-1
z-1 z-1 z-1
0 [Idref]
Id PI
Iq PI
Speed PI
ωref
Speed
estimation
Flux Phase
estimation
PWM
Modulation
(u, v, w) →
(α, β)
(α, β) →
(d, q)
(d, q) →
(α, β)
(α, β) →
(u, v, w) Motor
Current
Reading (z-1)
z-1
+
-
+
-
+
-
Vd
Vq
I
α
mea
I
β
mea
Iu
mea
Iv
mea
Id
mea
Iq
mea
ϑ
est
ω
est
Iq
ref
V
α
V
β
RX23T YROTATE-IT-RX23T Motor Control Kit
UM-YROTATE-IT-RX23T Rev. 1.0 Page 33 of 83
October 6, 2015
15. Software Tools used
15.1 IDE and e2sudio Tool Chain used
The embedded software delivered in the YROTATE-IT-RX23T kit is developed under e²studio integrated development
tool. Please find below the details of the IDE used.
The software was designed under e2studio Version: 4.0.2.008. Furthermore the e2studio IDE is based on Eclipse SDK
4.4.2 (Luna SR2) and CDT version 8.6.0.
The Renesas RXC Toolchain, version v2.03.00 is used. The compiler used is the “Renesas CCRX”. The Optimisation level
is “Max” and the optimization type is “Speed”, as visible on the picture below.
The device selected in the program is: R5F523T5AxFM, it means the RX23T with 128KB flash, 10KB RAM in a 64-pin
package. The Instruction Set Architecture selected must be “RXv2 Architecture” to ensure that the microcontroller is
delivering 80DMIPS at 40MHz CPU clock.
Finally, the Data endian selected is “little-endian data”.
RX23T YROTATE-IT-RX23T Motor Control Kit
UM-YROTATE-IT-RX23T Rev. 1.0 Page 34 of 83
October 6, 2015
Please find below the list of options for the compiler:
15.2 Project importation into e²studio
Launch de debugger by clicking on “Debug configuration” and the window below will appear:
RX23T YROTATE-IT-RX23T Motor Control Kit
UM-YROTATE-IT-RX23T Rev. 1.0 Page 35 of 83
October 6, 2015
After connection the E1 debugger to the target board powered by USB or external power supply, please click on
“Debug” to start the debugging and load the program into the microcontroller flash memory. The windows below
appears:
RX23T YROTATE-IT-RX23T Motor Control Kit
UM-YROTATE-IT-RX23T Rev. 1.0 Page 36 of 83
October 6, 2015
The program is loaded after clicking twice on the green button “Resumeto load and run the program. The window
below appears once the program is running from the MCU itself. The E1 debugger can be removed to run the software
on its own.
In the debugger, it’s also possible to display the measured speed as shown below.
RX23T YROTATE-IT-RX23T Motor Control Kit
UM-YROTATE-IT-RX23T Rev. 1.0 Page 37 of 83
October 6, 2015
16. Software description and Resources used
The software delivered in the YROTATE-IT-RX23T kit, previously described, is working on the RX23T microcontroller
clocked at 40MHz and its operating voltage is 5V which guarantee a high noise immunity.
Using the interrupt skipping function it is possible to regulate separately the PWM frequency (Pulse Width Modulation)
and the sampling frequency also called control loop frequency. For instance, if the PWM frequency is set to 16KHz and
the control loop is set to 8KHz, so the ratio is 2 which means that the full vector control algorithm is processed every
two PWM cycles.
Finally the main interrupt is called every 100µs which leaves enough time to perform the sensorless vector control
algorithm and the system control if needed.
Please find below detailed information related to the software blocks of the motor control embedded software:
The complete software uses the resources below in the three shunts configuration. It includes the serial
communication interface, the board management, the LED management, the EEPROM management, the auto-tuning
algorithm and self-identification and of course the complete sensorless vector control algorithm.
FLASH memory usage: 24KB and RAM memory usage: 3KB
The embedded software package is called “YRotateItRX23T_3s_VX.zip” running under e2studio environment.
The same source code is ported under CS+ (e.g. CubeSuite) environment and the software package is called:
“YRotateItRX23T_VX_E2CS+.zip”.
The control loop of the field oriented control algorithm (e.g. sampling frequency) is set to 8KHz by default. The Pulse
Width Modulation (PWM) frequency is set by default to 16KHz. The parameters are visible in the module name
“customize.h”.
The parameter “SAM_FRE_DEF” is the sampling frequency in Hertz and is set to 8000 (e.g. 8KHz).
The parameter “F_RATIO_DEF is the ratio between the sampling frequency and the PWM and is set to 2, so it
means 2 x 8000 = 16000 Hz (16KHz).
Such parameters can be modify dynamically using the PC GUI without recompiling the overall project changing the
parameters below and resetting the board. The PC GUI provide a direct access to the parameters below.
RX23T YROTATE-IT-RX23T Motor Control Kit
UM-YROTATE-IT-RX23T Rev. 1.0 Page 38 of 83
October 6, 2015
19
SAM_FRE_DEF
Set the sampling frequency [Hz] of the control loop
20
F_RATIO_DEF
Set the ratio between the PWM frequency and sampling frequency, e.g. if 8000 is set in the
parameter #19 and 2 in the parameter #20, the PWM frequency is 16KHz.
The parameter #19 is setting the control loop speed. By default, 8KHz is selected by entering the value “8000”.
The PWM frequency can be set to four different values depending on the motor and the applications either 8KHz,
16KHz, 24KHz or 32KHz by entering either 1, 2, 3, 4 as ratio between the two frequencies.
As the sampling period is 125µs (8KHz), and the control loop for the inverter control takes maximum of 50µs, the
CPU load of the motor control algorithm with all the option enable is: 50/125 = 40%. The CPU clock is running at
40MHz.
It leaves 60% of the CPU to perform additional tasks, like board management, system control, display, etc.
Please find below more details information regarding the timing of the control loop according to the selected options:
Option
Development
Version
Mass
Production
Communication management
Enable
Enable
EEPROM management
Enable
Disable
PI current auto
-
tuning
Enable
Disable
Motor self
-
identification
Enable
Disable
Oscilloscope window
Enable
Disable
Internal Variables debug
Enable
Disable
Control loop Timing
50µs
40µs
CPU load [8KHz
sampling frequency]
40%
32%
CPU load [14KHz sampling frequency]
70%
55%
Furthermore, the execution time of the motor control interrupt including all the, the Speed PI block, the Current PI
block and the complete vector control algorithm and the auto-calibration mechanisms: is 50µs with
The default development tools used is the e²studio tool chain: RX Family C/C++ Compiler.
The following flowcharts show the software implementation of the motor control part of the software.
Please fin below the flowchart for the main loop, the interrupt service routines and the Automatic Tuning.
RX23T YROTATE-IT-RX23T Motor Control Kit
UM-YROTATE-IT-RX23T Rev. 1.0 Page 39 of 83
October 6, 2015
PWM Interrupt
Interrupt enabling
Hardware and software
initialization
Embedded Software organization
10ms Main loop
RX23T YROTATE-IT-RX23T Motor Control Kit
UM-YROTATE-IT-RX23T Rev. 1.0 Page 40 of 83
October 6, 2015
EEPROM
parameters upload
A/D channels offset reading
Peripherals initialization
Variables initialization
cnt_int == 0 ?
NO
YES
cnt_int = NUM_INT
Main loop synchronization
Main loop body
Speed ramp management
Communication
management
General board management
Parameters modification management
Main Program
Interrupt enabling
RX23T YROTATE-IT-RX23T Motor Control Kit
UM-YROTATE-IT-RX23T Rev. 1.0 Page 41 of 83
October 6, 2015
Phase currents (iu
mea
, iv
mea
) reading
Transformations (using the phase angle ϑ):
(iumea, ivmea) → (iamea, ibmea) → (idmea, iqmea)
Read DC Link voltage vbus
Control Interrupt in
three shunts current
reading mode
Current PI controls use (id
ref
, iq
ref
), (id
mea
,iq
mea
) to produce (vd
out
, vq
out
)
Transformations (using the phase angle ϑ):
(vdout, vqout) → (vaout, vbout) → (vuout, vvout)
PWM output commands generation (using vuout, vvout)
vbus is used to calculate maximum phase voltage (used in current PI controls)
Phase estimation based on old_va
out
, old_vb
out
, ia
mea
, ib
mea
,
produces new estimated phase angle ϑest
Voltage memories update: old_vaout = vaout, old_vbout = vbout
Speed estimation produces ωest
Estimation errors detection (if errors: alarm is set)
Start-up in progress?
NO
YES
idref = 0
Speed PI control uses (ωref, ωest) to get iqref
Start-up procedure produces idref, iqref,
ϑ
stup
Phase angle update: ϑ = ϑnew
ϑnew = ϑstup
ϑnew = ϑest
cnt_int > 0 ?
NO
YES
--cnt_int
Main loop
synchronization
RX23T YROTATE-IT-RX23T Motor Control Kit
UM-YROTATE-IT-RX23T Rev. 1.0 Page 42 of 83
October 6, 2015
The auto -tuning process and the self-identification mechanisms are fully independent from the main sensorless
vector control software and can be used in the 1
st
phases of evaluation and configuration of the software.
The three blocks mentioned above are located in the library called: “YRotateItRX23T_LIB_LE_V1.lib” located in the
folder called: “YRotateItRX23T_Library” as shown below:
Header file for the Math Library block
Header file for the Motor Self-identification
Header file for the PI Coefficients auto-tuning
Library file containing the three blocks above
RX23T YROTATE-IT-RX23T Motor Control Kit
UM-YROTATE-IT-RX23T Rev. 1.0 Page 43 of 83
October 6, 2015
The complete project source code under e2studio is described below. For each C module, a specific header file is
associated.
Please find below the important Header files included into the project folder.
RX23T YROTATE-IT-RX23T Motor Control Kit
UM-YROTATE-IT-RX23T Rev. 1.0 Page 44 of 83
October 6, 2015
17. Start-up procedure – Embedded software
When the motor is in stand-still, the phase of the permanent magnet flux vector cannot be detected with the used
algorithm. So an appropriate start-up procedure has to be applied.
The idea is to move the motor in feed-forward (with higher current than that required to win the load), till a speed at
which the estimation algorithm can work. Then the system can be aligned to the estimated phase, and the current can
be reduced to the strictly necessary quantity.
The following graph illustrates the strategy used (the suffix
ref
stands for reference, the suffix
mea
stands for
measured).
Referring to the graph, the start-up procedure (in case of three shunts current reading) is described below.
a) At the beginning t
0
, the system phase is unknown. No current is imposed to the motor; the system phase is
arbitrarily decided to be ϑ
a
=0. All the references: id
ref
, iq
ref
and speed
ref
are set to zero.
b) From the moment t
0
, while the iq
ref
and the speed
ref
are maintained to zero, id
ref
is increased with a ramp till
the value i
start
is reached at the moment t
1
.
The references are referred to an arbitrary (d
a
, q
a
) system based on the arbitrary phase ϑ
a
. From this moment, the
phase estimation algorithm begins to be performed, and the estimated phase ϑ
est
is used to calculate the components
of the measured current, referred to the (d, q) system based on the estimated phase, id
mea
and iq
mea
. The components
of the current referred to the arbitrary (d
a
, q
a
) system are controlled to follow the references by the current PI
controllers. On the other hand, since the phase ϑ
est
is still not correctly estimated, id
mea
and iq
mea
have no physical
meaning. Even if they are not shown in the graph, the applied voltages are subjected to the same treatment (vd
mea
and vq
mea
are calculated in the algorithm).
c) At t = t
1
, while iq
ref
is maintained to zero and id
ref
is maintained to its value i
start
, speed
ref
is increased with a
ramp till the value s
start
is reached at the t = t
2
. The system phase ϑ
a
(t) is obtained simply by integration of
speed
ref
; in the meanwhile, the phase estimation algorithm begins to align with the real system phase.
t1
t0
t2
t3
t
istart
sstart
id0
iq0
speedref
idref
iqref
idmea
RX23T YROTATE-IT-RX23T Motor Control Kit
UM-YROTATE-IT-RX23T Rev. 1.0 Page 45 of 83
October 6, 2015
Furthermore id
mea
and iq
mea
begin to be similar to the real flux and torque components of the current. The real
components are supposed to be id
0
and iq
0
(those values are obtained applying a low-pass filter to id
mea
and
iq
mea
).
The interval (t
2
-t
1
) is the start-up time, and it is supposed to be large enough to allow the estimation algorithm to reach
the complete alignment with the real phase of the system.
d) At t = t
2
, the phase estimation process is supposed to be aligned. At this point a reference system change is
performed: from the arbitrary (d
a
, q
a
) reference to the (d, q) reference based on the estimated phase ϑ
est
.
The current references are changed to the values id
0
and iq
0
, and all the PI controllers are initialized with these new
values. The speed PI integral memory is initialized with the value iq
0
, while the current PI integral memories are
initialized with the analogous voltage values vd
0
and vq
0
, obtained from vd
mea
and vq
mea
.
e) After t > t
2
, the normal control is performed, based on the estimated phase ϑ
est
; the speed reference is
increased with the classical ramp; the id current reference is decreased with a ramp, till it reaches the value
zero at the moment t
3
; then it is maintained to zero; the iq current reference is obtained as output of the
speed PI controller.
RX23T YROTATE-IT-RX23T Motor Control Kit
UM-YROTATE-IT-RX23T Rev. 1.0 Page 46 of 83
October 6, 2015
18. Reference system transformations in details
Find below the detailed equations used for the coordinates transformations in the embedded software for the RX23T
microcontroller.
)2(
3
1
)(
3
1
)
2
3
2
3
(
3
2
)
2
1
2
1
(
3
2
vuwvwv
awvu
ggggggg
ggggg
+===
==
β
α
(u, v, w) (α, β)
2/)3(
2
3
2
1
2/)3(
2
3
2
1
βαβα
βαβα
α
ggggg
ggggg
gg
w
v
u
==
+=+=
=
(α, β) (u, v, w)
)cos()sin(
)sin()cos(
ϑϑ
ϑ
ϑ
βα
βα
ggg
ggg
q
d
+=
+
=
(α, β) (d, q)
)cos()sin(
)sin()cos(
ϑϑ
ϑ
ϑ
β
α
qd
qd
ggg
ggg
+=
=
(d, q) (α, β)
+= += +=
)3/4cos(
)3/2cos(
)cos(
0
0
0
πϕω πϕω ϕω
tVv
tVv
tVv
w
v
u
+= += )sin(
)cos(
0
0
ϕω ϕω
β
α
tVv
tVv
=
=)sin(
)cos(
0
0
ϕ
ϕ
Vv
Vv
q
d
RX23T YROTATE-IT-RX23T Motor Control Kit
UM-YROTATE-IT-RX23T Rev. 1.0 Page 47 of 83
October 6, 2015
19. Rotor position estimation
The rotor position estimation method which has been chosen is the direct integration of the back EMF. Such method
is enable by default in the RX23T inverter kit.
Please find below the fundamental equations:
ββββββ
αααααα
λλϑ
λλϑ
LidtiRvLiy
LidtiRvLix
S
t
m
S
t
m
+==Λ=
+==Λ=
)()sin(
)()cos(
0
0
0
0
)arctan( y
x
=
ϑ
)(t
dt
d
ϑω
=
The challenges in this approach are the calculation of the integrals which is well known as a problematic issue in a
numeric context, and the choice of the initial conditions, which are not known in general. There are two possibilities
to overcome these difficulties:
1. To use a so-called “approximated integration”, which means that instead of using an integral (1/s), a special
transfer function is chosen, which is very similar to the integral in certain conditions.
2. To correct the result of the integration with a sort of feedback signal, obtained combining the estimated phase
with the real flux amplitude, known as a parameter of the system.
In the 1
st
case, we choose an integral approximation function which has a limited memory of the errors and with a
zero DC gain. The goal is to reject any low frequency component, preventing the result to diverge, and automatically
forgetting the errors (noise, etc.). This is obtained by combining a low-pass filter with a high-pass filter, as in the
following scheme:
First order low
-
pass
1/(s+ω0)
Derivative:
s
First order low
-
pass:
1/(s+ω0)
2
0
)(
)(
ω
+
=ss
sY
RX23T YROTATE-IT-RX23T Motor Control Kit
UM-YROTATE-IT-RX23T Rev. 1.0 Page 48 of 83
October 6, 2015
It is evident the relationship between Y(s) and the integral I(s)=1/s for s=jω, when ω>>ω
0
.
That’s why, a specific parameter related to the estimator can be tuned via the PC GUI. It is the parameter n°18 “App.
FE Time Constant” in “ms” which is the Filter time constant used in the approximate integration flux estimation
method. Please find below more technical details about it.
Regarding the Filter time constant, the BEMF integral is approximated with a function composed by two low pass
filters and a derivative. In discrete time domain, the expression for the low pass filter is:
y(n)=((k-1)/k)*y(n-1)+(1/k)*x(n)
Where (k*Tc) is the so called time constant of the filter and Tc is the sampling period
In the new software release for RX23T: the parameter to be specified is the time constant on the filter in ms, which is
much more flexible and also more immediate to understand.
In fact the cut-off frequency of the filter is directly:
1/(2*pi*time_const[s]) = 1000/(6.28*parameter_value[ms]).
Internally k is calculated as 1000*parameter_value[ms]/Tc, and the filter is implemented performing a division, so
there’s no restrictions on the value and the sampling frequency is now variable.
For example, if the parameter_value = 32, so the time_constant[s]=0,032 and the cutoff_freq=4,97Hz, internal
k=0,032*sampling_freq.
That’s why, at 8KHz, please find below some calculation about the possible values to be used to tune the estimators:
Para. 18 in ms
App. FE Time Constant
Cut
-
off Frequency
128
1.25Hz
64
2.5Hz
32
5Hz
16
10Hz
Obviously high values of the cut-off frequency produce poor behaviour at low speed and good behaviour at high
speed, and vice-versa.
RX23T YROTATE-IT-RX23T Motor Control Kit
UM-YROTATE-IT-RX23T Rev. 1.0 Page 49 of 83
October 6, 2015
In the 2
nd
case, to prevent the integral to diverge, and the errors related to wrong initial conditions are rejected, by
the correcting action of the feedback.
The block scheme of the exact BEMF integration method for flux position estimation is the following:
The inputs of the system are the imposed voltage vector V and the measured current vector I. The motor phase
resistance R
s
, the synchronous inductance L
s
and the permanent magnet flux amplitude λ
m
are known as parameters
and motor dependant.
The integral operation is corrected with a signal obtained modulating accordingly with the estimated phase the error
between the estimated flux amplitude and the amplitude of the permanent magnets flux.
The gain of this correction is indicated with G. It is this feedback which avoids the integral divergence due to the errors
or offsets. The higher G is, the higher is the relationship between the estimated amplitude and the theoretical one,
but the larger can be the induced phase error.
The choice of G is a trade-off, in order to guarantee that the integral remains close to its theoretical value, but free
enough to estimate the correct system phase.
In the default embedded software delivered on the YROTATE-IT-RX23T kit, this second strategy is selected. The choice
to test the first one is left to the user thanks to the setting of the macros in the source code. Such modifications
required a compilation of the embedded software. Within the software module “customize.h”, please uncomment the
define APP_INT to enable the approximation method.
RX23T YROTATE-IT-RX23T Motor Control Kit
UM-YROTATE-IT-RX23T Rev. 1.0 Page 50 of 83
October 6, 2015
20. PC Graphical User Interface in details
Please install the Motor Control PC GUI on your machine by following the instructions of the Quick Start Guide
delivered in the YROTATE-IT-RX23T kit. After connecting the Nanotec Motor (DB42S03, 24V
DC
, 4000RPM), please
connect the board RX23T and select the COM port or use the Auto-detection mechanism.
The PC Graphical User interface supports such Operating Environment:
Windows® 10 (32-bit, 64-bit)
Windows® 8.1 (32-bit, 64-bit)
Windows® 8 (32-bit, 64-bit)
Windows® 7 (32-bit, 64-bit)
Please find below the detailed description of the PC GUI tabs and windows.
Set motor speed,
stop it, and reverse
Display internal quantities (Motor
speed, torque and direct current,
frequency, etc)
RX23T YROTATE-IT-RX23T Motor Control Kit
UM-YROTATE-IT-RX23T Rev. 1.0 Page 51 of 83
October 6, 2015
By clicking on the button “Save data to file, it becomes possible to record regularly all the values display in real-time
in a file, as describe below:
Furthermore, the Speed control window displays the Alarm codes status of the board itself:
Alarm code 1:
The alarm 1 is called “EEPROM alarm” and described in the software by “EQP_ALL”. This alarm is set when one or
more EEPROM parameters are higher than the maximum allowed value or lower than the minimum allowed value.
The LED DL2 is quickly blinking on the main board to indicate that an alarm is set.
The maximum and minimum values are specified in the two constants tables called: "par_max[]" "par_min[]" in the
"ges_eqp.h" header file. Another root cause for the alarm 1 is the EEPROM hardware failure when the error is
accessed in read or write mode.
When this alarm is active, the access to the EEPROM is restricted. To reset the alarm the default parameters set
should be reloaded in the EEPROM. By using the PC GUI and the parameters setting window, it becomes possible to
clean the EEPROM content. The first step is to write the magic number “33” in the first parameter n°00. The second
step is to reset the board by pressing the reset button on the PCB or switching off the power supply.
RX23T YROTATE-IT-RX23T Motor Control Kit
UM-YROTATE-IT-RX23T Rev. 1.0 Page 52 of 83
October 6, 2015
At this point a coherent set of parameters is loaded and the alarm should disappear.
Finally, if the alarm is produced by a hardware failure of the EEPROM itself, then the board needs to be repaired.
Alarm code 2:
The alarm 2 is called “hardware overcurrent” and described in the software by “FAULT_ALL”. This alarm is produced
by the MCU peripheral called Port Output Enable (POE) in case of external overcurrent signal. The hardware
overcurrent is producing a falling edge input on the POE pin. Furthermore, if the hardware level of the PWM output
pin is not coherent with the level imposed by software, the alarm 2 will also be triggered.
The LED DL2 is quickly blinking on the main board to indicate that an alarm is set.
The only way to clear the alarm is to reset the board by using the reset button on the PCB or by switching off the
supply and on again.
Finally, one of the root causes of the Alarm 2 is a hardware defect or a wrong behaviour of the current control. So
please also check the setting of the current PI coefficients that are stored in EEPROM or used in real-time.
Alarm code 3:
The alarm 3 is called “loss of phase” and described in the software by “TRIP_ALL”. This alarm is produced when the
sensorless position detection algorithm is producing inconsistent results. It means that the rotor position is unknown
due to a lack of accuracy, so the motor is stopped.
The LED DL2 is quickly blinking on the main board to indicate that an alarm is set.
This alarm can be reset by setting the speed reference to zero on the PC GUI.
Please find below an extract of the header file “const_def.h”.
In order to reset the board in case of Alarm code 2 “Overcurrent”, please push the button as described below:
Board
RESET
RX23T YROTATE-IT-RX23T Motor Control Kit
UM-YROTATE-IT-RX23T Rev. 1.0 Page 53 of 83
October 6, 2015
Then by clicking on the “Parameters Setting” button, the important window can be displayed showing all the
parameters of the system that can be changed in real-time without having to recompile the embedded software.
The detailed description of each parameter is display when pointing the mouse on the question mark. Each
parameters unit is displayed. To change one value in real-time, simply enter the new value and click on “Write” to
program the new value into the EEPROM.
RX23T YROTATE-IT-RX23T Motor Control Kit
UM-YROTATE-IT-RX23T Rev. 1.0 Page 54 of 83
October 6, 2015
Furthermore, it is possible to change only one parameter at a time during fine tuning, when the motor is rotating by
using the “Custom” button and enter the number of the parameter and the value inside the window as shown
below.
All the parameters can be changed on the fly and after pushing the “Write” button, it’s automatically set.
But there are two exceptions related to the parameters #19 and #20:
19
SAM_FRE_DEF
Set the sampling frequency [Hz] of the control loop
20
F_RATIO_DEF
Set the ratio between the PWM frequency and sampling frequency, e.g. if 8000 is set in the
parameter #19 and 2 in the parameter #20, the PWM frequency is 16KHz.
The parameter #19 is setting the control loop speed. If 8KHz is selected by entering the value “8000”, the PWM
frequency can be set to four different values depending on the motor and the applications either 8KHz, 16KHz,
24KHz or 32KHz.
=> It’s basically done by entering the ratio value in the parameter #20. Please find below the possible values that can
be entered.
Parameter 19:
Sampling freq.
Parameter 20:
Ratio = 1
Parameter 20:
Ratio = 2
Parameter 20:
Ratio = 3
Parameter 20:
Ratio = 4
4KHz
PWM freq.:
4KHz
PWM freq.:
8KHz
PWM freq.:
12KHz
PWM freq.:
16KHz
8KHz
PWM freq.:
8KHz
PWM freq.:
16
KHz
PWM freq.:
24
KHz
PWM freq.:
32
KHz
10KHz
PWM freq.:
10KHz
PWM freq.:
20
KHz
PWM freq.:
30
KHz
PWM freq.:
40
KHz
12KHz
PWM freq.:
12KHz
PWM freq.:
24
KHz
PWM freq.:
36
KHz
PWM freq.:
48
KHz
14KHz
PWM freq.:
14KHz
PWM freq.:
28
KHz
PWM freq.:
42
KHz
PWM freq.:
56
KHz
16KHz
PWM freq.:
16KHz
PWM freq.:
32
KHz
PWM freq.:
48
KHz
PWM freq.:
64
KHz
RX23T YROTATE-IT-RX23T Motor Control Kit
UM-YROTATE-IT-RX23T Rev. 1.0 Page 55 of 83
October 6, 2015
In order to change the values of the parameters #19 and #20, please follow the description below.
After entering the new values, in this case 8KHz of sampling frequency and 16KHz of PWM frequency, click on
“write” and Push the Reset button of the board. It’s only after the Reset of the board that the new PWM and loop
frequencies will be set in the embedded software.
Important Note: After setting up the new values for the parameters #19 or #20, it’s recommended to run the Auto-
calibration procedure described below. It ensure the software to use the best intrinsic values and the most adapted
values of the current PI coefficients.
Speed range limitations
The YROTATE-IT-RX23T kit is driving any 3-phase Permanent Magnet Motors using a sensorless vector control
algorithm. So it means that there is a minimum speed to reach in order to run the motor properly using the three
shunts current measurement methods. In the case of the Nanotec Motor DB42S03 delivered with the kit, the
minimum speed is 600RPM. Below this speed, the current flowing through the three shunts are too low to be
detected. Furthermore, when the board is supplied only via the USB cable, the maximum current provided to the
board is limited by the 500mA of the USB PC port and the voltage generating by the board which is 12V.
It means that, the first tests using the 3-phase Brushless AC motor DB42S03 from Nanotec will work properly in a
specific speed range: from 600RPM up to 3500RPM.
The DB42S03 brushless motor is able to reach its maximum speed of 6200RPM (without load) when the power
supply is 24V and up to 1A is provided. After changing the jumpers as described above and providing 24V to the
board, the Nanotec motor from the YROTATE-IT-RX23T kit reach easily 6200RPM, its maximum rated speed without
load. Of course, the embedded software enabling flux weakening technics, by providing more current to the board,
the motor can reach 8000RPM.
RX23T YROTATE-IT-RX23T Motor Control Kit
UM-YROTATE-IT-RX23T Rev. 1.0 Page 56 of 83
October 6, 2015
21. EEPROM parameters: detailed description
Please find below the software parameters list including their full description. Each parameters located in
the “customize.h” header file can be tuned by the user directly by the Graphic User Interface, without re-
compiling the program.
Parameter
number Short name Description
0 SEL_OP
default parameters setting, Used to perform special operations, like default
parameter set re-loading, or current PI tuning working mode setting
1
RPM_MIN
Set the Minimum
Speed in RPM
2
RPM_MAX
Set the Maximum Speed in RPM
3
R_ACC
Set the acceleration [RPM/s]
4
R_DEC
Set the deceleration [RPM/s]
5
C_POLI
Set the number of polar couples
6 I_START
Set the start
-
up current (peak) [Ampere/AMP_RES]. Used to specify the
peak phase
current value to be used during the start-up
7
I_MAX
Set the maximum phase current (peak) [Ampere/AMP_RES]
8
R_STA
Set the stator resistance [Ohm/OHM_RES]
9
L_SYN
Set the synchronous inductance [Henry/HEN_RES]
10 PM_FLX
Set the permanent
magnets flux [Weber/WEB_RES]. This value is only used when the
exact integration flux estimation algorithm is selected. By default, it’s not needed as
the approximated integration is selected.
11
KP_CUR
Set the Current loop Proportional coefficient: KP
12
KI_CUR
Set the Current loop Integral coefficient: KI
13
KP_VEL
Set the Speed loop Proportional coefficient: KP
14
KI_VEL
Set the Speed loop Integral coefficient: KI
15 FB_GAIN
Set the flux amplitude feedback gain. This value is only used when the
exact
integration flux estimation algorithm is selected. By default, it’s not needed as the
approximated integration is selected
16 PHA_OFF
Set the
phase offset [deg]. It is used to add a phase offset to the phase estimation, to
reach better alignment
1
7
ST_TIM
Set the Start
-
up acceleration time [sec/SEC_RES]
18
Not used
19
SAM_FRE_DEF
Set the sampling frequency [Hz] of the control loop
20
F_RATIO_DEF
Set the ratio between the PWM frequency and sampling frequency, e.g. if 8000 is set
in the parameter #19 and 2 in the parameter #20, the PWM frequency is 16KHz.
RX23T YROTATE-IT-RX23T Motor Control Kit
UM-YROTATE-IT-RX23T Rev. 1.0 Page 57 of 83
October 6, 2015
22. Motor Auto-calibration using the PC GUI
The full calibration of any 3-phase AC Brushless motor can be performed automatically using the PC Graphical User
Interface. Three specific buttons are now available for and shown below:
In terms of AC Brushless motor driven in sinusoidal mode and FOC algorithm, the most important parameters to tune
are:
1. Current PI parameters: Proportional K
p
and Integral K
i
2. Motor parameters: Stator resistance R
s
, the synchronous inductance L
s
, and Permanent Magnet flux Λ
m
.
Please find below the auto-tuning process step by step of the Nanotec Motor DB42S03 delivered with the YROTATE-
IT-RX23T kit. The DB42S03 motor is a low voltage Permanent Magnet Synchronous Motor. The auto-tuning
procedure will be performed using the kit running the sensorless vector control algorithm.
Important Note: The auto-tuning embedded software is working only on the three shunts version.
a) Please find below the specifications of the Motor delivered by the motor maker:
Motor Manufacturer: NANOTEC www.nanotec.com
Motor type: 3-phase AC Brushless DB42S03
Maximum current: 5.4A
Bus Voltage: 24V
Speed rated: 4000 RPM
Number of pole pairs: 4
RX23T YROTATE-IT-RX23T Motor Control Kit
UM-YROTATE-IT-RX23T Rev. 1.0 Page 58 of 83
October 6, 2015
b) Let’s setup the Motor control kit for 24V
DC
external power supply: the jumper JP1 and JP2 needs to be set to 1-3
position as explained in the “Chapter 3 Power Supply selection”.
c) Let’s connect the 24V
DC
Power supply to the RX23T motor control reference kit.
The following LEDs: DL3, DL4, DL5 are ON and the LED DL2 is blinking to indicate that the MCU is running fine.
Important Note: The procedure below is also working with the USB power supply, but it is recommended to connect
24V
DC
external power supply to the inverter kit. It ensure a higher resolution during the auto-tuning procedure and
the extraction of the intrinsic motor parameters as the level of energy is higher.
d) Now, connect the USB cable to the PC and the Kit and connect the 24V to the kit and the motor to the kit:
e) Launch the PC GU from the folder: “C:\Program Files\MCDEMO” launch: “MotorController.exe”
The LED DL1 of the RX23T board is blinking rapidly showing communication between the board and the PC.
RX23T YROTATE-IT-RX23T Motor Control Kit
UM-YROTATE-IT-RX23T Rev. 1.0 Page 59 of 83
October 6, 2015
Click on the “setup” button and select “RX23T Kit” and select “Auto detect” and click on “Connect” to ensure the PC
GUI is connected to the RX23T kit.
On the left hand side, the new buttons appears: “Cur. PI tuning”, “Cu. PI tuning (AUTO)”, “Motor Identification” and
“Oscilloscope” which are needed for the self-calibration of the motor.
f) Clean the EEPROM content and start with the default parameters in the EEPROM.
The first thing to do is to ensure that the inverter board is the default state and the default parameters are written
inside. The procedure below ensures it:
Click on the “Parameters Setting” button and enter the magic value “33” in the “00. Operation Select” and push the
RESET button on the board as shown:
g) Set the maximum current (parameter 07) as it will influence all the next steps: Click on “Parameters settings”
Enter the value: 3500 (the unit is in mA) and click on “Write” to save the parameter into the EEPROM and close the
parameter setting window. The maximum current parameter is fundamental for the auto-calibration. The maximum
value allowed by the motor must be used to guarantee the highest resolution.
Board
RESET
RX23T YROTATE-IT-RX23T Motor Control Kit
UM-YROTATE-IT-RX23T Rev. 1.0 Page 60 of 83
October 6, 2015
h) Click now on “Cu. PI tuning (AUTO)” button and press “start” to perform an automatic Current PI tuning. The two
coefficients of the PI current block will be extracted thanks to the embedded software able to generate a step
voltage and measuring the motor response.
And click on “Yes” to accept the results to be programed into the EEPROM as shown below.
i) Now click on the button “Cu. PI tuning” to open the manual current PI tuning window and check the step answer
by clicking on “Apply current step” button.
RX23T YROTATE-IT-RX23T Motor Control Kit
UM-YROTATE-IT-RX23T Rev. 1.0 Page 61 of 83
October 6, 2015
Depending on the motor, the parameters found by the automatic procedure can be too fast or too slow.
Please use the Zoom function to check the beginning of the step:
You can adjust manually the parameters to obtain an even better step response and also increase the step current
level by increasing the percentage of “Cur. [%] to 90%. The default value is 50%.
Once it’s done, the window can be closed as the proportional and integral coefficients of the PI current are tuned.
j) Perform an auto-identification of the motor parameters by clicking on “Motor Identification” and click “start”:
RX23T YROTATE-IT-RX23T Motor Control Kit
UM-YROTATE-IT-RX23T Rev. 1.0 Page 62 of 83
October 6, 2015
During this process the rotor should start rotating, please leave the rotor free and no loaded.
And finally accept the results to store them into the EEPROM by clicking on “yes”.
The stator resistance, the synchronous inductance and the Permanent Magnet flux have been measured and tuned.
k) Now please click on “parameters settings” and enter the number of pole pairs: 4 (parameter n°5) and enter a
minimum speed or 1000 RPM
l) Set a start-up current equal to 25% of the maximum current. In our case 25% of 3.5A is 0.875A. Please enter the
value 875 into the parameter n°6 and click on the “write” button on the right hand side.
RX23T YROTATE-IT-RX23T Motor Control Kit
UM-YROTATE-IT-RX23T Rev. 1.0 Page 63 of 83
October 6, 2015
Then let’s close the window.
j) Now, let’s try to run the motor. Please click on the button: “Speed Control”:
To start the motor, let’s enter a speed which is 1.5 times the minimum speed, in this case 1500 RPM
RX23T YROTATE-IT-RX23T Motor Control Kit
UM-YROTATE-IT-RX23T Rev. 1.0 Page 64 of 83
October 6, 2015
Please click on the “Oscilloscope” button to see the motor waveforms with the current in Y-axis and the time in x-
axis.
You can also display the phase by clicking on “Phase” selector:
For the oscilloscope window, use an opportune time scale: “1 sample every 1” should be used for extremely fast
phenomena when running at very high speed.
The setting “1 sample every 128” should be used for extremely low phenomena when running at very low speed.
Let’s start with an intermediate value and adjust it in order to see some periods of the current or the phase.
k) When the motor is running, you can adjust the two speed PI parameters: the proportional and integral terms: #13
and #14
RX23T YROTATE-IT-RX23T Motor Control Kit
UM-YROTATE-IT-RX23T Rev. 1.0 Page 65 of 83
October 6, 2015
Please follow the procedure: while running at a medium speed range: 2 times the minimum speed.
In our example, the speed is set to 2000 RPM, the PWM frequency is set to 30KHz and the sampling frequency to
10KHz. The board was RESETTED and the auto-tuning procedure redone.
Please open the Oscilloscope window and the Parameters Setting windows as shown below.
To tune the coefficients, start by increasing the Parameter n°13 (Kp) until the instability that can be display in the
current or phase waveform window.
Add a step of “1000” and click “write” to see the effect and keep on increasing it.
In our case, at 200 it started to be very unstable, but the motor is still running. Set the speed to “0”.
Then use less than half of the found value: 70 in our case, click on “write” and set the speed to 2000 RPM.
RX23T YROTATE-IT-RX23T Motor Control Kit
UM-YROTATE-IT-RX23T Rev. 1.0 Page 66 of 83
October 6, 2015
Do the same for the parameter n°14 (integral coefficient) which is the speed loop Ki parameter. Increase it until it
becomes unstable.
In our case the critical value is reached at 600 for Ki, so the value to be used is: 300 (half of the value found).
l) Test the parameters found in all the speed ranges and different rotations.
m) Finally the parameters list can be saved in a file in .CSV (“Save” button) or .h file (“Create.h” button) format for
further used and can also be uploaded later on:
Troubleshooting:
At the stage j) if the motor doesn’t start or generate an alarm n°3, please set the speed to “0” to clear the alarm
which indicates that the software lost the phase. One first test is to increase or decrease the start-up current and the
minimum speed or the speed PI gains
RX23T YROTATE-IT-RX23T Motor Control Kit
UM-YROTATE-IT-RX23T Rev. 1.0 Page 67 of 83
October 6, 2015
When the motor is running, you can verify the number of pole pairs taking measurement of the effective speed, and
comparing it with the imposed frequency: the number of pole pairs n is: n=freq*60/speed; if you change the number
of pole pairs, remember to adjust also the minimum (and maximum) speed values.
For some motors, the no-load start-up is easier if the inductance parameter is set to 0 (parameter #9)
All the procedure is tuned to manage motors which maximum current is close to the inverter capability, which is
around 6A for the external power stage (shunt value is 0.05 Ohm) and 3Arms for the internal power stage (shunt
value is 0.1 Ohm).
If you try to use it for very different motors, the results will be influenced by the losses in current reading resolution.
RX23T YROTATE-IT-RX23T Motor Control Kit
UM-YROTATE-IT-RX23T Rev. 1.0 Page 68 of 83
October 6, 2015
23. Updating the RX23T Flash memory using the Renesas Programming Flash
Tool
The procedure below explain in details how to re-program the RX23T flash memory using the Renesas Flash
Programing tool, called the RFP. It could be used to update the RX23T kit with the latest Firmware version
downloaded from the website: www.renesas.eu/motorcontrol . The RFP must be used with the E1 debugger and
there’s no need to install the full version of the development environment either e2studio or CS+.
Please have a look at the specific Flash Programming Tool website to us the latest software version:
www.renesas.eu/products/tools/flash_prom_programming/index.jsp
Please follow the 13 steps to update the flash memory of your RX23T MCU using the RFP tool.
Step1: Open RFP software v2.05.
The “Welcome” windows
appears. Then click on Create
new workspace
Step2: Select RX200(FINE) and a
workspace name, then click
Nextbutton
RX23T YROTATE-IT-RX23T Motor Control Kit
UM-YROTATE-IT-RX23T Rev. 1.0 Page 69 of 83
October 6, 2015
Step3: Select the E1 debugger and
then click “Avanti” or “next”
button.
Step5: Click on “Power target
from emulator”, then select 5.0V
(USB VBUS) and then click “OK
button.
Step4: Select the options as
shown and click “OK button.
RX23T YROTATE-IT-RX23T Motor Control Kit
UM-YROTATE-IT-RX23T Rev. 1.0 Page 70 of 83
October 6, 2015
Step6: Click on “OK button.
Step7: After E1 Emulator has been
located press “OK” button
Step8: Select RX200 Series (Little
Endian) and press “OK” button
Step9: After all the test will be
passed press “OK” button
RX23T YROTATE-IT-RX23T Motor Control Kit
UM-YROTATE-IT-RX23T Rev. 1.0 Page 71 of 83
October 6, 2015
Step10: Input Frequency will be
32MHz, so press “Avanti” button
Step11: click “Finebutton
RX23T YROTATE-IT-RX23T Motor Control Kit
UM-YROTATE-IT-RX23T Rev. 1.0 Page 72 of 83
October 6, 2015
Congratulations! The new firmware is now programed into the RX23T flash memory.
Step12: Check the summary and
then click “OKbutton
Step13: Browse the file with the
“.mot” extension to be
downloaded into the flash
memory and then click “START
button.
At the end of the process “Image
written to device” will appear.
The new program is now into the
flash of the RX23T.
RX23T YROTATE-IT-RX23T Motor Control Kit
UM-YROTATE-IT-RX23T Rev. 1.0 Page 73 of 83
October 6, 2015
24. Integration of user code to the motor control algorithm
There are several places in the embedded source code to add user code depending on the type of routines.
Basically, either the user code can be placed within the main routines in the module called “main.c” or in the interrupt
service routine offering the highest priority, used to execute the field oriented control algorithm in the module called:
“motorcontrol.c”.
The example below shows how to
add specific code in the module
“main.c” to add a specific speed
profile on the YROTATE-IT-RX23T.
The 1
st
step is to add a main
variable “COUNTER_CYCLE” to
generate a timer base.
The 2
nd
step is to add at the
beginning of the main loop the
speed ramps and the profile
wished.
In the example, the motor speed
will reach 30000 RPM with the first
cycle period and slow-down to
9000 RPM in the second phase and
it will work periodically.
The routine is generating a
The main loop timing is 10ms, so
120 times, it means 1.2 seconds is
the period of the cycle.
RX23T YROTATE-IT-RX23T Motor Control Kit
UM-YROTATE-IT-RX23T Rev. 1.0 Page 74 of 83
October 6, 2015
25. Communication Protocol between the MCU and the PC GUI
After the introduction of the auto-tuning, a new set of information is exchanged between the GUI and the board. To distinguish
between the software versions the answer to the check request is used. In the previous software version the answer to a check
com request ("c"), was the uppercase ("C"). In the versions with auto-tuning the answer code is ("d").
The maximum serial communication speed tested is 76.6 KBd.
****************************************************************************
*** MULTIPOINT MASTER-SLAVE SERIAL COMMUNICATION SIMPLIFIED PROTOCOL ***
****************************************************************************
ASCII: '!'=0x21, '#'=0x23, '?'=0x3F, 'C'=0x43, 'W'=0x57, 'c'=0x63, 'w'=0x77
Master String:
l i s o a n D1 .. Dm k
l = frame total length (1 byte)
i = master string identification ('?' = question)
s = station address (1 byte)
o = operation code (1 byte)
a = data address (1 byte)
n = data number (1 byte)
Dx = x-th data byte (1 byte)
k = checksum (1 byte)
Master operation codes:
'c' = check request
'w' = word reading (1 word = 2 bytes)
'W' = word writing (1 word = 2 bytes)
Possible master frames (questions):
check: l ? s c k
(l=5)
word read.: l ? s w a n k
(l=7)
word writ.: l ? s W a n D11 D10 .. Dn1 Dn0 k
(l=7+2*n)
Slave string:
l i s o a n D1 .. Dm k
l = frame total length (1 byte)
i = slave string identification ('!' = OK answer, '#' = NOK answer)
s = station address (1 byte)
o = operation code (1 byte)
a = data address (1 byte)
n = data number (1 byte)
Dx = x-th data byte (1 byte)
k = checksum (1 byte)
Slave operation codes:
'C' = check answer
'w' = word reading answer (word = 2 byte)
'W' = word writing answer (word = 2 byte)
RX23T YROTATE-IT-RX23T Motor Control Kit
UM-YROTATE-IT-RX23T Rev. 1.0 Page 75 of 83
October 6, 2015
Possible slave frames (answers):
nok: l # s o k
(l=5)
check: l ! s C k
(l=5)
word read.: l ! s w a n D11 D10 .. Dn1 Dn0 k
(l=7+2*n)
word writ.: l ! s W k
(l=5)
ADDRESSES:
If the address "a" specified in the question is a < NUM_PAR_EQP (number of EEPROM parameters), then an EEPROM parameter
is read or written. Otherwise if a > = NUM_PAR_EQP, then a parameter in the RAM table (Cf. module “userif.h”) is read or
written. Its address in the RAM table is a-NUM_PAR_EQP.
Operation example:
PC request of reading 16 words from the structure UIF_R, starting from the second one (UIF_R.ram_tab[1], .., IF_R.ram_tab[16]):
0 07 Number of bytes in the frame
1 3F Master string indicator "?"
2 00 Station address (it is always 0 in our boards)
3 77 word reading operation "w"
4 41 data start address (1(address in UIF_R.ram_tab) + 40h (offset to add for ram reading/writing))
5 10 number of data (10h=16dec)
6 39 checksum
Board answer:
0 27 Number of bytes in the frame (27h=39dec)
1 21 Slave string indicator "!"
2 00 Station address (it is always 0 in our boards)
3 77 word reading operation "w"
4 41 data start address (1(address in UIF_R.ram_tab)+40h(offset to add for ram reading))
5 10 number of data (10h=16dec)
6 00 MSB of the 1
st
word of data (UIF_R.ram_tab[1]=UIF_R.var.rpm, speed)
7 00 LSB of the 1
st
word of data
8 00 MSB of the 2
nd
word of data (UIF_R.ram_tab[2]=UIF_R.var.fre, imposed frequency)
9 00 LSB of the 2
nd
word of data
10 00 MSB of the 3
rd
word of data (UIF_R.ram_tab[3]=UIF_R.var.id, d axis current)
11 00 LSB of the 3
rd
word of data
12 00 MSB of the 4
th
word of data (UIF_R.ram_tab[4]=UIF_R.var.iq, q axis current)
13 00 LSB of the 4
th
word of data
14 00 MSB of the 5
th
word of data (UIF_R.ram_tab[5])
15 00 LSB of the 5
th
word of data
16 00 MSB of the 6
th
word of data (UIF_R.ram_tab[6])
17 00 LSB of the 6
th
word of data
18 00 MSB of the 7
th
word of data (UIF_R.ram_tab[7]=UIF_R.var.vb, bus voltage)
19 18 LSB of the 7
th
word of data
20 00 MSB of the 8
th
word of data (UIF_R.ram_tab[8])
21 00 LSB of the 8
th
word of data
22 00 MSB of the 9
th
word of data (UIF_R.ram_tab[9]=UIF_R.var.all, alarm)
23 01 LSB of the 9
th
word of data
24 00 MSB of the 10
th
word of data (UIF_R.ram_tab[10])
25 00 LSB of the 10
th
word of data
26 00 MSB of the 11
th
word of data (UIF_R.ram_tab[11])
27 00 LSB of the 11
th
word of data
RX23T YROTATE-IT-RX23T Motor Control Kit
UM-YROTATE-IT-RX23T Rev. 1.0 Page 76 of 83
October 6, 2015
28 00 MSB of the 12
th
word of data (UIF_R.ram_tab[12])
29 00 LSB of the 12
th
word of data
30 00 MSB of the 13
th
word of data (UIF_R.ram_tab[13])
31 00 LSB of the 13
th
word of data
32 00 MSB of the 14
th
word of data (UIF_R.ram_tab[14])
33 00 LSB of the 14
th
word of data
34 00 MSB of the 15
th
word of data (UIF_R.ram_tab[15])
35 00 LSB of the 15
th
word of data
36 00 MSB of the 16
th
word of data (UIF_R.ram_tab[16])
37 00 LSB of the 16
th
word of data
38 69 checksum
PC request of writing 4 words in the structure UIF_W, starting from the third one (UIF_W.ram_tab[2], .., UIF_W.ram_tab[5]):
0 0F Number of bytes in the frame (0Fh=15dec)
1 3F Master string indicator "?"
2 00 Station address (it is always 0 in our boards)
3 57 word writing operation "W"
4 42 data start address (2(address in UIF_W.ram_tab)+40h(offset to add for ram reading/writing))
5 04 number of data
6 03 MSB of the 1
st
word of data (value (03E8h=1000dec) to be written in UIF_W.ram_tab[2] =
UIF_W.var.rif, speed ref)
7 E8 LSB of the first word of data
8 00 MSB of the second word of data (value to be written in UIF_W.ram_tab[3], not used)
9 00 LSB of the second word of data
10 00 MSB of the third word of data (value to be written in UIF_W.ram_tab[4], not used)
11 00 LSB of the third word of data
12 00 MSB of the fourth word of data (value to be written in UIF_W.ram_tab[5], not used)
13 00 LSB of the fourth word of data
14 E7 checksum
Board answer (indicates that the request is received and processed):
0 05 Number of bytes in the frame
1 21 Slave string indicator "!"
2 00 Station address (it is always 0 in our boards)
3 57 word writing operation "W"
4 E6 checksum
Note: Two new operation codes have been added:
'y'(=0x79): word reading (EEPROM minimum value)
'z'(=0x7A): word reading (EEPROM maximum value)
In these cases the address is a < NUM_PAR_EQP.
To understand in more details the software implementation, please find below the extract of the “userif.h module, part of the
embedded software.
RX23T YROTATE-IT-RX23T Motor Control Kit
UM-YROTATE-IT-RX23T Rev. 1.0 Page 77 of 83
October 6, 2015
RX23T YROTATE-IT-RX23T Motor Control Kit
UM-YROTATE-IT-RX23T Rev. 1.0 Page 78 of 83
October 6, 2015
RX23T YROTATE-IT-RX23T Motor Control Kit
UM-YROTATE-IT-RX23T Rev. 1.0 Page 79 of 83
October 6, 2015
RX23T YROTATE-IT-RX23T Motor Control Kit
UM-YROTATE-IT-RX23T Rev. 1.0 Page 80 of 83
October 6, 2015
RX23T YROTATE-IT-RX23T Motor Control Kit
UM-YROTATE-IT-RX23T Rev. 1.0 Page 81 of 83
October 6, 2015
Revision History
Rev. Date
Description
Page Summary
0.50 May 20, 2015 First Edition
1.00
October 6, 2015
Chapter 10 to 24 are reworked or added
RX23T YROTATE-IT-RX23T Motor Control Kit
UM-YROTATE-IT-RX23T Rev. 1.0 Page 82 of 83
October 6, 2015
General Precautions in the Handling of MPU/MCU Products
The following usage notes are applicable to all MPU/MCU products from Renesas. For detailed usage notes on the
products covered by this document, refer to the relevant sections of the document as well as any technical updates
that have been issued for the products.
1. Handling of Unused Pins
Handle unused pins in accord with the directions given under Handling of Unused Pins in the manual.
The input pins of CMOS products are generally in the high-impedance state. In operation with an
unused pin in the open-circuit state, extra electromagnetic noise is induced in the vicinity of LSI, an
associated shoot-through current flows internally, and malfunctions occur due to the false
recognition of the pin state as an input signal become possible. Unused pins should be handled as
described under Handling of Unused Pins in the manual.
2. Processing at Power-on
The state of the product is undefined at the moment when power is supplied.
The states of internal circuits in the LSI are indeterminate and the states of register settings and
pins are undefined at the moment when power is supplied.
In a finished product where the reset signal is applied to the external reset pin, the states of pins
are not guaranteed from the moment when power is supplied until the reset process is completed.
In a similar way, the states of pins in a product that is reset by an on-chip power-on reset function
are not guaranteed from the moment when power is supplied until the power reaches the level at
which resetting has been specified.
3. Prohibition of Access to Reserved Addresses
Access to reserved addresses is prohibited.
The reserved addresses are provided for the possible future expansion of functions. Do not access
these addresses; the correct operation of LSI is not guaranteed if they are accessed.
4. Clock Signals
After applying a reset, only release the reset line after the operating clock signal has become stable.
When switching the clock signal during program execution, wait until the target clock signal has
stabilized.
When the clock signal is generated with an external resonator (or from an external oscillator)
during a reset, ensure that the reset line is only released after full stabilization of the clock signal.
Moreover, when switching to a clock signal produced with an external resonator (or by an external
oscillator) while program execution is in progress, wait until the target clock signal is stable.
5. Differences between Products
Before changing from one product to another, i.e. to a product with a different type number, confirm
that the change will not lead to problems.
The characteristics of an MPU or MCU in the same group but having a different part number may
differ in terms of the internal memory capacity, layout pattern, and other factors, which can affect
the ranges of electrical characteristics, such as characteristic values, operating margins, immunity
to noise, and amount of radiated noise. When changing to a product with a different part number,
implement a system-evaluation test for the given product.