In addition to Weibo, there is also WeChat
Please pay attention
WeChat public account
Shulou
2025-02-24 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Servers >
Share
Shulou(Shulou.com)06/02 Report--
Introduction of 1 EtherCAT open source protocol stack
At present, the common open source master code is SOEM (Simple OpenSource EtherCAT Master) developed by RT-LAB and the IgH EtherCAT ®Master,SylixOS of EtherLab. Both are supported. IgH as a commonly used EtherCAT open source protocol stack, SylixOS has been ported to support.
2 SylixOS-IgH usage framework
The use of SylixOS-IgH preserves the use of IgH under Linux as much as possible, which continues the function of command line tools. In application development, with the advantage of SylixOS integrated development kit, users can edit and debug SylixOS-IgH-based applications more easily.
SylixOS-IgH is mainly divided into IgH master station protocol stack, network device driver, IgH user layer interface library and user application. The details are as follows:
2.1 IgH master station protocol stack
The source code of the IgH master station protocol stack is compiled into a specific ec_master.ko kernel module, in which the EtherCAT function is centrally implemented. In addition, after registration, the module will create an EtherCAT character device under the / dev path, as shown in figure 21.
Figure 21 / EtherCAT0 master station under the dev path
When the user program operates the EtherCAT master station, it will finally call the open,ioctl function of the Icano system through the user layer interface function to complete the execution of the EtherCAT protocol stack.
2.2 Network device driver
The source code of the network device driver for SylixOS-IgH is a specific kernel module, in which the general network card driver module is named generic.ko, and the real-time network card driver is named according to the type of network card used. For example, the network card driver module of e1000e model is ec_e1000e.ko. The network device driver module should be registered after the master station module is registered, because the master station module is isolated after registration and will wait for the network device to connect. After the network device driver module is registered, there is a real physical network interface responsible for sending and receiving EtherCAT packets. All kernel modules are deployed under the / lib/modules path, as shown in figure 22.
Figure 22 EtherCAT-related kernel modules
2.2.2 Universal network card driver
The implementation of the general network card driver is based on the existing LwIP protocol of SylixOS to complete the sending and receiving of EtherCAT data packets, and its implementation principle is shown in figure 23.
Fig. 23 basic principle of general network card driver implementation
2.2.2 Real-time network card driver
In the real application scenario, the EtherCAT software master station will be equipped with real-time operating system and real-time network card driver, because the key factors affecting real-time performance are the operating system and network card driver, as shown in figure 24.
Fig. 24 key factors affecting real-time performance
The real-time operating system needs to send out the process data on time. In fact, the timeliness is mainly reflected in periodically calling the sending function of the EtherCAT master protocol stack, and the network card driver also needs to optimize the real-time performance to bypass the network transmission functions in the LwIP protocol stack, such as security check, routing, entry and exit queue, fragmentation and reorganization, which are not necessary compared with EtherCAT, so as to ensure that EtherCAT packets "start on time and can not be delayed on the way".
2.3 IgH user layer interface
The source code of IgH user layer interface is compiled into a specific dynamic library. The IgH source code encapsulates all the "ioctl" operations on the character equipment of EtherCAT master station into user layer interface functions, so that users do not need to face the underlying implementation of IgH protocol stack, but only need to understand the meaning and use of IgH user layer interface functions.
2.4 IgH user Application
It will be mentioned here that there are three states of the SylixOS-IgH master station, as shown in figure 25.
Figure 25 IgH master station status and transition
After the master station module is registered, the master station is in an isolated state; after the network device driver module is registered, the master station is idle; when the user application program is executed, the master station request operation will be carried out first. then configure the slave station and establish the mapping relationship between the user layer process data and the protocol stack data buffer, and finally activate the master station, and the master station is running. After the master station enters the running state, it can send and receive periodic process data.
Refer to the program execution flow in the IgH source code / examples/user/main.c to see the main interface for using IgH, as shown in figure 26.
Figure 26 user application flow
3 steps for using SylixOS
SylixOS does not support the mechanism for registering incoming parameters for kernel modules, so if you need to use SylixOS-IgH, you can select the network device as the EtherCAT data transceiver interface in advance. Yifi information will provide an appropriate master kernel module according to the user's hardware platform and the corresponding MAC address of the network device.
1. The user receives the SylixOS-IgH_USER project package, as shown in figure 31.
Figure 31 SylixOS-IgH_USER project package
two。 Users unpack the SylixOS-IgH_USER project package and import it into the RealEvo-IDE integrated development environment, and select the dependent BASE project in the project properties, as shown in figure 32.
Figure 32 Project attribute configuration
3. Select the target device for uploading the project file, as shown in figure 33.
Figure 33 Select the target device IP address
4. After the project properties are configured, the project is compiled and deployed to the target device, as shown in figure 34.
Figure 34 deploying the project to the target equipment
5. The hardware equipment of the master and slave station is connected and powered on by itself. Log in to the target device remotely, register the IgH master kernel module ec_master.ko, and then use the command line tool to view the master status, as shown in figure 35.
Figure 35 register the master module and view the status of the master
6. Then register the network device driver kernel module generic.ko, and then use the command line tool to check the master station status, as shown in figure 36.
Figure 36 registering the network device driver module and viewing the master station status
You can also view the identified slave types through the "ethercatslaves" command, as shown in figure 37.
Figure 37 View the status of the identified slave station
7. Execute the IgH test routine, which activates the master station and sends process data to flash the 8-bit output LED indicator 1s of the digital Istroke O module once, as shown in figure 38.
Fig. 38 activate the master station and send process data
At this point, the basic process of using the EtherCAT open source protocol stack IgH on SylixOS has been described, and there are a few other points to note:
When using the IgH protocol stack, the topology of the slave device needs to be predicted in advance. The application needs to configure the location information and SDO/PDO information of each slave station in advance according to the topology structure of the slave station. After the master station is activated, it will compare the predicted configuration information with the information obtained by actually reading the slave station register. Only after matching can the slave station enter the OP state.
After SylixOS supports the kernel module to register the incoming parameter mechanism, the user can modify the network configuration file according to the selected EtherCAT message network port.
EtherCAT open source protocol stack IgH natively only supports the Linux operating system, and SylixOS migration support will retain the same user-level usage habits as far as possible, while the information provided by the IgH open source community does not fully introduce the use of user-layer interfaces and command-line tools. For the time being, SylixOS-IgH only provides basic instructions for use, and instructions for the use of other features will be improved in the future.
Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.
Views: 0
*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.
Continue with the installation of the previous hadoop.First, install zookooper1. Decompress zookoope
"Every 5-10 years, there's a rare product, a really special, very unusual product that's the most un
© 2024 shulou.com SLNews company. All rights reserved.