IO-Link Masterv2.01.01
 
Loading...
Searching...
No Matches
Device Communication

Set up IO Link Port

There are several ways to configure an IO-Link port. The simplest way is to use the AUTOCOM mode. In this mode the Master accepts all devices and sets its internal parameters according to the device's requirements. Start up in AUTOCOM mode is done as follows:

IOLM_SPortConfig suPortCfg;
// Prepare struct
IOL_Port_vMemSet(&suPortCfg, 0, sizeof(IOLM_SPortConfig));
// Set desired target mode
// Send the configured struct to the System Management layer
@ IOL_eTargetMode_AUTOCOM
Device communicating in mode AUTOCOM without inspection (SCANMODE).
Definition IOL_Types.h:262
IOL_FUNC_DECL IOL_EErrorInfo IOLM_API_SM_eSetPortConfig(INT8U u8Port_p, IOLM_SPortConfig *psuPortConfig_p)
Port setup.
Definition IOLM_SM.c:424
This structure is used for the desired port mode.
Definition IOLM_Types.h:812
IOL_ETargetMode eTargetMode
This parameter indicates the requested operational mode of the port.
Definition IOLM_Types.h:823

Another way is to set up a specific device by Vendor ID and Device ID. During the startup procedure it is checked if the correct device is connected or if the device is compatible. If this check fails, it is indicated by the port mode IOL_ePortMode_COMP_FAULT

IOLM_SPortConfig suPortCfg;
// Prepare port configuration struct
IOL_Port_vMemSet(&suPortCfg, 0, sizeof(IOLM_SPortConfig));
// Set desired target mode and inspection level
// Set specific Vendor and Deviec ID
suPortCfg.au8ConfiguredVendorID[0] = 0x12;
suPortCfg.au8ConfiguredVendorID[1] = 0x34;
suPortCfg.au8ConfiguredDeviceID[0] = 0x12;
suPortCfg.au8ConfiguredDeviceID[1] = 0x34;
suPortCfg.au8ConfiguredDeviceID[2] = 0x54;
// Send the configured struct to the System Management layer
@ IOL_eTargetMode_CFGCOM
Device communicating in mode CFGCOM after successful inspection (FIXEDMODE).
Definition IOL_Types.h:260
@ IOL_eInspectionLevel_TYPE_COMP
Check Vendor ID and Device ID.
Definition IOLM_Types.h:558
INT8U au8ConfiguredDeviceID[3]
Configured Device ID.
Definition IOLM_Types.h:847
IOLM_EInspectionLevel eInspectionLevel
Device check during startup.
Definition IOLM_Types.h:839
INT8U au8ConfiguredVendorID[2]
Configured Vendor ID.
Definition IOLM_Types.h:843

The most complex way is to check if the Serial Number is also correct. This is also the safest way to check, whether the connected Device is the exact one which is expected on the specific port. If the check fails, it is indicated by the port mode IOL_ePortMode_SERNUM_FAULT

IOLM_SPortConfig suPortCfg;
char au8Serial[] = "SER12345"
// Prepare port configuration struct
IOL_Port_vMemSet(&suPortCfg, 0, sizeof(IOLM_SPortConfig));
// Set desired target mode and inspection level
// Set specific Vendor and Deviec ID
suPortCfg.au8ConfiguredVendorID[0] = 0x12;
suPortCfg.au8ConfiguredVendorID[1] = 0x34;
suPortCfg.au8ConfiguredDeviceID[0] = 0x12;
suPortCfg.au8ConfiguredDeviceID[1] = 0x34;
suPortCfg.au8ConfiguredDeviceID[2] = 0x54;
// Set specific Serial Number
IOL_Port_vMemCpy(suPortCfg.au8ConfiguredSerialNumber, au8Serial, sizeof(au8Serial));
suPortCfg.u8ConfiguredSerialNumberLen = sizeof(au8Serial);
// Send the configured struct to the System Management layer
@ IOL_eInspectionLevel_IDENTICAL
Check Vendor ID, Device ID and Serial Number.
Definition IOLM_Types.h:560
INT8U au8ConfiguredSerialNumber[16]
Configured Serial Number.
Definition IOLM_Types.h:855
INT8U u8ConfiguredSerialNumberLen
Configured Serial Number length.
Definition IOLM_Types.h:859

Stop Communication / Disable Port

The communication can be stopped by setting the port to the inactive state:

IOLM_SPortConfig suPortCfg;
// Prepare port configuration struct
IOL_Port_vMemSet(&suPortCfg, 0, sizeof(IOLM_SPortConfig));
// Set desired target mode
// Send the configured struct to the System Management layer
@ IOL_eTargetMode_INACTIVE
Communication disabled, no DI, no DO.
Definition IOL_Types.h:254

Standard Input and Output (SIO) Mode

The Port is set to SIO mode by the following command:

IOLM_SPortConfig suPortCfg;
INT8U u8State;
// Prepare port configuration struct
IOL_Port_vMemSet(&suPortCfg, 0, sizeof(IOLM_SPortConfig));
// Set desired target mode
suPortCfg.eTargetMode = IOL_eTargetMode_DI; // For intput mode (IOL_eTargetMode_DO for output mode)
// Send the configured struct to the System Management layer
uint8_t INT8U
8 bit unsigned integer
Definition IOL_Port_Types.h:68
@ IOL_eTargetMode_DI
Port in digital input mode (SIO).
Definition IOL_Types.h:256

Process Data

After each establishment of a communication relation, the Process Data is marked invalid. The application layer has to set the data valid again by IOLM_API_AL_eControlReq.

This can be done via the IOL_ePortMode_SM_OPERATE event in the function IOLM_Port_SM_vPortMode.