關於4G模塊的移植,請參考上一節
https://www.cnblogs.com/ChenChangXiong/p/10852177.html
ppp腳本,主要包含3個腳本文件,一個是需要pppd調用的腳本,還有一個chat是運營商的撥號腳本
// 在文件系統的 /etc 目錄下,創建 ppp 目錄 在 /etc/ppp 目錄下創建 peers 目錄
gprs腳本:
# vim /etc/ppp/peers/gprs
#/etc/ppp/peers/gprs
# This is pppd script for China Mobile, used GPRS Module
# Usage: root>pppd call gprs
debug nodetach /dev/ttyUSB0 115200 nocrtscts modem #noauth debug #nodetach #hide-password usepeerdns noipdefault defaultroute user "cmnet" 0.0.0.0:0.0.0.0 ipcp-accept-local #ipcp-accept-remote #lcp-echo-failure 12 #lcp-echo-interval 3 #noccp #novj #novjccomp #persist #connect '/usr/sbin/chat -s -v -f /etc/ppp/gprs-connect-chat' connect '/sbin/chat -v -s -f /etc/ppp/gprs-connect-chat' #disconnect '/bin/chat -v -f /etc/ppp/gprs-disconnect-chat'
另一個腳本
# vim etc/ppp/chap-secrets
# Secrets for authentication using CHAP
# client server secret IP addresses
"cmnet" * "cmnet" *
撥號腳本:
終端輸入:vim /etc/ppp/gprs-connect-chat
移動:
#Chat script for China Mobile, used SIMCOM sim4100 TD module.
TIMEOUT 15
ABORT "DELAYED"
ABORT "BUSY"
ABORT "ERROR"
ABORT "NO DIALTONE"
ABORT "NO CARRIER"
TIMEOUT 40
'' \rAT
OK ATS0=0
OK ATE0V1
OK AT+CGDCONT=1,"IP","CMNET"
OK AT+CGEQREQ=1,2,128,384,,,0,,,,,,
OK ATDT*99*1#
CONNECT
聯通:
TIMEOUT 5
ABORT 'NO CARRIER'
ABORT 'ERROR'
ABORT 'NODIALTONE'
ABORT 'BUSY'
ABORT 'NO ANSWER'
'' \rAT
OK \rATZ
OK \rAT+CGDCONT=1,"IP","3GNET",,0,0
OK-AT-OK ATDT*99#
CONNECT \d\c
關於腳本的詳細解釋,請參考: https://blog.csdn.net/duloveding/article/details/8287758
https://www.linuxidc.com/Linux/2011-03/33430p2.htm (三大運營商的腳本)
腳本設置好后,重啟。
首先嘗試和模塊通信,查看知否正常。
終端輸入:
echo “AT+CSQ” > /dev/ttyUSB2
然后:cat /dev/ttyUSB2
就可以查看信號強度,如果連接正常,就會收到回復,也可以試試其他的指令
如果都正常,最后啟動撥號:
ping一下谷歌:
參考文檔:
http://www.cnblogs.com/chenfulin5/p/6951290.html?tdsourcetag=s_pcqq_aiomsg
https://blog.csdn.net/duloveding/article/details/8287758
https://www.linuxidc.com/Linux/2011-03/33430p2.htm
https://blog.csdn.net/duloveding/article/details/8287758
https://www.linuxidc.com/Linux/2011-03/33430p2.htm
https://www.v2ex.com/t/328730
https://blog.csdn.net/skdkjzz/article/details/22209371
https://blog.csdn.net/qq_41546323/article/details/78930780
https://blog.csdn.net/szhebin/article/details/81114566 (有一個文檔可以下載參考 關於i.mux6移植)
注意:天線也很重要,一開始我以為不需要天線也可以,頂多是信號差一點,但是實際上,沒有天線是不行的,我試的根本無法啟動撥號,所以一直的時候ifconfgi沒有獲取到ip ME909s天線接在標有M的接口,有三個的天線接在標有M端口的