How to Choose the Bus Motion Controller in the era of industrial Ethernet?
Tags: tutorial
Published: 2023-04-24 06:37:14


Question from A:
A (one controller supplier)
Q
Pulses belong to parallel communication, but EtherCAT belongs to serial communication, then communication delay may be produced, synchronization of bus is worse than pulses?

Answer:
Actually it is opposite, EtherCAT doesn't equal to EtherNet, and synchronization between master and slave stations of EtherCAT doesn't coordinate through arrival time of data frame. From order issuance, EtherCAT synchronization is better.


Question from B:
B (one controller supplier)
There is 1000M bus, which is 10 times of 100M, therefore, our synchronization also is better than EtherCAT ？

Answer:
EtherCAT is extremely advanced fieldbus, and the distributed clock brought by specialized communication chip (ESC) to achieve synchronization of each slave station tasks, the synchronization error is <<1us (it should be 20ns in theory).



Next, let's learn deeply.

![Image description](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/zbjjmvxkallqqn9u3gyq.png)

EtherCAT is an open and advanced fieldbus developed by the EtherCAT Foundation based on Ethernet. It ensures efficient and reliable data transmission through a series of unique mechanisms.

And EtherCAT only needs to use a 100M network cable to realize data transmission. The common topology structure is daisy chain, namely, the master station (controller) is connected to the first slave station (motor, IO module, etc.), then the first slave station is connected to the second slave station, connect continuously. In addition, EtherCAT also supports other topologies.

Although you only see one network cable connected, the 100M network cable actually contains 4 lines, two of which are used to output data (TX), and two are used to return data (RX). Therefore, in fact, one loop is formed internally, as shown in the figure below.


![Image description](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/bsnndt2hxiew65hu1m7g.png)

The EtherCAT master station needs to use a real-time operating system + standard Ethernet chip + EtherCAT protocol stack, and the slave station needs to use a special communication chip (ESC) to ensure high-speed and stable communication.

Therefore, although their external interfaces are all network ports "RJ45 interface",  EtherCAT and EtherNET are very different at the hardware level, not just the difference in the data layer.

During the official work of EtherCAT (PDO communication), only one data frame is transmitted at high speed between the master station and the slave station. When passing through each slave station, each slave station takes down the required data, such as, command position, control word, etc., then it inserts the data that needs reporting (feedback position, motor status, etc.). It is the same principle as one high-speed train has to pick up and drop off passengers at every station.

![Image description](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/g3guc6t333yexcwminby.png)
 
But it is faster than high-speed rail, EtherCAT processes data in flight through a dedicated chip (ESC), instead of waiting until the data is completely received before processing and sending. Therefore, high-speed data exchange can be achieved.

As mentioned before, the EtherCAT slave chip (ESC) has a distributed clock. What exactly is this?

The field bus is generally serial communication, so there must be a time difference when reaching each slave station. No matter how fast the high-speed rail is, it cannot reach Shanghai and Kunshan at the same time.

So how does EtherCAT ensure that the slave stations act in unison without falling behind? The answer is the distributed clock.  

The EtherCAT master station will select the first slave station with clock (DC) function as the clock master station (DC Master), and each slave station will be synchronized according to the time of the clock master station. In this way, if multiple motors do multi-axis interpolation, they can refer to the precise clock signal to sample at a unified time (collect command data), and act at a unified time, like this:

![Image description](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/1xf0humogi21e0ij2ea9.png)

Each slave station has its own watch, like those police and gangster movies, the officer said: Now put on the watch, and act together at 8:50 in the evening (the expression must be serious when you say it).

Of course, the clock (DC) of EtherCAT is not dialed manually, but EtherCAT calculates the clock error between each slave station through a complex mechanism, then corrects it in real time to ensure that the time keeps a very small error between each slave station (much less than 1us, the official test data is about 20ns).

![Image description](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/n5i9wysqg923zbysnjkv.png)

Going back to the original question, compared with the pulse motor, the pulse drive receives the data at the same time, but there is no way to coordinate the clock signal between the drives, so it is inferior to EtherCAT in theory.

In fact, most applications are restricted in the performance of motor debugging, so our feelings are not obvious, but EtherCAT has already laid the foundation for precise synchronization at the bottom layer.

Some friends may say, don't brag, I know that the next generation standard of  EtherCAT is EtherCAT G, which is also the Gigabit bus, which means Gigabit is better. However, the fact is that EtherCAT G is not designed to improve synchronization ( It is already very good), what is its significance, it will be introduced in detail in the next technical support article).

![Image description](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/nl0uxnj3e09h9qn6h9qo.png)

In addition to the above advantages, EtherCAT has many other advantages, including simple wiring, convenient interference checking, no trouble of losing pulses, rich transmission data (such as absolute value data, torque status), etc.