最近打算买一台伺服电机,测试一下EtherCAT 接口。打算采用开源的lgh。网络上有许多的lgh 安装指南,但是照着安装仍然由一些问题,只能边做边记笔记。
硬件
- Dell T3360 台式机
- UP Squared 6000 边缘控制器
ubuntu 操作系统版本:
root@T3660:/home/yao2023/etherlab# uname -a
Linux T3660 6.2.0-31-generic #31~22.04.1-Ubuntu SMP PREEMPT_DYNAMIC Wed Aug 16 13:45:26 UTC 2 x86_64 x86_64 x86_64 GNU/Linux
root@T3660:/home/yao2023/etherlab# lsb_release -a
No LSB modules are available.
Distributor ID: Ubuntu
Description: Ubuntu 22.04.3 LTS
Release: 22.04
Codename: jammy
下载源代码
git clone https://gitlab.com/etherlab.org/ethercat.git /home/yao2023/etherlab
配置和安装
配置
./bootstrap
sudo su
./configure --disable-8139too --prefix=/opt/etherlab --sysconfdir=/etc
安装
make
make all modules
sudo make modules_install install
sudo depmod
查看以太网的mac地址
使用 ifconfig
root@T3660:/home/yao2023/etherlab# ifconfig
docker0: flags=4163<UP,BROADCAST,RUNNING,MULTICAST> mtu 1500
inet 172.17.0.1 netmask 255.255.0.0 broadcast 172.17.255.255
inet6 fe80::42:cbff:fe8a:1e8f prefixlen 64 scopeid 0x20<link>
ether 02:42:cb:8a:1e:8f txqueuelen 0 (以太网)
RX packets 0 bytes 0 (0.0 B)
RX errors 0 dropped 0 overruns 0 frame 0
TX packets 77 bytes 10819 (10.8 KB)
TX errors 0 dropped 0 overruns 0 carrier 0 collisions 0
enp0s31f6: flags=4099<UP,BROADCAST,MULTICAST> mtu 1500
ether 74:86:e2:19:66:0f txqueuelen 1000 (以太网)
RX packets 0 bytes 0 (0.0 B)
RX errors 0 dropped 0 overruns 0 frame 0
TX packets 0 bytes 0 (0.0 B)
TX errors 0 dropped 0 overruns 0 carrier 0 collisions 0
device interrupt 19 memory 0x72600000-72620000
enp4s0: flags=4099<UP,BROADCAST,MULTICAST> mtu 1500
ether a0:36:9f:30:32:a1 txqueuelen 1000 (以太网)
RX packets 0 bytes 0 (0.0 B)
RX errors 0 dropped 0 overruns 0 frame 0
TX packets 0 bytes 0 (0.0 B)
TX errors 0 dropped 0 overruns 0 carrier 0 collisions 0
device memory 0x72100000-721fffff
chmod +x /opt/etherlab/etc/init.d/ethercat
sudo cp -f script/init.d/ethercat /etc/init.d/
sudo mkdir -p /et
Ubuntu22.04上安装EtherCAT驱动并调试伺服电机控制

文章讲述了作者在Ubuntu22.04系统上配置和安装EtherCAT接口,解决lgh问题,遇到内核版本冲突,最终成功编译并运行示例程序以控制伺服电机的过程。
最低0.47元/天 解锁文章
353





