Versions Compared

Key

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

1. Example project

In this example, the application activate activates the Profinet PROFINET indications. For that, the application need 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

...

the Knowledge Base on the following website:

netX 90: https://hilscher.atlassian.net/wiki/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://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

Nothing needs to be done in the configuration packet.

...


4. Register Application

...

request

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

The application has often only 3 second has a span of three seconds to create the response. If the application does not responserespond, 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 Changed indication" (HIL_LINK_STATUS_CHANGE_IND).:

Image Modified

...

6. Indication / PacketHandler

The PacketHanlder 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 and implement ALL profinet indication like here .

All PROFINET indication (like 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 Significant is here, that the application use 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, that since the length value for the response is no allways not always sizeof(data). Chack carfully Carefully check the profinet PROFINET documentation an sometime , sometimes the length value is

X + sizeof(data).

...


7. Indication / PacketHandler

...

PROFINET default

Often a an application does not want need to handle all Profinet indicationsPROFINET indications or the user does not want it to. Only a set of a few indications want to can be used by the application. However, But 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.

Image Removed

...

Implement all indications like this:

Image Added


8. Indication / PacketHandler switch case default

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

For profinet PROFINET indications this default answer can we be wrong, but it is better as 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 information for the application and only a response is necessary.

Nevertheless, some indications need an implementation in the application. For example, if the application changes the stack behaviour with 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 you want to use another LED as Signal LED, it is possible to use the signal indication.