Hilscher Community Forum
Configuring EtherCAT communication - Printable Version

+- Hilscher Community Forum (https://forum.hilscher.com)
+-- Forum: netPI 3 - Docker featuring Industrial Raspberry Pi 3 platform (https://forum.hilscher.com/forum-1.html)
+--- Forum: Projects (https://forum.hilscher.com/forum-7.html)
+--- Thread: Configuring EtherCAT communication (/thread-762.html)



Configuring EtherCAT communication - Hoeber - September-22nd-2021

Hello Armin,

I am trying to run the netPi as an EtherCAT slave. I want to connect the netPi to the EtherCAT system of a machine where I need an Input and Output of 100 bytes each.
I used the netX example codes and changed the size of uint8_t abApp_Inputdata[10] and [i]uint8_t abApp_Outputdata[4][/i] to uint8_t abApp_Inputdata[100] and abApp_Outputdata[100] in "examples/includes/App.h". I also adapted the "Hilscher ECS LFW Host Example Simple Config.xml" by changing the DefaultSize of Inputs and Outputs from 10 and 4 to 100. Here, I also continued the RxPdo and TxPdo up to 100.

When I now run the application ECS_simpleConfig I get the following notification:

Register application failed Error: 0xc0000201
Error: 0xc0000201, <>
Error stopping the watchdog lRet = 0x800c0012!!

According to the documentation, the errorcode 0xc0000201 says that the "application ist already registered" and the errorcode 0x800c0012 means that the "communication channel ist not configured".
Does this indicate that there is a problem registering the slave with the master, meaning I made a mistake when customizing the xml file? Or have I missed a variable or something else in another file that I still have to change?

Or have I taken the whole thing too easy in the first place and it takes much more than just customizing the example files?

Thanks in advance!

André


RE: Configuring EtherCAT communication - Armin@netPI - September-22nd-2021

Well the source code under https://github.com/HilscherAutomation/netPI-netx-programming-examples/blob/master/examples/sources/PacketHandlerECS.c

registers an application using the command "RCX_REGISTER_APP_REQ" if now your program was accidentially stopped without using the "RCX_UNREGISTER_APP_REQ" the netx chip will deny another registration. 

Three methods to recover from this: 

1.) depower and repower the whole netPI and call your program again or
2.) execute the command xChannelReset() in the function "int32_t ChannelDemo()" of the source code https://github.com/HilscherAutomation/netPI-netx-programming-examples/blob/master/examples/sources/ECS_simpleConfig.c right before the line while(CIFX_NO_ERROR == (lRet = Pkt_ReceivePacket(hChannel,&tAppData.tPkt,0))); or
3.) call the "RCX_UNREGISTER_APP_REQ" message when you see the registration message returning an error in order to deregister a previously called program that didn't send "RCX_UNREGISTER_APP_REQ" before leaving

In all cases the netX chip will "lose" its previous registration setting.