我是靠谱客的博主 可靠果汁,最近开发中收集的这篇文章主要介绍S5P4418:4G模块EC20移植和测试笔记1. 前言2. 适配和测试2.1 适配2.2 测试,觉得挺不错的,现在分享给大家,希望可以做个参考。

概述

1. 前言

限于作者能力水平,本文可能存在的谬误,因此而给读者带来的损失,作者不做任何承诺。

2. 适配和测试

2.1 适配

修改文件drivers/usb/serial/option.c,增加设备的 VID & PID:

static const struct usb_device_id option_ids[] = {
{ USB_DEVICE(0x05C6,0x9215) },
// 为EC20模块增加VID & PID
{ USB_DEVICE(0x2C7C, 0x0125) },
// EC20CFD-512-STD. 
...
};

2.2 测试

(1) 下电,如下图连接好4G模块,4G天线,插入SIM卡
在这里插入图片描述
(2) 上电。系统启动到出现命令提示符时,会得到如下输出:
在这里插入图片描述
(3) 运行 lsusb 命令查看4G模块的USB连接状况,EC20 4G的模块会有如下图红框中的USB设备ID:
在这里插入图片描述
每个厂商的4G模块的USB设备VID & PID是不同的,所以对不同的4G模块,上面的输出是不同的。
(4) 查看是否存在/dev/ttyUSB*设备节点,这些设备是4G模块用来通信的,每个设备节点用途不同。如果不存在这些设备,4G模块是不能正常工作的。
在这里插入图片描述
(5) 4G拨号连接。运行命令pppd call quectel-ppp & 进行拨号,正常情况会得到如下输出:

# pppd call quectel-ppp &
# pppd options in effect:
debug
# (from /etc/ppp/peers/quectel-ppp)
nodetach
# (from /etc/ppp/peers/quectel-ppp)
dump
# (from /etc/ppp/peers/quectel-ppp)
noauth
# (from /etc/ppp/peers/quectel-ppp)
user test
# (from /etc/ppp/peers/quectel-ppp)
password ??????
# (from /etc/ppp/peers/quectel-ppp)
remotename 3gppp
# (from /etc/ppp/peers/quectel-ppp)
/dev/ttyUSB3
# (from /etc/ppp/peers/quectel-ppp)
115200
# (from /etc/ppp/peers/quectel-ppp)
lock
# (from /etc/ppp/peers/quectel-ppp)
connect chat -s -v -f /etc/ppp/peers/quectel-chat-connect
# (from /etc/ppp/peers/quectel-ppp)
disconnect chat -s -v -f /etc/ppp/peers/quectel-chat-disconnect
# (from /etc/ppp/peers/quectel-ppp)
nocrtscts
# (from /etc/ppp/peers/quectel-ppp)
modem
# (from /etc/ppp/peers/quectel-ppp)
hide-password
# (from /etc/ppp/peers/quectel-ppp)
novj
# (from /etc/ppp/peers/quectel-ppp)
novjccomp
# (from /etc/ppp/peers/quectel-ppp)
ipcp-accept-local
# (from /etc/ppp/peers/quectel-ppp)
ipcp-accept-remote
# (from /etc/ppp/peers/quectel-ppp)
ipparam 3gppp
# (from /etc/ppp/peers/quectel-ppp)
noipdefault
# (from /etc/ppp/peers/quectel-ppp)
ipcp-max-failure 30
# (from /etc/ppp/peers/quectel-
ppp)
defaultroute
# (from /etc/ppp/peers/quectel-ppp)
usepeerdns
# (from /etc/ppp/peers/quectel-ppp)
noccp
# (from /etc/ppp/peers/quectel-ppp)
abort on (BUSY)
abort on (NO CARRIER)
abort on (NO DIALTONE)
abort on (ERROR)
abort on (NO ANSWER)
timeout set to 30 seconds
send (AT^M)
expect (OK)
AT^M^M
OK
-- got it
send (ATE0^M)
expect (OK)
^M
ATE0^M^M
OK
-- got it
send (ATI;+CSUB;+CSQ;+CPIN?;+COPS?;+CGREG?;&D2^M)
expect (OK)
^M
^M
Quectel^M
EC20^M
Revision: EC20CQAR02A07E2G^M
^M
SubEdition: V03^M
^M
+CSQ: 28,99^M
^M
+CPIN: READY^M
^M
+COPS: 0,0,"CHINA
MOBILE CMCC",7^M
^M
expect (CONNECT)
^M
^M
CONNECT
-- got it
Script chat -s -v -f /etc/ppp/peers/quectel-chat-connect finished (pid 228), status = 0x0
Serial connection established.
using channel 1
Using interface ppp0
Connect: ppp0 <--> /dev/ttyUSB3
sent [LCP ConfReq id=0x1 <asyncmap 0x0> <magic 0xc97b788e>
<pcomp> <accomp>]
rcvd [LCP ConfReq id=0x0 <asyncmap 0x0> <auth chap MD5> <magic 0x16be8765> <pcomp> <accomp>]
sent [LCP ConfAck id=0x0 <asyncmap 0x0> <auth chap MD5> <magic 0x16be8765> <pcomp> <accomp>]
rcvd [LCP ConfAck id=0x1 <asyncmap 0x0> <magic 0xc97b788e> <pcomp> <accomp>]
rcvd [LCP DiscReq id=0x1 magic=0x16be8765]
rcvd [CHAP Challenge id=0x1 <ce75169e767890d400f8d45890f5e505>, name = "UMTS_CHAP_SRVR"]
sent [CHAP Response id=0x1 <16e21983dd474e25f437c19846143f1d>, name = "test"]
rcvd [CHAP Success id=0x1 ""]
CHAP authentication succeeded
CHAP authentication succeeded
sent [IPCP ConfReq id=0x1 <addr 0.0.0.0> <ms-dns1 0.0.0.0> <ms-dns2 0.0.0.0>]
rcvd [IPCP ConfReq id=0x0]
sent [IPCP ConfNak id=0x0 <addr 0.0.0.0>]
rcvd [IPCP ConfNak id=0x1 <addr 10.20.52.69> <ms-dns1 221.179.38.7> <ms-dns2 120.196.165.7>]
sent [IPCP ConfReq id=0x2 <addr 10.20.52.69> <ms-dns1 221.179.38.7> <ms-dns2 120.196.165.7>]
rcvd [IPCP ConfReq id=0x1]
sent [IPCP ConfAck id=0x1]
rcvd [IPCP ConfAck id=0x2 <addr 10.20.52.69> <ms-dns1 221.179.38.7> <ms-dns2 120.196.165.7>]
Could not determine remote IP address: defaulting to 10.64.64.64
local
IP address 10.20.52.69
remote IP address 10.64.64.64
primary
DNS address 221.179.38.7
secondary DNS address 120.196.165.7

最后4行输出,表示已经成功获取到IP,并分配了DNS服务器。
(6) 运行 ifconfig 命令查看是否存在拨号设备
在这里插入图片描述
上图中ppp0就是新的拨号设备。
(7) 用4G模块上网。测试中,我们拔掉所有网线,确保是从4G进行的网络通信。
在这里插入图片描述
由上图可见,已经可以上网了。

最后

以上就是可靠果汁为你收集整理的S5P4418:4G模块EC20移植和测试笔记1. 前言2. 适配和测试2.1 适配2.2 测试的全部内容,希望文章能够帮你解决S5P4418:4G模块EC20移植和测试笔记1. 前言2. 适配和测试2.1 适配2.2 测试所遇到的程序开发问题。

如果觉得靠谱客网站的内容还不错,欢迎将靠谱客网站推荐给程序员好友。

本图文内容来源于网友提供,作为学习参考使用,或来自网络收集整理,版权属于原作者所有。
点赞(54)

评论列表共有 0 条评论

立即
投稿
返回
顶部