Renesas RX72M Application Note
Renesas RX72M Application Note

Renesas RX72M Application Note

Single-chip motor control via ethercat communications
Hide thumbs Also See for RX72M:
Table of Contents

Advertisement

Quick Links

Application Note
RX72M Group
R01AN5434EJ0110
Rev.1.10
Single-Chip Motor Control via EtherCAT Communications
Aug.31.2020
Outline
This application note describes a sample program for the RX72M. The program has an encoder vector
control function for a permanent magnet synchronous motor (hereinafter referred to as a PMSM) and works
with the EtherCAT communications controller of the RX72M. The module provides an interface via the
EtherCAT Slave Stack Code (SSC) of Beckhoff, which is used in the RX family products that incorporate an
EtherCAT slave controller (ESC) for industrial Ethernet communications.
The FIT module itself does not include the SSC. Therefore, generate the executable code after obtaining the
sample SSC from the EtherCAT Technology Group (ETG Association).
This FIT module is hereinafter referred to as the EtherCAT FIT module.
Target Devices
RX72M group devices
When applying the sample program covered in this application note to another microcomputer, modify the
program according to the specifications for the target microcomputer and conduct an extensive evaluation
and testing of the modified program.
R01AN5434EJ0110 Rev.1.10
Page 1 of 85
Aug.31.2020

Advertisement

Table of Contents
loading

