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 7 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

Please add the following colored 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>
   
      <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="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="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