Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

1. Example project

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

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

Image Removed

...

Knowledge Base on the following website:

netX 90: https://kb.hilscher.com/display/NXLFWHST/netX+90+-+PROFINET+IO+Device+-+Examples


Image Added


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

Nothing needs to be done in the configuration packet.

...


4. Register Application

...

request

This The "Register Application Request request" activates all Profinet PROFINET indications. Indications are messages coming from the stack. The application therefore needs to create a response to the stack.

The application often only has a span of 3 three seconds to create the response. If the application does not respond, the stack will send an error indication.


Image Modified

...


5. Start

...

Sequence

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

This is the "link changed Link Changed indication" (HIL_LINK_STATUS_CHANGE_IND):

Image Modified

...

6. 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 All PROFINET indication (like here in this example the PNS_IF_PARAM_END_IND) shall be implemented in the switch case:Image Removed

Image Added


Example for PNS_IF_PARAM_END_IND:Image Removed

Image Added

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 are coming from the indication packet.

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

X + sizeof(data).

...


7. Indication / PacketHandler

...

PROFINET default

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

Profinet 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:Image Removed

Image Added

...


8. 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 PROFINET indications this default answer can we wrong, but it is better than no response.Image Removed

Image Added

...


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

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

But Nevertheless, some indications need an implementation in the application. For example, if the application changes the stack behavior behaviour with ptSetConfig→ulSystemFlags ptSetConfig → ulSystemFlags, than this makes it necessary to implement indications.

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

Another example is the PNS Signal LED Example. If the device developer forgets to control the signal LED of the device or he wants to use another LED as Signal LED, it is possible to use the signal indication.

...