Summary of Contents for Renesas RX72M

  • Page 1 Aug.31.2020 Outline This application note describes a sample program for the RX72M. The program has an encoder vector control function for a permanent magnet synchronous motor (hereinafter referred to as a PMSM) and works with the EtherCAT communications controller of the RX72M. The module provides an interface via the EtherCAT Slave Stack Code (SSC) of Beckhoff, which is used in the RX family products that incorporate an EtherCAT slave controller (ESC) for industrial Ethernet communications.
  • Page 2: Table Of Contents

    RX72M Group Single-Chip Motor Control via EtherCAT Communications Contents Description Overview ..........................4 This Application Note..........................4 Operation Environment ........................... 4 Projects ..............................5 System Overview ........................6 Hardware Configuration .......................... 6 Hardware Specifications .......................... 7 Software Configuration .......................... 10 2.3.1...
  • Page 3 RX72M Group Single-Chip Motor Control via EtherCAT Communications 5.19 R_MTR_AutoSetVariables ........................45 5.20 R_MTR_CtrlGainCalc ..........................46 5.21 R_MTR_UpdatePolling .......................... 47 5.22 R_MTR_GetErrorStatus ........................48 5.23 R_MTR_GetPositionPFStatus ....................... 49 5.24 R_MTR_SetPositionUnits ........................50 5.25 R_MTR_SetActualPositionUnits ......................51 5.26 R_MTR_GetPositionUnits ........................52 5.27 R_MTR_GetSpeedUnits ........................
  • Page 4: Overview

    (hereinafter referred to as a PMSM) and works with the EtherCAT communications controller of the RX72M. The sample program is intended to run on a combination of a board with an RX72M CPU and a 24-V system inverter board.
  • Page 5: Projects

    The project included for the sample program is shown below. In the following sections, the RX72M CPU card plus 24-V system inverter board project is used as an example. When using a different project, read the project name in this application note as that of the given project.
  • Page 6: System Overview

    RX72M Group Single-Chip Motor Control via EtherCAT Communications 2. System Overview 2.1 Hardware Configuration The following figure shows the hardware configuration of the environment where the sample program runs. Figure 2-1 Hardware Configuration R01AN5434EJ0110 Rev.1.10 Page 6 of 85 Aug.31.2020...
  • Page 7: Hardware Specifications

    RX72M Group Single-Chip Motor Control via EtherCAT Communications 2.2 Hardware Specifications Table 2-1 to Table 2-4 list the pin interfaces for use in the sample program. Table 2-1 Motor Control Related Pin Interface Pin Name Description P43 / AN003 Inverter’s main line voltage measurement...
  • Page 8 RX72M Group Single-Chip Motor Control via EtherCAT Communications Table 2-2 EtherCAT Communications Related Pin Interface (1) Pin Name Description PK6/CATLINKACT0 Link/Activity LED control output PK7/CATLINKACT1 Link/Activity LED control output PH1/CATI2CCLK EEPROM I2C clock output P15/CATLEDRUN RUN LED (green LED) control output...
  • Page 9 RX72M Group Single-Chip Motor Control via EtherCAT Communications Table 2-3 EtherCAT Communications Related Pin Interface (2) Pin Name Description PN1/CAT1_ETXD3 4-bit transmit data output (bit 3) PQ5/CAT1_ETXD0 4-bit transmit data output (bit 0) PN0/CAT1_ETXD2 4-bit transmit data output (bit 2)
  • Page 10: Software Configuration

    RX72M Group Single-Chip Motor Control via EtherCAT Communications 2.3 Software Configuration 2.3.1 Software File Configuration Folders and files configured for the sample program are listed in Table 2-5 to Table 2-7. The files in gray-shaded cells are those which required changes from the base project to implement the functionality of the sample program.
  • Page 11 RX72M Group Single-Chip Motor Control via EtherCAT Communications Table 2-6 Configuration of Files for the Motor Control Program (2) Directory File Description motor/ middle/ control/ r_mtr_foc_current.h Current control function r_mtr_foc_current.c definition r_mtr_foc_speed.h Velocity control function r_mtr_foc_speed.c definition r_mtr_foc_position.h Position control function r_mtr_foc_position.c...
  • Page 12 Batch file for modifying the apply_patch.bat SSC source file Modification patch for the RX72M_Motor_YYMMDD.patch single-chip motor control program esi/ RX72M EtherCAT MotorSolution.xml ESI file ssc_config/ Renesas_RX72M_config.xml SSC configuration file RX72M EtherCAT CiA402.esp SSC tool project file Table 2-8 Configuration of Files for the EtherCAT Communications Program (2)
  • Page 13: Software Module Configuration

    RX72M Group Single-Chip Motor Control via EtherCAT Communications 2.3.2 Software Module Configuration Figure 2-2 shows the module configuration of the motor control program. The files added or modified to control the motor control base project by EtherCAT communication are enclosed in a red frame.
  • Page 14 RX72M Group Single-Chip Motor Control via EtherCAT Communications Figure 2-2 Module Configuration of the Motor Control Program R01AN5434EJ0110 Rev.1.10 Page 14 of 85 Aug.31.2020...
  • Page 15 RX72M Group Single-Chip Motor Control via EtherCAT Communications Figure 2-3 shows the module configuration of the EtherCAT communications program. Library Application Provide Motor contorol(user asset) CiA402 Drive Profile Object Dictionary SSC Tool PDO Mapping Generate Application Layer(AL) Mailbox DLL Process Data Interface...
  • Page 16: Software Specifications

    RX72M Group Single-Chip Motor Control via EtherCAT Communications 2.4 Software Specifications The basic software specifications of the sample program are listed below. Table 2-10 Basic Specifications of the Motor Control Program Item Description Control method Vector control Detection of rotor's...
  • Page 17 RX72M Group Single-Chip Motor Control via EtherCAT Communications Table 2-11 Basic Specifications of the EtherCAT Communications Program Item Description Physical layer 100 BASE-TX (IEEE802.3) Baud rate 100 [Mbps] (full duplex) Number of communications ports EtherCAT LED RUN, ERR, STAT, L/A IN, or L/A OUT...
  • Page 18: Cia402 Drive Profile

    RX72M Group Single-Chip Motor Control via EtherCAT Communications 3. CiA402 Drive Profile The CiA402 drive profile is the device profile for drivers and motion controllers and mainly defines functional operations for servo drives, sine wave inverter, and stepping motor controller. In this profile, the multiple operating modes and corresponding parameters are defined as an object dictionary.
  • Page 19: Operating Mode

    RX72M Group Single-Chip Motor Control via EtherCAT Communications 3.1 Operating Mode Among the operating modes specified by the CiA402 standard, the sample program supports the following modes. Table 3-1 List of Supported Operating Modes Operating Mode Support Profile position mode...
  • Page 20: State Transitions

    RX72M Group Single-Chip Motor Control via EtherCAT Communications State Transitions Among the finite state automata (FSAs) defined in the CiA402 standard, the sample program supports the following modes. In Figure 3-2, the state where torque is being applied through the motor is "Operation enabled". The motor is activated at the times of transitions from "Switched on"...
  • Page 21: State Transition Functions

    RX72M Group Single-Chip Motor Control via EtherCAT Communications 3.3 State Transition Functions Table 3-2 shows the CiA402 state transition function list. Each function is linked to the number of each state transition of CiA402 FSA shown in Figure 3-2, and the corresponding function is called when the state transition occurs.
  • Page 22 RX72M Group Single-Chip Motor Control via EtherCAT Communications The specifications of the CiA402 state transition functions are described below. CiA402_StateTransition(N) These functions are called when a state transition (N), where N = 1 to 12 and 14 to 16 as specified for a CiA402 FSA, occurs.
  • Page 23: Object Dictionary

    RX72M Group Single-Chip Motor Control via EtherCAT Communications 3.4 Object Dictionary The portion of the object dictionary supported by the sample program is listed below. Table 3-3 Object Dictionary Supported by the Sample Program Data Index Object Name Category Access...
  • Page 24 RX72M Group Single-Chip Motor Control via EtherCAT Communications Data Index Object Name Category Access Type Mapping 0x60FF Target velocity Mandatory (csv) INT32 RxPDO 0x6402 Motor type Optional UINT16 No 0x6502 Supported drive modes Mandatory (all) UINT32 No R01AN5434EJ0110 Rev.1.10 Page 24 of 85...
  • Page 25: Motion Control Parameters

    The control parameters such as gain obtained through tuning by the motor control development support tool "Renesas Motor Workbench" are reflected in the source code of the motor control program, so the same values are also used in control via EtherCAT.
  • Page 26 RX72M Group Single-Chip Motor Control via EtherCAT Communications The symbols used in the above formulae, other than standard ones and those with meanings stated in the table, are explained in Table 4-2. Table 4-2 Symbols in the Conversion Formulae Symbol...
  • Page 27: Api Functions

    RX72M Group Single-Chip Motor Control via EtherCAT Communications 5. API Functions 5.1 Overview The API functions for the motor control program interface are shown below. Functions Description R_MTR_InitControl Initializes the motor control program. R_MTR_SetUserifMode Enables or disables automatic updating of the command values for position and velocity.
  • Page 28: R_Mtr_Initcontrol

    RX72M Group Single-Chip Motor Control via EtherCAT Communications 5.2 R_MTR_InitControl This function initializes the motor control program. This function must be executed before any other API function is called. Format void R_MTR_InitControl (uint8_t u1_id) Parameters u1_id Specifies the ID of the motor to be controlled.
  • Page 29: R_Mtr_Setuserifmode

    RX72M Group Single-Chip Motor Control via EtherCAT Communications 5.3 R_MTR_SetUserifMode This function enables or disables automatic updating of the command values for position and velocity specified in the user interface module. Format void R_MTR_SetUserifMode (uint8_t u1_user_mode) Parameters u1_user_mode Enables or disables automatic updating.
  • Page 30: R_Mtr_Execevent

    RX72M Group Single-Chip Motor Control via EtherCAT Communications 5.4 R_MTR_ExecEvent This function issues indicators of events with regard to the state of system operation of the motor control program. Format void R_MTR_ExecEvent (uint8_t u1_event, uint8_t u1_id) Parameters u1_event Event Name...
  • Page 31: R_Mtr_Chargecapacitor

    RX72M Group Single-Chip Motor Control via EtherCAT Communications 5.5 R_MTR_ChargeCapacitor This function sets up a wait waits for the inverter’s main line voltage to become stable. This function must be executed before starting motor control. Format void R_MTR_ChargeCapacitor(uint8_t u1_id) Parameters u1_id Specifies the ID of the motor to be controlled.
  • Page 32: R_Mtr_Getloopmodestatus

    RX72M Group Single-Chip Motor Control via EtherCAT Communications 5.6 R_MTR_GetLoopModeStatus This function gets the current setting for the control loop mode. Format uint8_t R_MTR_GetLoopModeStatus(uint8_t u1_id) Parameters u1_id Specifies the ID of the motor to be controlled. MTR_ID_A /* Motor A*/...
  • Page 33: R_Mtr_Setpositionstatus

    RX72M Group Single-Chip Motor Control via EtherCAT Communications 5.7 R_MTR_SetPositionStatus This function sets the input method of the position command value. Format void R_MTR_SetPositionStatus(uint8_t u1_pos_status) Parameters u1_pos_status Input method MTR_POS_CONST(0): 0 command MTR_POS_STEP(1): Direct input (step input) MTR_POS_TRAPEZOID(2): Command value creation...
  • Page 34: R_Mtr_Setposition

    RX72M Group Single-Chip Motor Control via EtherCAT Communications 5.8 R_MTR_SetPosition This function sets the position command value in degrees. Format void R_MTR_SetPosition(int16_t s2_ref_position) Parameters s2_ref_position Position command value [deg] Return Values None Properties The prototypes are declared in r_mtr_driver_acces.h. Description The position command value is a signed value in units of degrees.
  • Page 35: R_Mtr_Getposition

    RX72M Group Single-Chip Motor Control via EtherCAT Communications 5.9 R_MTR_GetPosition This function gets the value in degrees of the current position. Format int16_t R_MTR_GetPosition(uint8_t u1_id) Parameters u1_id Specifies the ID of the motor to be controlled. MTR_ID_A /* Motor A*/...
  • Page 36: R_Mtr_Getpositioningflag

    RX72M Group Single-Chip Motor Control via EtherCAT Communications 5.10 R_MTR_GetPositioningFlag This function gets the value of the positioning completed flag. Format uint8_t R_MTR_GetPositioningFlag (uint8_t u1_id) Parameters u1_id Specifies the ID of the motor to be controlled. MTR_ID_A /* Motor A*/...
  • Page 37: R_Mtr_Setspeed

    RX72M Group Single-Chip Motor Control via EtherCAT Communications 5.11 R_MTR_SetSpeed This function sets the velocity command value in rpm. Format void R_MTR_SetSpeed(int16_t ref_speed) Parameters ref_speed Velocity command value [rpm] Return Values None Properties The prototypes are declared in r_mtr_driver_acces.h. Description The unit of velocity command values is rpm.
  • Page 38: R_Mtr_Getspeed

    RX72M Group Single-Chip Motor Control via EtherCAT Communications 5.12 R_MTR_GetSpeed This function gets the current velocity value in rpm. Format int16_t R_MTR_GetSpeed (uint8_t u1_id) Parameters u1_id Specifies the ID of the motor to be controlled. MTR_ID_A /* Motor A*/ Return Values...
  • Page 39: R_Mtr_Setdir

    RX72M Group Single-Chip Motor Control via EtherCAT Communications 5.13 R_MTR_SetDir This function sets the direction of the motor’s rotation. Format void R_MTR_SetDir (uint8_t dir, uint8_t u1_id) Parameters Rotation direction MTR_CW(0): Clockwise MTR_CCW(1): Counterclockwise u1_id Specifies the ID of the motor to be controlled.
  • Page 40: R_Mtr_Getdir

    RX72M Group Single-Chip Motor Control via EtherCAT Communications 5.14 R_MTR_GetDir This function gets the currently set direction of motor rotation. Format uint8_t R_MTR_GetDir(uint8_t u1_id) Parameters u1_id Specifies the ID of the motor to be controlled. MTR_ID_A /* Motor A*/ Return Values...
  • Page 41: R_Mtr_Getstatus

    RX72M Group Single-Chip Motor Control via EtherCAT Communications 5.15 R_MTR_GetStatus This function gets the state of system operation of the motor control program. Format uint8_t R_MTR_GetStatus(uint8_t u1_id) Parameters u1_id Specifies the ID of the motor to be controlled. MTR_ID_A /* Motor A*/...
  • Page 42: R_Mtr_Inputbuffparamreset

    RX72M Group Single-Chip Motor Control via EtherCAT Communications 5.16 R_MTR_InputBuffParamReset This function sets the buffer of variables for ICS input to the default value. Format void R_MTR_InputBuffParamReset(void) Parameters None Return Values None Properties The prototypes are declared in r_mtr_driver_acces.h. Description The buffer of variables for ICS input is for use with the motor control parameters, input by the user interface module, and is for use by the interface module.
  • Page 43: R_Mtr_Ctrlinput

    RX72M Group Single-Chip Motor Control via EtherCAT Communications 5.17 R_MTR_CtrlInput This function copies an ICS input variable to the buffer of variables for ICS input. Format void R_MTR_CtrlInput(mtr_ctrl_input_t *st_ctrl_input) Parameters Pointer to an mtr_ctrl_input_t type structure Return Values None Properties The prototypes are declared in r_mtr_driver_acces.h.
  • Page 44: R_Mtr_Setvariables

    RX72M Group Single-Chip Motor Control via EtherCAT Communications 5.18 R_MTR_SetVariables This function sets the contents of the buffer of variables for ICS input as the motor control parameters. Format void R_MTR_SetVariables(void) Parameters None Return Values None Properties The prototypes are declared in r_mtr_driver_acces.h.
  • Page 45: R_Mtr_Autosetvariables

    RX72M Group Single-Chip Motor Control via EtherCAT Communications 5.19 R_MTR_AutoSetVariables This function sets the position and velocity command values in the buffer of variables for ICS input as the given motor control parameters. Format void R_MTR_AutoSetVariables(void) Parameters None Return Values...
  • Page 46: R_Mtr_Ctrlgaincalc

    RX72M Group Single-Chip Motor Control via EtherCAT Communications 5.20 R_MTR_CtrlGainCalc This function calculates the gain for the motor control parameters. Format void R_MTR_CtrlGainCalc(void) Parameters None Return Values None Properties The prototypes are declared in r_mtr_driver_acces.h. Description This function calculates the gain for PI control, IPD control, and velocity observer control.
  • Page 47: R_Mtr_Updatepolling

    RX72M Group Single-Chip Motor Control via EtherCAT Communications 5.21 R_MTR_UpdatePolling This function polls the write enable flag among the motor control parameters. Format void R_MTR_UpdatePolling(void) Parameters None Return Values None Properties The prototypes are declared in r_mtr_driver_acces.h. Description This function polls the write enable flag (u1_trig_enable_write) among the motor control parameters. If the...
  • Page 48: R_Mtr_Geterrorstatus

    RX72M Group Single-Chip Motor Control via EtherCAT Communications 5.22 R_MTR_GetErrorStatus This function gets the error state of the encoder position and velocity control. Format uint16_t R_MTR_GetErrorStatus(uint8_t u1_id) Parameters u1_id Specifies the ID of the motor to be controlled. MTR_ID_A /* Motor A*/...
  • Page 49: R_Mtr_Getpositionpfstatus

    RX72M Group Single-Chip Motor Control via EtherCAT Communications 5.23 R_MTR_GetPositionPFStatus This function gets the profile state of encoder position control. Format uint8_t R_MTR_GetPositionPFStatus(uint8_t u1_id) Parameters u1_id Specifies the ID of the motor to be controlled. MTR_ID_A /* Motor A*/ Return Values...
  • Page 50: R_Mtr_Setpositionunits

    RX72M Group Single-Chip Motor Control via EtherCAT Communications 5.24 R_MTR_SetPositionUnits This function sets the position command value (number counted). Format void R_MTR_SetPositionUnits (int32_t s4_position_units) Parameters Position command value [count] Return Values None Properties The prototypes are declared in r_mtr_driver_ecat_acces.h. Description The position command value is a signed value (number counted).
  • Page 51: R_Mtr_Setactualpositionunits

    RX72M Group Single-Chip Motor Control via EtherCAT Communications 5.25 R_MTR_SetActualPositionUnits This function sets the current position (number counted). Format void R_MTR_SetActualPositionUnits (int32_t s4_position_units) Parameters Position command value [count] Return Values None Properties The prototypes are declared in r_mtr_driver_ecat_acces.h. Description The position command value is a signed value (number counted).
  • Page 52: R_Mtr_Getpositionunits

    RX72M Group Single-Chip Motor Control via EtherCAT Communications 5.26 R_MTR_GetPositionUnits This function gets the value (number counted) corresponding to the current position. Format int32_t R_MTR_GetPositionUnits(uint8_t u1_id) Parameters u1_id Specifies the ID of the motor to be controlled. MTR_ID_A /* Motor A*/...
  • Page 53: R_Mtr_Getspeedunits

    RX72M Group Single-Chip Motor Control via EtherCAT Communications 5.27 R_MTR_GetSpeedUnits This function gets the current velocity value (number counted per second). Format int32_t R_MTR_GetSpeedUnits(uint8_t u1_id) Parameters u1_id Specifies the ID of the motor to be controlled. MTR_ID_A /* Motor A*/...
  • Page 54: R_Mtr_Setspeedunits

    RX72M Group Single-Chip Motor Control via EtherCAT Communications 5.28 R_MTR_SetSpeedUnits This function sets the velocity command value. Format void R_MTR_SetSpeedUnits(int32_t s4_speed_units) Parameters Velocity command value [count/s] Return Values None Properties The prototypes are declared in r_mtr_driver_ecat_acces.h. Description The velocity command value is a signed value (number counted per second).
  • Page 55: R_Mtr_Setaccelerationunits

    RX72M Group Single-Chip Motor Control via EtherCAT Communications 5.29 R_MTR_SetAccelerationUnits This function sets the acceleration command value in count/s Format void R_MTR_SetAccelerationUnits(uint32_t u4_acceleration_units) Parameters Acceleration command value [count/s Return Values None Properties The prototypes are declared in r_mtr_driver_ecat_acces.h. Description The acceleration command value is a signed value in count/s The value is converted to the 16.16-bit fixed point format.
  • Page 56: R_Mtr_Setdecelerationunits

    RX72M Group Single-Chip Motor Control via EtherCAT Communications 5.30 R_MTR_SetDecelerationUnits This function sets the deceleration command value in count/s Format void R_MTR_SetDeccelerationUnits(uint32_t u4_deceleration_units) Parameters Deceleration command value [count/s Return Values None Properties The prototypes are declared in r_mtr_driver_ecat_acces.h. Description The deceleration command value is a signed value in count/s The value is converted to the 16.16-bit fixed point format.
  • Page 57: Checking Operation Of The Application On The Solution Kit

    The sample program covered in this manual runs in the environment below. Table 6.6-1 Operating Environment Item Description Boards to be used RX72M CPU board TS-TCS02796 from Tessera Technology RX23T inverter board : RTK0EM0006S01212BJ) Motor encoder I/F board RX CPU (RXv3)
  • Page 58: Operating Environment Settings And Connection

    RX72M Group Single-Chip Motor Control via EtherCAT Communications 6.2 Operating Environment Settings and Connection Connect the required wiring between the power supply, motor, and inverter board. Connect the three-phase power lines of the motor to the U, V, and W phase outputs of the inverter board as shown below.
  • Page 59 RX72M Group Single-Chip Motor Control via EtherCAT Communications Connect the 5-V power supply points of the encoder I/F board and CPU board as shown below. 5-V cable Figure 6-3 Connection of the 5-V Power Supply Connect the inverter board and CPU board as follows.
  • Page 60 RX72M Group Single-Chip Motor Control via EtherCAT Communications Connect the power supply to the inverter board as follows. 24-V AC adapter Figure 6-5 Connection of the Power Supply for the Inverter The overall configuration of the connected parts is shown below.
  • Page 61 The details of the inverter board are shown below. -- The power is supplied through the main switch. -- Connect the ICS I/F when using the RMW (Renesas Motor Workbench). -- SW1 and SW2 are not used in control as covered by this manual.
  • Page 62: Building The Sample Program

    Double-click on the SSC project file of the sample program to activate the SSC tool. ecat_cia402_motor_rsskrx72m\src\smc_gen\r_ecat_rx\utilities\rx72m\ssc_config \RX72M EtherCAT CiA402.esp Click on [Project] → [Create New Slave Files], and then click on [Current new Slave Files] → [Start]. When the source code has been generated normally, "New files created successfully" will be displayed.
  • Page 63 RX72M Group Single-Chip Motor Control via EtherCAT Communications If you have not installed the patch file, GNU Patch Ver2.5.9 or later is required. If it has been installed, skip this step. Download the patch file (Ver2.5.9) from the following Web page and store "patch.exe" in a folder that has a path executable from the command prompt.
  • Page 64: Importing The Sample Project Into The E2 Studio

    RX72M Group Single-Chip Motor Control via EtherCAT Communications 6.4 Importing the Sample Project into the e2 studio Click on [File] → [Import]. In the [Select an import wizard] dialog box, select [General] → [Existing Project to Workspace] and click on [Next].
  • Page 65: Programming And Debugging

    RX72M Group Single-Chip Motor Control via EtherCAT Communications 6.5 Programming and Debugging Left-click on the "ecat_cia402_motor_rsskrx72m" project name in the project explorer, click on the arrow next to the [Build] button (hammer icon), and select [Hardware Debug] from the drop-down menu.
  • Page 66 RX72M Group Single-Chip Motor Control via EtherCAT Communications Click on "ecat_cia402_motor_rsskrx72m Hardware Debug" to download the program to the target and press the debugging button to start it. A firewall warning for "e2-server-gdb.exe" may be displayed. Select the checkbox for [Private networks such as home and work networks] and click on <Allow access>.
  • Page 67: Connection With Twincat (Writing The Esi File)

    Before starting TwinCAT, copy the ESI file included in the release folder to "/TwinCAT / 3.x / Config / IO / EtherCAT". "ecat_cia402_motor_rsskrx72m\src\smc_gen\r_ecat_rx\utilities\rx72m\esi\ RX72M EtherCAT MotorSolution.xml" Add the TwinCAT driver through the following procedure. This is only required the first time.
  • Page 68 RX72M Group Single-Chip Motor Control via EtherCAT Communications Connect the LAN cable to the evaluation board. As the In/Out direction of EtherCAT has been decided, connect it to CN2 IN. Select [Beckhoff] → [TwinCAT3] → [TwinCAT XAE (VS2013)] from the start menu. After starting the program, select [FILE] →...
  • Page 69 Select [Download from List]. A list of ESI files registered with TwinCAT3 will appear. Select the relevant file. For the motor board, (10) select [RX72M EtherCAT MotorSolution.xml]. For the I/O board, select [Renesas EtherCAT RX72M.xml]. R01AN5434EJ0110 Rev.1.10 Page 69 of 85...
  • Page 70 RX72M Group Single-Chip Motor Control via EtherCAT Communications Reflect the settings of the downloaded ESI file. Since this requires resetting the slave, temporarily (11) delete the slave from the TwinCAT network. After the slave has been reset, the ESI file will be read by scanning it again. Execute this with "Activate Free Run".
  • Page 71: Checking The Connection With Codesys

    RX72M Group Single-Chip Motor Control via EtherCAT Communications 6.7 Checking the Connection with CODESYS This section describes the procedure for connecting and operating an evaluation environment in which the sample program is installed along with the CODESYS software PLC. 6.7.1 Device Network Settings Set the IP address of the host before setting the device.
  • Page 72: Starting The Plc

    RX72M Group Single-Chip Motor Control via EtherCAT Communications After you start the project, the device tree is displayed. 6.7.3 Starting the PLC Check the state of the software PLC operation from the system tray. If it is stopped, right-click on the PLC window and select "Start PLC"...
  • Page 73: Updating The Slave Device

    Using the EtherCAT slave device requires installing the ESI file that contains the device information. Use "Renesas EtherCAT RX72M.xml" and "RX72M EtherCAT MotorSolution.xml" as the ESI files. From the [Tools] menu of CODESYS, select [Device Repository]. In the Device Repository dialog box, click on [Install] to display the file dialog box. Specify the ESI file "RX72M EtherCAT MotorSolution.xml".
  • Page 74: Setting Up The Connection With Plc

    RX72M Group Single-Chip Motor Control via EtherCAT Communications 6.7.5 Setting up the Connection with PLC Double-click on [Device (CODESYS Control Win V3)] in the tree of the [Devices] window to open the [Communication Settings] screen. You can set up communications to connect the development environment to the software PLC service on this screen.
  • Page 75 RX72M Group Single-Chip Motor Control via EtherCAT Communications If the scan was successful, the PC will be registered with GateWay. Available state Set the network to be used. Double-click on [EtherCAT_Master] to open the [General] screen for the corresponding settings.
  • Page 76 RX72M Group Single-Chip Motor Control via EtherCAT Communications Select the network to be used. After having selected the network, press [Browse] on the [EtherCAT_Master] screen to confirm the MAC address. Build the program. Select [Build] from the [Build] menu. R01AN5434EJ0110 Rev.1.10 Page 76 of 85 Aug.31.2020...
  • Page 77 RX72M Group Single-Chip Motor Control via EtherCAT Communications After completing the build, log in. Select [Login] from the menu. R01AN5434EJ0110 Rev.1.10 Page 77 of 85 Aug.31.2020...
  • Page 78 RX72M Group Single-Chip Motor Control via EtherCAT Communications After having logged in normally, the operation will be in the STOP state. Note, however, that the state of operation may shift to RUN without having been in the STOP state. Start the operation. Press the button to start or select the run icon on the toolbar.
  • Page 79 RX72M Group Single-Chip Motor Control via EtherCAT Communications If the connection was successful, the network connection will have been made and operation will start (10) as shown below. Device status : The PLC is connected and the application is running.
  • Page 80: Using Codesy To Check Operation

    RX72M Group Single-Chip Motor Control via EtherCAT Communications 6.8 Using CODESY to Check Operation The program for driving the attached motor is built from "rx72m_motor_control.project". In the state where the network connection has been completed, the motor is controlled through the CODESYS GUI.
  • Page 81: Documents For Reference

    7. Documents for Reference User’s Manual: Hardware RX72M Group User’s Manual: Hardware (Document No. R01UH0804) Renesas Starter Kit+ for RX72M User’s Manual (Document No. R20UT4383) RX72M Group Communications Board Hardware Manual (Document No. R01AN4661) (Download the latest version from the Renesas Electronics website.) Startup Manual RX72M Group RSK Board EtherCAT Startup Manual (Document No.
  • Page 82: Appendix

    RX72M Group Single-Chip Motor Control via EtherCAT Communications 8. APPENDIX This motor board can be used with the RMW (Renesas Motor Workbench). RMW (Renesas Motor Workbench) related procedure Download RMW V2.0 from the following Web page https://www.renesas.com/jp/ja/solutions/proposal/motor-control.html#kits Proceed through the preparations according to Table 3.1 in the RMW user’s manual (r21uz0004jj0201- motor.pdf), which will be in the RMW folder.
  • Page 83 RX72M Group Single-Chip Motor Control via EtherCAT Communications Start RMW and specify the following files. - Environment file ecat_cia402_motor_rsskrx72m \ecat_cia402_motor_rsskrx72m.rmt -map file ecat_cia402_motor_rsskrx72m\HardwareDebug \ecat_cia402_motor_rsskrx72m.map Connect RMW and the motor board When Connection → COM is specified, the following is displayed if the connection was made correctly.
  • Page 84 RX72M Group Single-Chip Motor Control via EtherCAT Communications Get the motor drive waveforms. [Analyzer] → Press the [RUN] button in the [Scope Window] Note: The example below shows the waveforms when Target Position is changed from 0 to 40000. R01AN5434EJ0110 Rev.1.10 Page 84 of 85 Aug.31.2020...
  • Page 85 RX72M Group Single-Chip Motor Control via EtherCAT Communications Revision History Description Rev. Date Page Summary 1.00 June 10, 2020 — First edition issued 1.10 Aug. 31, 2020 To change the file configuration by supporting EtherCAT FIT module Rev.1.10 2.3.1 Table 2-7 is revised. Table 2-8 is added.
  • Page 86 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 87 You are responsible for implementing safety measures to guard against the possibility of bodily injury, injury or damage caused by fire, and/or danger to the public in the event of a failure or malfunction of Renesas Electronics products, such as safety design for hardware and software, including but not limited to redundancy, fire control and malfunction prevention, appropriate treatment for aging degradation or any other appropriate measures.

Table of Contents