在ARM-linux上实现4G模块PPP拨号上网【转】

本文转载自:http://blog.csdn.net/zqixiao_09/article/details/52540887

在ARM平台上实现4G模块的PPP拨号上网,参考网上的资料和自己的理解,从一无所知到开发完成花了一周多。最后看到ARM板ping通www.baidu.com时甚是高兴,现将此过程整理如下。当然,除此之外要做的工作还有很多。

4G模块使用的SIMTECH 的SIM7100C,SIM7100C带有UART和USB接口,在考虑速度上我们使用USB接口和ARM进行通信。所以向Linux内核添加3G模块的驱动(USB转串口驱动)和PPP协议的支持,然后编译内核并下载到开发板。

1. 编译内核

◇ 大容量存储驱动

> Device Drivers > USB support
make ARCH=arm menuconfig配置USB驱动:
<*>     USB Mass Storage support
[*]       USB Mass Storage verbose debug
<*>       Realtek Card Reader support
[*]         Realtek Card Reader autosuspend support
<*>       Datafab Compact Flash Reader support

◇ USB驱动

> Device Drivers > USB support
<*>   Inventra Highspeed Dual Role Controller (TI, ADI, ...)   
            MUSB Mode Selection (Dual Role mode)  --->             
    <*>     Platform Glue Layer (TI DSPS platforms)  --->           
        MUSB DMA mode (Disable DMA (always use PIO))  --->
<*>   USB Serial Converter support  --->
[*]      USBGeneric Serial Driver 
<*>     USBdriver for GSM and CDMA modems

◇ PPP驱动

> Device Drivers > Network device support
   <*>   PPP (point-to-point protocol) support         
    <*>     PPP BSD-Compress compression                         
    <*>     PPP Deflate compression                              
     [*]     PPP filtering                                            
    <*>     PPP MPPE compression (encryption)                          
     [*]     PPP multilink support                 
    <*>     PPP over Ethernet                 
    <*>     PPP support for async serial ports    
    <*>     PPP support for sync tty ports      
<*>   SLIP (serial line) support      
[*]   CSLIP compressed headers

2. 交叉编译libusb

下载usblib库和libusb-compat

https://sourceforge.NET/projects/libusb/files/

[email protected]:/opt/usb-tools/libusb-1.0.20# mkdir install
configure: error: "udev support requested but libudev not installed"(解决:添加--disable-udev)
[email protected]:/opt/usb-tools/libusb-1.0.20# ./configure --host=arm-none-linux-gnueabi --prefix=/opt/usb-tools/libusb-1.0.20/install --disable-udev
[email protected]:/opt/usb-tools/libusb-1.0.20# make
[email protected]:/opt/usb-tools/libusb-1.0.20# make install
 
添加环境变量 http://www.linuxidc.com/Linux/2011-03/33432.htm(PKG_CONFIG_PATH设置)

[email protected]:/opt/usb-tools/libusb-1.0.20# export PKG_CONFIG_PATH=/opt/usb-tools/libusb-1.0.20/install/lib/pkgconfig:$PKG_CONFIG_PATH
[email protected]:/opt/usb-tools/libusb-1.0.20# echo $PKG_CONFIG_PATH
 
编译libusb-compat:

[email protected]:/opt/usb-tools/libusb-compat-0.1.5# ./configure --host=arm-none-linux-gnueabi --prefix=/opt/usb-tools/libusb-compat-0.1.5/install
[email protected]:/opt/usb-tools/libusb-compat-0.1.5# make
[email protected]:/opt/usb-tools/libusb-compat-0.1.5# make install
 
将生成的libusb-1.0.20和libusb-compat-0.1.5下的库文件复制到ARM板上的linux的/lib下面即可。
 
3. 交叉编译4G模块驱动

交叉编译GobiSerial.c(ARCH=arm CC=arm-none-linux-gnueabi-gcc),得到GobiSerial.ko。复制到ARM板安装驱动

#insmod GobiSerial.ko
 
