PNS SimpleConfig Example

1. Example project

The simple PROFINET configuration example is using the SET_CONFIGURATION_REQ packet without an indication handling

The extended PROFINET configuration example is using the SET_CONFIGURATION_REQ packet with an indication handling for ParameterEnd and Records. It uses the Register Application service.

Using the Register Application Service, the user application provides the stack an endpoint to send indications to.

The SimpleConfig example does not use the example above, this only applies to the extendedConfig example.


The SimpleConfig example can be found in the Knowledge Base on the following website:

netX 90: https://hilscher.atlassian.net/wiki/display/NXLFWHST/netX+90+-+PROFINET+IO+Device+-+Examples

netX 51: https://hilscher.atlassian.net/wiki/display/NXLFWHST/netX+51+-+PROFINET+IO+Device+-+Examples


This can alternatively be found under:

kb.hilscher.com → Software → LFW Host Examples → Profinet IO-Device → netX 90 APP / netX 51 → PROFINET IO Device - simpleConfig Vx.x.x.x

The SimpleConfig project can be opened by double-clicking the ".solproject" file. This requires the latest version of netXStudio (https://hilscher.atlassian.net/wiki/display/NDT/).


2. PROFINET Sources

A GSDML file is required for this example. The GSDML file can be found in the netXStudio project in Project Explorer at:

netXxx_PNSVx_simpleConfig → Components → cifXApplicationDemoPNS → DeviceDescription → GSDML-V2.3x-HILSCHER-NETX xx-RE PNS-20xxxxxx.xml


The PacketHandler describes the acyclic packages and can be found in the Project Explorer under:

netXxx_PNSVx_simpleConfig → Components → cifXApplicationDemoPNS → Sources → AppPNS_DemoApplicationFunctions.c


The IO Data Handler describes the IO data that is exchanged between the application and the stack and can be found in the Project Explorer under:

    long SetModulConfig( void* pvPck )


The terminal handler uses the interface used by UART to display debug messages and is located in Project Explorer under:

netXxx_PNSVx_simpleConfig → Components → cifXApplicationDemo → Sources → App_TerminalHandler.c


The event handler shows the diagnoses and alarms, which can be found in the Project Explorer under:

netXxx_PNSVx_simpleConfig → Components → cifXApplicationDemo → Sources → App_EventHandler.c


3. Configuration packet

The PacketHandler function is:

    bool AppPNS_PacketHandler (CIFX_PACKET * ptPacket,
                           void * pvUserData)


4. Values from GSDML file

   /* function:    SetConfigParams */

configuration packet
(AppPNS_DemoApplicationFunctions.c)

GSDML
(GSDML-V2.35-HILSCHER-NETX 90-RE PNS-20191118.xml)
ptSetConfig->ulVendorId        = 0x011E;      /* Vendor ID                            */
<DeviceIdentity DeviceID="0x1003" VendorID="0x011E">
ptSetConfig->ulDeviceId        = 0x1003;      /* Device ID                            */
<DeviceIdentity DeviceID="0x1003" VendorID="0x011E">
ptSetConfig->usSwRevision1     = 5;           /* Software Revision 1, default: 0      */
<SoftwareRelease Value="V5.3.0"/>
ptSetConfig->usSwRevision2     = 3;           /* Software Revision 2, default: 0      */
<SoftwareRelease Value="V5.3.0"/>
ptSetConfig->usSwRevision3     = 0;           /* Software Revision 3, default: 0      */
<SoftwareRelease Value="V5.3.0"/>
ptSetConfig->bSwRevisionPrefix = 'V';         /* Software Revision Prefix, default: 0 */
<SoftwareRelease Value="V5.3.0"/>
ptApi->ulNumSubmodItems        = 0x06;   
  1.    DAP V3.5
  2.    PDEV PN-IO
  3.    PDEV Port 1
  4.    PDEV Port 2
  5.    10 Byte Input module (Device to PLC)
  6.    6 Byte Output module (PLC to Device)
ptSubmod->ulModuleId           = 0x00003011;
<DeviceAccessPointItem CheckDeviceID_Allowed="true" DNS_CompatibleName="netxv5repns" DeviceAccessSupported="true" FixedInSlots="0" ID="DIM 31" ImplementationType="netX" LLDP_NoD_Supported="true" MinDeviceInterval="8" ModuleIdentNumber="0x00003011" MultipleWriteSupported="true" NameOfStationNotTransferable="true" NumberOfDeviceAccessAR="1" ObjectUUID_LocalIndex="1" PNIO_Version="V2.34" PhysicalSlots="0..32" PowerOnToCommReady="10000" PrmBeginPrmEndSequenceSupported="false" ResetToFactoryModes="2" SharedDeviceSupported="true" SharedInputSupported="false">


/* Configure the DAP V3.5 */

configuration packet
(AppPNS_DemoApplicationFunctions.c)
GSDML
(GSDML-V2.35-HILSCHER-NETX 90-RE PNS-20191118.xml)
ptSubmod->ulSubmodId           = 0x00003010;  /* Submodule ID                         */
<VirtualSubmoduleItem ID="DIM 31" IM5_Supported="false" MayIssueProcessAlarm="false" SubmoduleIdentNumber="0x00003010" Writeable_IM_Records="1 2 3">


  /* Configure PDEV PN-IO */

configuration packet
(AppPNS_DemoApplicationFunctions.c)
GSDML
(GSDML-V2.35-HILSCHER-NETX 90-RE PNS-20191118.xml)
ptSubmod->ulSubmodId           = 0x00003011;  /* Submodule ID                         */

<InterfaceSubmoduleItem DCP_BoundarySupported="true" DCP_HelloSupported="true" DelayMeasurementSupported="true" ID="DIM 31 Interfacesubmodule" NetworkComponentDiagnosisSupported="false" PTP_BoundarySupported="true" SubmoduleIdentNumber="0x00003011" SubslotNumber="32768" SupportedProtocols="SNMP;LLDP" SupportedRT_Classes="RT_CLASS_1;RT_CLASS_3" TextId="PN-IO" >


  /* Configure PDEV Port 1 */

configuration packet
(AppPNS_DemoApplicationFunctions.c)
GSDML
(GSDML-V2.35-HILSCHER-NETX 90-RE PNS-20191118.xml)
ptSubmod->ulSubmodId           = 0x00003012;  /* Submodule ID                         */
<PortSubmoduleItem CheckMAUTypeDifferenceSupported="true" CheckMAUTypeSupported="true" ID="DIM 31 Portsubmodule 1" IsDefaultRingport="true" LinkStateDiagnosisCapability="Up+Down" MAUTypes="16" MaxPortRxDelay="220" MaxPortTxDelay="116" PortDeactivationSupported="true" SubmoduleIdentNumber="0x00003012" SubslotNumber="32769" TextId="Port1">


  /* Configure PDEV Port 2 */

configuration packet
(AppPNS_DemoApplicationFunctions.c)
GSDML
(GSDML-V2.35-HILSCHER-NETX 90-RE PNS-20191118.xml)
ptSubmod->ulSubmodId           = 0x00003013;  /* Submodule ID                         */
<PortSubmoduleItem CheckMAUTypeDifferenceSupported="true" CheckMAUTypeSupported="true" ID="DIM 31 Portsubmodule 2" IsDefaultRingport="true" LinkStateDiagnosisCapability="Up+Down" MAUTypes="16" MaxPortRxDelay="220" MaxPortTxDelay="116" PortDeactivationSupported="true" SubmoduleIdentNumber="0x00003013" SubslotNumber="32770" TextId="Port2">


  /* Configure 10 Byte Input module (Device to PLC) */

configuration packet
(AppPNS_DemoApplicationFunctions.c)
GSDML
(GSDML-V2.35-HILSCHER-NETX 90-RE PNS-20191118.xml)
ptSubmod->ulModuleId           = 0x00000001;  /* Module ID to which this              */
/* submodule belongs */
<ModuleItem ID="10byteinput" ModuleIdentNumber="0x00000001">
ptSubmod->ulSubmodId           = 0x00000001;  /* Submodule ID                         */
<VirtualSubmoduleItem ID="10byteinput" MayIssueProcessAlarm="false" SubmoduleIdentNumber="0x00000001">
ptSubmod->ulProvDataLen        = 0x0000000A;  /* Length of provider data (sent by     */
/* IO-Device, received by */
/* IO-Controller) */
<IOData>

     <Input>
          <DataItem DataType="OctetString" Length="10" TextId="DataItem_10byteinput_inputdata_0_Name"/>
     </Input>
</IOData>

ptSubmod->ulConsDataLen        = 0x00000000;  /* Length of consumer data (sent by     */
/* IO-Controller, received by */
/* IO-Device) */
<IOData>

     <Output>
     </Output>
</IOData>


  /* Configure 6 Byte Output module (PLC to Device) */

configuration packet
(AppPNS_DemoApplicationFunctions.c)
GSDML
(GSDML-V2.35-HILSCHER-NETX 90-RE PNS-20191118.xml)
ptSubmod->ulModuleId           = 0x00000002;  /* Module ID to which this              */
/* submodule belongs */
<ModuleItem ID="6byteoutput" ModuleIdentNumber="0x00000002">
ptSubmod->ulSubmodId           = 0x00000001;  /* Submodule ID                         */
<VirtualSubmoduleItem ID="6byteoutput" MayIssueProcessAlarm="false" SubmoduleIdentNumber="0x00000001">
ptSubmod->ulProvDataLen        = 0x00000000;  /* Length of provider data (sent by     */
/* IO-Device, received by */
/* IO-Controller) */
<IOData>

     <Input>
     </Input>
</IOData>

ptSubmod->ulConsDataLen        = 0x00000006;  /* Length of consumer data (sent by     */
/* IO-Controller, received by */
/* IO-Device) */
<IOData>

     <Output>
          <DataItem DataType="OctetString" Length="6" TextId="DataItem_6byteoutput_outputdata_0_Name"/>
     </Output>
</IOData>


no ModuleDiffBlock:


ModuleDiffBlock:

 

Connect request (ExpectedSubmoduleBlockReq)                                                    Connect response (ModuleDiffBlock)