• 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
[SOLVED] EtherCAT Slave
#1
Hi

I purchased a netPI device, NIOT-E-NPI3-51-EN-RE.

How can I:

1) Set up this device as an EtherCAT slave?
2) Write / read to an internal buffer via EtherCAT?
3) Have an internal server permit data exchange with EtherCAT buffer via a client on the standard Ethernet interface?
4) Generate a slave information file (ESI) for this

Thank you and best regards,
Scott
  Reply
#2
Hi Scott,

this is an easy one.

Maybe you have recognized that we deliver example containers for netPI ready to use.

They all are located at Docker hub here: https://hub.docker.com/u/hilschernetpi/

There is on example container called https://hub.docker.com/r/hilschernetpi/n...-examples/. This example container configures the 2xRJ45 real-time ethernet ports either as EtherCAT slave, EtherNetIP Slave or PROFINET device depending on the pre-compiled user program you are starting. Each os the container examples is linked to the source code on Github. So follow the link and you'll find the documentation about all three protocols and also the ESI file in your case.

If you analyse the c-coded program you will see that it ends in an endless loop reading and writing to the ethernet controller's buffer. From there you can inject your data and pull out the data you need.

Armin








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

  Reply
#3
I’m still struggling on understanding the ESI structure. Taking the default ETHERCAT device description xml, I thought it would be as easy to make any changes to the names/data types/bit length but it won’t take when loading the new ESI. It always defaults to the original Byte In (x)… I know that the system is seeing the file since the device name had been updated.

There must be a flag I’m missing which allows me to the changes to take?
  Reply
#4
Well Jamie,

as with all Fieldbus and Real-Time Ethernet protocols everything follows very official specifications.

And indeed editing GSDML, ESI or whatever device description file is not that easy as it seems and is in my opinion nothing for non-specialists. You need to have background information about how the different systems operate and how they exchange their data and how these are defined.

For EtherCAT the EtherCAT Technology group provides all information if you are a member in the download section here: https://www.ethercat.org/default.htm
Interesting is also that next to the ESI file specification they provide also an ESI file checker tool which is very useful during development times.

But now back to your question and here is indeed EtherCAT knowledge is needed:

The example ESI file provided here is made for exactly 10 bytes input and 4 bytes output data. It matches the settings made in the "C" coded corresponding example. With EtherCat you don't speak about input and output data really, but about Process Data Objects, short PDOs. So in the end the master needs to know the excact number of PDOs (Tx = transmit, Rx = receive) and finally those have to be defined in the ESI file.

Now one can be naive and think just editing the lines in the ESI file where the maximum Defaultsize - in our case 10 and 4 - is enough. Ohhh no ... this is not enough. Relevant for a master configuration tool are the entries <RxPdo> and <TxPdo> instead. If you now count the entries in the file for each direction you will find 10 TxPdo objects and 4 RxPdo objects defined. Those have to extended to the amount of data you want to exchange.

EtherCAT took over the CANopen object dictionary scheme when it was specified. Everything is held in objects with Index and Subindex as addressing scheme.
The next thing you have to know about netPI's EtherCAT slave stack are the objects where it holds the input (Rx) and output (Tx) data. The manual in the repository gives you information about it ...

For Rx Pdo data it is Object Index 2000 with Subindexes 0, 1, 2, ... one object for each output byte
For Tx Pdo data it is Object Index 3000 with Subindexes 0, 1, 2, ... one object for each input byte


Back to the ESI file problem ... You have now to extend/modify the ESI with the amount of Rx Pdo and Tx Pdo you have in mind for your application. Please keep in mind to increase the subindex for each new entry ro map the IO data one by one.

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

  Reply
#5
This is great information thank you Armin! Utilizing the ETHERCAT example C code we managed to insert a TCP/IP socket connection which polls the 48 values from the device (Float32). These PDO objects are written to Object Index 3000 starting at subindex 0. The thing we haven’t figured out is if we can reallocate more than one byte per object in order to support float 32 (or any other data type) yet still remain below the maximum cyclical memory size. Otherwise we will need to think about breaking out the float 32 values spread across multiple objects (not ideal).
  Reply
#6
Got your point Jamie.

But what you need to know is that with the EtherCAT slave stack provided ALL process data objects are handled bytewise internally. There are not such things like FLOAT , UNT32 or others that could be defined. So in the end netX treats all data transparently as a kind of buffer byte by byte in adjacent order.

If this scheme is clear now of course in the application on top of the stack you can easily overlay some data types yourself. But the master on the other side will still see bytes .... or 4 bytes in a row if they shall contain a float or 2 bytes in a row containing an INT16 or so. But as far as I know you can bundle bytes in a master as well to a float or int.

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

  Reply


Possibly Related Threads…
Thread Author Replies Views Last Post
  Configuring EtherCAT communication Hoeber 1 2,098 September-22nd-2021, 01:29 PM
Last Post: Armin@netPI
  running ethercat slave MGharat 6 5,569 December-10th-2019, 10:06 AM
Last Post: MGharat
  [SOLVED] Monitoring as EtherCAT Slave PRingelberg 8 6,432 October-16th-2018, 08:10 PM
Last Post: Armin@netPI

Forum Jump:


Users browsing this thread: 1 Guest(s)