Skip to end of banner
Go to start of banner

PNS Diagnostics Example

Skip to end of metadata
Go to start of metadata

You are viewing an old version of this page. View the current version.

Compare with Current View Page History

« Previous Version 5 Next »

1. Example project

In this example, the application activates the PROFINET indications. For that, the application needs to call the request "Register Application".

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

netX 90: https://kb.hilscher.com/display/NXLFWHST/netX+90+-+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://kb.hilscher.com/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_extendedConfig → 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_extendedConfig → 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_extendedConfig → 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_extendedConfig → Components → cifXApplicationDemo → Sources → App_EventHandler.c


3. Configuration packet

The Diagnostic functions are:

void AppPNS_HandleAppAddChannelDiagnosisReq( uint16_t usSlot , uint16_t usSubslot, APP_DATA_T* ptAppData)
{
  /* use global packet buffer */
  PNS_IF_ADD_CHANNEL_DIAG_REQ_T *ptReq = ( PNS_IF_ADD_CHANNEL_DIAG_REQ_T*) &(ptAppData->tPacket);
  memset(ptReq, 0x00, sizeof(*ptReq));
  ptReq->tHead.ulDest = 0x20;
  ptReq->tHead.ulCmd = PNS_IF_ADD_CHANNEL_DIAG_REQ;
  ptReq->tHead.ulLen = sizeof(ptReq->tData);

  ptReq->tData.ulApi          = 0;
  ptReq->tData.ulSlot         = usSlot;
  ptReq->tData.ulSubslot      = usSubslot;

  ptReq->tData.usChannelNum     = 0x8000;
  ptReq->tData.usChannelProp    = 0x0000;
  ptReq->tData.usChannelErrType = 2;


  (void)Pkt_SendPacket(ptAppData->hChannel[0], &ptAppData->tPacket, TX_TIMEOUT);
}

void AppPNS_HandleAddChannelDiagnosisCnf( APP_DATA_T* ptAppData)
{
  PNS_IF_ADD_CHANNEL_DIAG_CNF_T* ptAddChannelDiagCnf=( PNS_IF_ADD_CHANNEL_DIAG_CNF_T*) &(ptAppData->tPacket);
  s_abDiagHandle = ptAddChannelDiagCnf->tData.hDiagHandle;
  return;
}

void AppPNS_HandleRemoveDiagnosisReq( APP_DATA_T* ptAppData)
{
  /* use global packet buffer */
  PNS_IF_REMOVE_DIAG_REQ_T *ptReq = ( PNS_IF_REMOVE_DIAG_REQ_T*) &(ptAppData->tPacket);

  memset(ptReq, 0x00, sizeof(*ptReq));

  ptReq->tHead.ulDest = 0x20;
  ptReq->tHead.ulCmd = PNS_IF_REMOVE_DIAG_REQ;
  ptReq->tHead.ulLen = 4;//sizeof(ptReq->tData);

  ptReq->tData.hDiagHandle=s_abDiagHandle;

  (void)Pkt_SendPacket(ptAppData->hChannel[0], &ptAppData->tPacket, TX_TIMEOUT);
}


4. Values from GSDML file

