Skip to end of banner
Go to start of banner

PNS ExtendedConfig 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 activates the Profinet indications. For that the application need to call the request "Register Application".

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

2. Configuration Packet

Nothing needs to be done in the configuration packet.

3. Register Application Request

This Register Application Request activates all Profinet indications. Indications are messages from the stack and the application needs to create a response to the stack.

The application has often only 3 second to create the response. If the application does not response, the stack will send an error indication.

4. Start Sequenz

The Register Application Request shall be called before Set Configuration Request. The application will get the first indication after channel init.

This is the Link changed indication (HIL_LINK_STATUS_CHANGE_IND).

5. Indication/PacketHandler

The PacketHandler needs to read the mailbox and check it for new packets (for example indications). If a new packet is available the application shall check the command in the header of the packet and implement a switch case. ALL profinet indication like here the PNS_IF_PARAM_END_IND shall be implemented in the switch case:

Example for PNS_IF_PARAM_END_IND:

Very important is here, that the application uses the indication packet to create the response packet. The only change is done in the values

Command, Length, State and Data. The rest of the values coming from the indication packet.

Take care, that the length value for the response is not always sizeof(data). Carefully check the profinet documentation, sometimes the length value is

X + sizeof(data).

5. Indication/PacketHandler Profinet default

Often an application does not need to handle all Profinet indications or the user does not want to. Only a set of a few indications can be used by the application. But the application needs to implement all

Profinet indications. In this case the application can return ERR_HIL_NO_APPLICATION_REGISTERED = 0xC0000202 for not wanted indications.

That means, that the stack will handle the indication like if the application is not registered for this indication. Implement all indications like this:

5. Indication/PacketHandler switch case default

The default of the switch case is very important. If not all indications are implemented in the application, the default will create a default response to the stack.

For profinet indications this default answer can we wrong, but it is better as no response.

6. When does the application need to implement an indication ?

There is no general answer, because this need to be checked for every application. Many indications can be seen as informations for the application and only a response is necessary.

But some indications need a implementation in the application. For example if the application change the stack behavior with ptSetConfig→ulSystemFlags, than it make is necessary to implement indications.

One example for that is the PNS DeviceName/IP Example.

A other example is the PNS Signal LED Example. If the device developer forgets to bring the signal LED on the case of the device or he want to use an other LED as Signal LED, is possible

to use the signal indication.




  • No labels