nettap 100 - Interfacing of Communication Protocols
Hilscher netTAP 100 - Interfacing of communication protocols
The Challenge: Interfacing Protocol X to Protocol Y
We often face the challenge of having to interface one communication protocol (e.g. Modbus, EtherCAT, Ethernet IP etc.) to another protocol. For example, we may have a Fieldbus application using EtherCAT, into which we need to tie a device that uses Modbus. For this purpose, we have recently explored the Hilscher netTAP 100 gateway. This blog outlines how to set up this device, using the example of Modbus to EtherCAT.
Context for application
Imagine you have an EtherCAT Fieldbus setup for a real-time control project. The EtherCAT master (e.g. NI cRIO, Bachman M1, MathWorks integrated Speedgoat system) communicates to a variety of EtherCAT slaves, for example motor drives, sensors, general IO. You now have a device (e.g. a solar inverter or a hydraulic motor soft starter) that only supports Modbus RTU, but which you would like to tie into your overall EtherCAT Fieldbus. The netTAP 100 Gateway can do exactly that. For the particular application we are considering (Modbus interfacing to EtherCAT), the suitable Gateway is the NT 100-RE-RS. However, many other options are available via Hilscher.
Setting up the Gateway protocols
First, download the SYCON gateway configuration software from Hilscher. Open SYCON and start a new project. Next, drag the NT 100-XX-XX from the device library to the bus line, so that the bus looks as shown in the image below (drag the icon from the library and place onto the horizontal bus line). Initially, this gateway we be named NT 100-XX-XX, where the two “XX” will be completed once the primary and secondary side protocols are chosen. Have a look at this video if in doubt.
Next, right click on the NT-100-XX-XX gateway on your bus, select Configuration->Gateway. In the dialog that opens go to Configuration->Settings, and select your Primary and Secondary networks. Once Primary (EtherCAT Slave in our case) and Secondary (Modbus RTU in our case) protocols are selected, only one option should remain in the “Available Firmware” box. Select that option, and press download to download to the NT-100 gateway. Also press Apply to apply all changes. Our application does not require a network license on either the primary or secondary network sides, but some protocols may require a license.
Setting up the Modbus RTU (Secondary network)
Close the configuration dialog for the Gateway. Open the Modbus RTU configuration dialog as shown below.
In our application, we wish to connect to a device (e.g. solar inverter) that is a Modbus Slave (aka Modbus Server). As a result, the netTAP gateway must act as a Modbus Master. The image below shows our Master setup. The NT-100-RE-RS supports RS232, RS422 and RS485. We selected RS232 for the purpose of this blog/demonstration.
Setting up the Modbus command table
Select the Command Table page in the menu on the left hand side. In the example shown below, we added 4 commands (via the Add button, and press Apply at the end). The first command reads holding register 301 cyclically (every 100ms) from slave 2. The additional three commands read registers 302, 303 and 304.
Once all commands are entered, the Signal Configuration page (next page down on the left hand side menu) should appear as follows.
Setting up the EtherCAT slave (primary side)
Go to the EtherCAT Slave configuration page (right click on NT-100 icon, Configuration->EtherCAT Slave). In our case, the secondary side (Modbus) registers were automatically added to the primary side and no action is required here. If this is not the case, you may have to manually connect primary and secondary IO variables via the Gateway Configuration->Signal Mapping page.
As noted above, the signal mapping in our example was done automatically (driven by the secondary side), and the Signal Mapping page in the Gateway looks as follows.
Export the EtherCAT ESI
All EtherCAT Masters require information (register names, addresses etc) for all connected EtherCAT slaves. This information is contained in ESI files. To export the ESI file for the “custom” EtherCAT slave (as created for the primary side), right click the NT-100 icon and navigate to Additional Functions -> Export -> XML.
Testing the system
You can test the system with your actual hardware (e.g. solar inverter + NI cRIO system as EtherCAT master). If you don’t have access to the hardware right now, testing case be done using a Modbus Slave simulator (we recommend this simulator with a 30 day free trial) and Beckhoff TwinCAT 3 (to act as EtherCAT Master). If using TwinCAT, copy the XML file produced under the previous step into the appropriate TwinCAT directory.
An example set of inputs for the Modbus slave simulator is shown below.
For example, the number 25 is entered for register 304. This register now appears in TwinCAT under byte 6. Our first register is register 301. In Modbus, each register is 16 bits, or 2 bytes. As a result, register 301 is represented on the EtherCAT side as bytes 0 and 1, register 302 is represented by bytes 2 and 3, register 303 is represented by bytes 4 and 5, and finally register 303 is represented by bytes 6 and 7. The convention that TxPDOs are written as an array of bytes into the exported XML seems to be somewhat baked into the SYNCON XML export tool. However, we are currently exploring if there are other/smarter (e.g. Word aligned) export options.
This blog showed how a Modbus slave device can be tied into an EtherCAT Fieldbus network, using the NT 100-RE-RS. The concepts / steps shown here should be fairly similar across a multitude of communication protocol interfaces via any of the NT 100-XX-XX series. Just contact us if you experience any setup challenges.