Yocto开发笔记之《驱动调试-华为3G模块》(QQ交流群:519230208)
QQ群:519230208,为避免广告骚扰,申请时请注明 “开发者” 字样
========================================================
参考:
http://blog.csdn.net/yel617/article/details/5602934
http://wenku.baidu.com/link?url=v96wCcrz8oYObkMTiPa55OyWxg35MhHF4L7voiDhKhtNPCB3uJhvNshz9UVUgpo4BTWmJE_4AhcAoW5oVOmtxr_NHYxb8ev0VKCpGwCSq1m
http://blog.csdn.net/suntao222/article/details/8930744
http://wandering.blog.51cto.com/467932/354562
http://blog.chinaunix.net/uid-9525959-id-3998519.html
一 上网模块需要内核编译配置 《Guide to Kernel Driver Integration ......》
修改源文件,修改内核配置项等,详细参考3G模块手册。
二 交叉编译一些工具(参考 《Yocto Project Application Developer's Guide》):
将以下内容添加到根目录的Makefile文件中:
CC=arm-poky-linux-gnueabi-gcc -m32 -march=i586 --sysroot=/opt/poky/1.8/sysroots/x86_64-pokysdk-linux
LD=arm-poky-linux-gnueabi-ld --sysroot=/opt/poky/1.8/sysroots/x86_64-pokysdk-linux
CFLAGS=-O2 -pipe -g -feliminate-unused-debug-types
CXXFLAGS=-O2 -pipe -g -feliminate-unused-debug-types change to : CC=arm-poky-linux-gnueabi-gcc --sysroot=/home/summer/test-yocto/qemuarm
LD=arm-poky-linux-gnueabi-ld --sysroot=/home/summer/test-yocto/qemuarm
CFLAGS=-O2 -pipe -g -feliminate-unused-debug-types
CXXFLAGS=-O2 -pipe -g -feliminate-unused-debug-types # ./configure # make
PPP
. 下载代码:https://ppp.samba.org/
. 编译代码: http://blog.csdn.net/lanyou1900/article/details/40185259
. 编译成功后将编译生成的chat,pppd,pppdump等命令拷贝到板子文件系统的/usr/sbin目录下边去
USB(我的环境里以下功能都包含了,以下仅用来参考)
libusb-1.0. (用于编译usb-modeswitch-2.0.)
http://sourceforge.net/projects/libusb/postdownload?source=dlp usb-modeswitch-2.0. (用于切换网卡的模式)
http://www.draisberghof.de/usb_modeswitch/#download usb-modeswitch-data- (用于切换时指定切换的型号)
http://www.draisberghof.de/usb_modeswitch/#download
三 编写拨号脚本
在板子文件系统/etc/ppp/peers目录下边创建三个文件如下:
1. wcdma
debug
nodetach
/dev/ttyUSB0 usepeerdns
noauth
noipdefault
novj
novjccomp
noccp
defaultroute
ipcp-accept-local
ipcp-accept-remote
connect '/usr/sbin/chat -s -v -f /etc/ppp/peers/chat-wcdma-connect'
2. chat-wcdma-connect
TIMEOUT
ABORT 'NO CARRIER'
ABORT 'ERROR'
ABORT 'NODIALTONE'
ABORT 'BUSY'
ABORT 'NO ANSWER'
'' \rAT
OK \rATZ
OK \rAT+CGDCONT=,"IP","3GNET",,,
OK-AT-OK ATDT*#
CONNECT \d\c
3. chat-wcdma-disconnect
ABORT"ERROR"
ABORT "NODIALTONE"
SAY"\nSending break to the modem\n"
'' "\K"
''"+++ATH"
SAY"\nGoodbay\n"
四 添加DNS信息
# vi /etc/resolv.conf // 加入以下内容, 如果已经存在,替换成以下内容
nameserver 202.99.160.68
nameserver 202.99.166.4 或者,替换成
nameserver 1.2.4.8
nameserver 210.2.4.8 // TOBEDO : 重启开发板,dns信息被冲掉
五 检测ppp0网络是否能够使用
# Ping –I ppp0 www.baidu.com // 能够ping通就表示3G卡移植驱动成功
出现错误,域名不能ping通,ip可以
root@imx6ulevk:~# ping www.baidu.com
ping: bad address 'www.baidu.com'
六 测试模块状态
# lsusb // 查看usb连接状态
Bus Device : ID 12d1:1c25 Huawei Technologies Co., Ltd.
Bus Device : ID 1d6b: Linux Foundation 2.0 root hub # netstat -nr
# dmesg cdc_ether -:2.0 eth2: register 'cdc_ether' at usb-ci_hdrc.-, CDC Ethernet Device, :1e::1f::
usbcore: registered new interface driver option
usbcore: registered new interface driver cdc_ether
usbserial: USB Serial support registered for GSM modem (-port)
option -:2.2: GSM modem (-port) converter detected
usb -: GSM modem (-port) converter now attached to ttyUSB0
option -:2.3: GSM modem (-port) converter detected
usb -: GSM modem (-port) converter now attached to ttyUSB1
option -:2.4: GSM modem (-port) converter detected
usb -: GSM modem (-port) converter now attached to ttyUSB2
usb -: USB disconnect, device number
cdc_ether -:2.0 eth2: unregister 'cdc_ether' usb-ci_hdrc.-, CDC Ethernet Device
option1 ttyUSB0: GSM modem (-port) converter now disconnected from ttyUSB0
option -:2.2: device disconnected
option1 ttyUSB1: GSM modem (-port) converter now disconnected from ttyUSB1
option -:2.3: device disconnected
option1 ttyUSB2: GSM modem (-port) converter now disconnected from ttyUSB2
option -:2.4: device disconnected
usb -: new full-speed USB device number using ci_hdrc
usb -: new high-speed USB device number using ci_hdrc
cdc_ether -:2.0 eth2: register 'cdc_ether' at usb-ci_hdrc.-, CDC Ethernet Device, :1e::1f::
option -:2.2: GSM modem (-port) converter detected
usb -: GSM modem (-port) converter now attached to ttyUSB0
option -:2.3: GSM modem (-port) converter detected
usb -: GSM modem (-port) converter now attached to ttyUSB1
option -:2.4: GSM modem (-port) converter detected
usb -: GSM modem (-port) converter now attached to ttyUSB2
# dmesg | grep -in ppp // 查看ppp连接状态
#cat /dev/ttyUSB0 &
# echo AT+CGMI > /dev/ttyUSB0 // 查询厂商相关信息
# echo AT+CSQ > /dev/ttyUSB0 // 查询信号,顺带还可以让你知道SIM卡相关的是否正常
# #netstat -nal // 查看网络连接状态
# ifconfig -a
Attention:
USB线的选择直接影响到能否正常识别模块
附录:
一 插上USB 3G模块显示的log
root@imx6ulevk:/mnt# usb -: new high-speed USB device number using ci_hdrc
usb -: new high-speed USB device number using ci_hdrc
cdc_ether -:2.0 eth2: register 'cdc_ether' at usb-ci_hdrc.-, CDC Ethernet Device, :1e::1f::
usbcore: registered new interface driver option
usbserial: USB Serial support registered for GSM modem (-port)
option -:2.2: GSM modem (-port) converter detected
usb -: GSM modem (-port) converter now attached to ttyUSB0
option -:2.3: GSM modem (-port) converter detected
usb -: GSM modem (-port) converter now attached to ttyUSB1
option -:2.4: GSM modem (-port) converter detected
usb -: GSM modem (-port) converter now attached to ttyUSB2
二 lsusb显示的log
root@imx6ulevk:/mnt# lsusb
Bus Device : ID 12d1:1c25 Huawei Technologies Co., Ltd.
Bus Device : ID 1d6b: Linux Foundation 2.0 root hub
三 ls /dev/ppp显示的log
root@imx6ulevk:/mnt# ls /dev/ppp
/dev/pp
四 手动拨号的错误log
root@imx6ulevk:~# timeout set to seconds
abort on (NO CARRIER)
abort on (ERROR)
abort on (NODIALTONE)
abort on (BUSY)
abort on (NO ANSWER)
send (^MAT^M)
expect (OK)
^M
OK
-- got it send (^MATZ^M)
expect (OK)
^M
^M
OK
-- got it send (^MAT+CGDCONT=,"IP","3GNET",,,^M)
expect (OK)
^M
^MAT+CGDCONT=,"IP","3GNET",,,^M^M
OK
-- got it send (ATDT*#^M)
expect (CONNECT)
^M
ATDT*#^M^M
CONNECT
-- got it send (\d)
Script /usr/sbin/chat -s -v -f /etc/ppp/peers/chat-wcdma-connect finished (pid ), status = 0x0
Serial connection established.
Couldn't set tty to PPP discipline: Invalid argument
expect (ABORT"ERROR")
^C
看起来像拨号成功的log
root@imx6ulevk:~# pppd call wcdma &
[]
root@imx6ulevk:~# timeout set to seconds
abort on (NO CARRIER)
abort on (ERROR)
abort on (NODIALTONE)
abort on (BUSY)
abort on (NO ANSWER)
send (^MAT^M)
expect (OK)
^MAT^M^M
OK
-- got it send (^MATZ^M)
expect (OK)
^M
^MATZ^M^M
OK
-- got it send (^MAT+CGDCONT=,"IP","3GNET",,,^M)
expect (OK)
^M
^MAT+CGDCONT=,"IP","3GNET",,,^M^M
OK
-- got it send (ATDT*#^M)
expect (CONNECT)
^M
ATDT*#^M^M
CONNECT
-- got it send (\d)
Script /usr/sbin/chat -s -v -f /etc/ppp/peers/chat-wcdma-connect finished (pid ), status = 0x0
Serial connection established.
using channel
Using interface ppp0
Connect: ppp0 <--> /dev/ttyUSB0
sent [LCP ConfReq id=0x1 <asyncmap 0x0> <magic 0x38c54823> <pcomp> <accomp>]
rcvd [LCP ConfReq id=0x1 <accomp> <pcomp> <asyncmap 0x0> <mru > <magic 0x545> <auth chap MD5>]
No auth is possible
sent [LCP ConfRej id=0x1 <auth chap MD5>]
rcvd [LCP ConfAck id=0x1 <asyncmap 0x0> <magic 0x38c54823> <pcomp> <accomp>]
rcvd [LCP ConfReq id=0x2 <accomp> <pcomp> <asyncmap 0x0> <mru > <magic 0x545>]
sent [LCP ConfAck id=0x2 <accomp> <pcomp> <asyncmap 0x0> <mru > <magic 0x545>]
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=0x1]
sent [IPCP ConfNak id=0x1 <addr 0.0.0.0>]
rcvd [IPCP ConfNak id=0x1 <ms-dns1 0.0.0.0> <ms-dns2 0.0.0.0>]
sent [IPCP ConfReq id=0x2 <addr 0.0.0.0> <ms-dns1 0.0.0.0> <ms-dns2 0.0.0.0>]
rcvd [IPCP ConfReq id=0x2]
sent [IPCP ConfAck id=0x2]
rcvd [IPCP ConfNak id=0x2 <addr 10.74.89.144> <ms-dns1 120.80.80.80> <ms-dns2 221.5.88.88>]
sent [IPCP ConfReq id=0x3 <addr 10.74.89.144> <ms-dns1 120.80.80.80> <ms-dns2 221.5.88.88>]
rcvd [IPCP ConfAck id=0x3 <addr 10.74.89.144> <ms-dns1 120.80.80.80> <ms-dns2 221.5.88.88>]
Could not determine remote IP address: defaulting to 10.64.64.64
local IP address 10.74.89.144
remote IP address 10.64.64.64
primary DNS address 120.80.80.80
secondary DNS address 221.5.88.88
ifconfig -a
ppp0 Link encap:Point-to-Point Protocol
inet addr:10.74.89.144 P-t-P:10.64.64.64 Mask:255.255.255.255
UP POINTOPOINT RUNNING NOARP MULTICAST MTU: Metric:
RX packets: errors: dropped: overruns: frame:
TX packets: errors: dropped: overruns: carrier:
collisions: txqueuelen:
RX bytes: (68.0 B) TX bytes: (80.0 B)
netstat -nr
root@imx6ulevk:~# netstat -nr
Kernel IP routing table
Destination Gateway Genmask Flags MSS Window irtt Iface
0.0.0.0 0.0.0.0 0.0.0.0 U ppp0
10.64.64.64 0.0.0.0 255.255.255.255 UH ppp0
error
root@imx6ulevk:~# ping -I ppp0 www.baidu.com
ping: bad address 'www.baidu.com'
success
root@imx6ulevk:~# ping 202.108.23.237
PING 202.108.23.237 (202.108.23.237): data bytes
bytes from 202.108.23.237: seq= ttl= time=1515.208 ms
bytes from 202.108.23.237: seq= ttl= time=75.742 ms
Yocto开发笔记之《驱动调试-华为3G模块》(QQ交流群:519230208)的更多相关文章
- 运维开发笔记整理-URL配置
运维开发笔记整理-URL配置 作者:尹正杰 版权声明:原创作品,谢绝转载!否则将追究法律责任. 一.URL路由 对于高质量的Web应用来说,使用简洁,优雅的URL的路由是一个非常值得重视的细节.Dja ...
- Yocto开发笔记之《快速入门,环境搭建 & 编译》(QQ交流群:519230208)
开了一个交流群,欢迎爱好者和开发者一起交流,转载请注明出处. QQ群:,为避免广告骚扰,申请时请注明 “开发者” 字样 ======================================== ...
- Yocto开发笔记之《根文件系统裁剪》(QQ交流群:519230208)
开了一个交流群,欢迎爱好者和开发者一起交流,转载请注明出处. QQ群:519230208,为避免广告骚扰,申请时请注明 “开发者” 字样 =============================== ...
- Yocto开发笔记之《嵌入式linux libcurl编程》(QQ交流群:519230208)
开了一个交流群,欢迎爱好者和开发者一起交流,转载请注明出处. QQ群:519230208,为避免广告骚扰,申请时请注明 “开发者” 字样 =============================== ...
- Yocto开发笔记之《Makefile编写》(QQ交流群:519230208)
开了一个交流群,欢迎爱好者和开发者一起交流,转载请注明出处. QQ群:519230208,为避免广告骚扰,申请时请注明 “开发者” 字样 =============================== ...
- Yocto开发笔记之《驱动调试-GPS数据采集》(QQ交流群:519230208)
开了一个交流群,欢迎爱好者和开发者一起交流,转载请注明出处. QQ群:519230208,为避免广告骚扰,申请时请注明 “开发者” 字样 =============================== ...
- Yocto开发笔记之《Tip-bitbake常用命令》(QQ交流群:519230208)
开了一个交流群,欢迎爱好者和开发者一起交流,转载请注明出处. QQ群:519230208,为避免广告骚扰,申请时请注明 “开发者” 字样 =============================== ...
- [Openwrt 项目开发笔记]:MySQL配置(六)
[Openwrt项目开发笔记]系列文章传送门:http://www.cnblogs.com/double-win/p/3888399.html 正文: 在本人的项目中,运行在路由器上的服务器采用Ngi ...
- 《linux就该这么学》课堂笔记12 网卡配置、防火墙配置
1.网卡配置(四种方法,选其一即可,配置后须重启网络服务使其生效) 1)修改配置文件./etc/sysconfig/network-scripts/ifcfg-网卡名称 2)nmtui [RHEL7] ...
- Yocto开发笔记之《网卡配置》(QQ交流群:519230208)
QQ群:519230208,为避免广告骚扰,申请时请注明 “开发者” 字样 ============================================== # ifconfig -a # ...
随机推荐
- Android四大组件之Activity详解——创建和启动Activity
前面我们已经对Activity有过简单的介绍: Android开发——初始Activity Android开发——响应用户事件 Android开发——Activity生命周期 先来看一下最终结果 项目 ...
- 屠龙之路_坚持就是胜利_NinthDay
狭小的空间里,屠龙天团的少年们和alpha恶龙苦苦对峙了一夜!这恶龙还挺能熬的,厉害了word龙.无奈之下,五更天的时候,我们的屠龙少年只能先退出战场养精蓄锐,为了不让恶龙再次逍遥法外,机智的屠龙队长 ...
- nginx安装(1) – ttlsa教程系列之nginx
1.必要软件准备 安装pcre 为了支持rewrite功能,我们需要安装pcre 1 # yum install pcre* //如过你已经装了,请跳过这一步 安装openssl 需要ssl的支持 ...
- C#反射设置属性值和获取属性值
/// /// 获取类中的属性值 /// /// /// /// public string GetModelValue(string FieldName, object obj) { try { T ...
- python 中的sort 和java中的Collections.sort()函数的使用
x=[1,2,3] x.sort()对的,x这个都变了 y=x.sort()错误 y=sorted(x)对的,x拍好序的一个副本 python中用匿名函数和自定义函数排序:(很奇怪的是比较函数返回的是 ...
- python 进程间共享数据 (三)
Python的multiprocessing模块包装了底层的机制,提供了Queue.Pipes等多种方式来交换数据. 我们以Queue为例,在父进程中创建两个子进程,一个往Queue里写数据,一个从Q ...
- Java 代码编译和执行的整个过程
Java 代码编译是由 Java 源码编译器来完成,流程图如下所示: Java 字节码的执行是由 JVM 执行引擎来完成,流程图如下所示: Java 代码编译和执行的整个过程包含了以下三个重要的机制: ...
- 总结的js性能优化方面的小知识
前言 一直在学习javascript,也有看过<犀利开发Jquery内核详解与实践>,对这本书的评价只有两个字犀利,可能是对javascript理解的还不够透彻异或是自己太笨,更多的是自己 ...
- 绘制图形与3D增强技巧(二)----直线图元
一. glBegin(GL_LINES); glend(); 二.线带和线环 glBegin(GL_LINE_STRIP); glend(); glBegin(GL_LINE_LOOP); glend ...
- BZOJ1070 [SCOI2007]修车
本文版权归ljh2000和博客园共有,欢迎转载,但须保留此声明,并给出原文链接,谢谢合作. 本文作者:ljh2000作者博客:http://www.cnblogs.com/ljh2000-jump/转 ...