长沙分类信息网-长沙新闻网

IMX6UL OTG以太网核心板定制 嵌入式软硬件服务 嵌智捷核心板定制设计

2021-6-23 10:49:02发布24次查看
是否进口产地四川
加工定制品牌嵌智捷
型号qzj132产品名称IMX6UL OTG
适用范围编译内核;编译驱动模块货号qzj4546
用途uweub产品认证4384
特色服务222订货号qjz343
最小包装数32434物料编号1323
是否跨境货源


一、内核配置
device drivers  --->
[*] usb support  --->
  usb gadget support  --->
[*]   debugging messages (development)
[*]     verbose debugging messages (development)
[*]   debugging information files (development)
[*]   debugging information files in debugfs (development)
(2)   maximum vbus power usage (2-500 ma)
(2)   number of storage pipeline buffers
  usb gadget drivers
    ethernet gadget (with cdc ethernet support)
[*]       rndis support
    cdc composite device (ethernet and acm)
二、编译内核和驱动模块
1. 编译内核;编译驱动模块
2. 所需的驱动模块位置如下:
drivers/usb/gadget/function/u_ether.ko
drivers/usb/gadget/function/u_serial.ko
drivers/usb/gadget/function/usb_f_ecm.ko
drivers/usb/gadget/function/usb_f_rndis.ko
drivers/usb/gadget/legacy/g_ether.ko
drivers/usb/gadget/libcomposite.ko
3. 配置模块
更新内核,将驱动模块拷贝到板子上
4. 编写脚本
脚本内容如下
insmod /home/root/usb_to_net/u_serial.ko
insmod /home/root/usb_to_net/libcomposite.ko
insmod /home/root/usb_to_net/u_ether.ko
insmod /home/root/usb_to_net/usb_f_rndis.ko
insmod /home/root/usb_to_net/usb_f_ecm.ko
insmod /home/root/usb_to_net/g_ether.ko
ifconfig usb0 up
ifconfig usb0 192.168.0.136
注意:加载脚本的顺序不要出错了
5. 运行脚本
如果出现以下打印则表示加载驱动成功
oot@imx6ulevk:~# ./test_usb_to_net/set.sh
using random self ethernet address
using random host ethernet address
usb0: host mac 4a:a5:fb:33:29:31
usb0: mac 06:a5:14:71:a1:1d
using random self ethernet address
using random host ethernet address
g_ether gadget: ethernet gadget, version: memorial day 2008
g_ether gadget: g_ether ready
ipv6: addrconf(netdev_up): usb0: link is not ready
root@imx6ulevk:~# g_ether gadget: high-speed config #1: cdc ethernet (ecm)
ipv6: addrconf(netdev_change): usb0: link becomes ready
root@imx6ulevk:~# ifconfig
eth0      link encap:ethernet  hwaddr 36:e5:d2:1b:9f:83  
         inet addr:192.168.1.106  bcast:192.168.1.255  mask:255.255.255.0
         inet6 addr: fe80::34e5:d2ff:fe1b:9f83/64 scope:link
         up broadcast running multicast dynamic  mtu:1500  metric:1
         rx packets:257 errors:0 dropped:0 overruns:0 frame:0
         tx packets:243 errors:0 dropped:0 overruns:0 carrier:0
         collisions:0 txqueuelen:1000
         rx bytes:20327 (19.8 kib)  tx bytes:26146 (25.5 kib)
eth1      link encap:ethernet  hwaddr 7e:99:41:96:30:b2  
         up broadcast multicast dynamic  mtu:1500  metric:1
         rx packets:0 errors:0 dropped:0 overruns:0 frame:0
         tx packets:0 errors:0 dropped:0 overruns:0 carrier:0
         collisions:0 txqueuelen:1000
         rx bytes:0 (0.0 b)  tx bytes:0 (0.0 b)
lo        link encap:local loopback  
         inet addr:127.0.0.1  mask:255.0.0.0
         inet6 addr: ::1/128 scope:host
         up loopback running  mtu:65536  metric:1
         rx packets:6 errors:0 dropped:0 overruns:0 frame:0
         tx packets:6 errors:0 dropped:0 overruns:0 carrier:0
         collisions:0 txqueuelen:0
         rx bytes:572 (572.0 b)  tx bytes:572 (572.0 b)
usb0      link encap:ethernet  hwaddr 06:a5:14:71:a1:1d  
         inet addr:192.168.0.136  bcast:192.168.0.255  mask:255.255.255.0
         inet6 addr: fe80::4a5:14ff:fe71:a11d/64 scope:link
         up broadcast running multicast  mtu:1500  metric:1
         rx packets:181 errors:0 dropped:0 overruns:0 frame:0
         tx packets:86 errors:0 dropped:0 overruns:0 carrier:0
         collisions:0 txqueuelen:1000
         rx bytes:20379 (19.9 kib)  tx bytes:13576 (13.2 kib)
