EtherCAT Master Controller Solution Based on Remi Pi
2024-06-25
1180
EtherCAT is a real-time industrial Ethernet technology proposed by the German BECKHOFF company in 2003. It has the characteristics of high speed and high data efficiency, and supports multiple device connection topologies. Its slave nodes use dedicated control chips, while the master station uses standard Ethernet controllers.
Both Industry 4.0 and the Internet of Things (IoT) require high networking and powerful communication capabilities between devices and servers. EtherCAT is a relatively mature industrial Ethernet fieldbus, specifically used for motion control applications. Compared to traditional industrial fieldbuses, EtherCAT has many advantages such as high stability, high real-time performance, high integration, strong scalability, and easy installation. It breaks through the system limitations of traditional Ethernet solutions and is widely used in the field of industrial control.
Based on MYIR’s Remi Pi Single Board Computer (SBC), the EtherCAT Master controller can achieve more intelligent EtherCAT master control by applying Preempt-RT real-time patches to the kernel and porting the open-source EtherCAT Master software IGH.
EtherCAT Master Controller Based on Remi Pi
1. RT Linux Real-time Patch
Obtain the patch corresponding to the L5.10.83 kernel version from the RT official website. The link is as follows:
https://cdn.kernel.org/pub/linux/kernel/projects/rt/5.10/older/
Extract the patch package to your own working directory.
PC:~/renesas/04_Sources$ tar -xvf patches-5.10.83-rt58.tar.gz
Apply patches to the kernel source code directory.
PC:~/renesas/04_Sources/myir-renesas-linux$ for p in `ls -1 ../patches/*.patch`;do patch -p1 < $p;done
Modify the mys_g2lx_defconfig configuration file
PC:~/renesas/04_Sources/myir-renesas-linux$ vi arch/arm64/configs/mys_g2lx_defconfig
CONFIG_EXPERT=y
CONFIG_ARCH_SUPPORTS_RT=y
CONFIG_PREEMPT_RT=y
#CONFIG_PREEMPT=y
#CONFIG_KVM=y
Compile the kernel source code and update the Image file.
PC:~/renesas/04_Sources/myir-renesas-linux$ source /opt/remi-sdk/environment-setup-aarch64-poky-linux
PC:~/renesas/04_Sources/myir-renesas-linux$ make ARCH=arm64 mys_g2lx_defconfig
PC:~/renesas/04_Sources/myir-renesas-linux$ make ARCH=arm64 Image dtbs -j16
2. IGH EtherCAT Master
Download the source code of Ethercat version 1.5 from the official website, the link is as follows:
https://gitlab.com/etherlab.org/ethercat/-/tree/stable-1.5?ref_type=heads
Extract the Ethercat source code package to your own working directory.
PC:~/renesas/04_Sources$ tar -xvf ethercat-stable-1.5.tar.bz2
PC:~/renesas/04_Sources$ cd ethercat-stable-1.5
Load environment variables
PC:~/renesas/04_Sources/ethercat-stable-1.5$ source /opt/remi-sdk/environment-setup-aarch64-poky-linux
Generate a configure file
PC:~/renesas/04_Sources/ethercat-stable-1.5$ ./bootstrap
Configure settings
PC:~/renesas/04_Sources/ethercat-stable-1.5$ mkdir output
PC:~/renesas/04_Sources/ethercat-stable-1.5$ ./configure --prefix=/home/renesas/04_Sources/ethercat-stable-1.5/output --with-linux-dir=/home/renesas/04_Sources/myir-renesas-linux --enable-8139too=no --enable-generic=yes --host=aarch64-poky-linux
Compile and install
PC:~/renesas/04_Sources/ethercat-stable-1.5$ make
PC:~/renesas/04_Sources/ethercat-stable-1.5$ make modules
PC:~/renesas/04_Sources/ethercat-stable-1.5$ make install
After compilation and installation, the generated ec_generic.ko driver file is located in the devices directory, the ec_master.ko driver file is located in the master directory, and the generated library related files are located in the output directory.
PC:~/renesas/04_Sources/ethercat-stable-1.5$ ls devices/en_genric.ko
devices/ec_generic.ko
PC:~/renesas/04_Sources/ethercat-stable-1.5$ master/ec_master.ko
devices/ec_master.ko
PC:~/renesas/04_Sources/ethercat-stable-1.5$ ls output/
bin etc include lib sbin share
Copy the relevant files and ec_master.ko from the output directory above to the following directory on the development board:
root@myir-remi-1g:~/output# ls
bin etc include lib modules sbin share
root@myir-remi-1g:~/output# cp bin/ethercat /bin/
root@myir-remi-1g:~/output# cp etc/ethercat.conf /etc/
root@myir-remi-1g:~/output# cp etc/init.d/* /etc/init.d
root@myir-remi-1g:~/output# cp -r etc/sysconfig/ /etc/
root@myir-remi-1g:~/output# cp lib/libethercat.* /lib64/
root@myir-remi-1g:~/output# cp -r lib/pkgconfig /lib64/
root@myir-remi-1g:~/output# cp modules/ec_master.ko /lib/modules/5.10.83-cip1-rt58-yocto-standard/
root@myir-remi-1g:~/output# cp -r etc/sysconfig/ /etc/
root@myir-remi-1g:~/output# cp lib/libethercat.* /lib64/
root@myir-remi-1g:~/output# cp -r lib/pkgconfig /lib64/
root@myir-remi-1g:~/output# cp modules/ec_master.ko /lib/modules/5.10.83-cip1-rt58-yocto-standard/
root@myir-remi-1g:~/output# cp sbin/ethercatctl /sbin/
start Ethercat。
root@myir-remi-1g:~# depmod
root@myir-remi-1g:~# modprobe ec_master main_devices=1E:ED:19:27:1A:B3
root@myir-remi-1g:~# /etc/init.d/ethercat start
Starting EtherCAT master 1.5.2 done
2024-10-12
Application of MYIR's i.MX 6ULL SOM in Teaching Devices
With the development of robotics technology, the application of robots in social production has been promoted. However, the application of robots face some issues such as difficulties in development a
2024-09-25
Application of MYC-Y6ULX-V2 System-On-Module in Motion Control System
With the continuous trend of automation from semi-automatic to fully automatic, the whole industry’s requirements for the "brain" of automation - control system are increasingly high, not on
2023-04-13
Industrial Data Acquisition Applications Utilizing MYIR's MYC-JX8MMA7 ARM+FPGA SOM
With the development of communication and network technology and the Internet, the digitization, networking, and intelligence of industrial management have become an inevitable trend. The use of indus
2023-03-21
Application of MYC-Y6ULX-V2 System-On-Module in Mechanical Intelligent Controllers
In recent years, with the development of information technology, the requirements for industrial intelligence and intelligent construction machinery have also been increasing, leading to a growing dem
2023-02-18
EtherCAT Master Controller Solution Based on MYIR's Allwinner T507-H SOM
EtherCAT is a real-time industrial Ethernet technology proposed by the German BECKHOFF company in 2003. It has the characteristics of high speed and high data efficiency, and supports multiple device