谷动谷力

 找回密码
 立即注册
查看: 2502|回复: 0
打印 上一主题 下一主题
收起左侧

Quectel EM05/EC20 4G模组使用-基于openwrt系统

[复制链接]
跳转到指定楼层
楼主
发表于 2022-7-2 00:14:12 | 只看该作者 |只看大图 回帖奖励 |倒序浏览 |阅读模式
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…
  • 增加PID&VID

    • 修改openwrt/build_dir/target-mipsel_24kc_glibc-2.24/linux-ramips_mt7688/linux-4.4.167/drivers/usb/serial/option.c文件
      1. static const struct usb_device_id option_ids[] =
      2. {
      3. #if 1 //Added by Quectel
      4. { USB_DEVICE(0x05C6, 0x9090) }, /* Quectel UC15 */
      5. { USB_DEVICE(0x05C6, 0x9003) }, /* Quectel UC20 */
      6. { USB_DEVICE(0x2C7C, 0x0125) }, /* Quectel EC25 EM05*/
      7. { USB_DEVICE(0x2C7C, 0x0121) }, /* Quectel EC21 */
      8. { USB_DEVICE(0x05C6, 0x9215) }, /* Quectel EC20 */
      9. { USB_DEVICE(0x2C7C, 0x0191) }, /* Quectel EG91 */
      10. { USB_DEVICE(0x2C7C, 0x0195) }, /* Quectel EG95 */
      11. { USB_DEVICE(0x2C7C, 0x0306) }, /* Quectel EG06/EP06/EM06 */
      12. { USB_DEVICE(0x2C7C, 0x0296) }, /* Quectel BG96 */
      13. { USB_DEVICE(0x2C7C, 0x0435) }, /* Quectel AG35 */
      14. #endif
      15. }
      复制代码

  • 添加零包处理

           修改openwrt/build_dir/target-mipsel_24kc_glibc-2.24/linux-ramips_mt7688/linux-4.4.167/drivers/usb/serial/usb_wwan.c文件

  1. 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文件。

  1. static struct usb_serial_driver option_1port_device = {
复制代码



2.修改openwrt配置
  • 执行命令make menuconfig进入配置
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配置
  1. config interface '4G'
  2.      option ifname 'ppp0'
  3.         option _orig_ifname 'eth0.2'
  4.         option _orig_bridge 'false'
  5.         option proto '3g'
  6.         option device '/dev/ttyUSB2'
  7.        option service 'umts'
  8.        option ipv6 'auto'
  9.        option keepalive '10 5'
  10.         option metric '0'
复制代码



  • 重启网络
    /etc/init.d/network restart
    • 等待4G连接成功
  1. root@LEDE:~# ifconfig
  2. 3g-4G     Link encap:Point-to-Point Protocol
  3.             inet addr:10.124.22.77  P-t-P:10.64.64.64  Mask:255.255.255.255
  4.           UP POINTOPOINT RUNNING NOARP MULTICAST  MTU:1500  Metric:1
  5.           RX packets:25 errors:0 dropped:0 overruns:0 frame:0
  6.           TX packets:58 errors:0 dropped:0 overruns:0 carrier:0
  7.           collisions:0 txqueuelen:3
  8.            RX bytes:1762 (1.7 KiB)  TX bytes:3818 (3.7 KiB)br-lan
  9.     Link encap:Ethernet  HWaddr C6:E5:72:41:19:1D
  10.             inet addr:192.168.2.1  Bcast:192.168.2.255  Mask:255.255.255.0
  11.           inet6 addr: fe80::c4e5:72ff:fe41:191d/64 Scope:Link
  12.           inet6 addr: fd3f:6922:178d::1/60 Scope:Global
  13.           UP BROADCAST RUNNING MULTICAST  MTU:1500  Metric:1
  14.           RX packets:0 errors:0 dropped:0 overruns:0 frame:0
  15.           TX packets:19 errors:0 dropped:0 overruns:0 carrier:0
  16.           collisions:0 txqueuelen:1000
  17.            RX bytes:0 (0.0 B)  TX bytes:2610 (2.5 KiB)eth0
  18.       Link encap:Ethernet  HWaddr 40:D6:3C:1E:70:14
  19.             inet6 addr: fe80::42d6:3cff:fe1e:7014/64 Scope:Link
  20.           UP BROADCAST RUNNING MULTICAST  MTU:1500  Metric:1
  21.           RX packets:5519 errors:0 dropped:4 overruns:0 frame:0
  22.           TX packets:1579 errors:0 dropped:0 overruns:0 carrier:0
  23.           collisions:0 txqueuelen:1000
  24.            RX bytes:476283 (465.1 KiB)
  25.            TX bytes:152174 (148.6 KiB)
  26.           Interrupt:5 eth0.1    Link encap:Ethernet  HWaddr C6:E5:72:41:19:1D
  27.             UP BROADCAST RUNNING MULTICAST  MTU:1500  Metric:1
  28.           RX packets:0 errors:0 dropped:0 overruns:0 frame:0
  29.           TX packets:19 errors:0 dropped:0 overruns:0 carrier:0
  30.           collisions:0 txqueuelen:1000
  31.            RX bytes:0 (0.0 B)  TX bytes:2610 (2.5 KiB)
  32. eth0.2    Link encap:Ethernet  HWaddr C6:E5:72:41:19:1E
  33.             inet addr:192.168.3.94  Bcast:192.168.3.255  Mask:255.255.255.0
  34.           inet6 addr: fe80::c4e5:72ff:fe41:191e/64
  35. Scope:Link          UP BROADCAST RUNNING MULTICAST  MTU:1500  Metric:1
  36.          RX packets:1170 errors:0 dropped:0 overruns:0 frame:0
  37.           TX packets:280 errors:0 dropped:0 overruns:0 carrier:0
  38.           collisions:0 txqueuelen:1000
  39.            RX bytes:70616 (68.9 KiB)  TX bytes:22980 (22.4 KiB)
  40. lo        Link encap:Local Loopback
  41.             inet addr:127.0.0.1  Mask:255.0.0.0          inet6 addr: ::1/128 Scope:Host
  42.           UP LOOPBACK RUNNING  MTU:65536  Metric:1
  43.          RX packets:2204 errors:0 dropped:0 overruns:0 frame:0
  44.           TX packets:2204 errors:0 dropped:0 overruns:0 carrier:0
  45.           collisions:0 txqueuelen:1           RX bytes:189751 (185.3 KiB)  TX bytes:189751 (185.3 KiB)
  46. wlan0     Link encap:Ethernet  HWaddr 40:D6:3C:1E:70:14
  47.             inet6 addr: fe80::42d6:3cff:fe1e:7014/64 Scope:Link
  48.           UP BROADCAST RUNNING MULTICAST  MTU:1500  Metric:1
  49.           RX packets:0 errors:0 dropped:0 overruns:0 frame:0
  50.           TX packets:13 errors:0 dropped:0 overruns:0 carrier:0
  51.           collisions:0 txqueuelen:1000
  52.            RX bytes:0 (0.0 B)  TX bytes:1856 (1.8 KiB)
复制代码

回复

使用道具 举报

您需要登录后才可以回帖 登录 | 立即注册

本版积分规则

QQ|Archiver|手机版|深圳市光明谷科技有限公司|光明谷商城|Sunshine Silicon Corpporation ( 粤ICP备14060730号|Sitemap

GMT+8, 2024-4-27 01:00 , Processed in 0.132241 second(s), 36 queries .

Powered by Discuz! X3.2 Licensed

© 2001-2013 Comsenz Inc.

快速回复 返回顶部 返回列表