Versions Compared

Key

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

1. Example project

In this example, the application shall handle Devicename Device name and IP on the application side. For that, it is necessary to change the configuration packet, to implement the "save station name "Save Station Name indication", the "save ip address "Save IP Address indication" and the "reset Reset to factory Factory indication". For that this, the application needs a possibility to save information remanent in a flash.


Example Sourcecode The extendedConfig example can be found in the Extended Config Example: netX 90 - PROFINET IO Device - extendedConfig V2.2the Knowledge Base on the following website:

netX 90: https://kb.hilscher.com/display/NXLFWHST/netX+90+-+PROFINET+IO+Device+-+Examples (from V3.0.0.0)


Image Modified


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

In the configuration packet, it is necessary to change the ptSetConfig→ulSystemFlags ptSetConfig → ulSystemFlags.

First step is to disable the flag PNS_IF_SYSTEM_NAME_IP_HANDLING_BY_STACK_ENABLED.


Image Modified


The next step is the use of devicename device name and ip IP address parameter in the configuration packet.

The application reads the last remanent saved data from the (application) flash.ptSetConfig→abNameOfStation

ptSetConfig → abNameOfStation = value from flash (240 signs)

ptSetConfig

...

→ ulIpAddr                = value from flash  

ptSetConfig

...

→ ulGateway            = value from flash 

...

ptSetConfig → ulNetMask            = value from flash  


3. Indications

Implement the packet handler Indications for

  • PNS_IF_SAVE_STATION_NAME_IND
  • PNS_IF_SAVE_IP_ADDR_IND
  • PNS_IF_RESET_FACTORY_SETTINGS_IND


Use for example the Ethernet Device Configuration Tool to change the devicename or IP address over the network with the DCP protocol.

Image Modified

This requires the latest version of netXStudio (https://kb.hilscher.com/display/ETHDEVCFG).


The stack forwards this change to the application as an indication. The application now needs to handle the indication.

Check in the indication, if the value shall be saved remanent in the application flash.

      if(ptSaveStationNameInd -

...

> tData.bRemanent == 1)

...

      if(ptSaveIpInd          -> tData.bRemanent == 1)

If the bRemanent value is 1, the application shall check if the value in the application flash is still the same like in the indication. If it is not the same value, write the new value into the application flash.

If the bRemanent value is 0, than your application needs to save the value temporary. That means , the saved value in the application flash needs to be deleted.

...