PNS Record 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 extendedConfig example use the example above.


The extendedConfig 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 - extendedConfig Vx.x.x.x

The extendedConfig 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 Read Record indication can be programmed in the AppPNS_DemoApplicationFunctions.c:

     /**************************************************************************************
 function:    ReadRecordInd
 description: Return ReadRecordResponse.
      global:      none
  input:       APP_DATA_T* ptAppData    - pointer to the packet
      output:      none
  return:      void
     **************************************************************************************/
     void AppPNS_HandleAppReadRecordInd( APP_DATA_T* ptAppData)
     {
  ...
}


The Write Record indication can be programmed in the AppPNS_DemoApplicationFunctions.c:

     /**************************************************************************************
function:    WriteRecordInd
description: Return WriteRecordResponse.
      global:      none
input:       APP_DATA_T* ptAppData    - pointer to the packet
      output:      none
return:      void
     **************************************************************************************/
     void AppPNS_HandleAppWriteRecordInd( APP_DATA_T* ptAppData)
     {
  ...
}


4. Values from GSDML file

Please add the following coloured keywords in the GSDML file:

Note: The diagnostic functions and diagnostic texts can be adapted and changed as required.


<ProfileBody>

     <ApplicationProcess>

          <ModuleList>

               <ModuleItem ID="10byteinput" ModuleIdentNumber="0x00000001">

                    <VirtualSubmoduleList>

                         <VirtualSubmoduleItem ID="10byteinput" MayIssueProcessAlarm="false" SubmoduleIdentNumber="0x00000001">

                              <RecordDataList>

                                   <ParameterRecordDataItem Index="1" Length="2">

                                        <Name TextId="Submodule_10byteinput_ParameterName"/>
                                        <Const Data="0x01,0x01"/>
                                        <Ref ValueItemTarget="ExampleParameter" TextId="IDT_InputExampleParameter1" DataType="Unsigned8" ByteOffset="0" BitOffset="0" DefaultValue="1" AllowedValues="1 2" Changeable="true" />
                                        <Ref ValueItemTarget="ExampleParameter" TextId="IDT_InputExampleParameter2" DataType="Unsigned8" ByteOffset="1" BitOffset="0" DefaultValue="1" AllowedValues="1 2" Changeable="true" />

                                   </ParameterRecordDataItem>

                              </RecordDataList>

                         </VirtualSubmoduleItem>

                    </VirtualSubmoduleList>

               </ModuleItem>

               <ModuleItem ID="6byteoutput" ModuleIdentNumber="0x00000002">

                    <VirtualSubmoduleList>

                         <VirtualSubmoduleItem ID="6byteoutput" MayIssueProcessAlarm="false" SubmoduleIdentNumber="0x00000001">

                              <RecordDataList>

                                   <ParameterRecordDataItem Index="2" Length="2">

                                        <Name TextId="Submodule_6byteoutput_ParameterName"/>
                                        <Const Data="0x02,0x02"/>
                                        <Ref ValueItemTarget="ExampleParameter" TextId="IDT_OutputExampleParameter1" DataType="Unsigned8" ByteOffset="0" BitOffset="0" DefaultValue="2" AllowedValues="1 2" Changeable="true" />
                                        <Ref ValueItemTarget="ExampleParameter" TextId="IDT_OutputExampleParameter2" DataType="Unsigned8" ByteOffset="1" BitOffset="0" DefaultValue="2" AllowedValues="1 2" Changeable="true" />

                                   </ParameterRecordDataItem>

                              </RecordDataList>

                         </VirtualSubmoduleItem>

                    </VirtualSubmoduleList>

               </ModuleItem>

          </ModuleList>

          <ValueList>

               <ValueItem ID="ExampleParameter">

                    <Assignments>

                         <Assign Content="1" TextId="ExampleParameterValue1" />
                         <Assign Content="2" TextId="ExampleParameterValue2" />

                    </Assignments>

               </ValueItem>

          </ValueList>

          <ChannelDiagList>

          <!--User Diagnosis - Example-->

               <ChannelDiagItem ErrorType="256">

                    <Name TextId="IDT_DIAG_EXAMPLE" />
                    <Help TextId="IDT_DIAG_HELP_EXAMPLE" />

               </ChannelDiagItem>

          </ChannelDiagList>

          <GraphicsList>
          </GraphicsList>

          <CategoryList>
          </CategoryList>

          <ExternalTextList>

                <PrimaryLanguage>

                     ...

                     <Text TextId="IDT_OutputExampleParameter1" Value="Output example parameter 1"/>
                     <Text TextId="IDT_OutputExampleParameter2" Value="Output example parameter 2"/>
                     <Text TextId="IDT_InputExampleParameter1" Value="Input example parameter 1"/>
                     <Text TextId="IDT_InputExampleParameter2" Value="Input example parameter 2"/>
                     <Text TextId="ExampleParameterValue1" Value="Parameter 1"/>
                     <Text TextId="ExampleParameterValue2" Value="Parameter 2"/>
                     <Text TextId="Submodule_10byteinput_ParameterName" Value="Example Record for 10 byteinput submodule"/>
                     <Text TextId="Submodule_6byteoutput_ParameterName" Value="Example Record for 6 byteoutput submodule"/>
                     <!--Generic Diagnosis-->
                     <!--#256-->
                     <Text TextId="IDT_DIAG_EXAMPLE" Value="Diagnosis is active" />
                     <Text TextId="IDT_DIAG_HELP_EXAMPLE" Value="Dip 3 in NXHX 90 Board is switched on" />           
         

                </PrimaryLanguage>

                <Language xml:lang="de">

                     ...

                     <Text TextId="IDT_OutputExampleParameter1" Value="Ausgang Beispiel Parameter 1"/>
                     <Text TextId="IDT_OutputExampleParameter2" Value="Ausgang Beispiel Parameter 2"/>
                     <Text TextId="IDT_InputExampleParameter1" Value="Eingang Beispiel Parameter 1"/>
                     <Text TextId="IDT_InputExampleParameter2" Value="Eingang Beispiel Parameter 2"/>
                    
