• 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
netHat configuration via config packets
#1
Hello,

I'm working on a project where i have to configure the netHat as EthernetIP Adapter with an static ip address.

The netHat/EIP Adapter ist connected to a Gateway that serves as Ethernet/IP Scanner. There's no DHCP server connected.

As i understand it, the netHat is configured through *.nxd (config.nxd, nwid.nxd) database files and probably set to use DHCP for IP configuration.

Following the Cifx API and Ethernet/IP Adapter API i'm creating a configuration packet (EIP_APS_SET_CONFIGURATION_REQ_T, EIP Adapter Protocol API, .p.81) and setting the configuration as follows using the cifx api functions (cifx API p.100 secion 6 "General Protocol Stack Handling"):


cifXDriverInit() -> ... ->  xChannelConfigLock (unlock) ->  xChannelPutPacket -> xChannelGetPacket -> Check .tHeader.ulState  -> 0xC0590013: ERR_EIP_APS_CONFIGBYDATABASE "Stack is already configured via database"

I also renamed all *.nxd files regarding EIP.
(see: https://forum.hilscher.com/Thread-Use-ne...-on-netHAT  "...Even keep in mind a netHAT must not be loaded with an .nxd file, else it will reject online configuration method.")


Is it generaly possible to configure the netHat using config packets like for expample you would use with a PCI Hilscher card?
Looking at the log, there is no file downloaded:


Code:
18.05.2020 16:48:09.339.224: ----- cifX Driver Log started ---------------------                                                                                                              
18.05.2020 16:48:09.339.364:       LinuxCIFXDrv V1.1.0 / Toolkit cifX Toolkit 1.2.0.0                                                                                                         
18.05.2020 16:48:09.339.419:  Name : cifX0                                                                                                                                                    
18.05.2020 16:48:09.339.467:  DPM  : 0x0, len=65536                                                                                                                                           
18.05.2020 16:48:09.339.515: ---------------------------------------------------                                                                                                              
18.05.2020 16:48:09.339.734: Device Type autodetection: Flash Based Device found!                                                                                                             
18.05.2020 16:48:09.340.054: Device Info:                                                                                                                                                     
18.05.2020 16:48:09.340.108:  - Device Number : 7775000                                                                                                                                       
18.05.2020 16:48:09.340.201:  - Serial Number : 20710                                                                                                                                         
18.05.2020 16:48:09.340.254:  - Slot Number   : 0                                                                                                                                             
18.05.2020 16:48:09.340.772: Firmware download, checking / starting: CHANNEL #0, 0 file(s)                                                                                                    
18.05.2020 16:48:09.340.863: Firmware download, checking / starting: CHANNEL #1, 0 file(s)                                                                                                    
18.05.2020 16:48:09.340.945: Firmware download, checking / starting: CHANNEL #2, 0 file(s)                                                                                                    
18.05.2020 16:48:09.341.026: Firmware download, checking / starting: CHANNEL #3, 0 file(s)                                                                                                    
18.05.2020 16:48:09.341.107: Firmware download, checking / starting: CHANNEL #4, 0 file(s)                                                                                                    
18.05.2020 16:48:09.341.187: Firmware download, checking / starting: CHANNEL #5, 0 file(s)                                                                                                    
18.05.2020 16:48:09.341.305: Configuration download, checking / starting: CHANNEL#0, 0 file(s)!
18.05.2020 16:48:09.341.388: Configuration download, checking / starting: CHANNEL#1, 0 file(s)!
18.05.2020 16:48:09.341.468: Configuration download, checking / starting: CHANNEL#2, 0 file(s)!
18.05.2020 16:48:09.341.548: Configuration download, checking / starting: CHANNEL#3, 0 file(s)!
18.05.2020 16:48:09.341.627: Configuration download, checking / starting: CHANNEL#4, 0 file(s)!
18.05.2020 16:48:09.341.707: Configuration download, checking / starting: CHANNEL#5, 0 file(s)!
18.05.2020 16:48:09.341.755: System channel is READY!


Also, is there another way to achive a configuration with static IP address, eg. by using SYCON.net and exporting the nxd files?

Any help is much appreciated! Smile
  Reply
#2
Well the point is the following ... once a netHAT is loaded with firmware and NXD file then you have no chance to remove th NXD file manually. It is stored in the internal flash memory like the firmware and cannot be removed. And while there is an NXD file loaded you cannot configure netHAT with messages.

But there is a trick. If you put (for example) the PROFINET firmware to the location where you EtherNet/IP firmware resides by replacong it by installing the corresponding *.deb file and remove the config.nxd file afterwards then the driver at the next start of your application detects that the firmware loaded in netHAT is different to what's in the firmware folder and downloads the PROFNET firmware. But since there is no config.nxd it cannot loader it. But what is good now is that the whole flash memory was cleared including the previous downloaded EtherNet/IP NXD file. At the end repeat this with the EtherNet/IP firmware an no config.nxd and you are getting a "blank" netHJAT with no NXD loaded.

I have never tried to create my own NXD file, but basically I agree that any NXD file made for netX51/netX52 chip running EtherNet/IP firmware will do the same job.

Thx
Armin
You never fail until you stop trying.“, Albert Einstein (1879 - 1955)

  Reply
#3
(May-18th-2020, 07:17 PM)Armin@netPI Wrote: Well the point is the following ... once a netHAT is loaded with firmware and NXD file then you have no chance to remove th NXD file manually. It is stored in the internal flash memory like the firmware and cannot be removed. And while there is an NXD file loaded you cannot configure netHAT with messages.

But there is a trick. If you put (for example) the PROFINET firmware to the location where you EtherNet/IP firmware resides by replacong it by installing the corresponding *.deb file and remove the config.nxd file afterwards then the driver at the next start of your application detects that the firmware loaded in netHAT is different to what's in the firmware folder and downloads the PROFNET firmware. But since there is no config.nxd it cannot loader it. But what is good now is that the whole flash memory was cleared including the previous downloaded EtherNet/IP NXD file. At the end repeat this with the EtherNet/IP firmware an no config.nxd and you are getting a "blank" netHJAT with no NXD loaded.

I have never tried to create my own NXD file, but basically I agree that any NXD file made for netX51/netX52 chip running EtherNet/IP firmware will do the same job.

Thx
Armin

Hello Armin!


Thanks for your quick answer.
I was able to force the netHAT not to use the *.nxd with your trick, thanks!

Using the same code i'm using for our cifx application that is operating with Hilscher PCI(e) cards, i'm running into following error: 0xC0000009
issueing the command:


Code:
lRet = xChannelGetPacket(this->hChannel, sizeof(cnf), (CIFX_PACKET *)&cnf, 1000);
printf("INFO: Status CNF-Paket: 0x%0X", cnf.tHeader.ulState);
...

I'm not sure if i'm missing out on a specific parameter from EIP_APS_SET_CONFIGURATION_REQ_T (EipAps_Public.h 38716 2013-09-25 09:13:47Z kai)
or if the error occures due to (EtherNet/IP Adapter V5 Protocol API 01.pdf; p.75):

"Only the parameter set V3 (and newer) is supported. The stack will reject any older version with error code ERR_HIL_INVALID_PARAMETER (0xC0000009)"

So my question is: which EIP Adapter V5 (param set) is to be used for EIP on netHat?
ATM i'm trying to use a newer EipAps_Public.h (56088 2015-09-09 12:44:58Z kai) with EIP_APS_CONFIGURATION_PARAMETER_SET_V3_T, but sill getting the same error (didn't use ALL parameter at the moment, though).

