Renesas rl78/g1g User Manual
Hide thumbs Also See for rl78/g1g:

Advertisement

Quick Links

RL78/G1G
Sensorless Speed control of 120-degree conducting controlled permanent
magnetic synchronous motor (Implementation)
Summary
This application note aims at explains sample programs driving a permanent magnetic synchronous motor in the 120-
degree conducting method using the RL78/G1G microcontroller.
These control programs are only to be used as reference and Renesas Electronics Corporation does not guarantee the
operations. Please use them after carrying out a thorough evaluation in a suitable environment.
Operation checking device
Operations of the control programs have been checked by using the following device.
RL78/G1G (R5F11EBAAFP)
Target control programs
The target control programs of this application note are as follows.
RL78G1G_MRSSK_SPM_LESS_120_CSP_CA_V100 (IDE:CS+ for CA,CX)
RL78G1G_MRSSK_SPM_LESS_120_CSP_CC_V100 (IDE:CS+ for CC)
RL78G1G_MRSSK_SPM_LESS_120_E2S_CC_V100 (IDE:e
RL78/G1G Sensorless 120-degree conducting control program for
Reference
RL78/G1G Group User's Manual: Hardware (R01UH0499EJ0130)
Application note: '120-degree conducting control of permanent magnetic synchronous motor: algorithm'
(R01AN2657EJ0120)
Renesas Solution Starter Kit 24V Motor Control Evaluation System for RX23T User's Manual
(R20UT3697EJ0100)
R01AN3582EJ0100 Rev.1.00
Jan 13, 2017
24V Motor Control Evaluation System and RL78/G1G CPU CARD
APPLICATION NOTE
2
studio)
R01AN3582EJ0100
Rev.1.00
Jan 13, 2017
Page 1 of 46

Advertisement

Table of Contents
loading
Need help?

Need help?

Do you have a question about the rl78/g1g and is the answer not in the manual?

Questions and answers

Subscribe to Our Youtube Channel

