linux 4G模块调试注意事项

本文详细记录了在Linux系统下配置和调试4G模块的过程,包括检查SIM卡状态、信号强度、网络注册,以及使用PPPD和CHAT脚本进行连接设置。关键步骤涉及AT指令的使用,如AT+CPIN?、AT+CSQ和AT+CGREG?,并提供了完整的PPPD和CHAT脚本示例,确保设备能够正确接入网络并设置默认路由。
摘要由CSDN通过智能技术生成

本文仅记录自己调试过程碰到的问题,后续有时间的话来完善内容。

1. 检查SIM卡是否插好:AT指令是AT+CPIN?,回复状态READY表示已插好。

2. 检查是否有信号:AT指令是AT+CSQ,回复 xx,99(xx范围0~31,越大信号越好)。

3. 检查SIM卡是否注册:AT指令AT+CGREG?

4. linux平台下PPPD和CHAT脚本文件换行符不能使用windows格式。

5. 查看和添加路由。查看:route -n, 添加:route add default dev ppp0 

下面是一个可用的配置(按照第一行注释存放位置+文件名):

#/etc/ppp/peers/4gnet
# Usage:root>pppd call 4gnet
# Hide password in debug messages
hide-password
# The phone is not required to authenticate
noauth
# The chat script (be sure to edit that file,too!)
connect '/usr/sbin/chat -s -v -f /etc/chatscripts/chat-connect'
# The close script(be sure to edit that file,too!)
disconnect '/usr/sbin/chat -s -v -f /etc/chatscripts/chat-disconnect'
# Debug info from pppd
# debug
# Serial Device to which the HSPDA phone is connected
/dev/ttyUSB3
# Serial port line speed
115200
# If you want to use the HSDPA link as your gateway
defaultroute
# pppd must not propose any IP address to the peer
noipdefault
# No ppp compression
novj
novjccomp
noccp
ipcp-accept-local
ipcp-accept-remote
local
lcp-echo-failure 6
lcp-echo-interval 10
#pppd donot exit limit by 'maxfail'
persist
#0:infinite
#maxfail 0
# For sanity, keep a lock on the serial line
lock
dump
# Keep pppd attached to the terminal
# Comment this to get daemon mode pppd
nodetach
user 
password 
# Hardware flow control
crtscts
remotename 3gppp
ipparam 3gppp
# Ask the peer for up to 2 DNS server addresses
usepeerdns
# /etc/chatsscripts/chat-connect
TIMEOUT 5
ABORT "BUSY"
ABORT "NO CARRIER"
ABORT "NO DIALTONE"
ABORT "ERROR"
ABORT "NO ANSWER"

'' AT
# OK ATI
OK AT+CPIN?
OK AT+CSQ
OK AT+CGREG?
OK ATZ
# OK ATE0
# Connection to the network
OK AT+CGDCONT=1,"IP","3gnet"
# Dial the number
OK ATDT*99#
CONNECT ''
# /etc/chatsscripts/chat-disconnect
ABORT "ERROR"
ABORT "NO DIALTONE"
SAY "\nSending break to the modem\n"
"" +++
"" +++
"" +++
"" ATH
SAY "\nGood bay\n"
#!/bin/sh
# /etc/ppp/if-up.d/0001usepeergw
# chmod a+x 0001usepeergw
route add default dev ppp0

  • 1
    点赞
  • 3
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值