Is there a configuration example, using the EIP_APS_CONFIGURATION_PARAMETER_SET_V3_T? Perhaps i'm still missing some obligatory params?
  Reply
#4
Hi there,

I am sorry to say that specifically for netHAT as entry-level device for netX technology we are not offering such an example.

But I give you a hint how you can get it configured if you are looking to the "big brother" of netHAT called netPI which is a combo device of RPi3 and netHAT in one device.

For this type of device we are offering Docker containers and examples how to program netX51 in this case. I think for netX52 chips these examples should work also: https://github.com/HilscherAutomation/ne...g-examples

Specifically look to the source code https://github.com/HilscherAutomation/ne...ndlerEIS.c

Please keep in mind that netHAT is using a V3.x.x.x version of firmware and some definitions may not work coming with V5. Especially if you download the DVD image of netHAT from here https://www.netiot.com/interface/nethat/ in the download section indicating a V3 API manual for EtherNet/IP slave.

Thx
Armin
You never fail until you stop trying.“, Albert Einstein (1879 - 1955)

  Reply
#5
Hi Armin,

thank you very much!
I was able to 'feed' the netHAT a configuration package with your trick and using the porgramming examples fo the netPI project.
I think i'm getting there to configure the netHAT with an static ip.  But somehow i'm missing something.

