Basic knowledge of EtherCAT protocol (Part 3)

3. EtherCAT application layer

1. Features

The EtherCAT application layer supports multiple device profiles to achieve mailbox communication, including CANopen, SERCOS, HTTP, etc. The application layer profile based on EtherCAT is called the xoE protocol (xxx over EtherCAT). In the equipment development, the slave equipment does not need to support all the profiles, just select the most suitable one according to its application. The following will describe the most widely used CoE protocol as an example.

2.C oE agreement

The full name of CoE is CAN application protocol over EtherCAT, which is a kind of EtherCAT application layer protocol implementation. Its characteristic is that it is written according to the CiA402 protocol and uses the functions of objects and object dictionary to realize mailbox communication.

The CANopen protocol has mature and large-scale applications. Using the CoE protocol, related equipment can be applied to the EtherCAT protocol with only a few changes, and most of the CANopen firmware can also be reused.

3. Site State Machine

EtherCAT regulates the status and operating functions of the station. As shown in the figure above, the brief introduction of each status function is as follows:

Init: Initialization state. In this state, the station will check whether the data link is correct, and there is no data interaction with the application layer.

Pre-Op: Pre-Operation State (POP). In this state, the site only communicates with mailboxes and does not interact with process data.

Safe-Op: Safe Operation (SOP). In this state, the site can communicate with mailboxes, and allows process data input but not output.

OP: Operating state, the site can carry out complete data communication and is in a normal working state.

Bootstrap: Bootstrap mode, only applicable to FoE mailbox communication, used for firmware update

4. Synchronization mode and working principle

EtherCAT has three synchronization modes: Free RUN, SM synchronization (Sync Manager), and DC synchronization (Distributed Clock). The three synchronization modes and their working principles will be briefly introduced below.

①Free RUN

Free RUN mode means that each station in the network is running in an asynchronous state without synchronization.

The slave station application program triggers and runs completely according to the time slice of the slave station's own clock, and has nothing to do with the sending and receiving of message frames. The Free RUN mode separates the time relationship between the master station and the slave station. When the clock frequency of the master station and the slave station differ greatly, situations such as frame loss may occur. This mode is suitable for applications that do not require synchronization at all.

②SM synchronization

The SM synchronization mode relies on the synchronization frame sent by the EtherCAT master station. Each slave station triggers its own application according to the number of received synchronization frames. If a slave station receives two EtherCAT synchronization frames, it will enter an interrupt service function for execution. Deal with it accordingly.

The synchronization accuracy of SM synchronization mode is affected by many factors, such as: the time jitter of the master station itself, which affects the transmission of synchronization frames; the physical transmission delay of the message frame determines the time for each slave station to receive the synchronization frame. There are differences, and the time difference will be enlarged when the entire network is relatively large. Therefore, this mode is more suitable for applications with general synchronization requirements.

③DC synchronization

The form of DC synchronization mode is similar to SM synchronization, which is based on the interrupt trigger signal to trigger its own application. The difference is that SM synchronization is based on the synchronization frame, while DC synchronization is based on the SYNC signal generated by the ESC in each site. .

EtherCAT has developed a complete mechanism to ensure that DC synchronization can run accurately. The overall operation process can be divided into two phases: initialization phase and dynamic compensation phase, as shown in the following figure:

In the initialization phase, the disordered trigger time of each device in the network is corrected to a tolerable level when the device is powered on. The process is:

1) After the master station starts, it sends a broadcast frame to scan the entire network, and each slave station calculates the time stamp value of the message looping back to itself once, and writes the value into the local register, and the difference is calculated to obtain the transmission of the message frame Delay, as shown in the figure below. This transmission delay is then compensated in the SYNC signal transmission process, thereby eliminating the influence of physical transmission delay.

2) Using the clock of the first slave with a DC unit in the slave as the reference clock, sending a large number of ARMW messages will read the reference value and send it to each slave, so that the local clock of each slave is Adjust to a value close to the reference clock. As shown below:

However, due to different clock sources, crystal oscillator frequency jitter and other uncontrollable factors, the network also needs to enter the dynamic compensation stage so that the synchronization time jitter of all stations can be maintained at a low level for a long time. The process is as follows:

The master station sends an ARMW message every sending cycle to send the reference clock value to all stations. After each station compares the reference value with the local clock value (combined with the transmission delay), the local clock value is updated (the ESC hardware Accelerate or decelerate). So as to realize the long-term low-level time jitter of the entire network.

About Hongke Industrial Communication:

Hongke is a high-tech company with more than 10 years of experience in the field of industrial automation, especially the industrial bus communication industry. Hongke Industrial Communication Division has in - depth cooperation with world-renowned industrial communication experts [ PEAK-System, Hilscher, Kunbus, SYS TEC, Koenig-Pa, Port, Copa-data, TenAsys, SoC-e, RELYUM] and other in-depth cooperation to provide industry-leading Level industrial bus protocol software and hardware solutions, protocol types include [CAN, CANopen, EtherCAT, Profibus, Profinet, EtherNET/IP, TSN], etc., and product types include code, software, chips, boards, modules, etc. Hongke Industrial Communication is customer-oriented and based on technical capabilities, providing domestic enterprises with the most suitable products and the most satisfactory services. Especially in the context of Industry 4.0, Hongke Industrial Communications keeps pace with the times and launches TSN (Time Sensitive Network) solutions, which will act as a highway-like connection in the trend of the Internet of Everything .

Scan WeChat, follow us for more industrial communication dry goods~

Author: Hong Branch Industrial Communication --- Chun Liang Hua

Typesetting: Hongke Industrial Communication---Huang Yi

Guess you like

Origin blog.csdn.net/weixin_47677928/article/details/109023509