This is a new article series in which we will use the Mitsubishi RJ71SEIP91-T4 to perform various communication tests. First we will introduce the RJ71SEIP91-T4 and explain how to build the TwinCAT3 4026’s Ethernet/IP Slave and Class 1 communication from scratch.
Come on, let’s enjoy FA.
Reference Link
Reference Video
RJ71SEIP91-T4?
Mitsubishi Electric has developed the MELSEC iQ-R series CIP Safety Module (Common Industrial Protocol), the RJ71SEIP91-T4, which is the ideal solution for applications seeking to implement safety communication via CIP Safety.
This module can handle and interconnect a wide variety of third-party or Mitsubishi Electric devices (Ethernet/IP or CIP Safety compliant).
It should be noted that we are operating an iQ-R Safety PLC with an iQ-R CIP Safety module that occupies the RJ71SEIP91-T4 dual slot. This module supports both Ethernet/IP and CIP Safety protocols.
✓KEY BENEFITS
- Dual protocol support: Modules support dual protocols, specifically Ethernet/IP and CIP Safety, providing versatility and integration capabilities for a variety of industrial environments.
- Transmission of safety signals: Excellent for safe transmission of safety signals, ensuring reliable communication of critical safety data in industrial automation systems.
- Efficient Safety Management: The RJ71SEIP91-T4 enhances safety management by facilitating the implementation of safety functions and provides for a robust and reliable safety framework for the entire control system.
- Compliant with international safety standards EN ISO 13849-1 Category 4 PL e and IEC 61508 SIL 3.
- Supports CIP safety communication and EtherNet/IP general communication.
- Supports CC-Link IE TSN configuration on the same PLC rack.
- Up to 2 CIP Safety modules per rack
- Centralized management of general and safety control programs in GX Works3 PLC programming software
- TUV Rheinland certified function blocks can be used in the GX Works3 programming environment
- Tested with various 3rd party robots, PLC Peer to Peer communication, gate switches, area scanners, VFDs, remote I/O
- CIP Safety traffic can be tunneled to target devices via iQ-R CC-Link IE TSN Master
✓Example Layout
Here is an example of RJ71SEIP91-T4 in use.
✓Specification
These are the specifications for RJ71SEIP91-T4.
✓Applicable CPU Modules
When using the CIP Safety module RJ71SEIP91-T4, the RnSF CPU must be used,
Indicates the availability of the CIP Safety module when using the CPU module. CPU modules are denoted by the following symbols.
Note that attaching a CIP Safety module to a CPU module that cannot be used will result in an error when writing engineering tools.
Also, the firmware version of the CPU module must be 28 or later.
✓The number of mountable modules
Although the CIP safety module is a 2-slot module, it is counted as the 1/2th module as well as the 1-slot module.
Also note that if the CIP Safety module is installed without setting the parameters, an error (error code: 3110H) will occur in the CIP Safety module when the module is turned on.
✓Available Software Packages
To configure the settings of the CIP Safety module, you will need the engineering tool and the CIP Safety Configuration Tool, which can be downloaded from Mitsubishi Electric’s website.
- Engineering Tool (GX Works3) Version 1.090U or later
- CIP Safety Configuration Tool Version 1.000A or later
EtherNet/IP CIP Safety on EtherNet/IP Network…
CIP Safety on EtherNet/IP networks and EtherNet/IP networks consists of CIP Safety modules and EtherNet/IP devices.
Scanner and adapter
For EtherNet/IP networks and CIP Safety on EtherNet/IP networks, station types are divided into Scanner and Adapter.
Scanner
The Scanner in EtherNet/IP has control information and controls the entire network. It can operate a device with an originator or target connection as a Scanner.
Adapter
Adapter can be a station other than Scanner. It can operate any device that can be connected to the target as an Adapter.
Topology
Various Topologies are supported for Ethernet/IP.
Line topology
Connect modules in a line topology using an Ethernet cable.
Star topology
Modules can be connected in a star topology using switching hubs and Ethernet cables.
Ring topology
Connect modules in a ring topology using an Ethernet cable.
Class1 communications
With Class 1 communications, data communication is performed in a fixed scan by establishing a connection between the CIP Safety module and the EtherNet/IP device.
There are two ways to establish its Class1 Communications.
- instance IDs
- tag names
The originator or target allocates a send/receive range for each connection to buffer memory for automatic data communication. This data is accessed from the program and is usually expanded into the CPU module’s device memory by auto-refresh.
Instance communications
Instance communication is primarily used to communicate with an EtherNet/IP device in fixed scan. Data communication is performed between the CIP Safety module and the EtherNet/IP device in a fixed scan by establishing a connection using the instance ID.
The CIP Safety module can function as an originator or target, and the following connection types are available
- Exclusive Owner
- Input Only
- Listen Only
Exclusive Owner Connection was used in this article. Exclusive Owner is used when a single connection is used to send and receive data.
Connection Open/Response
When the CIP Safety module (originator) sends a connection open request, the EtherNet/IP device (target) responds and establishes a connection.
Cyclic Transmission Target→Originator
The EtherNet/IP device (target) transmits data via cyclic transmission and stores the data in the ‘Class1 Input Area’ (UnG24576 to UnG57343, UnG1073152 to UnG1105919) of the CIP Safety module (originator). The data is stored in the ‘Class 1 Input Area’ (UnG24576 to UnG57343, UnG1073152 to UnG1105919) of the CIP Safety module (originator).
Cyclic Transmission Originator→Target
Data in the “Class 1 Output Area” (UnG61440 to UnG94207, UnG1110016to UnG1142783) of the CIP Safety module (originator) is sent in cyclic transmission and the data is stored in the receive The data is stored in the receive data buffer of the EtherNet/IP device (target).
Implementation
This is the configuration used in this article. Mitsubishi Electric RJ71SEIP91-T4 starts up as a Scanner, and TwinCAT 4026 side uses TF6280 to build an Ethernet/IP Adapter for instance communication.
TwinCAT3 Side
First build the TwinCAT3 side.
Add RT Ethernet Driver
To add a Real Time Ethernet Driver, go to I/O>Devices>Add New Item.
Configure the Ethernet Adapter to be used as the Ethernet/IP Adapter.
Done!
Sync Task
Open the Sync Task tab and set the task to run the Ethernet/IP Adapter.
Add a new IO task with Create new I/O task.
Set the task name.
Done!Finally, use Cycle ticks to set the cycle of the corresponding Task in accordance with the application.
Add Ethernet/IP Adapter
Next, click on EtherNet/IP>EtherNet/IP Adapter(Slave).
Add Slave
Now that you have added an Ethernet/IP Adapter, right click>Add New Item to add an Ethernet/Ip Slave under that Adapter.
Select TC Ethernet/IP Slave >OK to proceed.
Done!
Configure IP Address
Click on the Slave you just added and open the Settings Tab; set the IP Address and Network Mask to match your application.
Done!For this article, 192.168.250.111/24 was set up.
Append IO Assembly
Now, to add an Assembly Instance, right-click on Ethernet/Ip Slave and click >Append IO Assembly.
Done!Assembly Instance has been added.
No input/output data is set for Assembly Instance on Default.
Add Input
To add input data to the Assembly Instance, go to Inputs>Right Click>Add New Item.
This is the TwinCAT screen for adding variables.
Click Create Array Type to add array variables.
This is the screen for setting array variables.
Check in 0 to define a 1-dimensional array and set the length of the array.
Finally, select an array variable and add the variable with >Ok.
Done!
Add Output
To add output data to the Assembly Instance, go to Outputs>Right Click>Add New Item.
Select the array variable you just added and add the variable with >Ok.
Done!
Add PLC
Next, to add a PLC project, go to PLC>Add New Item.
Select Standard PLC Project > Add to proceed.
Done!PLC projects have been added.
Add GVL
Next, to add a Global Variable List, click GVLs>right click>Add>Global Variable List.
Enter the Global Variable List name and press Ok to proceed.
Define Process I/O data as follows.
{attribute ‘qualified_only’} VAR_GLOBAL Box1Ass1_IN AT %I*:ARRAY[0..29]OF BYTE; Box1Ass1_OUT AT %Q*:ARRAY[0..29]OF BYTE; END_VAR |
MAIN
Next, add a program for communication testing as follows.
PROGRAM MAIN VAR inputData,outputData:ARRAY[0..29]OF BYTE; inputData1:INT; outputData1,outputData2:INT; TestFalse:BOOL; END_VAR inputData:=GVL.Box1Ass1_IN; GVL.Box1Ass1_OUT:=outputData; MEMMOVE(destAddr:=ADR(inputData1),srcAddr:=ADR(inputData),n:=SIZEOF(INT)); IF TestFalse THEN outputData1:=16#5152; outputData2:=16#1712; ELSE outputData1:=16#1919; outputData2:=16#2123; END_IF MEMMOVE(destAddr:=ADR(GVL.Box1Ass1_OUT[0]),srcAddr:=ADR(outputData1),n:=SIZEOF(INT)); MEMMOVE(destAddr:=ADR(GVL.Box1Ass1_OUT[28]),srcAddr:=ADR(outputData2),n:=SIZEOF(INT)); |
Build Solution
Compile the project under Build>Build Solution.
Mapping
Now, in order to map the Process I/O of the Ethernet/Ip Slave to the variables of the PLC project, select Inputs>Right click>Change Link.
Select the input variables you just added with GVL.
Mapping the Process output variables to the variables in the PLC project is done in the same way as before.
Select the output variable you just added in GVL.
Export EDS File
Finally, to export the EDS File of the Ethernet/Ip Slave, click Ethernet/Ip Slave>right click>Export EDS File.
Sets the location of the EDS File.
Done!EDS File has been added.
Activate Configuration
Click TwinCAT>Activate Configuration to download the Hardware Configuration to TwinCAT Runtime.
OK to proceed.
If there are not enough licenses, click Yes to move to the Trial license entry screen.
Enter the same string as the Security code and press OK to proceed.
Ok switches TwinCAT Runtime to Run Mode.
Login
Download the PLC project to TwinCAT Runtime by going to PLC>Login.
Proceed with Yes.
Start
Finally, switch PLC Runtime to Run Mode.
IQ-R Side
The next step is to build the IQ-R side of the Mitsubishi Electric.
Register Profile
Download the Profile of RJ71SEIP91-T4 from Mitsubishi Electric’s website.
https://emea.mitsubishielectric.com/fa/products/cnt/plc/allcpu/rj71seip91-t4.html#downloads
Next, click on Tool>Profile Managment>Register to register the Profile to GXWORKS3.
Select the file XXXX.ipar that you have just downloaded.
Done!Profile registration for RJ71SEIP91-T4 was successful.
Install Module Label
Next, to install the Module Label for RJ71SEIP91-T4 in GXWORKS3, please copy the RJ71SEIP91-T4.mslu downloaded earlier to C:\Program Files (x86)\MELSOFT\MSF\Common\Library\ UNITFB Directory.
Next, run C:\Program Files (x86)\MELSOFT\GPPW3\GXW3PluginPreloader.exe with administrator rights.
Install Configuration Tools
To build the RJ71SEIP91-T4 module, you need to use the dedicated Configuration Tools, please download the RJ71SEIP91-T4 CIP Safety Configuration Tool from the Link below.
https://emea.mitsubishielectric.com/fa/products/cnt/plc/allcpu/rj71seip91-t4.html#downloads
Unzip the ZIP File you just downloaded and click on Setup,exe.
Proceed with Next>.
Set the installation location for the CIP Safety Configuration Tool and proceed with Next>.
Click Install to start setting up the CIP Safety Configuration Tool.
Please wait a moment…
Proceed with Yes to pass the Packets in the CIP Safety Configuration Tool through the Firewall.
Done!
Create New Project
Start GXWORKS3 and add a new project by going to Project>New.
The R32SF Safety PLC was used in this article.
To use the Safety PLC, a User name and Password must be set in the project.
Set User name and Password, and press “Ok” to proceed.
Once the project is created, click Setting Change.
Put on the Use Module Label Option.
Done!A project has been created.
Module Configuration
To configure Hardware Configuration, click on Module Configuration.
This is the Module Configuration screen.
Add R35B
Drop IQ-R Series>Main Base>R35B and add the Base Unit used in this article.
Done!
Add R61P
The next step is to add the power supply module used in this article at Power Suppy>R61P.
Done!
Add PLC into PLC Rack
Drop the R32SF Safety PLC into the CPU Slot.
Done!We installed the CPU in Rack.
Add R6SFM
CPU Extension>R6SFM to add CPU safety extension units.
Done!
Add RJ71SEIP91-T4
Finally, drop Network>RJ71SEIP91-T4 into Slot1.
Done!
Save the Configuration
Next, save the Module Configuration.
OK to proceed.
M+Global
Since we have just enabled the Module Label use setting, a Global Variable List named Label>Global Label>M+Global has been added.
M+Global has now defined labels for the CPUs and modules used in this article (RJ71SEIP91-T4, of course).
Check your Configuration
Convert>Rebuild All once to check for Hardware Configuration problems.
Reset User
Let’s initialize the PLC data and reset all the data in case you forgot the Password of the R32SF Safety PLC main unit, click Online>User Authentication>Initialize all PLC Data.
Write User Data
Next, in order to write the User Data for this project to the CPU, go to Online>User Authentication>Write User information to PLC to write the User data to R32SF Safety PLC.
Proceed with Yes.
Proceed further with Yes.
Done!
Write to PLC
Execute Online>Write to PLC to write the Hardware Configuration to the CPU once.
Check RJ71SEIP91-T4 IP Address
Click Diagnosis>System Monitor to see the IP address of the current RJ71SEIP91-T4.
Double-click the RJ71SEIP91-T4 module.
You can check the diagnostic information of RJ71SEIP91-T4 and open the Module Information List Tab.
Detailed information on RJ71SEIP91-T4 is displayed and P1=192.168.250.11 is confirmed.
Configure Ethernet/IP Network
Next, to build the Ethernet/IP network, double-click RJ71SEIP91-T4>CIP Safety Configuration Tool to launch the tool.
This is the initial screen of the CIP Safety Configuration Tool.
Setup the Local Adapter
Select the Safety Communication Module and go to >General>Local Network interface IP address to use and set the Ethernet Port to communicate with the RJ71SEIP91-T4.
Configure the appropriate Ethernet interface (your PC) from the Drop-List.
Done!
Configure Network1
The RJ71SEIP91-T4 used in this article is Port 1 of the RJ71SEIP91-T4, and as written on the RJ71SEIP91-T4 itself, Port A and Port B marked with P1 are Network 1, and Port A and Port B marked with P2 are Network 2.
Click Network1.
Detect the Network1
Find RJ71SEIP91-T4 under General>Scanner IP Address Settings>Detect.
Done!The IP address of the Port currently connected to the PC and RJ71SEIP91-T4 is shown in the Idnetifier column (192.168.250.11).
Next, OK to apply the settings.
Done!RJ71SEIP91-T4 Port1 IP address setting is reflected.
Ping Network1
Ping>Send Ping to confirm communication with Network1 of RJ71SEIP91-T4.
Done!Ping command passed.
Add EDS File
Next, click on Device Library>Add EDS to add the EDS File to the CIP Safety Configuration Tool.
The Add EDS File screen appears, this time we want to add a single EDS File, so click Add File>Browse.
Select the EDS File you just exported with TwinCAT3 and proceed with Open.
Import the EDS File with Next>.
Proceed with Next>.
Done!
The TwinCAT3 Ethernet/IP Slave device that was added earlier has been added to the Device Library.
Detect Network
Click the Tab under Network Detection to search for Ethernet/IP devices.
Click the green arrow button to search the network.
OK to proceed.
Done!We found the TwinCAT3 Ethernet/IP Slave we just added.
Add Adapter to Network
Add TwinCAT3 Ethernet/IP Slave to Network1.
Done!
Ping
Confirm communication with TwinCAT3 Ethernet/IP Slave using the Send Ping function.
Done!
Standard Settings
Open the Standard Settings tab and configure Connection settings according to your application. In this article, we will use the Exclusive Owner connection.
Information
Open the Information Tab and click the Refresh button to get information such as Vendor ID from the TwinCAT3 Ethernet/IP Slave.
Transfer
Transfer the Hardware Configuration from the CIP Safety Configuration Tool to the RJ71SEIP91-T4 by clicking Safety Communication Module>General>Save configuration to Module. Click Safety Communication Module>General>Save configuration to Module and transfer the configuration to RJ71SEIP91-T4.
Please wait a moment…
Done!
Start Diagonstic
Check the diagnostic information for the RJ71SEIP91-T4 under Configuration>Start Diagnosis.
OK to proceed.
Done!It is currently connected to Box 1 (TwinCAT3 Ethernet/IP Slave) and exchanging Cyclic IO data, so it has a green circle next to Box 1.
The Diagnostics tab has been increased to CIP Safety Configuration Tool, and the Connection Status confirms a normal connection to the TwinCAT3 Ethernet/IP Slave.
I was also able to check the current status of EIP and Scanner in Network1’s Diagnostics.
Identifier=2 for TwinCAT3 Ethernet/IP Slave in Connection Status, so we have confirmed that TwinCAT3 Ethernet/IP Slave is the second connection.
Global Variables‐ Input Data Size
The size of the data received by the CIP Safety module from the EtherNet/IP device during Class 1 communication is stored in that variable, in words, starting from connection number 1 in ascending order.
We have just confirmed that Connection=2 for the TwinCAT3 Ethernet/IP Slave, so the input data size for that Connection is 17 words.
Global Variables‐ Output Data Size
The size of the data sent by the EtherNet/IP device by the CIP Safety module during Class 1 communication is stored in that variable, in words, in ascending order starting with Connection number 1.
We have just confirmed that Connection=2 for the TwinCAT3 Ethernet/IP Slave, so the output data size for that Connection is 17 words.
Global Variables ‐stEIPCls1_P1.uSet_CommunicationStartupRequest_D
Writing 1 to this register will cause Network1 of RJ71SEIP91-T4 to start communication.
Global Variables ‐RJ71SEIP91_1. bSts_ModuleReady
If this register is True, it indicates that the RJ71SEIP91-T4 module is ready.
Global Variables‐ Input Data Offset
The offset addresses of the data storage locations (‘Class1 Input Area’ (UnƟG24576, UnƟG1073152)) received from the EtherNet/IP device from the CIP Safety module during Class1 communication are stored in ascending order starting with connection number 1. Note that the offset address for each connection is aligned to start in 2-word units.
Global Variables‐ Output Data Offset
The offset addresses of the data storage locations (‘Class1 Output Area’ (UnG61440, UnG1110016)) sent from the CIP Safety module to the EtherNet/IP device during Class1 communication are stored in ascending order starting with connection number 1. Note that the offset address for each connection is aligned to start in 2-word increments.
Program
The next step is to create a program. Define the program as Local Label as shown in the figure below.
This is a program to check the communication.
IF RJ71SEIP91_1.stEIPCls1_P1.uSet_CommunicationStartupRequest_D = 0 AND RJ71SEIP91_1.bSts_ModuleReady THEN RJ71SEIP91_1.stEIPCls1_P1.uSet_CommunicationStartupRequest_D := 1;END_IF; //Connection2 //Output iConn2Index:=RJ71SEIP91_1.stEIPCls1_P1.unVal_Class1OutputDataOffset_Connection_D[2]+2; RJ71SEIP91_1.stEIPCls1_P1.unArea_Class1OutputDataArea_D[iConn2Index]:=3421; IConnd2EndIndex:=iConn2Index+RJ71SEIP91_1.stEIPCls1_P1.unVal_Class1OutputDataSize_Connection_D[2]-1; IConnd2EndIndex:=IConnd2EndIndex-2; RJ71SEIP91_1.stEIPCls1_P1.unArea_Class1OutputDataArea_D[IConnd2EndIndex]:=16#ABCD; //Input iConn2Index:=RJ71SEIP91_1.stEIPCls1_P1.unVal_Class1InputDataOffset_Connection_D[2]+2; IConnd2EndIndex:=iConn2Index+RJ71SEIP91_1.stEIPCls1_P1.unVal_Class1InputDataSize_Connection_D[2]-1; IConnd2EndIndex:=IConnd2EndIndex-2; DataFromTwinCAT_0:=RJ71SEIP91_1.stEIPCls1_P1.unArea_Class1InputDataArea_D[iConn2Index]; DataFtomTwinCAT_14:=RJ71SEIP91_1.stEIPCls1_P1.unArea_Class1InputDataArea_D[IConnd2EndIndex]; |
Result
Check the communication from the TwinCAT3 side: open Box 1>Inputs>State.
State=0, so we confirmed that there are no errors.
Next, open Assembly 1>Inpuits>ConState.
State=0, so we confirmed that there are no errors.
We could see the data that TwinCAT3 sent to RJ71SEIP91-T4.
Next, let’s try sending data from the RJ71SEIP91-T4 to the TwinCAT3 Ethernet/IP Slave.
Done!Data sent by TwinCAT3 to RJ71SEIP91-T4 has been received.