Quectel EM05/EC20 4G模组使用-基于openwrt系统
一、模块简介- 使用M.2物理接口,usb通信接口
- 支持大下行速率为150Mbps,大上行速率为50Mbps。
- 其包含三个版本:EM05-CE、EM05-CML和 EM05-E*,能在LTE-FDD、LTE-TDD、DC-HSDPA、HSPA+、HSDPA、HSUPA、WCDMA和CDMA等多种网络制式中进行数据通信。
二、模块使用
1.修改linux内核
1)移植USB Serial驱动 移植后模块连接到USB串行驱动时,驱动程序将在目录/dev中创建设备文件USB0/ttyUSB1/ttyUSB2… 修改openwrt/build_dir/target-mipsel_24kc_glibc-2.24/linux-ramips_mt7688/linux-4.4.167/drivers/usb/serial/usb_wwan.c文件
- static struct urb *usb_wwan_setup_urb(
复制代码
当MCU进入暂停/休眠模式时,一些USB主机控制器/USB集线器将失去电源或重新设置,并且在MCU退出暂停/休眠模式后,它们不能恢复USB设备。请添加以下语句以启用重新设置恢复过程。
修改openwrt/build_dir/target-mipsel_24kc_glibc-2.24/linux-ramips_mt7688/linux-4.4.167/drivers/usb/serial/option.c文件。
- static struct usb_serial_driver option_1port_device = {
复制代码
2.修改openwrt配置1)内核模块Kernel modules >>
USB Support >>
<*> Kmod -usb-core
-*-Kmod -usb-net
-*- kmod-usb-net-cdc-ether//【可选】
<*> kmod-usb-net-cdc-mbim
-*- kmod-usb-net-cdc-ncm
<*> kmod-usb-net-cdc-subset//【可选】
<*>kmod-usb-net-qmi-wwan
<*>Kmod-usb-ohci //这个选项一定要勾选,否则可能无法在系统中查看设备
<*>Kmod-usb-serial
<*>Kmod-usb-serial-option
<*>Kmod-usb-serial-wwan
<*>kmod-usb-uhci
<*>Kmod-usb2
2)网络配置
NetWork >>
<*>wwan
<*>chat
<*>ppp
<*>uqmi
<*>umbim
3)Utilities配置
Utilities
<*>comgt
<*>usb-modeswitch //自动模式更改,将设备置于USB调制解调器模式
<*>usbutils//【可选,可查看usb设备】
4)Luci配置
Luci >>
1. Collections
<*> luci3. Applications
<*> luci-app-multiwan (optional to support multiple 3g dongles)//新版本为mwan3 【可选】
<*> luci-app-qos (optional to provide QOS support)//【可选】
6. Protocols
<*> luci-proto-3g
-*- luci-proto-ppp
3.网关配置
1)接入4G模块后,使用ls /dev命令,可以看到usb转串口设备
lsusb 命令查看usb设备
root@LEDE:~# ls usbBus
002 Device
001: ID
1d6b:0001
Linux Foundation 1.1 root hubBus 001 Device 012: ID 2c7c:0125
#PID-2c7c:VID-0125Bus 001 Device
001: ID
1d6b:0002
Linux Foundation 2.0 root hub
2)使用USB 3g / UMTS-modem进行WAN连接修改\etc\config\network配置- config interface '4G'
- option ifname 'ppp0'
- option _orig_ifname 'eth0.2'
- option _orig_bridge 'false'
- option proto '3g'
- option device '/dev/ttyUSB2'
- option service 'umts'
- option ipv6 'auto'
- option keepalive '10 5'
- option metric '0'
复制代码
重启网络 /etc/init.d/network restart
- root@LEDE:~# ifconfig
- 3g-4G Link encap:Point-to-Point Protocol
- inet addr:10.124.22.77 P-t-P:10.64.64.64 Mask:255.255.255.255
- UP POINTOPOINT RUNNING NOARP MULTICAST MTU:1500 Metric:1
- RX packets:25 errors:0 dropped:0 overruns:0 frame:0
- TX packets:58 errors:0 dropped:0 overruns:0 carrier:0
- collisions:0 txqueuelen:3
- RX bytes:1762 (1.7 KiB) TX bytes:3818 (3.7 KiB)br-lan
- Link encap:Ethernet HWaddr C6:E5:72:41:19:1D
- inet addr:192.168.2.1 Bcast:192.168.2.255 Mask:255.255.255.0
- inet6 addr: fe80::c4e5:72ff:fe41:191d/64 Scope:Link
- inet6 addr: fd3f:6922:178d::1/60 Scope:Global
- UP BROADCAST RUNNING MULTICAST MTU:1500 Metric:1
- RX packets:0 errors:0 dropped:0 overruns:0 frame:0
- TX packets:19 errors:0 dropped:0 overruns:0 carrier:0
- collisions:0 txqueuelen:1000
- RX bytes:0 (0.0 B) TX bytes:2610 (2.5 KiB)eth0
- Link encap:Ethernet HWaddr 40:D6:3C:1E:70:14
- inet6 addr: fe80::42d6:3cff:fe1e:7014/64 Scope:Link
- UP BROADCAST RUNNING MULTICAST MTU:1500 Metric:1
- RX packets:5519 errors:0 dropped:4 overruns:0 frame:0
- TX packets:1579 errors:0 dropped:0 overruns:0 carrier:0
- collisions:0 txqueuelen:1000
- RX bytes:476283 (465.1 KiB)
- TX bytes:152174 (148.6 KiB)
- Interrupt:5 eth0.1 Link encap:Ethernet HWaddr C6:E5:72:41:19:1D
- UP BROADCAST RUNNING MULTICAST MTU:1500 Metric:1
- RX packets:0 errors:0 dropped:0 overruns:0 frame:0
- TX packets:19 errors:0 dropped:0 overruns:0 carrier:0
- collisions:0 txqueuelen:1000
- RX bytes:0 (0.0 B) TX bytes:2610 (2.5 KiB)
- eth0.2 Link encap:Ethernet HWaddr C6:E5:72:41:19:1E
- inet addr:192.168.3.94 Bcast:192.168.3.255 Mask:255.255.255.0
- inet6 addr: fe80::c4e5:72ff:fe41:191e/64
- Scope:Link UP BROADCAST RUNNING MULTICAST MTU:1500 Metric:1
- RX packets:1170 errors:0 dropped:0 overruns:0 frame:0
- TX packets:280 errors:0 dropped:0 overruns:0 carrier:0
- collisions:0 txqueuelen:1000
- RX bytes:70616 (68.9 KiB) TX bytes:22980 (22.4 KiB)
- 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:2204 errors:0 dropped:0 overruns:0 frame:0
- TX packets:2204 errors:0 dropped:0 overruns:0 carrier:0
- collisions:0 txqueuelen:1 RX bytes:189751 (185.3 KiB) TX bytes:189751 (185.3 KiB)
- wlan0 Link encap:Ethernet HWaddr 40:D6:3C:1E:70:14
- inet6 addr: fe80::42d6:3cff:fe1e:7014/64 Scope:Link
- UP BROADCAST RUNNING MULTICAST MTU:1500 Metric:1
- RX packets:0 errors:0 dropped:0 overruns:0 frame:0
- TX packets:13 errors:0 dropped:0 overruns:0 carrier:0
- collisions:0 txqueuelen:1000
- RX bytes:0 (0.0 B) TX bytes:1856 (1.8 KiB)
复制代码
|