PNS Pull and Plug Example

1. Example project

In this example the application shall handle dynamical process data changes on the application side. For that, it is necessary to change the configuration packet, to implement "Pull and Plug Request“" and change Wire and Read Record Indication handling.

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



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

In the configuration packet, it is not necessary to change something.

4. Values from GSDML file

For dynamical configuration of modules the lines

            <ModuleItemRef FixedInSlots="1" ModuleItemTarget="10byteinput"/>

            <ModuleItemRef FixedInSlots="2" ModuleItemTarget="6byteoutput"/>

in the GSDML file need to be change to:

            <ModuleItemRef AllowedInSlots="1" ModuleItemTarget="10byteinput"/>

            <ModuleItemRef AllowedInSlots="1" ModuleItemTarget="5byteinput"/>

            <ModuleItemRef AllowedInSlots="2" ModuleItemTarget="6byteoutput"/>

            <ModuleItemRef AllowedInSlots="2" ModuleItemTarget="3byteoutput"/>

add 2 new modules has been added to the GSDML file


Now this is possible: to 

Slot 1: 10 byteinput

Slot 2: 6 byteoutput

or

Slot 1: 10 byteinput

Slot 2: 3 byteoutput

or

Slot 1: 5 byteinput

Slot 2: 6 byteoutput

or

Slot 1: 5 byteinput

Slot 2: 3 byteoutput

or

an empty slot configuration like

Slot 1: empty

Slot 2: 3 byteoutput

5. Check Indication

With the "Check Indication" the stack gets the information which module and submodule the IO Controller wants in a Slot / Subslot.

The application needs to decide if the requested ModuleIdentNumber and SubmoduleIdentNumber belongs to the device. In the certification test, the test tool will try a module and submodule which is not part of the GSDML file.

If the module / submodule is wrong and pass not the application check, then send a response with wrong module and wrong submodule.

If the module / submodule is correct, then do not sent directly a check response. Save the indication packet because the response will be done later.

The next step is to pull the module/submodule to clear the slot/subslot. In this application example with the first check indication, all modules will be pulled.


With the plug module and plug submodule service it is possible to plug the requested module and submodule.

6. Write / Read Record Indication

If a module has an application parameter, it is essential to take care now that the write / read record indication

can handle this dynamical. Here it is easy because Index 1 and Index 2 will not change.

10byteinput and 5byteinput have the same Index 1

6byteoutput and 3 byteoutput have the same Index 2

7. DPM Offset

If it is possible to choose 2 Inputs modules, then both modules cannot have the same DPM space. For example, input module 1 can have DPM space 0 till 5 and input module 2 can have DPM space 6 till 11.

Slot 1: 6 byteoutput  Index 1

Slot 2: 6 byteoutput  Index 1 with DPM offset = 6

In this example is no special DPM layout. The application developer should think about it. For example, if the application has 4 output modules that can be plugged in slot 1 with different byte size like this:

6 byteoutput

12 byteoutput

20 byteoutput

40 byteoutput

It would be good to use reserve DPM space 0 till 39 for this module. If the 6 byteoutput is plugged, use for the next module an offset of 40. There will be 34 byte unused in the DPM. If a DPM offset of 6 is used for the second output module and the application need now to pull the first 6 byte module and plug a 40 byte output module, it does not fit in this 6 byte DPM space.

8. TIA Portal

In TIA Portal, the user can choose which module combination he wants to have