<?xml version="1.0" encoding="iso-8859-1"?>
<ISO15745Profile xmlns="http://www.profibus.com/GSDML/2003/11/DeviceProfile" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://www.profibus.com/GSDML/2003/11/DeviceProfile ..\xsd\GSDML-DeviceProfile-V2.34.xsd">
  <ProfileHeader>
    <ProfileIdentification>PROFINET Device Profile</ProfileIdentification>
    <ProfileRevision>1.00</ProfileRevision>
    <ProfileName>Device Profile for PROFINET Devices</ProfileName>
    <ProfileSource>PROFIBUS Nutzerorganisation e. V. (PNO)</ProfileSource>
    <ProfileClassID>Device</ProfileClassID>
    <ISO15745Reference>
      <ISO15745Part>4</ISO15745Part>
      <ISO15745Edition>1</ISO15745Edition>
      <ProfileTechnology>GSDML</ProfileTechnology>
    </ISO15745Reference>
  </ProfileHeader>
  <ProfileBody>
    <DeviceIdentity DeviceID="0x1003" VendorID="0x011E">
      <InfoText TextId="DeviceDescription_InfoText"/>
      <VendorName Value="Hilscher Gesellschaft für Systemautomation mbH"/>
    </DeviceIdentity>
    <DeviceFunction>
      <Family MainFamily="I/O" ProductFamily="PNS"/>
    </DeviceFunction>
    <ApplicationProcess>
      <DeviceAccessPointList>
        <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">
          <ModuleInfo>
            <Name TextId="NETX RE/PNS V5.1.0 Host Example"/>
            <InfoText TextId="DIM 31_InfoText"/>
            <VendorName Value="Hilscher Gesellschaft für Systemautomation mbH"/>
            <OrderNumber Value="1234.567"/>
            <HardwareRelease Value="3"/>
            <SoftwareRelease Value="V5.1.0"/>
          </ModuleInfo>
          <CertificationInfo ApplicationClass="" ConformanceClass="C" NetloadClass="II"/>
          <SubslotList>
            <SubslotItem SubslotNumber="32768" TextId="X1"/>
            <SubslotItem SubslotNumber="32769" TextId="X1P1"/>
            <SubslotItem SubslotNumber="32770" TextId="X1P2"/>
          </SubslotList>
          <IOConfigData MaxInputLength="1440" MaxOutputLength="1440"/>
          <UseableModules>
            <ModuleItemRef FixedInSlots="1" ModuleItemTarget="10byteinput"/>
            <ModuleItemRef FixedInSlots="2" ModuleItemTarget="6byteoutput"/>
          </UseableModules>
          <VirtualSubmoduleList>
            <VirtualSubmoduleItem ID="DIM 31" IM5_Supported="false" MayIssueProcessAlarm="false" SubmoduleIdentNumber="0x00003010" Writeable_IM_Records="1 2 3">
              <IOData/>
              <ModuleInfo CategoryRef="DAP Module">
                <Name TextId="NETX RE/PNS V5.1.0 Host Example"/>
                <InfoText TextId="DIM 31_InfoText"/>
              </ModuleInfo>
            </VirtualSubmoduleItem>
          </VirtualSubmoduleList>
          <SystemDefinedSubmoduleList>
            <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" >
              <RT_Class3Properties ForwardingMode="Relative" MaxBridgeDelay="5500" MaxNumberIR_FrameData="256" MaxRetentionTime="20000" StartupMode="Advanced;Legacy"/>
              <SynchronisationMode MaxLocalJitter="50" SupportedRole="SyncSlave" SupportedSyncProtocols="PTCP" T_PLL_MAX="1000"/>
              <ApplicationRelations NumberOfAR="2" StartupMode="Advanced;Legacy">
                <TimingProperties ReductionRatio="1 2 4 8 16 32 64 128 256 512" SendClock="32 64 128"/>
                <RT_Class3TimingProperties ReductionRatio="1 2 4 8 16" SendClock="8 16 32 64 128"/>
              </ApplicationRelations>
              <MediaRedundancy SupportedRole="Client"/>
            </InterfaceSubmoduleItem>
            <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">
              <MAUTypeList>
                <MAUTypeItem AdjustSupported="true" Value="16"/>
              </MAUTypeList>
            </PortSubmoduleItem>
            <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">
              <MAUTypeList>
                <MAUTypeItem AdjustSupported="true" Value="16"/>
              </MAUTypeList>
            </PortSubmoduleItem>
          </SystemDefinedSubmoduleList>
          <Graphics>
            <GraphicItemRef GraphicItemTarget="1" Type="DeviceSymbol"/>
            <GraphicItemRef GraphicItemTarget="1" Type="DeviceIcon"/>
          </Graphics>
        </DeviceAccessPointItem>
      </DeviceAccessPointList>
      <ModuleList>
        <ModuleItem ID="10byteinput" ModuleIdentNumber="0x00000001">
          <ModuleInfo CategoryRef="Input Module">
            <Name TextId="Module_10byteinput_Name"/>
            <InfoText TextId="Module_10byteinput_InfoText"/>
          </ModuleInfo>
          <VirtualSubmoduleList>
            <VirtualSubmoduleItem ID="10byteinput" MayIssueProcessAlarm="false" SubmoduleIdentNumber="0x00000001">
              <IOData>
                <Input>
                  <DataItem DataType="OctetString" Length="10" TextId="DataItem_10byteinput_inputdata_0_Name"/>
                </Input>
              </IOData>
              <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>
              <ModuleInfo>
                <Name TextId="Submodule_10byteinput_Name"/>
                <InfoText TextId="Submodule_10byteinput_InfoText"/>
              </ModuleInfo>
            </VirtualSubmoduleItem>
          </VirtualSubmoduleList>
        </ModuleItem>
        <ModuleItem ID="6byteoutput" ModuleIdentNumber="0x00000002">
          <ModuleInfo CategoryRef="Output Module">
            <Name TextId="Module_6byteoutput_Name"/>
            <InfoText TextId="Module_6byteoutput_InfoText"/>
          </ModuleInfo>
          <VirtualSubmoduleList>
            <VirtualSubmoduleItem ID="6byteoutput" MayIssueProcessAlarm="false" SubmoduleIdentNumber="0x00000001">
              <IOData>
                <Output>
                  <DataItem DataType="OctetString" Length="6" TextId="DataItem_6byteoutput_outputdata_0_Name"/>
                </Output>
              </IOData>
              <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>
              <ModuleInfo>
                <Name TextId="Submodule_6byteoutput_Name"/>
                <InfoText TextId="Submodule_6byteoutput_InfoText"/>
              </ModuleInfo>
            </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>
        <GraphicItem GraphicFile="GSDML-011E-0x1003-NETX90REPNS" ID="1"/>
      </GraphicsList>
      <CategoryList>
        <CategoryItem ID="DAP Module" TextId="DAP Module_CategoryName"/>
        <CategoryItem ID="Input Module" TextId="Input Module_CategoryName"/>
        <CategoryItem ID="Output Module" TextId="Output Module_CategoryName"/>
      </CategoryList>
      <ExternalTextList>
        <PrimaryLanguage>
          <Text TextId="DAP Module_CategoryName" Value="Device Access Point Modules"/>
          <Text TextId="DIM 31_InfoText" Value="Firmware version V5.1.0 Identification &amp; Maintenance 1-3, Shared Device, RT and IRT Communication."/>
          <Text TextId="DataItem_10byteinput_inputdata_0_Name" Value="Inputs"/>
          <Text TextId="DataItem_6byteoutput_outputdata_0_Name" Value="Outputs"/>
          <Text TextId="DeviceDescription_InfoText" Value="PROFINET IO-Device"/>
          <Text TextId="Input Module_CategoryName" Value="Input Modules"/>
          <Text TextId="Module_10byteinput_InfoText" Value="10 Bytes Input Module"/>
          <Text TextId="Module_10byteinput_Name" Value="10 Bytes Input"/>
          <Text TextId="Module_6byteoutput_InfoText" Value="6 Bytes Output Module"/>
          <Text TextId="Module_6byteoutput_Name" Value="6 Bytes Output"/>
          <Text TextId="NETX RE/PNS V5.1.0 Host Example" Value="NETX RE/PNS V5.1.0 Host Example"/>
          <Text TextId="Output Module_CategoryName" Value="Output Modules"/>
          <Text TextId="PN-IO" Value="PN-IO"/>
          <Text TextId="Port1" Value="Port 1"/>
          <Text TextId="Port2" Value="Port 2"/>
          <Text TextId="Submodule_10byteinput_InfoText" Value="10 Bytes Input Submodule"/>
          <Text TextId="Submodule_10byteinput_Name" Value="10 Bytes Input"/>
          <Text TextId="Submodule_6byteoutput_InfoText" Value="6 Byte Output Submodule"/>
          <Text TextId="Submodule_6byteoutput_Name" Value="6 Bytes Output"/>
          <Text TextId="X1" Value="X1"/>
          <Text TextId="X1P1" Value="X1 P1"/>
          <Text TextId="X1P2" Value="X1 P2"/>
          <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="DAP Module_CategoryName" Value="Device Access Point Module"/>
          <Text TextId="DIM 31_InfoText" Value="Firmware version V5.1.0 Identification &amp; Maintenance 1-3, Shared Device, RT und IRT Betrieb."/>
          <Text TextId="DataItem_10byteinput_inputdata_0_Name" Value="Eingänge"/>
          <Text TextId="DataItem_6byteoutput_outputdata_0_Name" Value="Ausgänge"/>
          <Text TextId="DeviceDescription_InfoText" Value="PROFINET IO-Device"/>
          <Text TextId="Input Module_CategoryName" Value="Eingangsmodule"/>
          <Text TextId="Module_10byteinput_InfoText" Value="10 Byte Eingangsmodul"/>
          <Text TextId="Module_10byteinput_Name" Value="10 Byte Eingang"/>
          <Text TextId="Module_6byteoutput_InfoText" Value="6 Byte Ausgangsmodul"/>
          <Text TextId="Module_6byteoutput_Name" Value="6 Byte Ausgang"/>
          <Text TextId="NETX RE/PNS V5.1.0 Host Example" Value="NETX RE/PNS V5.1.0 Host Example"/>
          <Text TextId="Output Module_CategoryName" Value="Ausgangsmodule"/>
          <Text TextId="PN-IO" Value="PN-IO"/>
          <Text TextId="Port1" Value="Port 1"/>
          <Text TextId="Port2" Value="Port 2"/>
          <Text TextId="Submodule_10byteinput_InfoText" Value="10 Byte Eingangssubmodul"/>
          <Text TextId="Submodule_10byteinput_Name" Value="10 Byte Eingang"/>
          <Text TextId="Submodule_6byteoutput_InfoText" Value="6 Byte Ausgangssubmodul"/>
          <Text TextId="Submodule_6byteoutput_Name" Value="6 Byte Ausgang"/>
          <Text TextId="X1" Value="X1"/>
          <Text TextId="X1P1" Value="X1 P1"/>
          <Text TextId="X1P2" Value="X1 P2"/>
          <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>
</ISO15745Profile>

  • No labels