AM335X开发板+4G模块 调试小结
1、找到开发版配套资料中的linux内核源码包linux-3.2.0-Litev2.3-nand-2017-3-24.tar.gz
2、解压内核源码包,打开内核源码文件 option.c(路径为 drivers/usb/serial/option.c)
3、在源码中找到 option_ids 数组,在数组中添加 Longsung 产品的 VID(0x1C9E)和 PID(0x9B3C)
4、重新编译内核 ./build.sh (必须在ubuntu14.04版本下编译),更新开发板的内核。
5、修改开发版上gprs-connect-chat文件(路径为/etc/ppp/gprs-connect-chat)内容如下
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","ctnet" OK ATDT*99***1# CONNECT ''
注:插入不同运营商的卡,AT+CGDCONT=1,"IP","ctnet"最后一个参数不同,此为中国电信APN。
6、修改拨号配置文件(/etc/ppp/peer/gprs)内容如下
# Usage: root>pppd call gprs /dev/ttyUSB1 9600 crtscts modem #noauth debug nodetach #hide-password usepeerdns noipdefault defaultroute 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'
7、拨号使用以下指令(# pppd call gprs),断开网络使用以下指令(# killall pppd)
8、修改开发板Linux系统网络配置文件(interfaces),内容如下
# /etc/network/interfaces -- configuration file for ifup(8), ifdown(8) # The loopback interface auto lo iface lo inet loopback # Wireless interfaces iface wlan0 inet dhcp wireless_mode managed wireless_essid any wpa-driver wext wpa-conf /etc/wpa_supplicant.conf iface tiwlan0 inet dhcp wireless_mode managed wireless_essid any iface atml0 inet dhcp # Wired or wireless interfaces auto eth0 #iface eth0 inet dhcp # pre-up /bin/grep -v -e "ip=[0-9]\+\.[0-9]\+\.[0-9]\+\.[0-9]\+" /proc/cm iface eth0 inet static address 192.168.1.4 gateway 192.168.1.1 netmask 255.255.255.0 dns-nameservers 114.114.114.114 223.5.5.5 #auto eth1 #iface eth1 inet dhcp iface eth1 inet static address 10.10.80.15 gateway 10.10.80.1 netmask 255.0.0.0 # Ethernet/RNDIS gadget (g_ether) # ... or on host side, usbnet and random hwaddr iface usb0 inet dhcp # Bluetooth networking iface bnep0 inet dhcp
9、修改开发板Linux系统开机启动脚本(S99sztenv),内容如下
#!/bin/sh # sleep 10s echo start 4g call pppd call gprs & sleep 5s echo configure route route del default gw 192.168.1.1 route add default gw 10.64.64.64