Skip to end of banner
Go to start of banner

PNS I&M 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 14 Next »

1. Example project

In this example the application shall handle I&M data on application side. For that it is necessary to change the configuration packet, to implement the "write I&M indication" ,

the "read I&M indication" and the "reset to factory indication". For that, the application needs a possibility to save information remanent in a flash.

Example Sourcecode can be found in the Extended Config Example: netX 90 - PROFINET IO Device - extendedConfig V2.2.0.0

2. Configuration Packet

In the configuration packet it is necessary to change the ptSetConfig→ulSystemFlags. First step is to disable the flag PNS_IF_SYSTEM_STACK_HANDLE_I_M_ENABLED.


The next step is the use of the same data in the configuration packet like in the I&M0 informations.

You can for Example first create a structure of I&M0 and than use it:

ptSetConfig→ulVendorId              = IM0.usManufacturerId;

ptSetConfig->usSwRevision1       = IM0.tSoftwareRevision.bX;

ptSetConfig->usSwRevision2       = IM0.tSoftwareRevision.bY;

ptSetConfig->usSwRevision3       = IM0.tSoftwareRevision.bZ;

ptSetConfig->bSwRevisionPrefix  = IM0.tSoftwareRevision.bPrefix;

3. GSDML

In the GSDML the device developer needs to give information about which module has I&M data. Below you see the default configuration in our PNS V5.1.0.4 device.

I&M is currently just configured for the DAP:

<VirtualSubmoduleItem ID="DIM 31" IM5_Supported="false" MayIssueProcessAlarm="false" SubmoduleIdentNumber="0x00003010" Writeable_IM_Records="1 2 3">

That means, I&M0 is supported to 3. I&M4 and 5 is not supported. Only the DAP module has I&M Data.


It is possbile to use the Writeable_IM_Records="1 2 3 4" on a different module. For example:

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

That means the DAP has now I&M0 to 3 and the 10 Byte Input module has its own dataset for I&M0 to 2.

In this case the I&M data handling needs to be implemented in your application, because the stack can only handle the default I&M data on the DAP.

4. Indications

Implement the packet handler Indications for

PNS_IF_READ_IM_IND

PNS_IF_WRITE_IM_IND


The stack does not know anything about the GSDML file. The stack first needs the information about supported I&M data.

Therefore the stack sends PNS_IF_READ_IM_IND in startup, with the parameter PNS_IF_IM_TYPE_IM0FILTER.

That means the stack wants to get information of which modules do support their own I&M data, from the application.

The application can response with some flags to this stack request.


For example the stack requests for Slot 0 and Subslot 1 (DAP):

The application sends back the response with these flags:

ptReadImRes->tData.tData.atIM0FilterData[0].ulFlags = PNS_IF_IM0_FILTER_DATA_HAS_IM_DATA | PNS_IF_IM0_FILTER_DATA_MODULE_REF | PNS_IF_IM0_FILTER_DATA_DEVICE_REF;


PNS_IF_IM0_FILTER_DATA_HAS_IM_DATA means, that the module has his own I&M Data:

(The DAP has in data)

PNS_IF_IM0_FILTER_DATA_MODULE_REF means, that the I&M data of this Modul are the reference for all submodules which belong to this module:

(All other submodules respond with the I&M data from the DAP)

PNS_IF_IM0_FILTER_DATA_DEVICE_REF is only used one time (on the DAP) and means, that all other modules and submodules without own I&M data will refer to this module:

(All other modules and submodules respond with the I&M data from the DAP)



That means GSDML with

DAP: <VirtualSubmoduleItem ID="DIM 31" IM5_Supported="false" MayIssueProcessAlarm="false" SubmoduleIdentNumber="0x00003010" Writeable_IM_Records="1 2 3">

For Slot 0 Subslot 1

ptReadImRes->tData.tData.atIM0FilterData[0].ulFlags = PNS_IF_IM0_FILTER_DATA_HAS_IM_DATA | PNS_IF_IM0_FILTER_DATA_MODULE_REF | PNS_IF_IM0_FILTER_DATA_DEVICE_REF;


Modul: <VirtualSubmoduleItem ID="10byteinput" MayIssueProcessAlarm="false" SubmoduleIdentNumber="0x00000001" Writeable_IM_Records="1 2 ">

For Slot 2 Subslot 1

ptReadImRes->tData.tData.atIM0FilterData[0].ulFlags = PNS_IF_IM0_FILTER_DATA_HAS_IM_DATA | PNS_IF_IM0_FILTER_DATA_MODULE_REF;

(Slot 2 has its own I&M data and will not respond with the I&M data from the DAP)

(For the Module which is not marked yellow, only ptReadImRes->tData.tData.atIM0FilterData[0].ulFlags = PNS_IF_IM0_FILTER_DATA_HAS_IM_DATA; is necessary, because there are no submodules)


More informations to I&M can be found here: How to deal with I&M data? (Updated 2016-12-20)

5. Indication implementation

I&M0 is always read only. If a PNS_IF_WRITE_IM_IND comes for I&M0, than this can not be correct. I&M0 has the value usIMRevisionCounter. This must be updatet as soon as I&M1 to 4 are written.

I&M1 till 4 are read/write and need to be saved remanent on the application flash.

I&M5 is always read only.

That means each write and read can come for a slot with a subslot and the application needs to check if the combination of requested slot and subslot and write or read is really possible.

6. TIA Portal read I&M0




  • No labels