root@imx6ulevk:~#
6. 连接linux电脑(windos 会被识别成串口 需要添加驱动,在这里为了方便连接linux系统)
连接之前网口信息如下
[yw@192 kernel-source]$ ifconfig
enp3s0: flags=4163  mtu 1500
       inet 192.168.1.101  netmask 255.255.255.0  broadcast 192.168.1.255
       inet6 fe80::7ae3:b5ff:fe9c:fac9  prefixlen 64  scopeid 0x20
       ether 78:e3:b5:9c:fa:c9  txqueuelen 1000  (ethernet)
       rx packets 105405  bytes 69769972 (66.5 mib)
       rx errors 0  dropped 0  overruns 0  frame 0
       tx packets 89469  bytes 14642550 (13.9 mib)
       tx errors 0  dropped 0 overruns 0  carrier 0  collisions 0
lo: flags=73  mtu 65536
       inet 127.0.0.1  netmask 255.0.0.0
       inet6 ::1  prefixlen 128  scopeid 0x10
       loop  txqueuelen 0  (local loopback)
       rx packets 97  bytes 7832 (7.6 kib)
       rx errors 0  dropped 0  overruns 0  frame 0
       tx packets 97  bytes 7832 (7.6 kib)
       tx errors 0  dropped 0 overruns 0  carrier 0  collisions 0
virbr0: flags=4099  mtu 1500
       inet 192.168.124.1  netmask 255.255.255.0  broadcast 192.168.124.255
       ether 52:54:00:ad:e0:fe  txqueuelen 0  (ethernet)
       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
连接之后网口信息如下:
[yw@192 kernel-source]$ ifconfig
enp0s26f7u5: flags=4163  mtu 1500
       ether 4a:a5:fb:33:29:31  txqueuelen 1000  (ethernet)
       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
enp3s0: flags=4163  mtu 1500
       inet 192.168.1.101  netmask 255.255.255.0  broadcast 192.168.1.255
       inet6 fe80::7ae3:b5ff:fe9c:fac9  prefixlen 64  scopeid 0x20
       ether 78:e3:b5:9c:fa:c9  txqueuelen 1000  (ethernet)
       rx packets 105417  bytes 69770692 (66.5 mib)
       rx errors 0  dropped 0  overruns 0  frame 0
       tx packets 89474  bytes 14642760 (13.9 mib)
       tx errors 0  dropped 0 overruns 0  carrier 0  collisions 0
lo: flags=73  mtu 65536
       inet 127.0.0.1  netmask 255.0.0.0
       inet6 ::1  prefixlen 128  scopeid 0x10
       loop  txqueuelen 0  (local loopback)
       rx packets 97  bytes 7832 (7.6 kib)
       rx errors 0  dropped 0  overruns 0  frame 0
       tx packets 97  bytes 7832 (7.6 kib)
       tx errors 0  dropped 0 overruns 0  carrier 0  collisions 0
virbr0: flags=4099  mtu 1500
       inet 192.168.124.1  netmask 255.255.255.0  broadcast 192.168.124.255
       ether 52:54:00:ad:e0:fe  txqueuelen 0  (ethernet)
       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
7. pc设置enp0s26f7u5的ip
ifconfig enp0s26f7u5 192.168.0.135
注意:这里可能需要权限
8. 板子和pc机相互ping
pc机ping板子打印如下
[yw@192 kernel-source]$ ping 192.168.0.136
ping 192.168.0.136 (192.168.0.136) 56(84) bytes of data.
64 bytes from 192.168.0.136: icmp_seq=1 ttl=64 time=0.771 ms
64 bytes from 192.168.0.136: icmp_seq=2 ttl=64 time=0.506 ms
^c
--- 192.168.0.136 ping statistics ---
2 packets transmitted, 2 received, 0% packet loss, time 1000ms
rtt min/avg/max/mdev = 0.506/0.638/0.771/0.134 ms
[yw@192 kernel-source]$
板子ping pc机打印如下:
root@imx6ulevk:~# ping 192.168.0.135
ping 192.168.0.135 (192.168.0.135) 56(84) bytes of data.
64 bytes from 192.168.0.135: icmp_seq=1 ttl=64 time=0.459 ms
64 bytes from 192.168.0.135: icmp_seq=2 ttl=64 time=0.401 ms
^c
--- 192.168.0.135 ping statistics ---
2 packets transmitted, 2 received, 0% packet loss, time 999ms
rtt min/avg/max/mdev = 0.401/0.430/0.459/0.029 ms
测试完成

成都嵌智捷科技有限公司
向女士
15114011710
四川 成都 双流区 西航港长城路一段187光电产业园科奥大厦
该用户其它信息

推荐信息

长沙分类信息网-长沙新闻网
关于本站