QUECTEL EC200T 4G MODULE USAGE


1. Environment Setup

  1. Download the documents from QUECTEL official website and the modified kernel code.

  2. Sstar SDK


2. Kernel Modification

Add QUECTEL`s modified kernel to the corresponding directory.

Note: Pay attention to distinguish the corresponding kernel version; Consult the manufacturer for the corresponding modification reference file.(The current kernel version is 4.9.84, and you can also choose V4.9.111 or V4.9.51)


3. 3 Ways of Networking

EC200T supports PPP, ECM and RNDIS.


3.1. PPP

  1. Download open source tool: PPP

    wget https://download.samba.org/pub/ppp/ppp-2.4.8.tar.gz

  2. Unzip and compile

    1. tar -xvf ppp-2.4.8.tar.gz

    2. The latest pppd version use openssl by default, which need to be replaced to built-in libcrpto by modify pppd/Makefile.linux, and change #USE_CRYPT=y to USE_CRYPT=y.

    3. Use static compilation to modify pppd/Makefile.linux, change COPTS = -O2 -pipe -Wall -g to COPTS = -O2 -pipe -Wall -g --static

      ./configure
      
      make CC=arm-linux-gnueabihf-gcc
      

    If you could not find crypt library, click her to download.

  3. Copy the generated program to the corresponding rootfs directory.

    cp ppp-2.4.8/chat/chat  $(ROOTFS)/usr/sbin
    cp ppp-2.4.8/pppd/pppd  $(ROOTFS)/usr/sbin
    cp ppp-2.4.8/pppddump/pppddumo $(ROOTFS)/usr/sbin
    cp ppp-2.4.8/pppstats/pppstats $(ROOTFS)/usr/sbin
    
  4. Create config file

    mkdir $(ROOTFS)/etc/ppp/ $(ROOTFS)/etc/ppp/peers
    
    cp ppp-2.4.8/etc.ppp/pap-secrets $(ROOTFS)/etc/ppp
    cp ppp-2.4.8/etc.ppp/chap-secrets $(ROOTFS)/etc/ppp
    
    touch $(ROOTFS)/etc/ppp/peers/gprs
    touch $(ROOTFS)/etc/ppp/gprs-connect-chat
    touch $(ROOTFS)/etc/ppp/ip-up
    touch $(ROOTFS)/etc/ppp/ip-down
    

    /etc/ppp/peers/gprs

    # /etc/ppp/peers/gprs
    
    # Usage: root>pppd call gprs
    # Interface should be used is the interface which connects physics interface of SIM7100C Module
    
    # if the ttyname serial port does not start with "/", automatically add "/dev/"
    /dev/ttyUSB1
    
    # speed Serial port baud
    115200
    
    # hardware stream control
    crtscts
    
    # modem mode
    modem
    
    # no authentication
    noauth
    
    # refuse chap authorization
    refuse-chap
    
    # refuse mschap authorization
    refuse-mschap
    
    # refuse mschap-v2 authorization
    refuse-mschap-v2
    
    # debug mode 
    pppd will record the content of all control packets sent or received in a readable form
    debug
    
    # foreground running
    nodetach
    
    #hide-password
    
    # request 2 dns server addresses from ISP,  two of which will named as environment variables DNS1 and DNS2 and be transferred to /etc/ppp/ip-up script, and set environment variable USEPERDNS to 1.
    usepeerdns
    
    # ip is provided by ISP, disable the local ip
    noipdefault
    
    # add ISP gateway to the routing table as the default route
    defaultroute
    
    # username
    user "cmnet"
    
    0.0.0.0:0.0.0.0
    
    #ipcp-accept-local
    
    #ipcp-accept-remote
    
    # Enable the following two options to realize automatic replay of ppp disconnection
    
    # lcp connection failure times
    lcp-echo-failure 6
    
    # lcp echo sending interval
    lcp-echo-interval 10
    
    # disable ccp
    #noccp
    
    # disable tcp/ip header in Van Jacobson format
    #novj
    
    #novjccomp
    
    # reconnect instead of exit after each connection, the repeated connection times are limited by maxfail
    persist
    
    # maximum repeated connection times连接最大尝试次数0无限制
    #maxfail
    
    # hardware dial before enable ppp
    connect '/usr/sbin/chat -s -v -f /etc/ppp/gprs-connect-chat'
    

    /etc/ppp/gprs-connect-chat

    # set timeout
    TIMEOUT 15
    
    # exit the script when received DELAYED, BUSY, ERROR, NO DIALTONE, or NO CARRIER
    ABORT "DELAYED"                
    ABORT "BUSY"
    ABORT "ERROR"
    ABORT "NO DIALTONE"            
    ABORT "NO CARRIER"
    
    # send AT 无期望,直接发送AT字符串
    '' AT
    
    # look up the AT command manual for the meanings below
    OK ATS0=0
    OK ATE0V1
    
    # 设置APN,移动、联通、电信各不相同,见文末表格
    OK AT+CGDCONT=1,"IP","CMNET"
    
    # 拨号开启GPRS服务,号码移动、联通、电信各不相同,见文末表格
    OK ATD*99***1#
    
    # expect to receive CONNECT
    CONNECT ''
    

    /etc/ppp/ip-up

    #!/bin/sh
    #ip-up
    dns_file="/etc/resolv.conf"
    
    if [ -f $dns_file ];then
        rm "$dns_file"
    fi
    ln /etc/ppp/resolv.conf "$dns_file"
    

    /etc/ppp/ip-down

    #!/bin/sh
    #ip-down
    #set -vx
    dns_file="/etc/resolv.conf"
    
    rm $dns_file
    
    cat > "$dns_file" <<EOF
    # auto create by ip-down
    nameserver 114.114.114.114
    nameserver 8.8.8.8
    EOF
    
    chmod 755 "$dns_file"
    
    /etc/init.d/networking restart
    
    echo "Set dns for eth0"
    
  5. Kernel config, enable usb serial port driver

    CONFIG_USB_SERIAL
    CONFIG_USB_SERIAL_OPTION
    
    Device Drivers -->
    USB support  -->
        USB Serial Converter support  -->
            USB driver for GSM and CDMA modems -->
    

    Enable PPP driver

    CONFIG_PPP
    
    Device Drivers  --> 
    Network device support -->
        PPP (point-to-point protocol) support
    
  6. PPP dial

    1. Connect EC200T to Takoyaki demo board after environment config.

    2. Press EC200T PWRKEY until the module activated. The /dev/ directory in Takoyaki will generate nodes ttyUSB0, ttyUSB1 and ttyUSB2.

    3. Command pppd call gprs

      Enter ping www.baidu.com to check wether the internet is connected.


3.2. ECM/RNDIS

  1. Kernel config

    Enable usb serial port driver

    CONFIG_USB_SERIAL
    CONFIG_USB_SERIAL_OPTION
    
    Device Drivers -->
    USB support  -->
        USB Serial Converter support-->
                USB driver for GSM and CDMA modems -->
    

    Enable ECM/RNDIS driver

    1. CONFIG_USB_NET_DRIVERS
    Device Drivers -->
    Network device support -->
        USB Network Adapters -->
    
    2. CONFIG_USB_USBNET
    Device Drivers -->
    Network device support -->
        USB Network Adapters -->
            Multi-purpose USB Networking Framework -->
    
    3. CONFIG_USB_NET_RNDIS_HOST
    Device Drivers -->
    Network device support -->
        USB Network Adapters -->
            Multi-purpose USB Networking Framework -->
                Host for RNDIS and ActiveSync devices -->
    
  2. Config AT Command in EC200T mode, consult manufacturer for reference document.

    1. Use AT+QICSGP to configure APN/username/password/APN.

    2. Use AT+QIACT=1 to enable PDP when in 2G/3G.

    3. Use AT+QNETDEVCTL=1,1,1 to establish a data connection。

    4. Use dhcp to configure dns and ip

    Example:

    ## 4. microcom /dev/ttyUSB
    AT+QCFG="usbnet",1
    OK
    at+cpin?
    +CPIN: READY
    OK
    at+csq
    +CSQ: 31,99
    OK
    at+qicsgp=1,1,"cmnet"
    OK
    at+cops?
    +COPS: 0,0,"CHINA MOBILE",7
    OK
    at+qnetdevctl=1,1,1
    OK
    

    dns and ip config command

    udhcpc -i usb0 -s /etc/init.d/udhcpc.script