Although  i'm setting the netHAT to use a  static ip and the  cnf.tHeader.ulState returns 0, the netHAT still hasn' that IP address "active".
Checking for example with Hilschers SYCON.net Ethernet-Devices Setup the netHAT is not detected.
Attaching a DHCP server, the netHAT is detected with the DHCP leased IP.

Following, a sketch on how i'm using the APIs implemented in an application we use for Hilscher PCIe (ProfiNET/EtherNet IP) cards :
Code:
CIFX_LINUX_INIT init {. ...}; // w default values;
xDriverOpen();
xChannelOpen();
xChannelHostState(..., CIFX_HOST_STATE_READY, ...); // needed here? Working w PCIe cards
xChannelConfigLock(..., CIFX_CONFIGURATION_UNLOCK, ...); // - " -
CreateConfPkgReq(CIFX_PAKET ); // creating  EIP_APS_PACKET_SET_CONFIGURATION_PARAMETERS_REQ_T using the configuration example provided
xChannelPutPacket();
xChannelGetPacket(CONFIRMATION_PKG); // .tHeader.ulState = 0
xChannelReset(); // needed it here to activate conf on PCIe cards
xChannelConfigLock(..., CIFX_CONFIGURATION_LOCK, ....);

This workflow had been sufficient with the PCIe application. (i used the examples form CIFX API documentation).
My question now, is it obligatory to implement further packet handling from "SystemPackets.c" and "PacketHandlerEIS.c", e.g. form "PacketHandlerEIS.cTonguerotocol_PacketHandler:344 on" of the netPI examples?

Or should that "simple" configuration workflow suffice?
It would be no problem to implement all the packet handling, but i'm trying to keep the process as simple as possible. Smile


Best regards!
  Reply
#6
There is one thing I have to mention at this point.

The EIS firmware provided in the source code repository of netPI I gave you is of version 2.x.x.x. The firmware that is used and provided for netHAT on the DVD image is of version V3.x.x.x. So since I see major number changes between both firmwares, there can also be a change between the two API which I do not know to be honest.

I just can tell you that the source code example provided for netPI is working with the corresponding firmware V2.x.x.x best without any problems known. So it may be that you have to make little adaptions in the source code to fit also for your netHAT software V3.x.x.x. The API V3 is on the netHAT DVD and you should read it.

Thx
Armin
You never fail until you stop trying.“, Albert Einstein (1879 - 1955)

  Reply
#7
In my opinion the function Eis_SendConfig_req() of the source code file "PacketHandlerEIS.c" should be enough to send in order to bring the EtherNet/IP slave stack to life. So from what I see in your chronology of all your called functions everything is fine.

Thx
Armin
You never fail until you stop trying.“, Albert Einstein (1879 - 1955)

  Reply


Possibly Related Threads...
Thread Author Replies Views Last Post
  cifX drivers EtherCAT read/write performance with NetHat over STM32 thp9 14 93 7 hours ago
Last Post: Armin@netPI
  netHAT as Ethernet/IP Adapter with Codesys lstiegler 11 43 May-26th-2020, 06:40 PM
Last Post: Armin@netPI
  Using Powerlink firmware with netHAT and config nxd thp9 1 20 May-25th-2020, 06:40 AM
Last Post: Armin@netPI
  How can i set a EtherCAT node in netHAT 52-RTE? JGLee 3 28 May-19th-2020, 12:08 PM
Last Post: Armin@netPI
  NetHAT temperature question thp9 1 10 May-14th-2020, 09:21 PM
Last Post: Armin@netPI
  Using netHAT drivers with custom linux (not Raspbian) FrankS 5 60 September-11th-2019, 06:16 AM
Last Post: Armin@netPI
  Use netPi firmware on netHAT zz_zesys 1 245 September-30th-2018, 08:04 PM
Last Post: Armin@netPI
  NetHat Labview richielfc 1 123 August-10th-2018, 12:08 PM
Last Post: Simon@netHAT
  Problem with NetHAT Configuration adeeljsid 2 207 July-5th-2018, 12:10 PM
Last Post: Simon@netHAT
  EtherCAT slave configuration? snortman 1 175 April-17th-2018, 09:25 AM
Last Post: Simon@netHAT

Forum Jump:


Users browsing this thread: 1 Guest(s)