| 3G modem: | Huawei E180(WCDMA) |
| 3G SIM Card: | China Unicom 3G Card(WO) |
| CPU/Board | FSL P1022DS RevC board |
| Linux: | Linux-2.6.35 |
二、步骤
| 1. | 向linux内核中添加3G模块的驱动(USB转串口的驱动)和PPP协议的支持 |
| 2. | 下载ppp-2.4.5源码并进行交叉编译(toolchian:powerpc-linux-)。 将拨号上网所需的两个应用程序pppd和chat拷贝到开发板/usr/sbin文件夹下。 将改好的脚本文件ppp-on,ppp-on-dialer存放在/etc/ppp目录下。 将含有域名解析服务器地址的文件resolv.conf拷贝到/etc目录下。 |
| 3. | 进入 /etc/ppp 目录 ,执行 ./ppp-on。 进行网络测试 |
三、具体工作
1. 向linux内核添加3G模块的驱动(USB转串口的驱动)
| usb 1-1: new high speed USB device using fsl-ehci and address3 usb 1-1: New USB device found, idVendor=12d1,idProduct=1001 usb 1-1: New USB device strings: Mfr=3, Product=2,SerialNumber=0 usb 1-1: Product: HUAWEI Mobile usb 1-1: Manufacturer: HUAWEI Technology option 1-1:1.0: GSM modem (1-port) converter detected usb 1-1: GSM modem (1-port) converter now attached tottyUSB0 option 1-1:1.1: GSM modem (1-port) converter detected usb 1-1: GSM modem (1-port) converter now attached tottyUSB1 option 1-1:1.2: GSM modem (1-port) converter detected usb 1-1: GSM modem (1-port) converter now attached tottyUSB2 scsi7 : usb-storage 1-1:1.3 scsi8 : usb-storage 1-1:1.4 scsi 7:0:0:0: CD-ROM sr0: scsi-1 drive Uniform CD-ROM driver Revision: 3.20 sr 7:0:0:0: Attached scsi generic sg1 type 5 scsi 8:0:0:0: Direct-Access sd 8:0:0:0: Attached scsi generic sg2 type 0 sd 8:0:0:0: [sdb] Attached SCSI removabledisk |
2. 向Linux内核中添加PPP协议的支持
| <*> |
| ls /dev/ppp -l crw-rw---- |
3. 交叉编译拨号上网需要的拨号工具pppd和chat
| #cd |
4. 配置拨号脚本文件
| # These are the parameters. Change as needed. TELEPHONE=*99# ACCOUNT= PASSWORD= LOCAL_IP=0.0.0.0 REMOTE_IP=0.0.0.0 # Remote IP address if desired. Normally0.0.0.0 NETMASK=255.255.255.0 DIALER_SCRIPT=/etc/ppp/ppp-on-dialer exec /usr/sbin/pppd debug lock modem crtscts /dev/ttyUSB0 115200\ |
2) ppp-on-dialer配置文件的内容:
| #!/bin/sh exec chat -v \ TIMEOUT 5 \ ABORT ABORT ABORT '' \rAT OK OK CONNECT '' |
3) 设置正确的域名解析服务器地址
| nameserver 202.106.195.68 nameserver 202.106.46.151 |
5. 应用测试
| ppp0 |

本文详细介绍了如何在嵌入式Linux系统中集成3G模块,包括添加USB驱动、PPP协议支持,以及拨号上网所需的应用程序与脚本配置。通过交叉编译pppd和chat工具,并设置网络参数,实现了从USB接口连接3G模块到成功拨号上网的过程。最终,通过ifconfig命令验证了网络连接,并展示了如何ping外网和下载资源。

6972

被折叠的 条评论
为什么被折叠?



