EtherCAT integration
With the EtherCAT integration, the system is made up of the following components:
Bus master
Bus modules/slaves (here the bus module BNI)
Device data
In order to properly parameterize the bus master, device data in the form of three ESI files is enclosed with the bus module BNI.
Input/output buffer
The data exchange with the controlling system takes place in the input and output buffer. The size of this buffer must be configured by the master.
Configuration
Note
Please check whether IO-Link is supported by your module before using this function. For more information on product variants that support IO-Link, see Supported product variants
During the project planning the BNI bus module is displayed as a modular device. The device data required for the project planning is stored in the ESI files. The data modules of the inputs/outputs, the IO-Link Port and any additional modules are shown in the project planning software in relation to the slot.
The ESI files make available the possible data modules (inputs/outputs, IO-Link Ports of varying data width and other additional modules).
The appropriate data modules are assigned to a certain slot for the configuration of the BNI. Unused slots can be released.
Integration in project planning software
As an example, the connection of the BNI to a Beckhoff TwinCAT control is shown with the TwinCAT System Manager. The exact procedure depends on the project planning software used.
Installing ESI files
The device description has the following name: Balluff BNI XG5-538-1B5-Z067 ECS V.x.x.x.xml
Copy the file to the corresponding TwinCAT directory (in the standard:
C:\TwinCAT\3.1\Config\Io\EtherCAT).⇒ Installed devices are available when the TwinCAT System Manager starts again.
Automatic scanning
Prerequisite
Before connecting devices to the EtherCAT network, the EtherCAT system must be in a secure, de-energized state.
Switch on the operating voltage and start the TwinCAT System Manager in Config mode.
Scan BNI as a box.
Manually adding a device
Prerequisite
Before connecting devices to the EtherCAT network, the EtherCAT system must be in a secure, de-energized state.
Switch on the operating voltage and start the TwinCAT System Manager in Config mode.
Attach a box.
Select a box.
Necessary configuration of device
After automatic scanning or manual adding of the device, the device appears in the tree structure of TwinCAT.
The BNI supports EoE (Ethernet over Ethercat). In order to configure TwinCAT, in the EtherCAT tab select Advanced settings.
A valid DNS name and then a valid IP address must be entered.
Configuring Station Alias
The Station Alias can be selected under the EtherCAT tabAdvanced settings.
Note
The new value is only valid after a reset.
Configuring the network module
Note
Please check whether IO-Link is supported by your module before using this function. For more information on product variants that support IO-Link, see Supported product variants
The BNI is a modular EtherCAT device. The device has the following slot structure:
Slot number |
Meaning |
|---|---|
1-8 |
IO-Link Ports |
Note
The sum of the output data may not exceed 256 bytes.
In order to configure the IO-Link Ports, a defined number of process data (buffer size) must be assigned to the EtherCAT slots. In the TwinCAT System Manager this works as follows:
Delete assignment of IO-Link channel (or port) with x.
Place the channel selected on the left side with with
<the module configuration selected on the right.Transfer configuration to the EtherCAT slave with restart of TwinCAT in Config mode.
Bitmapping and function
Signals from configured inputs or outputs are displayed in the modulesSTD_IN_1bit(inputs Pin 4), Input Pin 2 (inputs Pin 2), as well asSTD_OUT_1bit(outputs Pin 4) and Output Pin 2 (outputs Pin 2).
Note
XG1 devices have no outputs to Pin 2.
Network modules
The IO-Link modules are always established according to the same schema:
IOLI/Ox/xBytes
Quantity of process data used (should be greater than or equal to the process data length of the O-Link device)
I = Input data
O = Output data
I/O = Input and output data
Short circuits and restart bits
The BNI restarts automatically if a short circuit occurs at one of the IO-Link Ports. No restart bits are required.
IO-Link state
Note
Please check whether IO-Link is supported by your module before using this function. For more information on product variants that support IO-Link, see Supported product variants
In the IO-Link state the current status of each port is displayed.
Start-up
In the start-up the IO-Link Ports and outputs can be preconfigured. For more information, see Configuration without ESI.
The entries are transferred during the transfer of the configuration.
Configuration of modules
Validation
No validation: Validation deactivated, every device is accepted.
Compatibility: Manufacturer ID and device ID are compared with the module data. IO-Link communication is only started if they match.
The following values are possible for the validation setting:
Value |
Validation |
|---|---|
0 |
No validation |
1 |
Compatible (VID + DID) |
The validation can be activated via the CoE object additional IO-Link Configuration Data for each port with subindex 1 (validation and backup). The values used for the validation must be configured in the CoE object IO-Link Configuration Data for each port.
Parameter server
Switched on : Data retention functions active, parameter data and identification data of the IO-Link device are saved in a remanent memory.
Disabled : Data storage function disabled, stored data remains stored.
Deleted : Data storage function disabled, stored data is deleted.
Upload enabled : Can be used to select whether an upload of the parameter data to the data storage of the network module port should be performed or not. If the upload is enabled, as soon as a device has requested an upload (Upload flag set) or if no data is saved in the master port (e.g. after deletion of the data or before the first data upload), the master starts uploading the parameter data.
Block upload : No data upload is started if the upload is blocked. For an upload request from the IO-Link device, a download (if activated) is started in the case of different parameter sets as no upload may be carried out.
Enable download : Can be used to select whether a download of the parameter data to the IO-Link device should be performed or not. As soon as the stored parameter data in the port’s parameter server differs from the connected IO-Link device and there are no upload requests from the IO-Link device, a download is performed.
Block download : If the download is blocked, an upload (if activated) of the parameter data takes place, irrespective of the upload flag of the IO-Link device.
Block upload and download : There is no exchange of parameter data if both upload and download are blocked. The IO-Link device communicates then with the IO-Link Port.
The following values are possible for the settings:
Value |
Function |
|---|---|
|
switch on |
|
switch off |
|
delete |
|
Switch on upload |
|
Switch on download |
The data memory can be activated via the CoE object additional IO-Link Configuration Datafor each port with subindex 1 (validation and backup). There is no read or write access to the content of the data memory via EtherCat.
Note
After uploading the parameter data, the Vendor ID and Device ID of the connected IO-Link device remain stored until the data records are deleted.
Validation takes place when the connected IO-Link device is started up. Only an IO-Link device of the same type can be used for data storage.
In order to use a different type of IO-Link device, the content of the parameter server must be deleted.
Upload flag at IO-Link device
Note
Please check whether IO-Link is supported by your module before using this function. For more information on product variants that support IO-Link, see Supported product variants
The upload flag is required in order to overwrite data already saved in the parameter server with new parameter data of the same IO-Link device.
In order to activate the upload flag of an IO-Link device, the value 0x05 must be
entered in the parameterIndex 0x02, Subindex 0.
Failsafe values
If the EtherCAT connection fails or if the EtherCAT status is notOperate, the IO-Link Ports use these values:
If a port is in the IO-Link stateOperate, the process data displayed is switched to invalid.
If Pin 2 or Pin 4 are in the digital output mode, zero (low level) is displayed.
IO-Link parameterization
Note
Please check whether IO-Link is supported by your module before using this function. For more information on product variants that support IO-Link, see Supported product variants
Via the object 0x4000 (IO-Link Service Data Ch. X), IO-Link ISDU parameters can
be read or written from the IO-Link device. For this purpose, the corresponding
index and subindex must be entered and for writing the corresponding length and
data must be entered. The read or write operation is started via the control
object. The result is displayed in the status object.
Values for the control
Value |
Function |
|---|---|
|
No function |
|
Write |
|
Read |
Values for the status
Value |
Status |
|---|---|
|
No status |
|
Active/Busy |
|
Access |
|
Error |
|
Fail |
Example of CoE setting
This example shows how the index 0x40 of Smartlight (mode) is changed by reading and writing.
Select module.
Open CoE - Online.
Activate the setting Auto Update.
Under Advanced select the setting Online - via SDO Information.
In port, select 4030:0(here channel 4).
Read index by double clicking 4030:0 and specifying the respective index (here 0x0040 64).
In control write the command 0x03.
⇒ Content of the index is read and displayed in data.
Change data, specify length and use the command
0x02.
⇒ The data is written and the parameter is changed in the device.Acyclic access via AoE
Acyclic access via AoE
The ETG5001.6220 describes AoE instead of CoE for the ISDU read/write access to IO-Link device parameters. Details on ADS can be found in the Beckhoff TwinCAT documentation and in ETG.1020. In contrast to CoE, AoE permits non-blocking processing.
AoE ISDU access uses these definitions (all are 32 bit):
AoE IndexGroup =
0x0000F302AoE PortNumber =
0x00001000+ IO-Link port number, starting with 0.AoE IndexOffset
16 Bit IO-Link Index
8 Bit always zero
8 Bit IO-Link Subindex
Return error code
16 Bit additional information about the error code, which is 0x0700 (ADS device error).
16 Bit error code via IO-Link
Function blocks ADSREAD and ADSWRITE
Function block ADSREAD in TwinCat
ADSREAD commands
Name |
Type |
Inherited from |
Address |
Initial |
Comment |
|---|---|---|---|---|---|
NETID |
T_AmsNetId |
– |
– |
– |
Ams net id |
PORT |
T_AmsPort |
– |
– |
– |
ADS communication port |
IDXGRP |
UDINT |
– |
– |
– |
Index group |
IDXOFFS |
UDINT |
– |
– |
– |
IndexOffset |
LEN |
UDINT |
– |
– |
– |
Maximum number of the data bytes to be read (LEN ≤ maximum size of target buffer) |
DESTADDR |
PVOID |
– |
– |
– |
Indicator of target buffer |
READ |
BOOL |
– |
– |
– |
Rising edge starts command execution. |
TMOUT |
TIME |
– |
– |
DEFAULT_ADS_TIMEOUT |
Maximum permissible time for the execution of this ADS command |
BUSY |
BOOL |
– |
– |
– |
Busy-Flag |
ERR |
BOOL |
– |
– |
– |
Error-Flag |
ERRID |
UDINT |
– |
– |
– |
ADS error code |
Function block ADSWRITE in TwinCat
ADSWRITE commands
Name |
Type |
Inherited from |
Address |
Initial |
Comment |
|---|---|---|---|---|---|
NETID |
T_AmsNetId |
– |
– |
– |
Ams net id |
PORT |
T_AmsPort |
– |
– |
– |
ADS communication port |
IDXGRP |
UDINT |
– |
– |
– |
Index group |
IDXOFFS |
UDINT |
– |
– |
– |
IndexOffset |
LEN |
UDINT |
– |
– |
– |
Maximum number of the data bytes to be written (LEN ≤ maximum size of source buffer) |
SRCADDR |
PVOID |
– |
– |
– |
Indicator of source buffer |
WRITE |
BOOL |
– |
– |
– |
Rising edge starts command execution. |
TMOUT |
TIME |
– |
– |
DEFAULT_ADS_TIMEOUT |
Maximum permissible time for the execution of this ADS command |
BUSY |
BOOL |
– |
– |
– |
Busy-Flag |
ERR |
BOOL |
– |
– |
– |
Error-Flag |
ERRID |
UDINT |
– |
– |
– |
ADS error code |
Preparation for the web server
EoE set-up
In order to be able to access the web server of the BNI module, access via EoE (Ethernet over EtherCAT) must be configured first.
Select the Advanced Settings… button.
Enter valid DNS name and valid IP address.
Preparing network
Before the web server can be reached via EoE, the network of the Beckhoff control must be configured.
Configuring Beckhoff control
A static IP address must be assigned to both network cards.
On the Beckhoff control select Start > Control panel Network and dial-up connections > PCI…Settings.
Assign IP address.
Under Start > Control Panel > Beckhoff CX Configuration Tool > Miscellaneous activate the setting IP Routing.
EoE and PC networks
For the EoE settings in the Twincat, the IP address of the second network card of the Beckhoff control must be entered as a default gateway.
As a default gateway for the network configuration of the PC, the IP address of the first network card of the Beckhoff control must be entered.
Object directory
-
Map TxPDO input pin 2 (
0x1A90) - Input Pin 2, one bit for each port.
-
Map TxPDO pin 4 (
0x1A0n) -
The following index range applies in a modular EtherCAT device:
0x6xxx is a module-specific input range for TxPDO data.
0x7xxx is a module-specific output range for RxPDO data.
IO-Link data is up to 32 bytes for input and output.
If a connection is configured as aDigital InputorDigital Output, the value of pin 4 is mapped to data byte 0, bit 0.
-
Map TxPDO input pin 2 (
0x1A90) - Input Pin 2, one bit for each port.
-
Map TxPDO PowerStatus (0x1A91)
-
Index Subindex Name DataType 0xF601 0x01 Global status:
Bit 0: Sensor supply low (1 = low, 0 = OK)
Bit 1: Actuator supply low (1 = low, 0 = OK)
UINT8 0x02 Short circuit in the sensor supply; one bit for each port UINT8 0x03 Short circuit at pin 4 of the actuator supply, one bit for each port UINT8 0x04 Short circuit at pin 2 of the actuator supply, one bit for each port UINT8 -
IO-Link Service Data Ch. x (0x4000 – 0x4FFF)
-
Note
Please check whether IO-Link is supported by your module before using this function. For more information on product variants that support IO-Link, see Supported product variants
Index Sub-index Name DataType Access Value 0x40n0 0x01 Control UINT8 RW 0: no control action
3: read
2: write0x02 Status UINT8 RO 0: no activity
1: busy
2: success
4: error
0xFF: failure0x03 Index UINT16 RW – 0x04 Subindex UINT8 RW – 0x05 Length UINT8 RW – 0x06 Data UINT32 RW – n = 0…7 0x07 Error code UINT16 RO – -
IO-Link Configuration Data Ch. x (0x8000 – 0x8FFF)
-
Note
Please check whether IO-Link is supported by your module before using this function. For more information on product variants that support IO-Link, see Supported product variants
Index Sub-index Name Value DataType 0x8nn0 n = 0…7 0x04 Device ID 24-Bit-ID UINT32 0x05 Vendor ID 16-Bit-ID UINT32 0x32 IO-Link revision 0x10 or 0x11 UINT8 0x33 Frame Capability not in use UINT8 0x34 Desired Cycle Time Cycle Time UINT8 0x35 Offset Time not in use UINT8 0x36 Max. PD In Length Max. length UINT8 0x37 Max. PD Out Length Max. length UINT8 0x38 Compatible ID not in use UINT16 0x40 Master Control UINT16 -
IO-Link Information Data Ch. x (0x9000 – 0x9FFF)
-
Note
Please check whether IO-Link is supported by your module before using this function. For more information on product variants that support IO-Link, see Supported product variants
Index Subindex Name DataType Access 0x90n0 0x04 Device ID UINT32 RO n = 0…7 0x05 Vendor ID UINT32 RO 0x20 IO-Link revision UINT8 RO 0x22 Min Cycle Time UINT8 RO 0x24 Process Data In Length UINT8 RO 0x25 Process Data Out Length UINT8 RO -
IO-Link Diagnosis Data Ch. x (0xA000 – 0xAFFF)
-
Note
Please check whether IO-Link is supported by your module before using this function. For more information on product variants that support IO-Link, see Supported product variants
Index Subindex Name DataType Access 0xa0n0
n = 0…70x01 IO-Link state UINT8 RO 0x02 Lost Frames UINT8 RO -
Values for IO-Link state (Subindex 0x01)
-
Value
Name
Status of IO-Link Port
0
INACTIVE
Deactivated
1
DIGINPUT
Digital Input
2
DIGOUTPUT
Digital Output
3
ESTABLISHCOMM
not in use
4
INITMASTER
not in use
5
INITDEVICE
not in use
6, 7
Unused
not in use
8
OPERATE
IO-Link, in status Operate
9
STOP
IO-Link, not in status Operate state (error or no device)
-
Values for Lost Frames (Subindex 0x02)
-
This parameter counts lost IO-Link Frames (M sequence repeats).
Two repeat attempts are generally added when changing the device. This value is only reset to zero during the start. The value is updated regularly, e.g. once a second.
-
IO-Link Status Data Ch. x (0xF100)
-
Note
Please check whether IO-Link is supported by your module before using this function. For more information on product variants that support IO-Link, see Supported product variants
Index Subindex Name DataType Access 0xF100 0x01 Status of IO-Link Port 1 UINT8 RO 0x02 Status of IO-Link Port 2 UINT8 RO 0x03 Status of IO-Link Port 3 UINT8 RO 0x04 Status of IO-Link Port 4 UINT8 RO 0x05 Status of IO-Link Port 5 UINT8 RO 0x06 Status of IO-Link Port 6 UINT8 RO 0x07 Status of IO-Link Port 7 UINT8 RO 0x08 Status of IO-Link Port 8 UINT8 RO The CoE objectDevice Status(0xF100) is mapped asTxPDO-Mapping of Status Datato the Process Data.
-
IO-Link Port Qualifier Ch. x (0xF101)
-
Note
Please check whether IO-Link is supported by your module before using this function. For more information on product variants that support IO-Link, see Supported product variants
Index Subindex Name DataType Access 0xF101 0x01 Port Qualifier Port 1 UINT8 RO 0x02 Port Qualifier Port 2 UINT8 RO 0x03 Port Qualifier Port 3 UINT8 RO 0x04 Port Qualifier Port 4 UINT8 RO 0x05 Port Qualifier Port 5 UINT8 RO 0x06 Port Qualifier Port 6 UINT8 RO 0x07 Port Qualifier Port 7 UINT8 RO 0x08 Port Qualifier Port 8 UINT8 RO The CoE objectPort Qualifier(0xF101) is mapped asTxPDO-Mapping of Port Qualifierto the Process Data.
-
Port Qualifier Bits
-
Bit
Description
4
PortActive / Port activated
1 = Port can be used.
2 = Port deactivated.5
DevCom / device is ready for operation
1 = Device detected and in status Operate
0 = everything else6
DevErr / device error
1 = Error occurred (validation error, short circuit, etc.)
0 = OK7
PQ / validity of input data of IO-Link device
1 = valid
0 = invalid
Configuration without ESI
Note
Please check whether IO-Link is supported by your module before using this function. For more information on product variants that support IO-Link, see Supported product variants
The ports can also be configured without integration of an ESI. For this, the master control and the respective length of the process data must be set in the object 0x8000.
Values for the master control (80X0:28)
Value |
Function |
|---|---|
0x0000 |
Deactivated |
0x0001 |
Port in Standard Input |
0x0002 |
Port in Standard Output |
0x0003 |
Port in IO-Link mode |
0x0005 |
Power |
Process data length
IO-Link Ports
Byte |
Length of data |
|---|---|
1 Byte |
0x08 |
2 Byte |
0x16 |
4 Byte |
0x83 |
6 Byte |
0x85 |
8 Byte |
0x87 |
10 Byte |
0x89 |
16 Byte |
0x8F |
24 Byte |
0x97 |
32 Byte |
0x9F |
Standard input/output ports
0x01
Example
| MasterControl = 3 --> IO-Link | ||||
| IO-Link size | Process Data In Length | Process Data Out Length | ||
| Hex | Dec | Hex | Dec | |
| IOL_l_1byte | 0x08 | 8 | 0x00 | 0 |
| IOL_l_2byte | 0x16 | 22 | 0x00 | 0 |
| IOL_l_4byte | 0x83 | 131 | 0x00 | 0 |
| IOL_l_6byte | 0x85 | 133 | 0x00 | 0 |
| IOL_l_8byte | 0x87 | 135 | 0x00 | 0 |
| IOL_l_10byte | 0x89 | 137 | 0x00 | 0 |
| IOL_l_16byte | 0x8F | 143 | 0x00 | 0 |
| IOL_l_24byte | 0x97 | 151 | 0x00 | 0 |
| IOL_l_32byte | 0x9F | 159 | 0x00 | 0 |
| IOL_l_1byte/0_1bytes | 0x08 | 8 | 0x08 | 8 |
| IOL_l_2byte/0_2bytes | 0x16 | 22 | 0x16 | 22 |
| IOL_l_2byte/0_4bytes | 0x16 | 22 | 0x83 | 131 |
| IOL_l_4byte/0_4bytes | 0x83 | 131 | 0x83 | 131 |
| IOL_l_4byte/0_2bytes | 0x83 | 131 | 0x16 | 22 |
| IOL_l_2byte/0_8bytes | 0x16 | 22 | 0x87 | 135 |
In the start-up the configuration for Port 6 in IO-Link mode with 32 Byte process data length for input and output looks as follows: