SIM7600CE联网测试分为两部分:
1、TCP/IP连接
2、PPP拨号上网
实验环境:ubuntu-meta 16.04
硬件:树莓派3B,SIM7600CE
上网卡:移动的NB-IOT物联网卡
微雪官方教程:/wiki/SIM7600CE_4G_HAT
把模块插入到树莓派,并USB接口连到树莓派USB口上,开机,如下图所示:
使用SIM7600CE模块之前,需要对树莓派引脚初始化
1. TCP/IP连接
2. ppp拨号软件安装与配置
安装ppp
sudo apt-get install ppp
新建一个script脚本
cd /etc/ppp/peerscp provider gprs
修改gprs配置文件
nano gprs
修改内容如下:
# example configuration for a dialup connection authenticated with PAP or CHAP## This is the default configuration used by pon(1) and poff(1).# See the manual page pppd(8) for information on all the options.# MUST CHANGE: replace myusername@realm with the PPP login name given to# your by your provider.# There should be a matching entry with the password in /etc/ppp/pap-secrets# and/or /etc/ppp/chap-secrets.user "myusername@realm"# MUST CHANGE: replace ******** with the phone number of your provider.# The /etc/chatscripts/pap chat script may be modified to change the# modem initialization string.connect "/usr/sbin/chat -v -f /etc/chatscripts/gprs"# Serial device to which the modem is connected./dev/ttyUSB2 #由于我们使用SIM7600CE的4G模块,并且该模块的驱动已经默认添加到raspbian的内核的,ttyUSB2为ppp的拨号端口# Speed of the serial line.115200nocrtscts #增加debug #增加nodetach #增加ipcp-accept-local #增加ipcp-accept-remote #增加# Assumes that your IP address is allocated dynamically by the ISP.noipdefault# Try to get the name server addresses from the ISP.usepeerdns# Use this connection as the default route.defaultroute# Makes pppd "dial again" when the connection is lost.persist
# Do not ask the remote to authenticate.
noauth
查看SIM7600CE的串口
ls /dev/ttyUSB*
使用minicom串口调试工具简单测试(如果未安装使用 sudo apt-get install minicom 进行安装)
连接 /dev/ttyUSB2 串口调试
minicom -D /dev/ttyUSB2
调试过程如下:
ATOKAT+CSQ+CSQ: 21,99OKAT+CPIN?+CPIN: READYOKAT+COPS?+COPS: 1,0,"CHINA MOBILE CMCC",7OKAT+CREG?+CREG: 0,1OKAT+CPSI?+CPSI: LTE,Online,460-00,0x69B1,132648988,136,EUTRAN-BAND40,38950,5,5,-65,-988,8OKAT+CEREG?+CEREG: 0,1OK
调试完成退出。
查看网卡信息
ifconfig
开始拨号
pppd call gprs
拨号成功!
再次查看网卡信息:
可以看到多出ppp0网卡,即成功拨号,并获得一个临时IP。