Why need to use EtherCAT to Modbus TCP gateway solution?
Modbus TCP is NOT a real-time network, since the Modbus TCP/IP ADU (Application Data Unit) data is embedded inside the TCP/IP frames of standard Ethernet packets. Designers can use AX58200 EtherCAT to Modbus TCP Gateway solution to integrate Non-real-time Modbus TCP network (with longer than 100ms cycle time) into Real-time EtherCAT network (with less than 1ms cycle time)!!
AX58200 EtherCAT Slave Controller SoC supports two embedded Fast Ethernet PHY for EtherCAT network connection; AX58200 also supports another embedded Ethernet MAC controller, which can be connected with an external RMII Fast Ethernet PHY for Modbus TCP network connection.
AX58200 EtherCAT to Modbus TCP Gateway firmware can realize the gateway functionalities by parsing EtherCAT RxPDO, TxPDO and Modbus commands based on the pre-defined Modbus commands mapping table.
This AX58200 EtherCAT to Modbus TCP gateway demonstration uses AX58200 TwinCAT PLC Modbus TCP demo utility and Modbus TCP Server Simulator to demonstrate digital I/O remote control functionalities between EtherCAT and Modbus TCP networks.
ASIX offers AX58200 EtherCAT to Modbus TCP gateway development kit for designers to easily evaluate AX58200 EtherCAT to Modbus TCP gateway functionalities. ASIX has outstanding engineering teams to provide customers the professional and timely technical services. For more information, please contact ASIX Electronics Corp. via e-mail: sales@asix.com.tw, or visit ASIX website: https://www.asix.com.tw/.
12. AX58200 EtherCAT to Modbus TCP Gateway
System Diagram
RxPDO[0]~[7]
TxPDO[0]~[7]
EtherCAT
Master
EtherCAT
ESC
ESI
EEPROM
I2C
USB
Embedded
Flash
USB ICE
Debugger
Modbus TCP
Mapping Table
Configuration
Modbus TCP
Server (Slave)
Modbus TCP
Client (Master)
Modbus
Command
Data
Bridge
Get EtherCAT Master PDO data from RxPDO
For Modbus Write Single Coil Command
Read Modbus Read Input Register Value
To store into TxPDO for EtherCAT Master process
13. AX58200 EtherCAT to Modbus TCP Gateway
Modbus Command Mapping Table Configuration Example
;AX58200 EtherCAT to Modbus TCP Gateway Mapping Table Example
START;
192.168.000.002; This Gateway IP address
192.168.000.001; This Gateway Gateway IP address
255.255.255.000; This Gateway Netmask IP address
150; Timeout for Modbus command, valid=[0 ~ 255], unit=0.01sec
0; Delay time after Modbus command, valid=[0 ~ 255], unit=0.01sec
0,0; Reserved, default=0
;Vendor Specific Gateway System Commands
RXPDO[0];
000.000.000.000,FF 00 02,00,10,00,00; Write Gateway Control data from RxPDO[0]
TXPDO[0];
000.000.000.000,FF 00 00,00,10,00,00; Read Gateway System State to TxPOD[0]
;EtherCAT to Modbus TCP Device Commands Mapping Table
;(For example: Target Modbus TCP device IP address is 192.168.0.3)
RXPDO[1];
192.168.000.003,01 05 00 00 00 00,00,01,04,00; Modbus Write Single Coil from RxPDO[1].bit0
192.168.000.003,01 05 00 01 00 00,01,01,04,00; Modbus Write Single Coil from RxPDO[1].bit1
192.168.000.003,01 05 00 02 00 00,02,01,04,00; Modbus Write Single Coil from RxPDO[1].bit2
192.168.000.003,01 05 00 03 00 00,03,01,04,00; Modbus Write Single Coil from RxPDO[1].bit3
192.168.000.003,01 05 00 04 00 00,04,01,04,00; Modbus Write Single Coil from RxPDO[1].bit4
192.168.000.003,01 05 00 05 00 00,05,01,04,00; Modbus Write Single Coil from RxPDO[1].bit5
192.168.000.003,01 05 00 06 00 00,06,01,04,00; Modbus Write Single Coil from RxPDO[1].bit6
192.168.000.003,01 05 00 07 00 00,07,01,04,00; Modbus Write Single Coil from RxPDO[1].bit7
TXPDO[1];
192.168.000.003,01 04 00 00 00 01,00,01,00,00; Modbus Read Input Register 0x00 to TxPDO[1]
192.168.000.003,01 04 00 01 00 01,01,01,00,00; Modbus Read Input Register 0x01 to TxPDO[1]
192.168.000.003,01 04 00 02 00 01,02,01,00,00; Modbus Read Input Register 0x02 to TxPDO[1]
192.168.000.003,01 04 00 03 00 01,03,01,00,00; Modbus Read Input Register 0x03 to TxPDO[1]
192.168.000.003,01 04 00 04 00 01,04,01,00,00; Modbus Read Input Register 0x04 to TxPDO[1]
192.168.000.003,01 04 00 05 00 01,05,01,00,00; Modbus Read Input Register 0x05 to TxPDO[1]
192.168.000.003,01 04 00 06 00 01,06,01,00,00; Modbus Read Input Register 0x06 to TxPDO[1]
192.168.000.003,01 04 00 07 00 01,07,01,00,00; Modbus Read Input Register 0x07 to TxPDO[1]
END;
Command Descriptions Comments
Start Mapping table start
End Mapping table end
xxx.xxx.xxx.xxx IP address
RXPDO[n] RxPDO field ID n n is from 0 to 7,
0 is for gateway system command
TXPDO[n] TxPDO field ID n n is from 0 to 7,
0 is for gateway system command
, Field separator
; Field termination
RXPDO[n]/TXPDO[n] fields example: 192.168.000.003,01 05 00 00 00 00,00,01,04,00;
14. MBAP Header PDU
Transaction
ID
Protocol
ID
Length
Unit
ID
Function
Code
Data
2 bytes 2 bytes 2 bytes 1 byte 1 byte n bytes
AX58200 EtherCAT to Modbus TCP Gateway
Modbus TCP Packet Format
Ethernet
Header
IP
Header
TCP
Header
Modbus
TCP/IP ADU
Data FCS
14 bytes 20 bytes 20 bytes Up to 1460 bytes 4 bytes
The default Modbus TCP port number is 502.
The Modbus TCP/IP ADU (Application Data Unit)
fields data are encoded in Big-Endian.
Modbus Function Code
MBAP (ModBus Application Protocol) Header
16. Modbus TCP Server (Slave) Simulator
AX58200 EtherCAT to Modbus TCP
Client (Master) Gateway PLC Demo
EtherCAT to Modbus TCP Gateway
Digital I/O Remote Control Demo
AX58200 EtherCAT to Modbus TCP Gateway Solution
Demonstration Environment
1
1
Demo #1: EtherCAT OUT Modbus TCP IN
2
Demo #2: EtherCAT IN Modbus TCP OUT
2
EtherCAT
Slave
AX58200 EtherCAT to Modbus
TCP Client (Master) Gateway
Modbus TCP
Client (Master)
Ethernet
Modbus TCP Server
(Slave) Simulator
EtherCAT
Master
PHY
17. Step 1. Install Modbus TCP Server Simulator
on Modbus TCP Server
18. Install Modbus TCP Server Simulator
Please download a free Modbus TCP Server Simulator application from Internet
to emulate Modbus TCP Server devices for digital I/O remote control demonstration
(e.g.: http://www.icdt.com.tw/main/index.php/2013-07-09-05-16-50/modbus-free-software/file/57-modbus-tcp-server)
Please see below demonstration…
22. Program Modbus Command Mapping Table
Program Modbus command mapping table onto AX58200 Flash memory
via Nu-Link USB ICE debugger on AX58200 evaluation board
Please see below demonstration…
23. Step 4. Create TwinCAT Project &
Update AX58200 EEPROM via new ESI File
24. Create TwinCAT Project &
Update AX58200 EEPROM with new ESI File
Create TwinCAT project to update AX58200 EEPROM with new ESI file
Please see below demonstration…
26. Build TwinCAT PLC Source
Import and build AX58200 EtherCAT to Modbus TCP Gateway
TwinCAT PLC demo utility source
Please see below demonstration…
27. Step 6. Run TwinCAT PLC Demo and Modbus TCP
Server Simulator
28. Run TwinCAT PLC Demo and Modbus TCP Server Simulator
Run TwinCAT PLC Modbus TCP
Demo and Modbus TCP Server
Simulator for EtherCAT to Modbus
TCP gateway digital I/O remote
control demonstration
Please see below demonstration…
29. Contact ASIX for further supporting
ASIX Electronics Corporation
https://www.asix.com.tw
sales@asix.com.tw
Corporate Headquarters
4F, No. 8, Hsin Ann Rd. Hsinchu Science Park, Hsinchu 30078, Taiwan
TEL : +886-3-5799500
FAX : +886-3-5799558