Summary of Contents for Renesas rl78/g1g

  • Page 1 This application note aims at explains sample programs driving a permanent magnetic synchronous motor in the 120- degree conducting method using the RL78/G1G microcontroller. These control programs are only to be used as reference and Renesas Electronics Corporation does not guarantee the operations. Please use them after carrying out a thorough evaluation in a suitable environment.
  • Page 2 RL78/G1G Sensorless Speed control of 120-degree conducting controlled permanent magnetic synchronous motor (Implementation) Contents Overview ............................3 System overview ..........................7 Descriptions of the control program ....................14 R01AN3582EJ0100 Rev.1.00 Page 2 of 46 Jan 13, 2017...
  • Page 3: Development Environment

    This application note explains how to implement the 120-degree conducting control programs of permanent magnetic synchronous motor (PMSM) using the RL78/G1G microcontroller. Note that this control programs use the algorithm described in the application note ‘120-degree conducting control of permanent magnetic synchronous motor: algorithm’.
  • Page 4 Sensorless Speed control of 120-degree conducting controlled permanent magnetic synchronous motor (Implementation) Modifying the Evaluation Board To support the control programs in this application note, the 24V Inverter Board and RL78/G1G CPU Card should be modified per below explanations. 1.2.1 Modification of the VR1 input port (1) Remove R8, R15, C9.
  • Page 5 1.2.2 Modification when overcurrent detection method is changed When the overcurrent detection method is changed to "PGA+CMP0, CMP1" from default (INTP0), the 24V Inverter Board and RL78/G1G CPU Card should be modified per below explanations. (1) Modification of the 24V Inverter Board Change 3-Shunt to 1-Shunt.
  • Page 6 RL78/G1G Sensorless Speed control of 120-degree conducting controlled permanent magnetic synchronous motor (Implementation) (2) Modification of the RL78/G1G CPU Card Modification for the filter circuit of comparator input (1) Mount 0 Ohms on R16. (2) Change resister R10 from 100 Ohms to 1k Ohms (3) Change capacitor C11 from 100pF to 470pF.
  • Page 7: System Overview

    RL78/G1G Sensorless Speed control of 120-degree conducting controlled permanent magnetic synchronous motor (Implementation) System overview Overview of this system is explained below. Hardware configuration The hardware configuration is shown below. RL78/G1G DC 24V input A/D converter input Bus voltage P23 / ANI3...
  • Page 8 - At the time of normal operation: OFF RESET Push switch (RESET1) System reset Table 2-2 is a list of port interfaces of RL78/G1G microcontroller of this system. Table 2-2 Port Interface R5F11EBAAFP Port name Function Inverter bus voltage measurement...
  • Page 9: Peripheral Functions

    RL78/G1G Sensorless Speed control of 120-degree conducting controlled permanent magnetic synchronous motor (Implementation) 2.2.2 Peripheral functions Table 2-3 is a list of peripheral functions used in this system. Table 2-3 List of Peripheral Functions Peripheral Function Purpose - Rotational speed command value input...
  • Page 10 RL78/G1G Sensorless Speed control of 120-degree conducting controlled permanent magnetic synchronous motor (Implementation) (6) Programmable Gain Amp (PGA) PGA is used to detect overcurrent with CMP0, CMP1 (when selected). (7) External interrupt (INTP0) An overcurrent is detected by an external circuit. (when selected).
  • Page 11: Software Structure

    Control characteristic dependent processing part header motor_parameter.h Motor characteristic dependent processing part header RL78G1G_MRSSK_ SPM_LESS_120_E mtr_ctrl_rl78g1g_mrssk.h RL78/G1G and board dependent processing part header 2S_CC_V100 mtr_feedback.h Feedback control processing part header mtr_gmc.h General motor control function part header mtr_driver_access.h Driver access function on part header mtr_filter.h...
  • Page 12: Module Configuration

    RL78/G1G Sensorless Speed control of 120-degree conducting controlled permanent magnetic synchronous motor (Implementation) 2.3.2 Module configuration Figure 2-2 and Table 2-5 show module configuration of the control programs. Application layer User application Motor control layer Motor-control-processing-part H/W control layer Microcontroller dependent processing part,...
  • Page 13: Software Specifications

    RL78/G1G Sensorless Speed control of 120-degree conducting controlled permanent magnetic synchronous motor (Implementation) Software specifications Table 2-6 shows the basic software specification of this system. For details of 120-degree conducting control, refer to the application note ‘120-degree conducting control of permanent magnetic synchronous motor: algorithm’.
  • Page 14: Descriptions Of The Control Program

    (U, V, and W phase voltage: A/D conversion value) U, V, W phase voltage 0 V to 111 V: 0000H to 03FFH ANI17, ANI18, ANI19 For more details of A/D conversion characteristics, refer to RL78/G1G User’s Manual: Hardware. R01AN3582EJ0100 Rev.1.00 Page 14 of 46 Jan 13, 2017...
  • Page 15: Speed Control

    RL78/G1G Sensorless Speed control of 120-degree conducting controlled permanent magnetic synchronous motor (Implementation) 3.1.3 Speed control In this system, the motor rotational speed is calculated from a difference of the current timer value and the timer value 2π [rad] before. The timer values are obtained when patterns are switched after zero-crossing detection, while having the timer of Timer Array Unit (TAU) channel 1 performed free running.
  • Page 16 RL78/G1G Sensorless Speed control of 120-degree conducting controlled permanent magnetic synchronous motor (Implementation) 3.1.4 Voltage control by PWM PWM control is used for controlling output voltage. The PWM control is a control method that continuously adjusts the average voltage by varying the duty of pulse, as shown in Figure 3-2.
  • Page 17 RL78/G1G Sensorless Speed control of 120-degree conducting controlled permanent magnetic synchronous motor (Implementation) Figure 3-4 Complimentary first-60-degree Chopping R01AN3582EJ0100 Rev.1.00 Page 17 of 46 Jan 13, 2017...
  • Page 18: State Transition

    RL78/G1G Sensorless Speed control of 120-degree conducting controlled permanent magnetic synchronous motor (Implementation) 3.1.5 State transition Figure 3-5 shows state transition diagrams of sensorless 120-degree conducting control software. SYSTEM MODE POWER ON/ RESET INACTIVE [ERROR EVENT] [ACTIVE EVENT] [RESET EVENT]...
  • Page 19: Start-Up Method

    RL78/G1G Sensorless Speed control of 120-degree conducting controlled permanent magnetic synchronous motor (Implementation) 3.1.6 Start-up method In Sensorless 120-degree conducting control, the position of the magnetic poles (the rotor) is estimated every 60 degrees per the induced voltage which is generated the change of magnetic flux due to the rotation of the permanent magnet (rotor).
  • Page 20: System Protection Function

    RL78/G1G Sensorless Speed control of 120-degree conducting controlled permanent magnetic synchronous motor (Implementation) 3.1.7 System protection function This system has the following types of error status and enables emergency stop functions in case of occurrence of respective error. Refer to Table 3-5, Table 3-6 for settings.
  • Page 21 RL78/G1G Sensorless Speed control of 120-degree conducting controlled permanent magnetic synchronous motor (Implementation) Table 3-6 Setting Value of Each System Protection Function Error name Threshold (Note) Overcurrent error Overcurrent limit [A] ±2.0 Overvoltage error Overvoltage limit [V] Monitoring cycle [ms]...
  • Page 22 RL78/G1G Sensorless Speed control of 120-degree conducting controlled permanent magnetic synchronous motor (Implementation) Function specifications of 120-degree conducting control software Multiple control functions are used in this control program. However, functions which are not used in this system are undescribed.
  • Page 23 RL78/G1G Sensorless Speed control of 120-degree conducting controlled permanent magnetic synchronous motor (Implementation) Table 3-9 List of Functions “mtr_ctrl_rl78g1g.c” File name Function name Process overview mtr_ctrl_rl78g1g.c R_MTR_InitHardware Initialization of the clock and peripheral functions Input: None Output: None mtr_init_clock Initialization of clock...
  • Page 24 RL78/G1G Sensorless Speed control of 120-degree conducting controlled permanent magnetic synchronous motor (Implementation) Table 3-11 List of Functions “mtr_driver_access.c” File name Function name Process overview R_MTR_SetSpeed Set the speed command value mtr_driver_access.c Input: (uint16) u2_ref_speed / speed command value Output: None...
  • Page 25: Function Name

    RL78/G1G Sensorless Speed control of 120-degree conducting controlled permanent magnetic synchronous motor (Implementation) Table 3-13 List of Functions “mtr_gmc.c” File name Function name Process overview mtr_get_vdc Obtain the bus voltage mtr_gmc.c Input: None Output: (int16) s2_temp / the bus voltage value...
  • Page 26 RL78/G1G Sensorless Speed control of 120-degree conducting controlled permanent magnetic synchronous motor (Implementation) Table 3-14 List of Functions “mtr_interrupt.c” File name Function name Process overview mtr_interrupt.c mtr_oc_intp0_interrupt Overcurrent detection process (Hardware detection) Input: None - Disable INTP0 interrupt servicing Output: None...
  • Page 27 RL78/G1G Sensorless Speed control of 120-degree conducting controlled permanent magnetic synchronous motor (Implementation) Table 3-15 List of Functions “mtr_spm_less_120.c” [1/2] File name Function name Process overview R_MTR_InitSequence Initialization of the sequence process mtr_spm_less_120.c Input: None Output: None R_MTR_ExecEvent - Change the status...
  • Page 28 RL78/G1G Sensorless Speed control of 120-degree conducting controlled permanent magnetic synchronous motor (Implementation) Table 3-16 List of Functions “mtr_spm_less_120.c” [2/2] File name Function name Process overview mtr_draw_in_signal_set Set the conduction pattern at draw in the rotor mtr_spm_less_120.c Input: None Output: None...
  • Page 29 RL78/G1G Sensorless Speed control of 120-degree conducting controlled permanent magnetic synchronous motor (Implementation) List of variables of sensorless 120-degree conducting control software Lists of variables used in this control program are given below. However, note that the local variables are not mentioned.
  • Page 30 RL78/G1G Sensorless Speed control of 120-degree conducting controlled permanent magnetic synchronous motor (Implementation) Table 3-18 List of variables [2/4] Variable name Type Scale Content Remarks - g_u2_run_mode uint16 Operation mode management 0x00: Initialize mode 0x01: Boot mode 0x02: Drive mode...
  • Page 31 RL78/G1G Sensorless Speed control of 120-degree conducting controlled permanent magnetic synchronous motor (Implementation) Table 3-19 List of variables [3/4] Variable name Type Scale Content Remarks - g_u2_ctrl_conf uint16 Control configuration 0x01: Current control 0x02: Speed control 0x04: Position control 0x08: Torque control 0x10: Voltage control -...
  • Page 32 RL78/G1G Sensorless Speed control of 120-degree conducting controlled permanent magnetic synchronous motor (Implementation) Table 3-20 List of variables [4/4] Variable name Type Scale Content Remarks - Free run timer count g_u2_bemf_timer_cnt uint16 - g_u2_pre_bemf_timer_cnt uint16 Previous free run timer count -...
  • Page 33 RL78/G1G Sensorless Speed control of 120-degree conducting controlled permanent magnetic synchronous motor (Implementation) List of sensorless 120-degree conducting control software structure Lists of structure used in this control program are given below. Table 3-21 List of structure Structure Member Type...
  • Page 34 RL78/G1G Sensorless Speed control of 120-degree conducting controlled permanent magnetic synchronous motor (Implementation) Macro definitions of sensorless 120-degree conducting control software Lists of macro definitions used in this control program are given below. Table 3-22 List of Macro definitions “motor_parameter.h”...
  • Page 35 RL78/G1G Sensorless Speed control of 120-degree conducting controlled permanent magnetic synchronous motor (Implementation) Table 3-24 List of Macro definitions “main.h” File name Macro name Definition value Remarks main.h M_CW Rotation direction M_CCW VOFFSET_MEASURE_CNT CP_OFFSET_CALC_TIME Counts for measurement of voltage offset [ms]...
  • Page 36 RL78/G1G Sensorless Speed control of 120-degree conducting controlled permanent magnetic synchronous motor (Implementation) Table 3-25 List of Macro definitions “mtr_ctrl_rl78g1g.h” File name Macro name Definition value Remarks mtr_ctrl_rl78g1g.h MTR_OC_USE_INTP Select the external circuit to detect overcurrent (default) MTR_OC_USE_PGACMP Select PGA+CMP0, CMP1 to detect overcurrent...
  • Page 37: Macro Name

    RL78/G1G Sensorless Speed control of 120-degree conducting controlled permanent magnetic synchronous motor (Implementation) Table 3-27 List of Macro definitions “mtr_ctrl_rl78g1g_mrssk.h” [2/2] File name Macro name Definition value Remarks mtr_ctrl_rl78g1g MTR_ADCCH_VR1 A/D Converter channel of VR1 _mrssk.h MTR_ADCCH_VDC A/D Converter channel of inverter bus voltage...
  • Page 38 RL78/G1G Sensorless Speed control of 120-degree conducting controlled permanent magnetic synchronous motor (Implementation) Table 3-28 List of Macro definitions “mtr_spm_less_120.h” [1/4] File name Macro name Definition value Remarks mtr_spm_less_ MTR_POLE_PAIRS MP_POLE_PAIRS Motor Pole pairs 120.h MTR_TWOPI 2 * 3.14159265f 2π...
  • Page 39 RL78/G1G Sensorless Speed control of 120-degree conducting controlled permanent magnetic synchronous motor (Implementation) Table 3-29 List of Macro definitions “mtr_spm_less_120.h” [2/4] File name Macro name Definition value Remarks mtr_spm_less_ MTR_OL_MODE3_RATE_REFV (int16) CP_OL_MODE3_RATE_REFV Increase step of voltage at open 120.h loop mode3 [V]...
  • Page 40 RL78/G1G Sensorless Speed control of 120-degree conducting controlled permanent magnetic synchronous motor (Implementation) Table 3-30 List of Macro definitions “mtr_spm_less_120.h” [3/4] File name Macro name Definition value Remarks mtr_spm_less MTR_VP_ON_U_PWM Conduction pattern _120.h MTR_VP_ON_W_PWM MTR_WP_ON_U_PWM MTR_WP_ON_V_PWM MTR_OFFSET_CALC_TIME CP_OFFSET_CALC_TIME Time to calculate voltage offset [ms]...
  • Page 41 RL78/G1G Sensorless Speed control of 120-degree conducting controlled permanent magnetic synchronous motor (Implementation) Table 3-31 List of Macro definitions “mtr_spm_less_120.h” [4/4] File name Macro name Definition value Remarks mtr_spm_less MTR_ERROR_NONE 0x00 No error _120.h MTR_ERROR_OVER_CURRENT 0x01 Overcurrent error MTR_ERROR_OVER_VOLTAGE 0x02...
  • Page 42 RL78/G1G Sensorless Speed control of 120-degree conducting controlled permanent magnetic synchronous motor (Implementation) Control flows (flow charts) 3.6.1 Main process Main process Initialization of peripheral functions Initialization of user interface Initialization of variables used in the main process Initialization of sequence process...
  • Page 43 RL78/G1G Sensorless Speed control of 120-degree conducting controlled permanent magnetic synchronous motor (Implementation) 3.6.2 Carrier cycle interrupt handling Carrier cycle interrupt Get inverter bus voltage value Measure the voltage of three phase Cancel voltage offset [INACTIVE] SYSTEM MODE [ACTIVE] [before MODE2]...
  • Page 44 RL78/G1G Sensorless Speed control of 120-degree conducting controlled permanent magnetic synchronous motor (Implementation) 3.6.3 1 [ms] interrupt handling 1 ms interrupt [INACTIVE] SYSTEM MODE [ACTIVE] [INIT MODE] [DRIVE MODE] RUM MODE [BOOT MODE] [NO] Calculate speed reference Calculate voltage reference...
  • Page 45 RL78/G1G Sensorless Speed control of 120-degree conducting controlled permanent magnetic synchronous motor (Implementation) 3.6.4 Overcurrent interrupt handling Overcurrent detection interrupt (Hardware) Disable INTP0 interrupt servicing Generate error event Set the flag of error about overcurrent Figure 3-10 Overcurrent detection process (Hardware detection)
  • Page 46: Website And Support

    RL78/G1G Sensorless Speed control of 120-degree conducting controlled permanent magnetic synchronous motor (Implementation) Website and Support Renesas Electronics Website http://www.renesas.com/ Inquiries http://www.renesas.com/contact/ All trademarks and registered trademarks are the property of their respective owners. R01AN3582EJ0100 Rev.1.00 Page 46 of 46...
  • Page 47: Revision History

    Revision History Description Rev. Date Page Summary - 1.00 Jan.13.2017 First edition issued...
  • Page 48: General Precautions In The Handling Of Microprocessing Unit And Microcontroller Unit Products

    The following usage notes are applicable to all Microprocessing unit and Microcontroller unit 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.
  • Page 49 10. It is the responsibility of the buyer or distributor of Renesas Electronics products, who distributes, disposes of, or otherwise places the product with a third party, to notify such third party in advance of the contents and conditions set forth in this document, Renesas Electronics assumes no responsibility for any losses incurred by you or third parties as a result of unauthorized use of Renesas Electronics products.

Table of Contents