<Text TextId="ExampleParameterValue1" Value="Parameter 1"/>
                    
<Text TextId="ExampleParameterValue2" Value="Parameter 2"/>
                    
<Text TextId="Submodule_10byteinput_ParameterName" Value="Beispiel Parameter für 10 byteinput Submodul"/>
                    
<Text TextId="Submodule_6byteoutput_ParameterName" Value="Beispiel Parameter für 6 byteoutput Submodul"/>

                     <!--Generic Diagnosis→
                     <!--#256-->

                    
<Text TextId="IDT_DIAG_EXAMPLE" Value="Diagnose ist aktiv"/>
                    
<Text TextId="IDT_DIAG_HELP_EXAMPLE" Value="Dip 3 im NXHX 90 Board ist eingeschaltet"/>

                </Language>

          <ExternalTextList>

     </ApplicationProcess>

</ProfileBody>


5. Values in SYCON.net and frame in Wireshark trace

Click in SYCON.net on the module and choose the dataset "parameter".


It is possible to change the value. "Parameter1" and "Parameter2" are available.


The PLC writes this parameter in the connection establishment.

  • Slot 1 Subslot 1 Parameter with Index 1 (see GSDML file)
  • Slot 2 Subslot 1 Parameter with Index 2


Wireshark Trace of the connection establishment:

ConnectionEstablishment with Parameter.pcap


After filtering the DCE / RPC frames the following is visible:


The configured value can now be seen in the frame via SYCON.net.


6. Hilscher netHost with PROFINET IO-Controller

Configure the marshaller with an IP address.

Select with right-click the master. Go to "Configuration" and choose "Ethernet Marshalling".


Start the program netHost and connect the PC. Go to Device → Setup → TCP Connection and make sure that the TCP connector is enabled.


Establish the TCP Connection between netHost and PC and open the PROFINET IO-Controller channel.

Go to Data Transfer → PacketData


Create a read request using our PROFINET IO-Controller API manual.


Following picture shows an example for Slot 1 Subslot 1 Index 1 with length 2

On the left side you can see the response of the IO-Controller. It can be seen that the received package returns the value "02 01".

7. TIA Portal

ReadRecord.zap14