4. 查看驱动运行状况

插上4G模块,虚拟出6个ttyUSB,它们分别是:

[email protected]:/# ls /dev/ttyUSB*
/dev/ttyUSB0  /dev/ttyUSB1  /dev/ttyUSB2  /dev/ttyUSB3  /dev/ttyUSB4  /dev/ttyUSB5
1) /dev/ttyUSB0-diag port for output developing messages
2) /dev/ttyUSB1- NMEA port for GPS NMEA data output
3) /dev/ttyUSB2-AT port for AT commands
4) /dev/ttyUSB3-Modem port for ppp-dial
5) /dev/ttyUSB4-audio port
6) /dev/ttyUSB5-Virtual Net card
 
插上U盘,提示设备运行:

[75097.986054] usb 2-1: New USB device found, idVendor=058f, idProduct=6387
[75097.993167] usb 2-1: New USB device strings: Mfr=1, Product=2, SerialNumber=3
[75098.000689] usb 2-1: Product: Mass Storage
[75098.004995] usb 2-1: Manufacturer: Generic
[75098.009342] usb 2-1: SerialNumber: AC3DF2EE
[75098.024341] usb-storage 2-1:1.0: USB Mass Storage device detected
[75098.049922] scsi0 : usb-storage 2-1:1.0

lsusb命令查看结果:

Bus 001 Device 002: ID 1e0e:9001
Bus 002 Device 002: ID 058f:6387
Bus 001 Device 001: ID 1d6b:0002
Bus 002 Device 001: ID 1d6b:0002
 
5. 交叉编译PPP

参见:http://blog.sina.com.cn/s/blog_7880d3350102wb3e.html
 
6. 拨号脚本设置

[email protected]:/etc/ppp# vi 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
[email protected]:/etc/ppp/peers# vi gprsdial
#/etc/ppp/peers/gprsdial
# This is pppd script for China Mobile, used SIMCOM SIM7100 Module
# Usage: root>pppd call gprs
#Interface should be used is the interface which connects physics interface of S
/dev/ttyUSB3
115200
crtscts
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‘
#disconnect ‘/bin/chat -v -f /etc/ppp/gprs-disconnect-chat‘
 
6. 拨号

[email protected]: pppd call gprsdial
 
6. 测试

拨号之后进行测试,发现可以ping通ip但是无法ping通域名。这需要设置/etc/resolv.conf来添加DNS解析服务器的地址

文件/etc/resolv.conf配置DNS客户,它包含了主机的域名搜索顺序和DNS服务器的地址,每一行应包含一个关键字和一个或多个的由空格隔开的参数。下面是一个例子文件: 
domain test.com
search www.test.com test.com
nameserver 202.96.128.86
nameserver 202.96.128.166
nameserver   #定义DNS服务器的IP地址
domain       #定义本地域名
search       #定义域名的搜索列表
sortlist     #对返回的域名进行排序
主要是nameserver关键字,如果没指定nameserver就找不到DNS服务器,其它关键字是可选的。
    我这里只设置了两个DNS,如下:
ameserver 114.114.114.114
nameserver 8.8.8.8
 
参考文档:
How to use the SIM7100 module in Linux.pdf
http://blog.csdn.net/hanmengaidudu/article/details/17099737
http://www.linuxidc.com/Linux/2011-03/33430p2.htm
http://www.linuxidc.com/Linux/2011-03/33430.htm

时间: 2024-08-02 06:52:03

在ARM-linux上实现4G模块PPP拨号上网【转】的相关文章

sim900GPRS模块ppp拨号上网

一:编辑Linux内核,使其支持PPP拨号上网 [[email protected] linux-3.0]$ make menuconfig Device dirver --->Network device *** CAIF transport drivers *** <*> PPP (point-to-point protocol) support [*] PPP multilink support (EXPERIMENTAL) [*] PPP filtering <*>

4G模块*99#拨号上网

