在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

linux怎么使用4g模块的网络,在ARM-linux上实现4G模块PPP拨号上网(示例代码)相关推荐

  1. linux下的ppp软件,linux下ppp拨号无线上网(示例代码)

    linux下用ppp上网需要两个程序:pppd和chat.ubuntu自带pppd和chat,可以使用man查看具体使用方法. 典型的ppp拨号需要准备几个文件: 1. pppd脚本. 2. chat ...

  2. linux 串口4g ppp,在ARM-linux上实现4G模块PPP拨号上网

    原标题:在ARM-linux上实现4G模块PPP拨号上网 在ARM平台上实现 的 ,参考网上的资料和自己的理解,从一无所知到开发完成花了一周多.最后看到ARM板ping通www.baidu.com时甚 ...

  3. 怎么在Linux内核模块加打印,在ARM-linux上实现4G模块PPP拨号上网

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

  4. 树莓派搭载EC200U 4G模块(USB网卡上网和PPP拨号上网)

    文章目录 一.EC200U模块4G模块介绍 二.USB转串口驱动设置 (1)打开树莓派的串口 (2)lsusb是否有EC200U模块 (3)添加 VID 和 PID 信息 三.USB网卡驱动上网 四. ...

  5. 实现4G模块EC20在树莓派系统下的PPP拨号上网

    目录 PPP协议 PPP通信建立 PPP认证方式 ppp协议栈 pppd数据传输 Pppd 控制协议数据流程 Linux中的PPP实现 安装PPP 方法一:源码安装 方法二: 直接安装 PPP拨号上网 ...

  6. 树莓派中SIM7600G-H 4G DONGLE模块使用记录(一)PPP拨号上网/4G上网

    项目场景: 如何使用SIM7600系列的4G通信模块进行PPP网上拨号以实现4G通信,在讲解前,未搭建好树莓派远程连接桌面的读者可以先转向树莓派4B环境搭建+电脑远程连接+打开文件管理闪退(上). 模 ...

  7. 在ARM-linux上实现4G模块simcom7100c 的PPP拨号上网

    转http://blog.sina.com.cn/s/blog_7880d3350102wb92.html 在ARM平台上实现4G模块的PPP拨号上网,参考网上的资料和自己的理解,从一无所知到开发完成 ...

  8. sim7600ce 拨号上网测试_SIM7600CE TCP/IP连接与PPP拨号上网 4G上网

    SIM7600CE联网测试分为两部分: 1.TCP/IP连接 2.PPP拨号上网 实验环境:ubuntu-meta 16.04 硬件:树莓派3B,SIM7600CE 上网卡:移动的NB-IOT物联网卡 ...

  9. sim900芯片—GPRS模块ppp拨号上网

    --------------------------------------- 主机操作系统:Centos 6.7 交叉编译器环境:arm-linux-gcc-4.5.4  开发板平台: FL2440 ...

最新文章

  1. Understanding CORS
  2. 监控linux空间变化,Linux监控文件变化及主动上报实现
  3. indesign选中不了图片删除_(54)批量给图片加上说明文字
  4. boost::geometry::strategy::distance用法的测试程序
  5. Python的继承多态
  6. 程序员的数学笔记2--余数
  7. 在java中柱状图代码_我在java中编写了个柱状图,可运行了,我想让柱状图在JSP页面中显示,请问有什么方法么?谢谢。...
  8. python使用sqlite
  9. 苍狼敏捷软件开发团队建设指南-2-团队建设
  10. oracle中那个日期怎么相减_oracle日期相减
  11. 虚拟DOM和deff算法
  12. 普通笔记本/台式机安装MacOS教程
  13. netty源码阅读之编码之flush刷新buffer队列
  14. Docker 启动tomcat报错Error starting userland proxy: listen tcp 0.0.0.0:80: bind: address already in use.
  15. pytorch中的神经网络模块基础类——torch.nn.Module
  16. 计算机中系统更新是指,Mac电脑操作系统更新了什么功能
  17. 联通云服务器怎么修改密码,桌面云使用说明
  18. 国家开发银行软件测试工资待遇,国家开发银行总行工资待遇
  19. 堆排序(大根堆与小根堆)
  20. Python核心编程第二版第五章数字(课后习题)----我的答案

热门文章

  1. 前端汉字encode_前端常用的几种加密与解密
  2. 关于 Kubernetes 中通过 Kustomize 定制 Yaml资源文件的一些笔记
  3. Java使用阿里邮箱生成excle邮件附件发送
  4. LATEX公式行间距调整
  5. 四元数矩阵向量积 matlab
  6. 怎么用js改变html里面的图片大小,网页中图片属性固定宽度,如何用js改变大小...
  7. PMML 预测模型教程
  8. 什么是LoRaWAN
  9. 二、TIPTOP命名原则和目录配置—TIPTOP GP ERP二次开发新手教程
  10. steam搬砖项目详细拆解教程,steam搬砖长期稳定