操作系统:win10 模块型号:quectel EC20 CE FAG 4G模块拨号步骤如下: 1. 打开网络和internet设置 2. 选择"拨号" 3. 选择"设置新连接" 4. 选择"拨号调至调节器或ISDN连接" 5. 关键一步,选择网络服务商(ISP)的时候,输入"*99#",然后直接点击"连接" 6. 开始连接->可以上网冲浪了. 原文地址:https://www.cnblogs.com

linux下GPRS模块ppp拨号上网

------------------------------------------------------------------------------------------------------------------------------ 交叉编译器:arm-linux-gcc-4.5.4 Linux内核版本:Linux-3.0 主机操作系统:Centos 6.5 开发板:FL2440 GPRS:SIM900A 在开发SIM900模块之前,开发板已经加载了linux内核以及文件系统

linux下EC20 4G模块驱动移植

之前有移植过ME909s MU609,主要工作就是把4G模块当做USB设备,挂载在linux上,驱动移植主要是能够让板子识别到模块,并产生SUB多个虚拟的节点,用于操作模块,拨号上网 关于内核的配置,请参考:https://www.cnblogs.com/ChenChangXiong/p/10852177.html 内核配置: Device Drivers ---> [*] USB support ---> <*> USB Serial Converter support ---&

win10使用4G 模块RNDIS模式上网

Windons使用RNDIS模式上网步骤 Chapter 1 模块端配置 1模块设置为RNDIS模式 1.       以EC20CEFAG模块为例 2.       命令如下: 1)         echo  rndis  >  /sbin/usb/compositions/usb_net_type 2)         sync 3)         reboot   查看设置结果: [email protected]:/usrdata# cat /sbin/usb/composition

arm linux上的第一个应用程序 BOA移植

1. 首先, linux在开发板上能跑起来了. 包括网络驱动也有了, ifconfig之后, 能看到在rcS里面设置的IP, 也能ping通windows主机了, 当然, 也要window关掉防火墙才行. 2. 在windows上起一个tftp, 后来发现这样是不行的, 因为每个包都要反复打包, 有点累, 还是用虚拟机开nfs比较靠谱, 但是我虚拟机不靠谱, 老是不走有线网卡, 主动跑去无线去了. 3. busybo的tftp命令有点屌, 格式是: tftp -g -l localFileNam

嵌入式Linux系统---ppp拨号,4G模块上网【转】

本文转载自:http://blog.csdn.net/qq562029186/article/details/65438553 4G模块PPP拨号上网 方法1 所需文件: xxx-chat-connect,xxx-chat-disconnect ,xxx-ppp 复制以上三个文件到/etc/ppp/peers目录下 在 xxx-ppp 文件 修改你的串口设备名和pppd 拨号使用的 username,password. 在 xxx-chat-connect文件 修改你的 APN.APN/user

0710 mux协议的作用(ppp拨号时如何和gprs进行at指令交互)

ppp拨号使gprs上网的同时如何和gprs模块进行at指令的交互,这是一个问题. 在linux中,ppp拨号上网是内核中支持的,只需要在内核配置中选上. ppp拨号的方式使gprs进行上网与at指令使gprs上网,两者之间有不同.ppp是一个将用at指令使gprs上网的那一部分给封装了起来.只要你将ppp成功的移植到了你的根文件系统中,那么你使用pppd call的时候就相当于用at指令让gprs上网了,封装的部分,包括一部分at命令,认证等等一些列的过程.最后双方认证通过,达成一致后,给了你

ARM+llinux系统移植3G拨号上网收发短信(一)【转】

本文转载自:http://blog.csdn.net/hanmengaidudu/article/details/17099737 一.      PPP移植 各项工作具体说明 向Linux内核添加3G模块的驱动(USB转串口驱动)和PPP协议的支持,然后编译内核并下载到开发板.当然如果之前已经移植好内核,那么只需要增加几个选项就可以,然后在编译内核就可以了,这个文档默认内核已经移植过,所以只讲与USB转串口驱动和PPP协议支持的几个选项. [[email protected] linux-3.